Use image buttons for ordering summary bar sections (images courtesy of dr|z3d)
@ -26,10 +26,7 @@ public class ConfigSummaryHandler extends FormHandler {
|
|||||||
boolean deleting = _action.equals(_("Delete selected"));
|
boolean deleting = _action.equals(_("Delete selected"));
|
||||||
boolean adding = _action.equals(_("Add item"));
|
boolean adding = _action.equals(_("Add item"));
|
||||||
boolean saving = _action.equals(_("Save order"));
|
boolean saving = _action.equals(_("Save order"));
|
||||||
boolean movingTop = _action.substring(_action.indexOf(' ') + 1).equals(_("Top"));
|
boolean moving = _action.startsWith("move_");
|
||||||
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"));
|
|
||||||
if (_action.equals(_("Save")) && "0".equals(group)) {
|
if (_action.equals(_("Save")) && "0".equals(group)) {
|
||||||
try {
|
try {
|
||||||
int refreshInterval = Integer.parseInt(getJettyString("refreshInterval"));
|
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);
|
_context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_MINIMAL);
|
||||||
addFormNotice(_("Minimal summary bar default restored.") + " " +
|
addFormNotice(_("Minimal summary bar default restored.") + " " +
|
||||||
_("Summary bar will refresh shortly."));
|
_("Summary bar will refresh shortly."));
|
||||||
} else if (adding || deleting || saving ||
|
} else if (adding || deleting || saving || moving) {
|
||||||
movingTop || movingUp || movingDown || movingBottom) {
|
|
||||||
Map<Integer, String> sections = new TreeMap<Integer, String>();
|
Map<Integer, String> sections = new TreeMap<Integer, String>();
|
||||||
for (Object o : _settings.keySet()) {
|
for (Object o : _settings.keySet()) {
|
||||||
if (!(o instanceof String))
|
if (!(o instanceof String))
|
||||||
@ -115,21 +111,19 @@ public class ConfigSummaryHandler extends FormHandler {
|
|||||||
addFormNotice(_("Removed") + ": " + removedName);
|
addFormNotice(_("Removed") + ": " + removedName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (movingTop || movingUp || movingDown || movingBottom) {
|
} else if (moving) {
|
||||||
int start = _action.indexOf('[');
|
String parts[] = _action.split("_");
|
||||||
int end = _action.indexOf(']');
|
|
||||||
String fromStr = _action.substring(start + 1, end - start);
|
|
||||||
try {
|
try {
|
||||||
int from = Integer.parseInt(fromStr);
|
int from = Integer.parseInt(parts[1]);
|
||||||
int to = 0;
|
int to = 0;
|
||||||
if (movingUp)
|
if ("up".equals(parts[2]))
|
||||||
to = from - 1;
|
to = from - 1;
|
||||||
if (movingDown)
|
if ("down".equals(parts[2]))
|
||||||
to = from + 1;
|
to = from + 1;
|
||||||
if (movingBottom)
|
if ("bottom".equals(parts[2]))
|
||||||
to = sections.size() - 1;
|
to = sections.size() - 1;
|
||||||
int n = -1;
|
int n = -1;
|
||||||
if (movingDown || movingBottom)
|
if ("down".equals(parts[2]) || "bottom".equals(parts[2]))
|
||||||
n = 1;
|
n = 1;
|
||||||
for (int i = from; n * i < n * to; i += n) {
|
for (int i = from; n * i < n * to; i += n) {
|
||||||
String temp = sections.get(i + n);
|
String temp = sections.get(i + n);
|
||||||
@ -159,4 +153,16 @@ public class ConfigSummaryHandler extends FormHandler {
|
|||||||
return null;
|
return null;
|
||||||
return arr[0].trim();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -799,6 +799,9 @@ public class SummaryHelper extends HelperBase {
|
|||||||
sortedSections.add(section);
|
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);
|
StringBuilder buf = new StringBuilder(2048);
|
||||||
buf.append("<table><tr><th>")
|
buf.append("<table><tr><th>")
|
||||||
.append(_("Remove"))
|
.append(_("Remove"))
|
||||||
@ -817,28 +820,28 @@ public class SummaryHelper extends HelperBase {
|
|||||||
.append(i)
|
.append(i)
|
||||||
.append("\">");
|
.append("\">");
|
||||||
if (i > 0) {
|
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(i)
|
||||||
.append("] ")
|
.append("_top\" alt=\"")
|
||||||
.append(_("Top"))
|
.append(_("Top"))
|
||||||
.append("\">");
|
.append("\" src=\"" + imgPath + "move_top.png\">");
|
||||||
buf.append("<input type=\"submit\" class=\"buttonUp\" name=\"action\" value=\"[")
|
buf.append("<input type=\"image\" class=\"buttonUp\" name=\"move_")
|
||||||
.append(i)
|
.append(i)
|
||||||
.append("] ")
|
.append("_up\" alt=\"")
|
||||||
.append(_("Up"))
|
.append(_("Up"))
|
||||||
.append("\">");
|
.append("\" src=\"" + imgPath + "move_up.png\">");
|
||||||
}
|
}
|
||||||
if (i < sections.size() - 1) {
|
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(i)
|
||||||
.append("] ")
|
.append("_down\" alt=\"")
|
||||||
.append(_("Down"))
|
.append(_("Down"))
|
||||||
.append("\">");
|
.append("\" src=\"" + imgPath + "move_down.png\">");
|
||||||
buf.append("<input type=\"submit\" class=\"buttonBottom\" name=\"action\" value=\"[")
|
buf.append("<input type=\"image\" class=\"buttonBottom\" name=\"move_")
|
||||||
.append(i)
|
.append(i)
|
||||||
.append("] ")
|
.append("_bottom\" alt=\"")
|
||||||
.append(_("Bottom"))
|
.append(_("Bottom"))
|
||||||
.append("\">");
|
.append("\" src=\"" + imgPath + "move_bottom.png\">");
|
||||||
}
|
}
|
||||||
buf.append("</td><td align=\"left\">")
|
buf.append("</td><td align=\"left\">")
|
||||||
.append(section)
|
.append(section)
|
||||||
|
@ -30,6 +30,9 @@ input.default {
|
|||||||
<jsp:setProperty name="formhandler" property="*" />
|
<jsp:setProperty name="formhandler" property="*" />
|
||||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
|
||||||
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
|
<jsp:setProperty name="formhandler" property="settings" value="<%=request.getParameterMap()%>" />
|
||||||
|
<%
|
||||||
|
formhandler.setMovingAction();
|
||||||
|
%>
|
||||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||||
<%
|
<%
|
||||||
String pageNonce = formhandler.getNewNonce();
|
String pageNonce = formhandler.getNewNonce();
|
||||||
|
After Width: | Height: | Size: 326 B |
BIN
installer/resources/themes/console/classic/images/move_down.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
installer/resources/themes/console/classic/images/move_top.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
installer/resources/themes/console/classic/images/move_up.png
Normal file
After Width: | Height: | Size: 290 B |
@ -923,6 +923,10 @@ input[type=text]:active, input[type=text]:hover {
|
|||||||
background: #000;
|
background: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type=image] {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset {
|
fieldset {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
BIN
installer/resources/themes/console/dark/images/move_bottom.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
installer/resources/themes/console/dark/images/move_down.png
Normal file
After Width: | Height: | Size: 498 B |
BIN
installer/resources/themes/console/dark/images/move_top.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
installer/resources/themes/console/dark/images/move_up.png
Normal file
After Width: | Height: | Size: 452 B |
BIN
installer/resources/themes/console/light/images/move_bottom.png
Normal file
After Width: | Height: | Size: 326 B |
BIN
installer/resources/themes/console/light/images/move_down.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
installer/resources/themes/console/light/images/move_top.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
installer/resources/themes/console/light/images/move_up.png
Normal file
After Width: | Height: | Size: 290 B |
After Width: | Height: | Size: 497 B |
BIN
installer/resources/themes/console/midnight/images/move_down.png
Normal file
After Width: | Height: | Size: 498 B |
BIN
installer/resources/themes/console/midnight/images/move_top.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
installer/resources/themes/console/midnight/images/move_up.png
Normal file
After Width: | Height: | Size: 452 B |