IDEMPIERE-4549 Detect broken theme configuration (#380)
* IDEMPIERE-4549 Detect broken theme configuration * IDEMPIERE-4549 Detect broken theme configuration make getTheme() synchronized * Revert "IDEMPIERE-4549 Detect broken theme configuration" This reverts commit 9044c7887064f217acea1051cd35c5c791ce47da. Co-authored-by: hengsin <hengsin@gmail.com>
This commit is contained in:
parent
9bb1836bcf
commit
3adbc9e00f
|
@ -20,6 +20,7 @@ import org.compiere.model.MClientInfo;
|
|||
import org.compiere.model.MImage;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.image.AImage;
|
||||
|
@ -31,6 +32,12 @@ import org.zkoss.image.AImage;
|
|||
*/
|
||||
public final class ThemeManager {
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ThemeManager.class);
|
||||
|
||||
private static String m_theme = null;
|
||||
private static String m_brokenTheme = null;
|
||||
|
||||
/**
|
||||
* @return url for large logo
|
||||
*/
|
||||
|
@ -57,7 +64,24 @@ public final class ThemeManager {
|
|||
*/
|
||||
public static String getTheme() {
|
||||
String theme = System.getProperty(MSysConfig.ZK_THEME);
|
||||
return Util.isEmpty(theme) ? MSysConfig.getValue(MSysConfig.ZK_THEME, ITheme.ZK_THEME_DEFAULT) : theme;
|
||||
if (Util.isEmpty(theme))
|
||||
theme = MSysConfig.getValue(MSysConfig.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
|
||||
if (theme.equals(m_brokenTheme)) {
|
||||
theme = ITheme.ZK_THEME_DEFAULT;
|
||||
} else {
|
||||
if (! theme.equals(m_theme)) {
|
||||
if (! ITheme.ZK_THEME_DEFAULT.equals(theme)) {
|
||||
// Verify the theme.css.dsp exists in the theme folder
|
||||
if (ThemeManager.class.getResource(ITheme.THEME_PATH_PREFIX + theme + ITheme.THEME_STYLESHEET) == null) {
|
||||
log.warning("The theme " + theme + " does not exist or is not properly configured, falling back to default");
|
||||
m_brokenTheme = theme;
|
||||
theme = ITheme.ZK_THEME_DEFAULT;
|
||||
}
|
||||
}
|
||||
m_theme = theme;
|
||||
}
|
||||
}
|
||||
return theme;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue