2009-07-12 03:21:20 +00:00
|
|
|
package net.i2p.router.web;
|
|
|
|
|
|
|
|
/** set the theme */
|
|
|
|
public class ConfigUIHandler extends FormHandler {
|
|
|
|
private boolean _shouldSave;
|
|
|
|
private String _config;
|
|
|
|
|
2009-08-15 16:08:33 +00:00
|
|
|
@Override
|
2009-07-12 03:21:20 +00:00
|
|
|
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;
|
2009-07-17 16:53:53 +00:00
|
|
|
if (_config.equals("default")) // obsolete
|
2009-07-16 01:55:14 +00:00
|
|
|
_context.router().removeConfigSetting(CSSHelper.PROP_THEME_NAME);
|
2009-07-12 03:21:20 +00:00
|
|
|
else
|
2009-07-16 01:55:14 +00:00
|
|
|
_context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
|
2009-07-12 03:21:20 +00:00
|
|
|
if (_context.router().saveConfig())
|
2009-08-11 10:45:20 +00:00
|
|
|
addFormNotice("Theme change saved. <a href=\"configui.jsp\">Refresh the page</a> to actuate phase change.");
|
2009-07-12 03:21:20 +00:00
|
|
|
else
|
2009-08-02 12:57:50 +00:00
|
|
|
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs.");
|
2009-07-12 03:21:20 +00:00
|
|
|
}
|
|
|
|
}
|