* Add configui.jsp
* orange flash remove take 2
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
/** set the theme */
|
||||
public class ConfigUIHandler extends FormHandler {
|
||||
private boolean _shouldSave;
|
||||
private String _config;
|
||||
|
||||
protected void processForm() {
|
||||
if (_shouldSave)
|
||||
saveChanges();
|
||||
}
|
||||
|
||||
public void setShouldsave(String moo) { _shouldSave = true; }
|
||||
|
||||
public void setTheme(String val) {
|
||||
_config = val;
|
||||
}
|
||||
|
||||
private void saveChanges() {
|
||||
if (_config == null)
|
||||
return;
|
||||
if (_config.equals("default"))
|
||||
_context.router().removeConfigSetting(ConfigUIHelper.PROP_THEME);
|
||||
else
|
||||
_context.router().setConfigSetting(ConfigUIHelper.PROP_THEME, _config);
|
||||
if (_context.router().saveConfig())
|
||||
addFormNotice("Configuration saved successfully");
|
||||
else
|
||||
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
public class ConfigUIHelper extends HelperBase {
|
||||
public ConfigUIHelper() {}
|
||||
|
||||
public static final String PROP_THEME = "routerconsole.theme";
|
||||
private static final String themes[] = {"default", "classic", "dark", "defCon1", "light"};
|
||||
|
||||
public String getSettings() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
String current = _context.getProperty(PROP_THEME, "default");
|
||||
for (String theme : themes) {
|
||||
buf.append("<input type=\"radio\" name=\"theme\" ");
|
||||
if (theme.equals(current))
|
||||
buf.append("checked=\"true\" ");
|
||||
buf.append("value=\"").append(theme).append("\"/>").append(theme).append("<br />\n");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
<b>
|
||||
<% if (request.getRequestURI().indexOf("config.jsp") != -1) {
|
||||
%>Network<% }
|
||||
else if (request.getRequestURI().indexOf("configui.jsp") != -1) {
|
||||
%>UI<% }
|
||||
else if (request.getRequestURI().indexOf("configservice.jsp") != -1) {
|
||||
%>Service<% }
|
||||
else if (request.getRequestURI().indexOf("configupdate.jsp") != -1) {
|
||||
@ -26,6 +28,8 @@ Configuration</b>
|
||||
-->
|
||||
<h4><% if (request.getRequestURI().indexOf("config.jsp") != -1) {
|
||||
%>Network | <% } else { %><a href="config.jsp">Network</a> | <% }
|
||||
if (request.getRequestURI().indexOf("configui.jsp") != -1) {
|
||||
%>UI | <% } else { %><a href="configui.jsp">UI</a> | <% }
|
||||
if (request.getRequestURI().indexOf("configservice.jsp") != -1) {
|
||||
%>Service | <% } else { %><a href="configservice.jsp">Service</a> | <% }
|
||||
if (request.getRequestURI().indexOf("configupdate.jsp") != -1) {
|
||||
|
40
apps/routerconsole/jsp/configui.jsp
Normal file
40
apps/routerconsole/jsp/configui.jsp
Normal file
@ -0,0 +1,40 @@
|
||||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html><head>
|
||||
<title>I2P Router Console - config UI</title>
|
||||
<%@include file="css.jsp" %>
|
||||
</head><body>
|
||||
|
||||
<%@include file="nav.jsp" %>
|
||||
<%@include file="summary.jsp" %>
|
||||
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigUIHelper" id="uihelper" scope="request" />
|
||||
<jsp:setProperty name="uihelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
|
||||
<h1>I2P UI Configuration</h1>
|
||||
<div class="main" id="main">
|
||||
|
||||
<%@include file="confignav.jsp" %>
|
||||
|
||||
<jsp:useBean class="net.i2p.router.web.ConfigUIHandler" id="formhandler" scope="request" />
|
||||
<jsp:setProperty name="formhandler" property="*" />
|
||||
<jsp:setProperty name="formhandler" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<jsp:getProperty name="formhandler" property="allMessages" />
|
||||
|
||||
<h2>Router Console Theme</h2>
|
||||
<form action="configui.jsp" method="POST">
|
||||
<% String prev = System.getProperty("net.i2p.router.web.ConfigUIHandler.nonce");
|
||||
if (prev != null) System.setProperty("net.i2p.router.web.ConfigUIHandler.noncePrev", prev);
|
||||
System.setProperty("net.i2p.router.web.ConfigUIHandler.nonce", new java.util.Random().nextLong()+""); %>
|
||||
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigUIHandler.nonce")%>" />
|
||||
<input type="hidden" name="action" value="blah" />
|
||||
<jsp:getProperty name="uihelper" property="settings" />
|
||||
<p>
|
||||
<input type="submit" name="shouldsave" value="Apply" /> <input type="reset" value="Cancel" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,3 +1,7 @@
|
||||
2009-07-12 zzz
|
||||
* Add configui.jsp
|
||||
* orange flash remove take 2
|
||||
|
||||
2009-07-11 zzz
|
||||
* netdb.jsp: Fix bad tag causing orange mouseovers
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 7;
|
||||
public final static long BUILD = 8;
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
||||
|
@ -1003,7 +1003,7 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
|
||||
out.write("<a href=\"netdb.jsp?l=1\">View LeaseSets</a>");
|
||||
Hash us = _context.routerHash();
|
||||
out.write("<a name=\"routers\" /><h3>Routers (<a href=\"netdb.jsp");
|
||||
out.write("<a name=\"routers\" ></a><h3>Routers (<a href=\"netdb.jsp");
|
||||
if (full)
|
||||
out.write("#routers\" >view without");
|
||||
else
|
||||
@ -1075,9 +1075,9 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
|
||||
private void renderRouterInfo(StringBuilder buf, RouterInfo info, boolean isUs, boolean full) {
|
||||
String hash = info.getIdentity().getHash().toBase64();
|
||||
buf.append("<a name=\"").append(hash.substring(0, 6)).append("\" />");
|
||||
buf.append("<a name=\"").append(hash.substring(0, 6)).append("\" ></a>");
|
||||
if (isUs) {
|
||||
buf.append("<a name=\"our-info\" /><b>Our info: ").append(hash).append("</b><br />\n");
|
||||
buf.append("<a name=\"our-info\" ></a><b>Our info: ").append(hash).append("</b><br />\n");
|
||||
} else {
|
||||
buf.append("<b>Peer info for:</b> ").append(hash).append("<br />\n");
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
|
||||
|
||||
public void renderStatusHTML(Writer out) throws IOException {
|
||||
out.write("<h2><a name=\"exploratory\">Exploratory tunnels</a> (<a href=\"/configtunnels.jsp#exploratory\">config</a>):</h2>\n");
|
||||
out.write("<h2><a name=\"exploratory\" ></a>Exploratory tunnels (<a href=\"/configtunnels.jsp#exploratory\">config</a>):</h2>\n");
|
||||
renderPool(out, _inboundExploratory, _outboundExploratory);
|
||||
|
||||
List destinations = null;
|
||||
@ -428,7 +428,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
if (name == null)
|
||||
name = client.toBase64().substring(0,4);
|
||||
out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
|
||||
+ "\">Client tunnels</a> for " + name);
|
||||
+ "\" ></a>Client tunnels for " + name);
|
||||
if (_context.clientManager().isLocal(client))
|
||||
out.write(" (<a href=\"/configtunnels.jsp#" + client.toBase64().substring(0,4) +"\">config</a>):</h2>\n");
|
||||
else
|
||||
@ -438,7 +438,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
|
||||
List participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
||||
Collections.sort(participating, new TunnelComparator());
|
||||
out.write("<h2><a name=\"participating\">Participating tunnels</a>:</h2><table border=\"1\">\n");
|
||||
out.write("<h2><a name=\"participating\"></a>Participating tunnels:</h2><table border=\"1\">\n");
|
||||
out.write("<tr><th>Receive on</th><th>From</th><th>"
|
||||
+ "Send on</th><th>To</th><th>Expiration</th>"
|
||||
+ "<th>Usage</th><th>Rate</th><th>Role</th></tr>\n");
|
||||
@ -601,7 +601,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
|
||||
List<Hash> peerList = new ArrayList(peers);
|
||||
Collections.sort(peerList, new HashComparator());
|
||||
|
||||
out.write("<h2><a name=\"peers\">Tunnel Counts By Peer</a>:</h2>\n");
|
||||
out.write("<h2><a name=\"peers\"></a>Tunnel Counts By Peer:</h2>\n");
|
||||
out.write("<table border=\"1\"><tr><th>Peer</th><th>Expl. + Client</th><th>% of total</th><th>Part. from + to</th><th>% of total</th></tr>\n");
|
||||
for (Hash h : peerList) {
|
||||
out.write("<tr><td align=\"right\">");
|
||||
|
Reference in New Issue
Block a user