propagate from branch 'i2p.i2p.zzz.test3' (head 1f086d33dd3479afceb025d2da7956d7470fb3e5)

to branch 'i2p.i2p' (head 6959293ce260b9da4d61776717c02e20a0c7b2dd)
This commit is contained in:
zzz
2009-08-07 18:30:04 +00:00
51 changed files with 1229 additions and 453 deletions

View File

@ -55,7 +55,7 @@ public class ConfigClientsHandler extends FormHandler {
else
startWebApp(app);
} else {
addFormError("Unsupported " + _action);
addFormError("Unsupported " + _action + ".");
}
}
@ -70,18 +70,18 @@ public class ConfigClientsHandler extends FormHandler {
ca.disabled = val == null;
}
ClientAppConfig.writeClientAppConfig(_context, clients);
addFormNotice("Client configuration saved successfully - restart required to take effect");
addFormNotice("Client configuration saved successfully - restart required to take effect.");
}
private void startClient(int i) {
List clients = ClientAppConfig.getClientApps(_context);
if (i >= clients.size()) {
addFormError("Bad client index");
addFormError("Bad client index.");
return;
}
ClientAppConfig ca = (ClientAppConfig) clients.get(i);
LoadClientAppsJob.runClient(ca.className, ca.clientName, LoadClientAppsJob.parseArgs(ca.args), _log);
addFormNotice("Client " + ca.clientName + " started");
addFormNotice("Client " + ca.clientName + " started.");
}
private void saveWebAppChanges() {
@ -98,7 +98,7 @@ public class ConfigClientsHandler extends FormHandler {
props.setProperty(name, "" + (val != null));
}
RouterConsoleRunner.storeWebAppProperties(props);
addFormNotice("WebApp configuration saved successfully - restart required to take effect");
addFormNotice("WebApp configuration saved successfully - restart required to take effect.");
}
// Big hack for the moment, not using properties for directory and port
@ -116,14 +116,14 @@ public class ConfigClientsHandler extends FormHandler {
path = new File(path, app + ".war");
s.addWebApplication("/"+ app, path.getAbsolutePath()).start();
// no passwords... initialize(wac);
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "</a> started");
addFormNotice("WebApp <a href=\"/" + app + "/\">" + app + "</a> started.");
} catch (Exception ioe) {
addFormError("Failed to start " + app + " " + ioe);
addFormError("Failed to start " + app + " " + ioe + ".");
}
return;
}
}
}
addFormError("Failed to find server");
addFormError("Failed to find server.");
}
}

View File

