forked from I2P_Developers/i2p.i2p
* Add configui.jsp
* orange flash remove take 2
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
/** set the theme */
|
||||
public class ConfigUIHandler extends FormHandler {
|
||||
private boolean _shouldSave;
|
||||
private String _config;
|
||||
|
||||
protected void processForm() {
|
||||
if (_shouldSave)
|
||||
saveChanges();
|
||||
}
|
||||
|
||||
public void setShouldsave(String moo) { _shouldSave = true; }
|
||||
|
||||
public void setTheme(String val) {
|
||||
_config = val;
|
||||
}
|
||||
|
||||
private void saveChanges() {
|
||||
if (_config == null)
|
||||
return;
|
||||
if (_config.equals("default"))
|
||||
_context.router().removeConfigSetting(ConfigUIHelper.PROP_THEME);
|
||||
else
|
||||
_context.router().setConfigSetting(ConfigUIHelper.PROP_THEME, _config);
|
||||
if (_context.router().saveConfig())
|
||||
addFormNotice("Configuration saved successfully");
|
||||
else
|
||||
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
public class ConfigUIHelper extends HelperBase {
|
||||
public ConfigUIHelper() {}
|
||||
|
||||
public static final String PROP_THEME = "routerconsole.theme";
|
||||
private static final String themes[] = {"default", "classic", "dark", "defCon1", "light"};
|
||||
|
||||
public String getSettings() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String current = _context.getProperty(PROP_THEME, "default");
|
||||
for (String theme : themes) {
|
||||
buf.append("<input type=\"radio\" name=\"theme\" ");
|
||||
if (theme.equals(current))
|
||||
buf.append("checked=\"true\" ");
|
||||
buf.append("value=\"").append(theme).append("\"/>").append(theme).append("<br />\n");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user