1 | <%@page contentType="text/html"%> |
---|
2 | <%@page pageEncoding="UTF-8"%> |
---|
3 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
4 | |
---|
5 | <% |
---|
6 | /* |
---|
7 | * All links in the summary bar must have target="_top" |
---|
8 | * so they don't load in the iframe |
---|
9 | */ |
---|
10 | %> |
---|
11 | |
---|
12 | <html><head> |
---|
13 | <title>Summary Bar</title> |
---|
14 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
---|
15 | <% |
---|
16 | out.print("<center>\n"); |
---|
17 | // try hard to avoid an error page in the iframe after shutdown |
---|
18 | String action = request.getParameter("action"); |
---|
19 | String d = request.getParameter("refresh"); |
---|
20 | // Normal browsers send value, IE sends button label |
---|
21 | boolean shutdownSoon = "shutdownImmediate".equals(action) || "restartImmediate".equals(action) || |
---|
22 | "Shutdown immediately".equals(action) || "Restart immediately".equals(action); |
---|
23 | if (!shutdownSoon) { |
---|
24 | if (d == null || "".equals(d)) { |
---|
25 | d = System.getProperty("routerconsole.summaryRefresh"); |
---|
26 | if (d == null || "".equals(d)) |
---|
27 | d = "60"; |
---|
28 | } else { |
---|
29 | System.setProperty("routerconsole.summaryRefresh", d); |
---|
30 | } |
---|
31 | // we probably don't get here if d == "0" since caught in summary.jsp, but just |
---|
32 | // to be sure... |
---|
33 | if (!"0".equals(d)) { |
---|
34 | // doesn't work for restart or shutdown with no expl. tunnels, |
---|
35 | // since the call to ConfigRestartBean.renderStatus() hasn't happened yet... |
---|
36 | // So we delay slightly |
---|
37 | if ("restart".equalsIgnoreCase(action) || "shutdown".equalsIgnoreCase(action)) { |
---|
38 | synchronized(this) { |
---|
39 | try { |
---|
40 | wait(1000); |
---|
41 | } catch(InterruptedException ie) {} |
---|
42 | } |
---|
43 | } |
---|
44 | long timeleft = net.i2p.router.web.ConfigRestartBean.getRestartTimeRemaining(); |
---|
45 | long delay = 60; |
---|
46 | try { delay = Long.parseLong(d); } catch (NumberFormatException nfe) {} |
---|
47 | if (delay*1000 < timeleft + 5000) |
---|
48 | out.print("<meta http-equiv=\"refresh\" content=\"" + d + "\" />\n"); |
---|
49 | else |
---|
50 | shutdownSoon = true; |
---|
51 | } |
---|
52 | } |
---|
53 | out.print("</center>\n"); |
---|
54 | %> |
---|
55 | <%@include file="css.jsp" %> |
---|
56 | </head> |
---|
57 | |
---|
58 | <body style="margin: 0;"> |
---|
59 | |
---|
60 | <div class="routersummary"> |
---|
61 | <%@include file="summarynoframe.jsp" %> |
---|
62 | <% |
---|
63 | // d and shutdownSoon defined above |
---|
64 | if (!shutdownSoon) { |
---|
65 | out.print("<hr /><p><form action=\"summaryframe.jsp\" method=\"GET\">\n"); |
---|
66 | if ("0".equals(d)) { |
---|
67 | out.print("<b>Refresh (s):<b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n"); |
---|
68 | out.print("<button type=\"submit\">Enable</button>\n"); |
---|
69 | } else { |
---|
70 | // this will load in the iframe but subsequent pages will not have the iframe |
---|
71 | out.print("<input type=\"hidden\" name=\"refresh\" value=\"0\" />\n"); |
---|
72 | out.print("<button type=\"submit\">Disable " + d + "s Refresh</button>\n"); |
---|
73 | } |
---|
74 | out.print("</form></p>\n"); |
---|
75 | } |
---|
76 | %> |
---|
77 | </div> |
---|
78 | |
---|
79 | </body> |
---|
80 | </html> |
---|