@ -14,8 +14,8 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm1() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n");
buf.append("<tr><th>Client</th><th>Run at Startup?</th><th>Start Now</th><th>Class and arguments</th></tr>\n");
buf.append("<table>\n");
buf.append("<tr><th align=\"right\">Client</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Class and arguments</th></tr>\n");
List clients = ClientAppConfig.getClientApps(_context);
for (int cur = 0; cur < clients.size(); cur++) {
@ -30,8 +30,8 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm2() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table border=\"1\">\n");
buf.append("<tr><th>WebApp</th><th>Run at Startup?</th><th>Start Now</th><th>Description</th></tr>\n");
buf.append("<table>\n");
buf.append("<tr><th align=\"right\">WebApp</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Description</th></tr>\n");
Properties props = RouterConsoleRunner.webAppProperties();
Set keys = new TreeSet(props.keySet());
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
@ -47,7 +47,7 @@ public class ConfigClientsHelper extends HelperBase {
}
private void renderForm(StringBuilder buf, String index, String name, boolean urlify, boolean enabled, boolean ro, String desc) {
buf.append("<tr><td>");
buf.append("<tr><td class=\"mediumtags\" align=\"right\" width=\"25%\">");
if (urlify && enabled) {
String link = "/";
if (! RouterConsoleRunner.ROUTERCONSOLE.equals(name))
@ -56,16 +56,16 @@ public class ConfigClientsHelper extends HelperBase {
} else {
buf.append(name);
}
buf.append("</td><td align=\"center\"><input type=\"checkbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
buf.append("</td><td align=\"center\" width=\"10%\"><input type=\"checkbox\" class=\"optbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
if (enabled) {
buf.append("checked=\"true\" ");
if (ro)
buf.append("disabled=\"true\" ");
}
buf.append("/></td><td>&nbsp;");
buf.append("/></td><td align=\"center\" width=\"15%\">");
if (!enabled) {
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >Start<span class=hide> ").append(index).append("</span></button>");
}
buf.append("&nbsp;</td><td>").append(desc).append("</td></tr>\n");
buf.append("</td><td align=\"left\" width=\"50%\">").append(desc).append("</td></tr>\n");
}
}

View File

@ -47,7 +47,7 @@ public class ConfigTunnelsHandler extends FormHandler {
boolean saveRequired = false;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Saving changes, with props = " + _settings);
_log.debug("Saving changes, with props = " + _settings + ".");
int updated = 0;
int index = 0;
@ -67,7 +67,7 @@ public class ConfigTunnelsHandler extends FormHandler {
try {
client.fromBase64(poolName);
} catch (DataFormatException dfe) {
addFormError("Internal error (pool name could not resolve - " + poolName + ")");
addFormError("Internal error (pool name could not resolve - " + poolName + ").");
index++;
continue;
}
@ -76,7 +76,7 @@ public class ConfigTunnelsHandler extends FormHandler {
}
if ( (in == null) || (out == null) ) {
addFormError("Internal error (pool settings cound not be found for " + poolName + ")");
addFormError("Internal error (pool settings cound not be found for " + poolName + ").");
index++;
continue;
}
@ -131,14 +131,14 @@ public class ConfigTunnelsHandler extends FormHandler {
}
if (updated > 0)
addFormNotice("Updated settings for " + updated + " pools");
addFormNotice("Updated settings for " + updated + " pools.");
if (saveRequired) {
boolean saved = _context.router().saveConfig();
if (saved)
addFormNotice("Exploratory tunnel configuration saved successfully");
addFormNotice("Exploratory tunnel configuration saved successfully.");
else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs.");
}
}
private static final int getInt(Object val) {

View File

@ -62,18 +62,18 @@ public class ConfigTunnelsHelper extends HelperBase {
in.getLength() + in.getLengthVariance() <= 0 ||
out.getLength() <= 0 ||
out.getLength() + out.getLengthVariance() <= 0)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels.</font></th></tr>");
else if (in.getLength() <= 1 ||
in.getLength() + in.getLengthVariance() <= 1 ||
out.getLength() <= 1 ||
out.getLength() + out.getLengthVariance() <= 1)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels.</font></th></tr>");
if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include very long tunnels.</font></th></tr>");
if (in.getQuantity() + in.getBackupQuantity() >= WARN_QUANTITY ||
out.getQuantity() + out.getBackupQuantity() >= WARN_QUANTITY)
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include high tunnel quantities</font></th></tr>");
buf.append("<tr><th colspan=\"3\"><font color=\"red\">PERFORMANCE WARNING - Settings include high tunnel quantities.</font></th></tr>");
buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\"/>&nbsp;&nbsp;Inbound</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\"/>&nbsp;&nbsp;Outbound</th></tr>\n");

View File

@ -24,8 +24,8 @@ public class ConfigUIHandler extends FormHandler {
else
_context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
if (_context.router().saveConfig())
addFormNotice("Theme change successfully saved (<a href=\"configui.jsp\">refresh page to view</a>)");
addFormNotice("Theme change successfully saved (<a href=\"configui.jsp\">refresh page</a> to view).");
else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs.");
}
}

View File

@ -9,7 +9,7 @@ public class ConfigUIHelper extends HelperBase {
StringBuilder buf = new StringBuilder(512);
String current = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
for (String theme : themes) {
buf.append("<input type=\"radio\" name=\"theme\" ");
buf.append("<input type=\"radio\" class=\"optbox\" name=\"theme\" ");
if (theme.equals(current))
buf.append("checked=\"true\" ");
buf.append("value=\"").append(theme).append("\"/>").append(theme).append("<br />\n");

View File

@ -42,10 +42,10 @@ public class ConfigUpdateHelper extends HelperBase {
public String getUpdateThroughProxy() {
String proxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY);
if (Boolean.valueOf(proxy).booleanValue())
return "<input type=\"checkbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"true\" >";
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"true\" >";
else
return "<input type=\"checkbox\" value=\"true\" name=\"updateThroughProxy\" >";
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" >";
}
private static final long PERIODS[] = new long[] { 12*60*60*1000l, 24*60*60*1000l, 48*60*60*1000l, -1l };

View File

@ -109,13 +109,13 @@ public class GraphHelper extends HelperBase {
_out.write("<p />[<a href=\"configstats.jsp\">Select Stats to Graph</a>]<p />");
_out.write("<form action=\"graphs.jsp\" method=\"GET\">");
_out.write("Periods: <input size=\"3\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\" /><br />\n");
_out.write("Plot averages: <input type=\"radio\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + " /> ");
_out.write("or plot events: <input type=\"radio\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + " /><br />\n");
_out.write("Plot averages: <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + " /> ");
_out.write("or plot events: <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + " /><br />\n");
_out.write("Image sizes: width: <input size=\"4\" type=\"text\" name=\"width\" value=\"" + _width
+ "\" /> pixels, height: <input size=\"4\" type=\"text\" name=\"height\" value=\"" + _height
+ "\" /><br />\n");
_out.write("Refresh delay: <select name=\"refreshDelay\"><option value=\"60\">1 minute</option><option value=\"120\">2 minutes</option><option value=\"300\">5 minutes</option><option value=\"600\">10 minutes</option><option value=\"1800\">30 minutes</option><option value=\"3600\">1 hour</option><option value=\"-1\">Never</option></select><br />\n");
_out.write("<hr /><input type=\"submit\" value=\"Redraw\" /></div>");
_out.write("<hr /><div class=\"formaction\"><input type=\"submit\" value=\"Redraw\" /></div></div>");
} catch (IOException ioe) {
ioe.printStackTrace();
}