Console: Fix bug with IE buttons not working, because it sends the label instead of the value
This commit is contained in:
@ -142,7 +142,7 @@ public class IndexBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String processAction() {
|
private String processAction() {
|
||||||
if ( (_action == null) || (_action.trim().length() <= 0) )
|
if ( (_action == null) || (_action.trim().length() <= 0) || ("Cancel".equals(_action)))
|
||||||
return "";
|
return "";
|
||||||
if ( (_prevNonce != _curNonce) && (!validPassphrase(_passphrase)) )
|
if ( (_prevNonce != _curNonce) && (!validPassphrase(_passphrase)) )
|
||||||
return "Invalid nonce, are you being spoofed?";
|
return "Invalid nonce, are you being spoofed?";
|
||||||
|
@ -41,6 +41,18 @@ public class ConfigClientsHandler extends FormHandler {
|
|||||||
startClient(appnum);
|
startClient(appnum);
|
||||||
else
|
else
|
||||||
startWebApp(app);
|
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 {
|
} else {
|
||||||
addFormError("Unsupported " + _action);
|
addFormError("Unsupported " + _action);
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,10 @@ public class ConfigClientsHelper extends HelperBase {
|
|||||||
if (ro)
|
if (ro)
|
||||||
buf.append("disabled=\"true\" ");
|
buf.append("disabled=\"true\" ");
|
||||||
}
|
}
|
||||||
buf.append("/></td><td> ");
|
buf.append("/></td><td> ");
|
||||||
if (!enabled) {
|
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);
|
RouterContext ctx = ContextHelper.getContext(null);
|
||||||
String systemNonce = getNonce();
|
String systemNonce = getNonce();
|
||||||
if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) {
|
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.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD));
|
||||||
//ctx.router().shutdown(Router.EXIT_HARD); // never returns
|
//ctx.router().shutdown(Router.EXIT_HARD); // never returns
|
||||||
ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond
|
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();
|
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.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
|
||||||
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
|
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
|
||||||
ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond
|
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.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
|
||||||
ctx.router().shutdownGracefully(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.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
|
||||||
ctx.router().shutdownGracefully();
|
ctx.router().shutdownGracefully();
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
<html><head>
|
<html><head>
|
||||||
<title>I2P Router Console - config clients</title>
|
<title>I2P Router Console - config clients</title>
|
||||||
<link rel="stylesheet" href="default.css" type="text/css" />
|
<link rel="stylesheet" href="default.css" type="text/css" />
|
||||||
|
<style type='text/css'>
|
||||||
|
button span.hide{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head><body>
|
</head><body>
|
||||||
|
|
||||||
<%@include file="nav.jsp" %>
|
<%@include file="nav.jsp" %>
|
||||||
|
Reference in New Issue
Block a user