I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 679549cb authored by str4d's avatar str4d
Browse files

Reverted susidns to storing theme itself, but checking routerconsole for universal theming

parent a623d924
No related branches found
No related tags found
No related merge requests found
......@@ -14,14 +14,14 @@ public class BaseBean
{
private final I2PAppContext _context;
protected final Properties properties;
private String _theme;
private long configLastLoaded = 0;
private static final String PRIVATE_BOOK = "private_addressbook";
private static final String DEFAULT_PRIVATE_BOOK = "../privatehosts.txt";
public static final String THEME_CONFIG_FILE = "themes.config";
public static final String PROP_THEME_NAME = "susidns.theme";
public static final String RC_PROP_THEME_NAME = "routerconsole.theme";
public static final String RC_PROP_UNIVERSAL_THEMING = "routerconsole.theme.universal";
public static final String PROP_THEME_NAME = "theme";
public static final String DEFAULT_THEME = "light";
public static final String BASE_THEME_PATH = "/themes/susidns/";
......@@ -46,21 +46,6 @@ public class BaseBean
// added in 0.5, for compatibility with 0.4 config.txt
if( properties.getProperty(PRIVATE_BOOK) == null)
properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK);
// Fetch theme
Properties themeProps = _context.readConfigFile(THEME_CONFIG_FILE);
_theme = themeProps.getProperty(PROP_THEME_NAME);
// Ensure that theme config line exists in config file, and theme exists
String[] themes = getThemes();
boolean themeExists = false;
for (int i = 0; i < themes.length; i++) {
if (themes[i].equals(_theme))
themeExists = true;
}
if (_theme == null || !themeExists) {
_theme = DEFAULT_THEME;
themeProps.put(PROP_THEME_NAME, _theme);
_context.writeConfigFile(THEME_CONFIG_FILE, themeProps);
}
configLastLoaded = currentTime;
}
catch (Exception e) {
......@@ -78,7 +63,22 @@ public class BaseBean
public String getTheme() {
loadConfig();
String url = BASE_THEME_PATH;
url += _theme + "/";
String theme = properties.getProperty(PROP_THEME_NAME, DEFAULT_THEME);
boolean universalTheming = _context.getBooleanProperty(RC_PROP_UNIVERSAL_THEMING);
if (universalTheming) {
// Fetch routerconsole theme (or use our default if it doesn't exist)
theme = _context.getProperty(RC_PROP_THEME_NAME, DEFAULT_THEME);
// Ensure that theme exists
String[] themes = getThemes();
boolean themeExists = false;
for (int i = 0; i < themes.length; i++) {
if (themes[i].equals(theme))
themeExists = true;
}
if (!themeExists)
theme = DEFAULT_THEME;
}
url += theme + "/";
return url;
}
......
......@@ -130,6 +130,9 @@
<li><b>log</b> -
<%=intl._("File to log activity to (change to /dev/null if you like)")%>
</li>
<li><b>theme</b> -
<%=intl._("Name of the theme to use (defaults to 'light')")%>
</li>
</ul>
</div><hr>
<div id="footer">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment