Console: Fix bug with IE buttons not working, because it sends the label instead of the value
This commit is contained in:
@ -41,6 +41,18 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
startClient(appnum);
|
||||
else
|
||||
startWebApp(app);
|
||||
} else if (_action.toLowerCase().startsWith("start<span class=hide> ") &&
|
||||
_action.toLowerCase().endsWith("</span>")) {
|
||||
// IE sucks
|
||||
String app = _action.substring(23, _action.length() - 7);
|
||||
int appnum = -1;
|
||||
try {
|
||||
appnum = Integer.parseInt(app);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
if (appnum >= 0)
|
||||
startClient(appnum);
|
||||
else
|
||||
startWebApp(app);
|
||||
} else {
|
||||
addFormError("Unsupported " + _action);
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
if (ro)
|
||||
buf.append("disabled=\"true\" ");
|
||||
}
|
||||
buf.append("/></td><td> ");
|
||||
buf.append("/></td><td> ");
|
||||
if (!enabled) {
|
||||
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >Start</button>");
|
||||
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >Start<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
buf.append(" </td><td>").append(desc).append("</td></tr>\n");
|
||||
buf.append(" </td><td>").append(desc).append("</td></tr>\n");
|
||||
}
|
||||
}
|
||||
|
@ -24,20 +24,21 @@ public class ConfigRestartBean {
|
||||
RouterContext ctx = ContextHelper.getContext(null);
|
||||
String systemNonce = getNonce();
|
||||
if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) {
|
||||
if ("shutdownImmediate".equals(action)) {
|
||||
// Normal browsers send value, IE sends button label
|
||||
if ("shutdownImmediate".equals(action) || "Shutdown immediately".equals(action)) {
|
||||
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD));
|
||||
//ctx.router().shutdown(Router.EXIT_HARD); // never returns
|
||||
ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond
|
||||
} else if ("cancelShutdown".equals(action)) {
|
||||
} else if ("cancelShutdown".equals(action) || "Cancel shutdown".equals(action)) {
|
||||
ctx.router().cancelGracefulShutdown();
|
||||
} else if ("restartImmediate".equals(action)) {
|
||||
} else if ("restartImmediate".equals(action) || "Restart immediately".equals(action)) {
|
||||
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
|
||||
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
|
||||
ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond
|
||||
} else if ("restart".equals(action)) {
|
||||
} else if ("restart".equalsIgnoreCase(action)) {
|
||||
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
|
||||
ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
} else if ("shutdown".equals(action)) {
|
||||
} else if ("shutdown".equalsIgnoreCase(action)) {
|
||||
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
|
||||
ctx.router().shutdownGracefully();
|
||||
}
|
||||
|
@ -5,6 +5,11 @@
|
||||
<html><head>
|
||||
<title>I2P Router Console - config clients</title>
|
||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||
<style type='text/css'>
|
||||
button span.hide{
|
||||
display:none;
|
||||
}
|
||||
</style>
|
||||
</head><body>
|
||||
|
||||
<%@include file="nav.jsp" %>
|
||||
|
Reference in New Issue
Block a user