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 3ad7c1c20653fd569352b91f302cddfbb84c100a..92228d4bf2cbcf8dc553ce96ec583a7f6ba2570f 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<Integer, String> sections = new TreeMap<Integer, String>(); 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 79d3233501e0e5e02e760e2acbc9d41f760ffce5..3adcf38cd96c437f7410215097560415a3cc4755 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("<table><tr><th>") .append(_("Remove")) @@ -817,28 +820,28 @@ public class SummaryHelper extends HelperBase { .append(i) .append("\">"); if (i > 0) { - buf.append("<input type=\"submit\" class=\"buttonTop\" name=\"action\" value=\"[") + buf.append("<input type=\"image\" class=\"buttonTop\" name=\"move_") .append(i) - .append("] ") + .append("_top\" alt=\"") .append(_("Top")) - .append("\">"); - buf.append("<input type=\"submit\" class=\"buttonUp\" name=\"action\" value=\"[") + .append("\" src=\"" + imgPath + "move_top.png\">"); + buf.append("<input type=\"image\" class=\"buttonUp\" name=\"move_") .append(i) - .append("] ") + .append("_up\" alt=\"") .append(_("Up")) - .append("\">"); + .append("\" src=\"" + imgPath + "move_up.png\">"); } if (i < sections.size() - 1) { - buf.append("<input type=\"submit\" class=\"buttonDown\" name=\"action\" value=\"[") + buf.append("<input type=\"image\" class=\"buttonDown\" name=\"move_") .append(i) - .append("] ") + .append("_down\" alt=\"") .append(_("Down")) - .append("\">"); - buf.append("<input type=\"submit\" class=\"buttonBottom\" name=\"action\" value=\"[") + .append("\" src=\"" + imgPath + "move_down.png\">"); + buf.append("<input type=\"image\" class=\"buttonBottom\" name=\"move_") .append(i) - .append("] ") + .append("_bottom\" alt=\"") .append(_("Bottom")) - .append("\">"); + .append("\" src=\"" + imgPath + "move_bottom.png\">"); } buf.append("</td><td align=\"left\">") .append(section) diff --git a/apps/routerconsole/jsp/configsidebar.jsp b/apps/routerconsole/jsp/configsidebar.jsp index 3f219fb40b7aa15e19c7089f112a35ea423e5b2e..cbb270d4f68db0d204ee9bad56ffe0b5d091a7e6 100644 --- a/apps/routerconsole/jsp/configsidebar.jsp +++ b/apps/routerconsole/jsp/configsidebar.jsp @@ -30,6 +30,9 @@ input.default { <jsp:setProperty name="formhandler" property="*" /> <jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" /> <jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" /> +<% + formhandler.setMovingAction(); +%> <jsp:getProperty name="formhandler" property="allMessages" /> <% 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 0000000000000000000000000000000000000000..577ae3352199ef87736c59ec1a137aa5165a4961 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 0000000000000000000000000000000000000000..d82b5d45dcfd3fe251ef497ce48108cb251109be 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 0000000000000000000000000000000000000000..55192cf79bd3ce5bb58ab0323eed2d3f05b2bab7 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 0000000000000000000000000000000000000000..e512dbdc2d1682d38bd58edaa248aff3cbde7863 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 a08bce064147864d6e29a454759a9c9b6f73edf3..827d3a6b7d9c0baa28bb98b58d08a987a38117d4 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 0000000000000000000000000000000000000000..349fe2d5046056bb6e6f3082b2ef063268bcfeb9 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 0000000000000000000000000000000000000000..c9152a3a005daaa7e896e26f872232e24ee6bd4a 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 0000000000000000000000000000000000000000..b743ff473eea18cda0dda3d895784e29cb4f48c8 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 0000000000000000000000000000000000000000..937e4266fea11848e0ea610f4f9a686e29d3626d 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 0000000000000000000000000000000000000000..577ae3352199ef87736c59ec1a137aa5165a4961 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 0000000000000000000000000000000000000000..d82b5d45dcfd3fe251ef497ce48108cb251109be 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 0000000000000000000000000000000000000000..55192cf79bd3ce5bb58ab0323eed2d3f05b2bab7 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 0000000000000000000000000000000000000000..e512dbdc2d1682d38bd58edaa248aff3cbde7863 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 0000000000000000000000000000000000000000..349fe2d5046056bb6e6f3082b2ef063268bcfeb9 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 0000000000000000000000000000000000000000..c9152a3a005daaa7e896e26f872232e24ee6bd4a 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 0000000000000000000000000000000000000000..b743ff473eea18cda0dda3d895784e29cb4f48c8 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 0000000000000000000000000000000000000000..937e4266fea11848e0ea610f4f9a686e29d3626d Binary files /dev/null and b/installer/resources/themes/console/midnight/images/move_up.png differ