IDEMPIERE-4536 Allow minor customizations in default theme (#382)
only include fragment/custom.css.dsp if the file exists
This commit is contained in:
parent
bf4935395a
commit
9bb1836bcf
|
@ -19,6 +19,7 @@ import org.adempiere.webui.apps.AEnv;
|
|||
import org.compiere.model.MClientInfo;
|
||||
import org.compiere.model.MImage;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.image.AImage;
|
||||
|
@ -147,6 +148,25 @@ public final class ThemeManager {
|
|||
}
|
||||
}
|
||||
|
||||
private static final CCache<String, Boolean> s_themeHasCustomCSSCache = new CCache<String, Boolean>(null, "ThemeHasCustomCSSCache", 2, -1, false);
|
||||
|
||||
/**
|
||||
* @return true if custom css exists
|
||||
*/
|
||||
public static Boolean isThemeHasCustomCSSFragment() {
|
||||
String theme = getTheme();
|
||||
Boolean flag = s_themeHasCustomCSSCache.get(theme);
|
||||
if (flag != null)
|
||||
return flag;
|
||||
if (ThemeManager.class.getResource(ITheme.THEME_PATH_PREFIX + theme + "/css/fragment/custom.css.dsp") == null) {
|
||||
flag = Boolean.FALSE;
|
||||
} else {
|
||||
flag = Boolean.TRUE;
|
||||
}
|
||||
s_themeHasCustomCSSCache.put(theme, flag);
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static boolean isUseCSSForWindowSize() {
|
||||
return "Y".equals(Env.getContext(Env.getCtx(), ITheme.USE_CSS_FOR_WINDOW_SIZE));
|
||||
}
|
||||
|
|
|
@ -39,4 +39,15 @@
|
|||
Clean all ampersand from string
|
||||
</description>
|
||||
</function>
|
||||
|
||||
<function>
|
||||
<name>isThemeHasCustomCSSFragment</name>
|
||||
<function-class>org.adempiere.webui.theme.ThemeManager</function-class>
|
||||
<function-signature>
|
||||
java.lang.Boolean isThemeHasCustomCSSFragment()
|
||||
</function-signature>
|
||||
<description>
|
||||
Returns whether theme has fragment/custom.css.dsp
|
||||
</description>
|
||||
</function>
|
||||
</taglib>
|
|
@ -124,4 +124,6 @@ table.z-vbox > tbody > tr > td > table {
|
|||
|
||||
<c:include page="fragment/font-icons.css.dsp" />
|
||||
|
||||
<c:include page="fragment/custom.css.dsp" />
|
||||
<c:if test="${u:isThemeHasCustomCSSFragment()}">
|
||||
<c:include page="fragment/custom.css.dsp" />
|
||||
</c:if>
|
Loading…
Reference in New Issue