forked from I2P_Developers/i2p.i2p
Separated disabling of iframe refresh from the refresh time
This commit is contained in:
@ -20,6 +20,7 @@ public class CSSHelper extends HelperBase {
|
|||||||
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
|
public static final String PROP_REFRESH = "routerconsole.summaryRefresh";
|
||||||
public static final String DEFAULT_REFRESH = "60";
|
public static final String DEFAULT_REFRESH = "60";
|
||||||
public static final int MIN_REFRESH = 3;
|
public static final int MIN_REFRESH = 3;
|
||||||
|
public static final String PROP_DISABLE_REFRESH = "routerconsole.summaryDisableRefresh";
|
||||||
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
private static final String PROP_XFRAME = "routerconsole.disableXFrame";
|
||||||
|
|
||||||
public String getTheme(String userAgent) {
|
public String getTheme(String userAgent) {
|
||||||
@ -90,6 +91,25 @@ public class CSSHelper extends HelperBase {
|
|||||||
return r;
|
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 */
|
/** translate the title and display consistently */
|
||||||
public String title(String s) {
|
public String title(String s) {
|
||||||
StringBuilder buf = new StringBuilder(128);
|
StringBuilder buf = new StringBuilder(128);
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
|
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
|
||||||
// pass the new delay parameter to the iframe
|
// pass the new delay parameter to the iframe
|
||||||
newDelay = "?refresh=" + d;
|
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");
|
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
|
// d and allowIFrame defined above
|
||||||
if (!"0".equals(d)) {
|
if (!intl.getDisableRefresh()) {
|
||||||
out.print("</div><noscript></iframe></noscript>\n");
|
out.print("</div><noscript></iframe></noscript>\n");
|
||||||
} else if (allowIFrame) {
|
} else if (allowIFrame) {
|
||||||
// since we don't have an iframe this will reload the base page, and
|
// since we don't have an iframe this will reload the base page, and
|
||||||
|
@ -26,10 +26,11 @@
|
|||||||
} else {
|
} else {
|
||||||
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
|
d = net.i2p.data.DataHelper.stripHTML(d); // XSS
|
||||||
intl.setRefresh(d);
|
intl.setRefresh(d);
|
||||||
|
intl.setDisableRefresh(d);
|
||||||
}
|
}
|
||||||
// we probably don't get here if d == "0" since caught in summary.jsi, but just
|
// we probably don't get here if d == "0" since caught in summary.jsi, but just
|
||||||
// to be sure...
|
// to be sure...
|
||||||
if (!"0".equals(d)) {
|
if (!intl.getDisableRefresh()) {
|
||||||
// doesn't work for restart or shutdown with no expl. tunnels,
|
// doesn't work for restart or shutdown with no expl. tunnels,
|
||||||
// since the call to ConfigRestartBean.renderStatus() hasn't happened yet...
|
// since the call to ConfigRestartBean.renderStatus() hasn't happened yet...
|
||||||
// So we delay slightly
|
// So we delay slightly
|
||||||
@ -64,7 +65,7 @@
|
|||||||
// d and shutdownSoon defined above
|
// d and shutdownSoon defined above
|
||||||
if (!shutdownSoon) {
|
if (!shutdownSoon) {
|
||||||
out.print("<hr>\n<div class=\"refresh\"><form action=\"summaryframe.jsp\" method=\"POST\">\n");
|
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("<b>");
|
||||||
out.print(intl._("Refresh (s)"));
|
out.print(intl._("Refresh (s)"));
|
||||||
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" >\n");
|
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" >\n");
|
||||||
|
Reference in New Issue
Block a user