Rearrange summary bar code to consolidate Ajax and IFrame, and /home and /console

Now, Ajax will be used first, and will fall back to IFrame if JS is disabled,
and a separate page if on a text or mobile browser.
Also, /home and /console (and everywhere) now all have the same summary bar
content, which currently defaults to the original full listing.
This commit is contained in:
str4d
2012-06-05 12:44:17 +00:00
parent 531c6c0f4c
commit 52a3860717
9 changed files with 79 additions and 96 deletions

View File

@@ -1,3 +1,10 @@
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
<%
java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml");
%>
<jsp:setProperty name="newshelper" property="page" value="<%=newspath.getAbsolutePath()%>" />
<jsp:setProperty name="newshelper" property="maxLines" value="300" />
<div class="routersummaryouter">
<%
// The refresh delay, 0 to disable
@@ -15,7 +22,7 @@
newDelay = "?refresh=" + d;
}
if (!"0".equals(d))
out.print("<iframe src=\"/summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\">\n");
out.print("<noscript><iframe src=\"/summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\"></noscript>\n");
}
%>
<div class="routersummary">
@@ -34,11 +41,11 @@
// d and allowIFrame defined above
if (!"0".equals(d)) {
out.print("</div></iframe>\n");
out.print("</div><noscript></iframe></noscript>\n");
} else if (allowIFrame) {
// since we don't have an iframe this will reload the base page, and
// the new delay will be passed to the iframe above
out.print("<div class=\"refresh\"><form action=\"" + request.getRequestURI() + "\" method=\"POST\">\n" +
out.print("<noscript><div class=\"refresh\"><form action=\"" + request.getRequestURI() + "\" method=\"POST\">\n" +
"<b>");
// We have intl defined when this is included, but not when compiled standalone.
out.print(intl._("Refresh (s)"));
@@ -47,7 +54,7 @@
// ditto
out.print(intl._("Enable"));
out.print("</button>\n" +
"</form></div></div>\n");
"</form></div></noscript></div>\n");
} else {
out.print("</div>\n");
}