source: apps/routerconsole/jsp/summaryframe.jsp @ 7c646f8

Last change on this file since 7c646f8 was d9cb4e2, checked in by zzz <zzz@…>, 12 years ago
  • Console:
    • Move the console css from default.css in the .war to docs/themes/console/console.css, and support console themes in the main console with routerconsole.theme=foo
  • Property mode set to 100644
File size: 2.9 KB
Line 
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    // try hard to avoid an error page in the iframe after shutdown
17    String action = request.getParameter("action");
18    String d = request.getParameter("refresh");
19    // Normal browsers send value, IE sends button label
20    boolean shutdownSoon = "shutdownImmediate".equals(action) || "restartImmediate".equals(action) ||
21                           "Shutdown immediately".equals(action) || "Restart immediately".equals(action);
22    if (!shutdownSoon) {
23        if (d == null || "".equals(d)) {
24            d = System.getProperty("routerconsole.summaryRefresh");
25            if (d == null || "".equals(d))
26                d = "60";
27        } else {
28            System.setProperty("routerconsole.summaryRefresh", d);
29        }
30        // we probably don't get here if d == "0" since caught in summary.jsp, but just
31        // to be sure...
32        if (!"0".equals(d)) {
33            // doesn't work for restart or shutdown with no expl. tunnels,
34            // since the call to ConfigRestartBean.renderStatus() hasn't happened yet...
35            // So we delay slightly
36            if ("restart".equalsIgnoreCase(action) || "shutdown".equalsIgnoreCase(action)) {
37                synchronized(this) {
38                    try {
39                        wait(1000);
40                    } catch(InterruptedException ie) {}
41                }
42            }
43            long timeleft = net.i2p.router.web.ConfigRestartBean.getRestartTimeRemaining();
44            long delay = 60;
45            try { delay = Long.parseLong(d); } catch (NumberFormatException nfe) {}
46            if (delay*1000 < timeleft + 5000)
47                out.print("<meta http-equiv=\"refresh\" content=\"" + d + "\" />\n");
48            else
49                shutdownSoon = true;
50        }
51    }
52%>
53<%@include file="css.jsp" %>
54</head>
55
56<body style="margin: 0;">
57
58<div class="routersummary">
59<%@include file="summarynoframe.jsp" %>
60<%
61    // d and shutdownSoon defined above
62    if (!shutdownSoon) {
63        out.print("<hr /><p><form action=\"summaryframe.jsp\" method=\"GET\">\n");
64        if ("0".equals(d)) {
65            out.print("<b>Refresh (s):<b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
66            out.print("<button type=\"submit\">Enable</button>\n");
67        } else {
68            // this will load in the iframe but subsequent pages will not have the iframe
69            out.print("<input type=\"hidden\" name=\"refresh\" value=\"0\" />\n");
70            out.print("<button type=\"submit\">Disable " + d + "s Refresh</button>\n");
71        }
72        out.print("</form></p>\n");
73    }
74%>
75</div>
76
77</body>
78</html>
Note: See TracBrowser for help on using the repository browser.