From bb39d9ddcf83c9cbf76f0147d6d5db30827d7475 Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 8 Jul 2012 22:11:05 +0000 Subject: [PATCH] Integrated summary bar preset buttons into main edit form as restore buttons --- .../i2p/router/web/ConfigSummaryHandler.java | 20 ++++++++----------- .../src/net/i2p/router/web/SummaryHelper.java | 8 ++++---- apps/routerconsole/jsp/configsidebar.jsp | 14 ++----------- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java index f668800168..7fbe10cbcd 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java @@ -38,18 +38,14 @@ public class ConfigSummaryHandler extends FormHandler { addFormError(_("Refresh interval must be a number")); return; } - } else if ("1".equals(group)) { - if (_action.equals(_("Use full preset"))) { - _context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.PRESET_FULL); - addFormNotice(_("Full summary bar preset selected.") + " " + - _("Summary bar will refresh shortly.")); - } else if (_action.equals(_("Use reduced preset"))) { - _context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.PRESET_SHORT); - addFormNotice(_("Reduced summary bar preset selected.") + " " + - _("Summary bar will refresh shortly.")); - } else { - addFormError(_("Unsupported")); - } + } else if (_action.equals(_("Restore full default"))) { + _context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_FULL); + addFormNotice(_("Full summary bar default restored.") + " " + + _("Summary bar will refresh shortly.")); + } else if (_action.equals(_("Restore minimal default"))) { + _context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_MINIMAL); + addFormNotice(_("Minimal summary bar default restored.") + " " + + _("Summary bar will refresh shortly.")); } else if (adding || deleting || saving) { Map sections = new TreeMap(); for (Object o : _settings.keySet()) { diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java index 4d631dbc3f..e2345e3bf6 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java @@ -42,7 +42,7 @@ public class SummaryHelper extends HelperBase { private static final char S = ','; static final String PROP_SUMMARYBAR = "routerconsole.summaryBar."; - static final String PRESET_FULL = + static final String DEFAULT_FULL = "HelpAndFAQ" + S + "I2PServices" + S + "I2PInternals" + S + @@ -59,7 +59,7 @@ public class SummaryHelper extends HelperBase { "Destinations" + S + ""; - static final String PRESET_SHORT = + static final String DEFAULT_MINIMAL = "ShortGeneral" + S + "NewsHeadings" + S + "UpdateStatus" + S + @@ -749,11 +749,11 @@ public class SummaryHelper extends HelperBase { public List getSummaryBarSections(String page) { String config = ""; if ("home".equals(page)) - config = _context.getProperty(PROP_SUMMARYBAR + page, PRESET_SHORT); + config = _context.getProperty(PROP_SUMMARYBAR + page, DEFAULT_MINIMAL); else config = _context.getProperty(PROP_SUMMARYBAR + page, null); if (config == null) - config = _context.getProperty(PROP_SUMMARYBAR + "default", PRESET_FULL); + config = _context.getProperty(PROP_SUMMARYBAR + "default", DEFAULT_FULL); return Arrays.asList(config.split("" + S)); } diff --git a/apps/routerconsole/jsp/configsidebar.jsp b/apps/routerconsole/jsp/configsidebar.jsp index 5fece05585..3f219fb40b 100644 --- a/apps/routerconsole/jsp/configsidebar.jsp +++ b/apps/routerconsole/jsp/configsidebar.jsp @@ -46,18 +46,6 @@ input.default { " > -

<%=intl._("Use preset layout")%>

-

<%=intl._("Several preset layouts for the summary bar are available.")%> - <%=intl._("Note that choosing one of the presets will cause the current summary bar configuration to be lost.")%>

-
-
- - - " > - " > -
-
-

<%=intl._("Customise Summary Bar")%>

@@ -65,6 +53,8 @@ input.default {
" > + " > + " > " > " > " >