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 3ad7c1c20..92228d4bf 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigSummaryHandler.java @@ -26,10 +26,7 @@ public class ConfigSummaryHandler extends FormHandler { boolean deleting = _action.equals(_("Delete selected")); boolean adding = _action.equals(_("Add item")); boolean saving = _action.equals(_("Save order")); - boolean movingTop = _action.substring(_action.indexOf(' ') + 1).equals(_("Top")); - boolean movingUp = _action.substring(_action.indexOf(' ') + 1).equals(_("Up")); - boolean movingDown = _action.substring(_action.indexOf(' ') + 1).equals(_("Down")); - boolean movingBottom = _action.substring(_action.indexOf(' ') + 1).equals(_("Bottom")); + boolean moving = _action.startsWith("move_"); if (_action.equals(_("Save")) && "0".equals(group)) { try { int refreshInterval = Integer.parseInt(getJettyString("refreshInterval")); @@ -50,8 +47,7 @@ public class ConfigSummaryHandler extends FormHandler { _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 || - movingTop || movingUp || movingDown || movingBottom) { + } else if (adding || deleting || saving || moving) { Map sections = new TreeMap(); for (Object o : _settings.keySet()) { if (!(o instanceof String)) @@ -115,21 +111,19 @@ public class ConfigSummaryHandler extends FormHandler { addFormNotice(_("Removed") + ": " + removedName); } } - } else if (movingTop || movingUp || movingDown || movingBottom) { - int start = _action.indexOf('['); - int end = _action.indexOf(']'); - String fromStr = _action.substring(start + 1, end - start); + } else if (moving) { + String parts[] = _action.split("_"); try { - int from = Integer.parseInt(fromStr); + int from = Integer.parseInt(parts[1]); int to = 0; - if (movingUp) + if ("up".equals(parts[2])) to = from - 1; - if (movingDown) + if ("down".equals(parts[2])) to = from + 1; - if (movingBottom) + if ("bottom".equals(parts[2])) to = sections.size() - 1; int n = -1; - if (movingDown || movingBottom) + if ("down".equals(parts[2]) || "bottom".equals(parts[2])) n = 1; for (int i = from; n * i < n * to; i += n) { String temp = sections.get(i + n); @@ -159,4 +153,16 @@ public class ConfigSummaryHandler extends FormHandler { return null; return arr[0].trim(); } + + public void setMovingAction() { + for (Object o : _settings.keySet()) { + if (!(o instanceof String)) + continue; + String k = (String) o; + if (k.startsWith("move_") && k.endsWith(".x") && _settings.get(k) != null) { + _action = k.substring(0, k.length() - 2); + break; + } + } + } } 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 79d323350..3adcf38cd 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java @@ -799,6 +799,9 @@ public class SummaryHelper extends HelperBase { sortedSections.add(section); } + String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); + String imgPath = CSSHelper.BASE_THEME_PATH + theme + "/images/"; + StringBuilder buf = new StringBuilder(2048); buf.append("
") .append(_("Remove")) @@ -817,28 +820,28 @@ public class SummaryHelper extends HelperBase { .append(i) .append("\">"); if (i > 0) { - buf.append(""); - buf.append(""); + buf.append(""); + .append("\" src=\"" + imgPath + "move_up.png\">"); } if (i < sections.size() - 1) { - buf.append(""); - buf.append(""); + buf.append(""); + .append("\" src=\"" + imgPath + "move_bottom.png\">"); } buf.append("") .append(section) diff --git a/apps/routerconsole/jsp/configsidebar.jsp b/apps/routerconsole/jsp/configsidebar.jsp index 3f219fb40..cbb270d4f 100644 --- a/apps/routerconsole/jsp/configsidebar.jsp +++ b/apps/routerconsole/jsp/configsidebar.jsp @@ -30,6 +30,9 @@ input.default { " /> +<% + formhandler.setMovingAction(); +%> <% String pageNonce = formhandler.getNewNonce(); diff --git a/installer/resources/themes/console/classic/images/move_bottom.png b/installer/resources/themes/console/classic/images/move_bottom.png new file mode 100644 index 000000000..577ae3352 Binary files /dev/null and b/installer/resources/themes/console/classic/images/move_bottom.png differ diff --git a/installer/resources/themes/console/classic/images/move_down.png b/installer/resources/themes/console/classic/images/move_down.png new file mode 100644 index 000000000..d82b5d45d Binary files /dev/null and b/installer/resources/themes/console/classic/images/move_down.png differ diff --git a/installer/resources/themes/console/classic/images/move_top.png b/installer/resources/themes/console/classic/images/move_top.png new file mode 100644 index 000000000..55192cf79 Binary files /dev/null and b/installer/resources/themes/console/classic/images/move_top.png differ diff --git a/installer/resources/themes/console/classic/images/move_up.png b/installer/resources/themes/console/classic/images/move_up.png new file mode 100644 index 000000000..e512dbdc2 Binary files /dev/null and b/installer/resources/themes/console/classic/images/move_up.png differ diff --git a/installer/resources/themes/console/dark/console.css b/installer/resources/themes/console/dark/console.css index a08bce064..827d3a6b7 100644 --- a/installer/resources/themes/console/dark/console.css +++ b/installer/resources/themes/console/dark/console.css @@ -923,6 +923,10 @@ input[type=text]:active, input[type=text]:hover { background: #000; } +input[type=image] { + min-width: 0; +} + fieldset { overflow: hidden; position: relative; diff --git a/installer/resources/themes/console/dark/images/move_bottom.png b/installer/resources/themes/console/dark/images/move_bottom.png new file mode 100644 index 000000000..349fe2d50 Binary files /dev/null and b/installer/resources/themes/console/dark/images/move_bottom.png differ diff --git a/installer/resources/themes/console/dark/images/move_down.png b/installer/resources/themes/console/dark/images/move_down.png new file mode 100644 index 000000000..c9152a3a0 Binary files /dev/null and b/installer/resources/themes/console/dark/images/move_down.png differ diff --git a/installer/resources/themes/console/dark/images/move_top.png b/installer/resources/themes/console/dark/images/move_top.png new file mode 100644 index 000000000..b743ff473 Binary files /dev/null and b/installer/resources/themes/console/dark/images/move_top.png differ diff --git a/installer/resources/themes/console/dark/images/move_up.png b/installer/resources/themes/console/dark/images/move_up.png new file mode 100644 index 000000000..937e4266f Binary files /dev/null and b/installer/resources/themes/console/dark/images/move_up.png differ diff --git a/installer/resources/themes/console/light/images/move_bottom.png b/installer/resources/themes/console/light/images/move_bottom.png new file mode 100644 index 000000000..577ae3352 Binary files /dev/null and b/installer/resources/themes/console/light/images/move_bottom.png differ diff --git a/installer/resources/themes/console/light/images/move_down.png b/installer/resources/themes/console/light/images/move_down.png new file mode 100644 index 000000000..d82b5d45d Binary files /dev/null and b/installer/resources/themes/console/light/images/move_down.png differ diff --git a/installer/resources/themes/console/light/images/move_top.png b/installer/resources/themes/console/light/images/move_top.png new file mode 100644 index 000000000..55192cf79 Binary files /dev/null and b/installer/resources/themes/console/light/images/move_top.png differ diff --git a/installer/resources/themes/console/light/images/move_up.png b/installer/resources/themes/console/light/images/move_up.png new file mode 100644 index 000000000..e512dbdc2 Binary files /dev/null and b/installer/resources/themes/console/light/images/move_up.png differ diff --git a/installer/resources/themes/console/midnight/images/move_bottom.png b/installer/resources/themes/console/midnight/images/move_bottom.png new file mode 100644 index 000000000..349fe2d50 Binary files /dev/null and b/installer/resources/themes/console/midnight/images/move_bottom.png differ diff --git a/installer/resources/themes/console/midnight/images/move_down.png b/installer/resources/themes/console/midnight/images/move_down.png new file mode 100644 index 000000000..c9152a3a0 Binary files /dev/null and b/installer/resources/themes/console/midnight/images/move_down.png differ diff --git a/installer/resources/themes/console/midnight/images/move_top.png b/installer/resources/themes/console/midnight/images/move_top.png new file mode 100644 index 000000000..b743ff473 Binary files /dev/null and b/installer/resources/themes/console/midnight/images/move_top.png differ diff --git a/installer/resources/themes/console/midnight/images/move_up.png b/installer/resources/themes/console/midnight/images/move_up.png new file mode 100644 index 000000000..937e4266f Binary files /dev/null and b/installer/resources/themes/console/midnight/images/move_up.png differ