forked from I2P_Developers/i2p.i2p
Integrated summary bar preset buttons into main edit form as restore buttons
This commit is contained in:
@ -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<Integer, String> sections = new TreeMap<Integer, String>();
|
||||
for (Object o : _settings.keySet()) {
|
||||
|
@ -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<String> 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));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user