I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 75046d11 authored by str4d's avatar str4d
Browse files

Separated disabling of iframe refresh from the refresh time

parent bb39d9dd
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ public class CSSHelper extends HelperBase {
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
public static final String DEFAULT_REFRESH = "60";
public static final int MIN_REFRESH = 3;
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
public String getTheme(String userAgent) {
......@@ -90,6 +91,25 @@ public class CSSHelper extends HelperBase {
return r;
}
/**
* change disable refresh boolean and save it
* @since 0.9.1
*/
public void setDisableRefresh(String r) {
String disableRefresh = "false";
if ("0".equals(r))
disableRefresh = "true";
_context.router().saveConfig(PROP_DISABLE_REFRESH, disableRefresh);
}
/**
* @return true if refresh is disabled
* @since 0.9.1
*/
public boolean getDisableRefresh() {
return _context.getBooleanProperty(PROP_DISABLE_REFRESH);
}
/** translate the title and display consistently */
public String title(String s) {
StringBuilder buf = new StringBuilder(128);
......
......@@ -20,8 +20,10 @@
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
// pass the new delay parameter to the iframe
newDelay = "?refresh=" + d;
// update disable boolean
intl.setDisableRefresh(d);
}
if (!"0".equals(d))
if (!intl.getDisableRefresh())
out.print("<noscript><iframe src=\"/summaryframe.jsp" + newDelay + "\" height=\"1500\" width=\"200\" scrolling=\"auto\" frameborder=\"0\" title=\"sidepanel\"></noscript>\n");
}
%>
......@@ -40,7 +42,7 @@
}
// d and allowIFrame defined above
if (!"0".equals(d)) {
if (!intl.getDisableRefresh()) {
out.print("</div><noscript></iframe></noscript>\n");
} else if (allowIFrame) {
// since we don't have an iframe this will reload the base page, and
......
......@@ -26,10 +26,11 @@
} else {
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
intl.setRefresh(d);
intl.setDisableRefresh(d);
}
// we probably don't get here if d == "0" since caught in summary.jsi, but just
// to be sure...
if (!"0".equals(d)) {
if (!intl.getDisableRefresh()) {
// doesn't work for restart or shutdown with no expl. tunnels,
// since the call to ConfigRestartBean.renderStatus() hasn't happened yet...
// So we delay slightly
......@@ -64,7 +65,7 @@
// d and shutdownSoon defined above
if (!shutdownSoon) {
out.print("<hr>\n<div class=\"refresh\"><form action=\"summaryframe.jsp\" method=\"POST\">\n");
if ("0".equals(d)) {
if (intl.getDisableRefresh()) {
out.print("<b>");
out.print(intl._("Refresh (s)"));
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" >\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment