When fetching a theme, if theme config key is not found, write out the default

This is required in order to get the theme config keys of the various apps into
themes.config; this way, the routerconsole requires no knowledge of what apps
support universal theming, and can just blanket apply themes to all known keys.
This commit is contained in:
str4d
2012-07-22 13:13:43 +00:00
parent 6be94658a7
commit a7c8a7201a
4 changed files with 33 additions and 8 deletions

View File

@ -29,16 +29,17 @@ public class ConfigUIHandler extends FormHandler {
return;
Properties props = _context.readConfigFile(CSSHelper.THEME_CONFIG_FILE);
String oldTheme = props.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
// Save routerconsole theme first to ensure it is in config file
if (_config.equals("default")) // obsolete
props.put(CSSHelper.PROP_THEME_NAME, null);
else
props.put(CSSHelper.PROP_THEME_NAME, _config);
if (_universalTheming) {
// The routerconsole theme gets set again, but oh well
for (Iterator it = props.keySet().iterator(); it.hasNext();) {
String key = (String) it.next();
props.put(key, _config);
}
} else {
if (_config.equals("default")) // obsolete
props.put(CSSHelper.PROP_THEME_NAME, null);
else
props.put(CSSHelper.PROP_THEME_NAME, _config);
}
boolean ok = _context.writeConfigFile(CSSHelper.THEME_CONFIG_FILE, props);
if (ok) {