diff --git a/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java index 833e197a04..d5d702e8ff 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java @@ -18,12 +18,6 @@ public class NewsHelper extends ContentHelper { return super.getContent(); } - /** @since 0.9.1 */ - public String getNewsHeadings() { - SummaryBarRenderer renderer = new SummaryBarRenderer(_context, this); - return renderer.renderNewsHeadingsHTML(); - } - /** @since 0.8.12 */ public boolean shouldShowNews() { return NewsFetcher.getInstance(_context).shouldShowNews(); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java index 756126895f..84f1401021 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java @@ -15,6 +15,7 @@ import net.i2p.router.RouterContext; * */ public class SummaryBarRenderer { + // Commented out because broken. Replaced by if-elseif blob below. /*static final Map ALL_SECTIONS; static { Map aMap = new HashMap();; @@ -42,20 +43,10 @@ public class SummaryBarRenderer { private final RouterContext _context; private final SummaryHelper _helper; - private final NewsHelper _newshelper; public SummaryBarRenderer(RouterContext context, SummaryHelper helper) { - this(context, helper, null); - } - - public SummaryBarRenderer(RouterContext context, NewsHelper newshelper) { - this(context, null, newshelper); - } - - public SummaryBarRenderer(RouterContext context, SummaryHelper helper, NewsHelper newshelper) { _context = context; _helper = helper; - _newshelper = newshelper; } /** @@ -64,25 +55,9 @@ public class SummaryBarRenderer { */ public void renderSummaryHTML(Writer out) throws IOException { StringBuilder buf = new StringBuilder(8*1024); - String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); - - // TODO - the bar would render more cleanly if we specified the img height and width here, - // but unfortunately the images in the different themes are different sizes. - // They range in height from 37 to 43 px. But there's a -2 bottom margin... - // So put it in a div. - buf.append("
\"")
\n"); - - out.write(buf.toString()); - String[] sections = _helper.getSummaryBarSections(); for (int i = 0; i < sections.length; i++) { + // Commented out because broken. Replaced by if-elseif blob below. /*try { String section = (String)ALL_SECTIONS.get(sections[i]).invoke(this); if (section != null && section != "") { @@ -546,7 +521,9 @@ public class SummaryBarRenderer { /** @since 0.9.1 */ public String renderNewsHeadingsHTML() { - if (_newshelper == null || _newshelper.shouldShowNews()) return ""; + if (_helper == null) return ""; + NewsHelper newshelper = _helper.getNewsHelper(); + if (newshelper == null || newshelper.shouldShowNews()) return ""; StringBuilder buf = new StringBuilder(512); String consoleNonce = System.getProperty("router.consoleNonce"); if (consoleNonce != null) { @@ -555,7 +532,7 @@ public class SummaryBarRenderer { .append(_("News & Updates")) .append("
\n"); // Get news content. - String newsContent = _newshelper.getContent(); + String newsContent = newshelper.getContent(); if (newsContent != "") { buf.append("
    \n"); // Parse news content for headings. diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java index 46c6d58af6..32d3b2bbc6 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java @@ -739,6 +739,10 @@ public class SummaryHelper extends HelperBase { return buf.toString(); } + private NewsHelper _newshelper; + public void storeNewsHelper(NewsHelper n) { _newshelper = n; } + public NewsHelper getNewsHelper() { return _newshelper; } + public String[] getSummaryBarSections() { String config = _context.getProperty(PROP_SUMMARYBAR, PRESET_FULL); return config.split("" + S); diff --git a/apps/routerconsole/jsp/console.jsp b/apps/routerconsole/jsp/console.jsp index c02b64b9a8..7a080d2b98 100644 --- a/apps/routerconsole/jsp/console.jsp +++ b/apps/routerconsole/jsp/console.jsp @@ -6,7 +6,13 @@ <%@include file="css.jsi" %> <%=intl.title("home")%> - + + + <% String consoleNonce = System.getProperty("router.consoleNonce"); if (consoleNonce == null) { @@ -15,16 +21,13 @@ } %> -<%@include file="summary.jsi" %>

    <%=intl._("I2P Router Console")%>

    +<%@include file="summary.jsi" %> + +

    <%=intl._("I2P Router Console")%>

    - - " /> <% if (newshelper.shouldShowNews()) { - java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); %> - -
    <% diff --git a/apps/routerconsole/jsp/home.jsp b/apps/routerconsole/jsp/home.jsp index f4088cc031..5183f64a80 100644 --- a/apps/routerconsole/jsp/home.jsp +++ b/apps/routerconsole/jsp/home.jsp @@ -6,7 +6,7 @@ <%=intl.title("home")%> @@ -33,7 +33,6 @@ -
    <%@include file="xhr1.jsi" %> diff --git a/apps/routerconsole/jsp/summary.jsi b/apps/routerconsole/jsp/summary.jsi index 847e42d523..0eb9d77b0b 100644 --- a/apps/routerconsole/jsp/summary.jsi +++ b/apps/routerconsole/jsp/summary.jsi @@ -1,3 +1,10 @@ + +" /> +<% + java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); +%> + +
    <% // The refresh delay, 0 to disable @@ -15,7 +22,7 @@ newDelay = "?refresh=" + d; } if (!"0".equals(d)) - out.print("\n"); + out.print("
    \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("
    \n" + + out.print("
    \n"); + "
    \n"); } else { out.print("
\n"); } diff --git a/apps/routerconsole/jsp/summaryframe.jsp b/apps/routerconsole/jsp/summaryframe.jsp index 5822c9f64d..218e78ba6a 100644 --- a/apps/routerconsole/jsp/summaryframe.jsp +++ b/apps/routerconsole/jsp/summaryframe.jsp @@ -52,6 +52,13 @@ } %>
+ +" /> +<% + java.io.File newspath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); +%> + + <%@include file="summarynoframe.jsi" %> <% // d and shutdownSoon defined above diff --git a/apps/routerconsole/jsp/summarynoframe.jsi b/apps/routerconsole/jsp/summarynoframe.jsi index 63c39e6e54..6fae7c9016 100644 --- a/apps/routerconsole/jsp/summarynoframe.jsi +++ b/apps/routerconsole/jsp/summarynoframe.jsi @@ -1,35 +1,17 @@ -<%@page import="net.i2p.router.web.SummaryHelper" %> <% /* - * Note: - * This is included almost 30 times, so keep whitespace etc. to a minimum. + * TODO - the bar would render more cleanly if we specified the img height and width here, + * but unfortunately the images in the different themes are different sizes. + * They range in height from 37 to 43 px. But there's a -2 bottom margin... + * So put it in a div. */ %> - -" /> -" /> -" /> -" /> - -<% helper.storeWriter(out); %> -<% -/* - * The following is required for the reseed button to work, although we probably - * only need the reseedNonce property. - */ -%> - - -<% -/* - * The following is required for the update buttons to work, although we probably - * only need the updateNonce property. - */ -%> - - -" /> -<% - // moved to java for ease of translation and to avoid 30 copies - helper.renderSummaryBar(); -%> + +
+ +<%@include file="xhr1.jsi" %> +
diff --git a/apps/routerconsole/jsp/xhr1.jsi b/apps/routerconsole/jsp/xhr1.jsi index 4a646c7590..1362cca1f7 100644 --- a/apps/routerconsole/jsp/xhr1.jsi +++ b/apps/routerconsole/jsp/xhr1.jsi @@ -1,31 +1,41 @@ +<%@page import="net.i2p.router.web.SummaryHelper" %> +<% +/* + * Note: + * This is included on every refresh, so keep whitespace etc. to a minimum. + */ +%> " /> " /> -
<%=intl._("Version")%>: - -
<%=intl._("Uptime")%>: - -

" /> " /> <% String reqURI = request.getRequestURI(); if (reqURI != null) - reqURI = reqURI.replace("/xhr1.jsp", "/home"); + reqURI = reqURI.replace("/xhr1.jsp", "/"); helper.setRequestURI(reqURI); %> +<% helper.storeWriter(out); %> +<% helper.storeNewsHelper(newshelper); %> <% - if (!newshelper.shouldShowNews()) { +/* + * The following is required for the reseed button to work, although we probably + * only need the reseedNonce property. + */ %> -
+ + <% - } // !shouldShowNews() +/* + * The following is required for the update buttons to work, although we probably + * only need the updateNonce property. + */ +%> + + +" /> +<% + // moved to java for ease of translation + helper.renderSummaryBar(); %> - -

"><%=intl._("Network")%>: -

-
- - -
-