IDEMPIERE-2259 Add SysConfig keys to avoid using hardcoded values on login page
This commit is contained in:
parent
78c3ca3bbe
commit
d6822cc466
|
@ -35,6 +35,7 @@ import javax.swing.event.EventListenerList;
|
|||
import org.adempiere.base.Core;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MSystem;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
import org.compiere.model.ServerStateChangeEvent;
|
||||
|
@ -153,6 +154,10 @@ public final class Adempiere
|
|||
*/
|
||||
public static String getVersion()
|
||||
{
|
||||
String version = MSysConfig.getValue(MSysConfig.APPLICATION_MAIN_VERSION, null);
|
||||
if(version != null)
|
||||
return version;
|
||||
|
||||
IProduct product = Platform.getProduct();
|
||||
if (product != null) {
|
||||
Bundle bundle = product.getDefiningBundle();
|
||||
|
@ -170,9 +175,40 @@ public final class Adempiere
|
|||
return "Unknown";
|
||||
} // getVersion
|
||||
|
||||
public static boolean isVersionShown(){
|
||||
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_MAIN_VERSION_SHOWN, true);
|
||||
}
|
||||
|
||||
public static boolean isDBVersionShown(){
|
||||
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
|
||||
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_DATABASE_VERSION_SHOWN, defaultVal);
|
||||
}
|
||||
|
||||
public static boolean isVendorShown(){
|
||||
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_IMPLEMENTATION_VENDOR_SHOWN, true);
|
||||
}
|
||||
|
||||
public static boolean isJVMShown(){
|
||||
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
|
||||
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_JVM_VERSION_SHOWN, defaultVal);
|
||||
}
|
||||
|
||||
public static boolean isOSShown(){
|
||||
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
|
||||
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_OS_INFO_SHOWN, defaultVal);
|
||||
}
|
||||
|
||||
public static boolean isHostShown()
|
||||
{
|
||||
boolean defaultVal = MSystem.get(Env.getCtx()).getSystemStatus().equalsIgnoreCase("P") ? false : true;
|
||||
return MSysConfig.getBooleanValue(MSysConfig.APPLICATION_HOST_SHOWN, defaultVal);
|
||||
}
|
||||
|
||||
public static String getDatabaseVersion()
|
||||
{
|
||||
return DB.getSQLValueString(null, "select lastmigrationscriptapplied from ad_system");
|
||||
// return DB.getSQLValueString(null, "select lastmigrationscriptapplied from ad_system");
|
||||
return MSysConfig.getValue(MSysConfig.APPLICATION_DATABASE_VERSION,
|
||||
DB.getSQLValueString(null, "select lastmigrationscriptapplied from ad_system"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,6 +274,11 @@ public final class Adempiere
|
|||
*/
|
||||
public static String getImplementationVendor()
|
||||
{
|
||||
if(DB.isConnected()){
|
||||
String vendor = MSysConfig.getValue(MSysConfig.APPLICATION_IMPLEMENTATION_VENDOR, null);
|
||||
if(vendor != null)
|
||||
return vendor;
|
||||
}
|
||||
if (s_ImplementationVendor == null)
|
||||
setPackageInfo();
|
||||
return s_ImplementationVendor;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1418216769489567455L;
|
||||
private static final long serialVersionUID = -5622739157380126505L;
|
||||
|
||||
public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG";
|
||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||
|
@ -50,6 +50,15 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
public static final String ALLOW_APPLY_PAYMENT_TO_CREDITMEMO = "ALLOW_APPLY_PAYMENT_TO_CREDITMEMO";
|
||||
public static final String ALLOW_OVER_APPLIED_PAYMENT = "ALLOW_OVER_APPLIED_PAYMENT";
|
||||
public static final String ALogin_ShowOneRole = "ALogin_ShowOneRole";
|
||||
public static final String APPLICATION_DATABASE_VERSION = "APPLICATION_DATABASE_VERSION";
|
||||
public static final String APPLICATION_DATABASE_VERSION_SHOWN = "APPLICATION_DATABASE_VERSION_SHOWN";
|
||||
public static final String APPLICATION_HOST_SHOWN = "APPLICATION_HOST_SHOWN";
|
||||
public static final String APPLICATION_IMPLEMENTATION_VENDOR = "APPLICATION_IMPLEMENTATION_VENDOR";
|
||||
public static final String APPLICATION_IMPLEMENTATION_VENDOR_SHOWN = "APPLICATION_IMPLEMENTATION_VENDOR_SHOWN";
|
||||
public static final String APPLICATION_JVM_VERSION_SHOWN = "APPLICATION_JVM_VERSION_SHOWN";
|
||||
public static final String APPLICATION_MAIN_VERSION = "APPLICATION_MAIN_VERSION";
|
||||
public static final String APPLICATION_MAIN_VERSION_SHOWN = "APPLICATION_MAIN_VERSION_SHOWN";
|
||||
public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN";
|
||||
public static final String BACKGROUND_JOB_ALLOWED = "BACKGROUND_JOB_ALLOWED";
|
||||
public static final String BACKGROUND_JOB_BY_DEFAULT = "BACKGROUND_JOB_BY_DEFAULT";
|
||||
public static final String BACKGROUND_JOB_MAX_IN_SYSTEM = "BACKGROUND_JOB_MAX_IN_SYSTEM";
|
||||
|
|
|
@ -11,6 +11,13 @@ Copyright (C) 2009 Idalica Corporation
|
|||
var vendor = Adempiere.getImplementationVendor();
|
||||
var jvm = Adempiere.getJavaInfo();
|
||||
var os = Adempiere.getOSInfo();
|
||||
var isVersionShown = Adempiere.isVersionShown();
|
||||
var isDBVersionShown = Adempiere.isDBVersionShown();
|
||||
var isVendorShown = Adempiere.isVendorShown();
|
||||
var isJVMShown = Adempiere.isJVMShown();
|
||||
var isOSShown = Adempiere.isOSShown();
|
||||
var isHostShown = Adempiere.isHostShown();
|
||||
var isInfoShown = isVersionShown || isDBVersionShown || isVendorShown || isJVMShown || isOSShown || isHostShown;
|
||||
</zscript>
|
||||
<html>
|
||||
<![CDATA[
|
||||
|
@ -25,40 +32,41 @@ Copyright (C) 2009 Idalica Corporation
|
|||
font-size: 8pt;
|
||||
}
|
||||
</style>
|
||||
<div class="versionInfoBox">
|
||||
]]>
|
||||
<div class="versionInfoBox" if="${isInfoShown == true}">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<tr if="${isVersionShown == true}">
|
||||
<td align="right">Version</td>
|
||||
<td>:</td>
|
||||
<td aligh="left">${mainVersion}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr if="${isDBVersionShown == true}">
|
||||
<td align="right">Database Version</td>
|
||||
<td>:</td>
|
||||
<td aligh="left">${dbVersion}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr if="${isVendorShown == true}">
|
||||
<td align="right">Vendor</td>
|
||||
<td>:</td>
|
||||
<td aligh="left">${vendor}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr if="${isJVMShown == true}">
|
||||
<td align="right">JVM</td>
|
||||
<td>:</td>
|
||||
<td aligh="left">${jvm}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr if="${isOSShown == true}">
|
||||
<td align="right">OS</td>
|
||||
<td>:</td>
|
||||
<td aligh="left">${os}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr if="${isHostShown == true}">
|
||||
<td align="right">Host</td>
|
||||
<td>:</td>
|
||||
<td aligh="left">${desktop.execution.serverName}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
]]>
|
||||
|
||||
</html>
|
||||
</zk>
|
||||
|
|
Loading…
Reference in New Issue