* Console:

- Don't save config when checking for updates on configupdate.jsp
      - Rework ConfigRestartBean and tag
      - More tag fixups
      - Add lang=xx for testing
      - Add file for additional tagged strings
This commit is contained in:
zzz
2009-10-26 21:48:46 +00:00
parent 850a8da0a9
commit a2d90eebea
27 changed files with 254 additions and 119 deletions

View File

@ -101,6 +101,13 @@
<delete file="../jsp/web-out.xml" />
<mkdir dir="../jsp/WEB-INF/" />
<mkdir dir="../jsp/WEB-INF/classes" />
<!-- TODO: Don't compile the following jsps, which should be used only as includes:
- summary.jsp, summarynoframe.jsp, css.jsp, confignav.jsp
- Is here a JspC command line switch for that?
- Or should we move them to a separate directory?
-->
<!-- there are various jspc ant tasks, but they all seem a bit flakey -->
<java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
<classpath>

View File

@ -15,7 +15,7 @@ do
LG=${LG%.po}
# make list of java files newer than the .po file
find src ../jsp/WEB-INF -name *.java -newer $i > $TMPFILE
find src ../jsp/WEB-INF strings -name *.java -newer $i > $TMPFILE
if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a ! -s $TMPFILE ]
then
continue
@ -31,13 +31,15 @@ do
# intl.title("foo")
# handler._("foo")
# formhandler._("foo")
# net.i2p.router.web.Messages.getString("foo")
# In a jsp, you must use a helper or handler that has the context set.
# To start a new translation, copy the header from an old translation to the new .po file,
# then ant distclean updater.
find src ../jsp/WEB-INF -name *.java > $TMPFILE
find src ../jsp/WEB-INF strings -name *.java > $TMPFILE
xgettext -f $TMPFILE -F -L java \
--keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
--keyword=handler._ --keyword=formhandler._ \
--keyword=net.i2p.router.web.Messages.getString \
-o ${i}t
if [ $? -ne 0 ]
then
@ -60,7 +62,7 @@ do
msgfmt --java -r $CLASS -l $LG -d build/obj $i
if [ $? -ne 0 ]
then
echo 'Warning - xgettext failed, not updating translations'
echo 'Warning - msgfmt failed, not updating translations'
break
fi
done

View File

@ -13,7 +13,7 @@ import java.util.Iterator;
*
*/
public class ConfigAdvancedHandler extends FormHandler {
private boolean _forceRestart;
//private boolean _forceRestart;
private boolean _shouldSave;
private String _config;
@ -27,7 +27,7 @@ public class ConfigAdvancedHandler extends FormHandler {
}
public void setShouldsave(String moo) { _shouldSave = true; }
public void setRestart(String moo) { _forceRestart = true; }
//public void setRestart(String moo) { _forceRestart = true; }
public void setConfig(String val) {
_config = val;
@ -54,7 +54,7 @@ public class ConfigAdvancedHandler extends FormHandler {
unsetKeys.remove(key);
}
} catch (IOException ioe) {
addFormError("Error updating the configuration (IOERROR) - please see the error logs");
addFormError(_("Error updating the configuration - please see the error logs"));
return;
}
@ -66,15 +66,15 @@ public class ConfigAdvancedHandler extends FormHandler {
boolean saved = _context.router().saveConfig();
if (saved)
addFormNotice("Configuration saved successfully");
addFormNotice(_("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"));
if (_forceRestart) {
addFormNotice("Performing a soft restart");
_context.router().restart();
addFormNotice("Soft restart complete");
}
//if (_forceRestart) {
// addFormNotice("Performing a soft restart");
// _context.router().restart();
// addFormNotice("Soft restart complete");
//}
}
}
}

View File

@ -51,9 +51,9 @@ public class ConfigClientsHelper extends HelperBase {
String link = "/";
if (! RouterConsoleRunner.ROUTERCONSOLE.equals(name))
link += name + "/";
buf.append("<a href=\"").append(link).append("\">").append(name).append("</a>");
buf.append("<a href=\"").append(link).append("\">").append(_(name)).append("</a>");
} else {
buf.append(name);
buf.append(_(name));
}
buf.append("</td><td align=\"center\" width=\"10%\"><input type=\"checkbox\" class=\"optbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
if (enabled) {

View File

@ -36,7 +36,7 @@ public class ConfigNetHelper extends HelperBase {
public String getUdpAddress() {
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
if (addr == null)
return "unknown";
return _("unknown");
UDPAddress ua = new UDPAddress(addr);
return ua.toString();
}
@ -44,20 +44,20 @@ public class ConfigNetHelper extends HelperBase {
public String getUdpIP() {
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
if (addr == null)
return "unknown";
return _("unknown");
UDPAddress ua = new UDPAddress(addr);
if (ua.getHost() == null)
return "unknown";
return _("unknown");
return ua.getHost();
}
public String getUdpPort() {
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
if (addr == null)
return "unknown";
return _("unknown");
UDPAddress ua = new UDPAddress(addr);
if (ua.getPort() <= 0)
return "unknown";
return _("unknown");
return "" + ua.getPort();
}

View File

@ -1,7 +1,5 @@
package net.i2p.router.web;
import java.util.StringTokenizer;
import net.i2p.data.DataHelper;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
@ -11,6 +9,12 @@ import net.i2p.router.RouterContext;
*
*/
public class ConfigRestartBean {
/** all these are tagged below so no need to _x them here */
static final String[] SET1 = {"shutdownImmediate", "Shutdown immediately", "cancelShutdown", "Cancel shutdown"};
static final String[] SET2 = {"restartImmediate", "Restart immediately", "cancelShutdown", "Cancel restart"};
static final String[] SET3 = {"restart", "Restart", "shutdown", "Shutdown"};
static final String[] SET4 = {"shutdown", "Shutdown"};
public static String getNonce() {
RouterContext ctx = ContextHelper.getContext(null);
String nonce = System.getProperty("console.nonce");
@ -25,20 +29,20 @@ public class ConfigRestartBean {
String systemNonce = getNonce();
if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) {
// Normal browsers send value, IE sends button label
if ("shutdownImmediate".equals(action) || "Shutdown immediately".equals(action)) {
if ("shutdownImmediate".equals(action) || _("Shutdown immediately", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD));
//ctx.router().shutdown(Router.EXIT_HARD); // never returns
ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond
} else if ("cancelShutdown".equals(action) || "Cancel shutdown".equals(action)) {
} else if ("cancelShutdown".equals(action) || _("Cancel shutdown", ctx).equals(action)) {
ctx.router().cancelGracefulShutdown();
} else if ("restartImmediate".equals(action) || "Restart immediately".equals(action)) {
} else if ("restartImmediate".equals(action) || _("Restart immediately", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond
} else if ("restart".equalsIgnoreCase(action)) {
} else if ("restart".equals(action) || _("Restart", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
} else if ("shutdown".equalsIgnoreCase(action)) {
} else if ("shutdown".equals(action) || _("Shutdown", ctx).equals(action)) {
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
ctx.router().shutdownGracefully();
}
@ -47,38 +51,35 @@ public class ConfigRestartBean {
boolean shuttingDown = isShuttingDown(ctx);
boolean restarting = isRestarting(ctx);
long timeRemaining = ctx.router().getShutdownTimeRemaining();
if (shuttingDown) {
if (timeRemaining <= 0) {
return "<center><b>Shutdown imminent</b></center>";
} else {
return "<center><b>Shutdown in " + DataHelper.formatDuration(timeRemaining) + "</b></center><br>"
+ buttons(urlBase, systemNonce, "shutdownImmediate,Shutdown immediately,cancelShutdown,Cancel shutdown");
}
StringBuilder buf = new StringBuilder(128);
if ((shuttingDown || restarting) && timeRemaining <= 0) {
buf.append("<center><b>").append(_("Shutdown imminent", ctx)).append("</b></center>");
} else if (shuttingDown) {
buf.append("<center><b>");
buf.append(_("Shutdown in {0}", DataHelper.formatDuration(timeRemaining), ctx));
buf.append("</b></center><br>");
buttons(ctx, buf, urlBase, systemNonce, SET1);
} else if (restarting) {
if (timeRemaining <= 0) {
return "<center><b>Restart imminent</b></center>";
} else {
return "<center><b>Restart in " + DataHelper.formatDuration(timeRemaining) + "</b></center><br>"
+ buttons(urlBase, systemNonce, "restartImmediate,Restart immediately,cancelShutdown,Cancel restart");
}
buf.append("<center><b>");
buf.append(_("Restart in {0}", DataHelper.formatDuration(timeRemaining), ctx));
buf.append("</b></center><br>");
buttons(ctx, buf, urlBase, systemNonce, SET2);
} else {
if (System.getProperty("wrapper.version") != null)
return buttons(urlBase, systemNonce, "restart,Restart,shutdown,Shutdown");
buttons(ctx, buf, urlBase, systemNonce, SET3);
else
return buttons(urlBase, systemNonce, "shutdown,Shutdown");
buttons(ctx, buf, urlBase, systemNonce, SET4);
}
return buf.toString();
}
/** @param s value,label,... pairs */
private static String buttons(String url, String nonce, String s) {
StringBuilder buf = new StringBuilder(128);
StringTokenizer tok = new StringTokenizer(s, ",");
private static void buttons(RouterContext ctx, StringBuilder buf, String url, String nonce, String[] s) {
buf.append("<form action=\"").append(url).append("\" method=\"GET\">\n");
buf.append("<input type=\"hidden\" name=\"consoleNonce\" value=\"").append(nonce).append("\" >\n");
while (tok.hasMoreTokens())
buf.append("<button type=\"submit\" name=\"action\" value=\"").append(tok.nextToken()).append("\" >").append(tok.nextToken()).append("</button>\n");
for (int i = 0; i < s.length; i+= 2)
buf.append("<button type=\"submit\" name=\"action\" value=\"").append(s[i]).append("\" >").append(_(s[i+1], ctx)).append("</button>\n");
buf.append("</form>\n");
return buf.toString();
}
private static boolean isShuttingDown(RouterContext ctx) {
@ -96,4 +97,13 @@ public class ConfigRestartBean {
return ctx.router().getShutdownTimeRemaining();
return Long.MAX_VALUE/2; // summaryframe.jsp adds a safety factor so we don't want to overflow...
}
public static String _(String s, RouterContext ctx) {
return Messages.getString(s, ctx);
}
public static String _(String s, Object o, RouterContext ctx) {
return Messages.getString(s, o, ctx);
}
}

View File

@ -81,7 +81,7 @@ public class ConfigServiceHandler extends FormHandler {
installService();
} else if (_("Don't run I2P on startup").equals(_action)) {
uninstallService();
} else if ("Dump threads".equals(_action)) {
} else if (_("Dump threads").equals(_action)) {
try {
WrapperManager.requestThreadDump();
} catch (Throwable t) {

View File

@ -8,9 +8,14 @@ import net.i2p.data.Destination;
import net.i2p.router.TunnelPoolSettings;
public class ConfigTunnelsHelper extends HelperBase {
static final String HOP = _x("hop");
static final String TUNNEL = _x("tunnel");
/** dummies for translation */
static final String HOPS = _x("hops");
static final String TUNNELS = _x("tunnels");
public ConfigTunnelsHelper() {}
public String getForm() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n");
@ -74,7 +79,7 @@ public class ConfigTunnelsHelper extends HelperBase {
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></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");
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");
// buf.append("<tr><th></th><th>Inbound</th><th>Outbound</th></tr>\n");
@ -82,16 +87,16 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Depth") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthInbound\">\n");
int now = in.getLength();
renderOptions(buf, 0, MAX_LENGTH, now, "", _("hop"));
renderOptions(buf, 0, MAX_LENGTH, now, "", HOP);
if (now > MAX_LENGTH)
renderOptions(buf, now, now, now, "", _("hop"));
renderOptions(buf, now, now, now, "", HOP);
buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthOutbound\">\n");
now = out.getLength();
renderOptions(buf, 0, MAX_LENGTH, now, "", _("hop"));
renderOptions(buf, 0, MAX_LENGTH, now, "", HOP);
if (now > MAX_LENGTH)
renderOptions(buf, now, now, now, "", _("hop"));
renderOptions(buf, now, now, now, "", HOP);
buf.append("</select></td>\n");
buf.append("</tr>\n");
@ -99,40 +104,40 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Randomization") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceInbound\">\n");
now = in.getLengthVariance();
renderOptions(buf, 0, 0, now, "", _("hop"));
renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", _("hop"));
renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", _("hop"));
renderOptions(buf, 0, 0, now, "", HOP);
renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", HOP);
renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", HOP);
if (now > MAX_VARIANCE)
renderOptions(buf, now, now, now, "+ 0-", _("hop"));
renderOptions(buf, now, now, now, "+ 0-", HOP);
else if (now < MIN_NEG_VARIANCE)
renderOptions(buf, now, now, now, "+/- 0", _("hop"));
renderOptions(buf, now, now, now, "+/- 0", HOP);
buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceOutbound\">\n");
now = out.getLengthVariance();
renderOptions(buf, 0, 0, now, "", _("hop"));
renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", _("hop"));
renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", _("hop"));
renderOptions(buf, 0, 0, now, "", HOP);
renderOptions(buf, 1, MAX_VARIANCE, now, "+ 0-", HOP);
renderOptions(buf, MIN_NEG_VARIANCE, -1, now, "+/- 0", HOP);
if (now > MAX_VARIANCE)
renderOptions(buf, now, now, now, "+ 0-", _("hop"));
renderOptions(buf, now, now, now, "+ 0-", HOP);
else if (now < MIN_NEG_VARIANCE)
renderOptions(buf, now, now, now, "+/- 0", _("hop"));
renderOptions(buf, now, now, now, "+/- 0", HOP);
buf.append("</select></td>\n");
// tunnel quantity
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Quantity") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityInbound\">\n");
now = in.getQuantity();
renderOptions(buf, 1, MAX_QUANTITY, now, "", _("tunnel"));
renderOptions(buf, 1, MAX_QUANTITY, now, "", TUNNEL);
if (now > MAX_QUANTITY)
renderOptions(buf, now, now, now, "", _("tunnel"));
renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityOutbound\">\n");
now = out.getQuantity();
renderOptions(buf, 1, MAX_QUANTITY, now, "", _("tunnel"));
renderOptions(buf, 1, MAX_QUANTITY, now, "", TUNNEL);
if (now > MAX_QUANTITY)
renderOptions(buf, now, now, now, "", _("tunnel"));
renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n");
buf.append("</tr>\n");
@ -140,16 +145,16 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Backup quantity") + ":</td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupInbound\">\n");
now = in.getBackupQuantity();
renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", _("tunnel"));
renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", TUNNEL);
if (now > MAX_BACKUP_QUANTITY)
renderOptions(buf, now, now, now, "", _("tunnel"));
renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n");
buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupOutbound\">\n");
now = out.getBackupQuantity();
renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", _("tunnel"));
renderOptions(buf, 0, MAX_BACKUP_QUANTITY, now, "", TUNNEL);
if (now > MAX_BACKUP_QUANTITY)
renderOptions(buf, now, now, now, "", _("tunnel"));
renderOptions(buf, now, now, now, "", TUNNEL);
buf.append("</select></td>\n");
buf.append("</tr>\n");
@ -191,9 +196,13 @@ buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt
buf.append("<option value=\"").append(i).append("\" ");
if (i == now)
buf.append("selected=\"true\" ");
buf.append(">").append(prefix).append(i).append(' ').append(name);
String pname;
// pluralize and then translate
if (i != 1 && i != -1)
buf.append('s');
pname = name + 's';
else
pname = name;
buf.append(">").append(prefix).append(i).append(' ').append(_(pname));
buf.append("</option>\n");
}
}

View File

@ -17,16 +17,23 @@ public class ConfigUIHandler extends FormHandler {
_config = val;
}
/** note - lang change is handled in CSSHelper but we still need to save it here */
private void saveChanges() {
if (_config == null)
return;
String oldTheme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
if (_config.equals("default")) // obsolete
_context.router().removeConfigSetting(CSSHelper.PROP_THEME_NAME);
else
_context.router().setConfigSetting(CSSHelper.PROP_THEME_NAME, _config);
if (_context.router().saveConfig())
addFormNotice("Theme change saved. <a href=\"configui.jsp\">Refresh the page</a> to view.");
else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs.");
if (_context.router().saveConfig()) {
if (!oldTheme.equals(_config))
addFormNotice(_("Theme change saved.") +
" <a href=\"configui.jsp\">" +
_("Refresh the page to view.") +
"</a>");
} else {
addFormNotice(_("Error saving the configuration (applied but not saved) - please see the error logs."));
}
}
}

View File

@ -51,7 +51,9 @@ public class ConfigUpdateHandler extends FormHandler {
@Override
protected void processForm() {
if (_action != null && _action.equals(_("Check for updates"))) {
if (_action == null)
return;
if (_action.equals(_("Check for updates"))) {
NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext());
fetcher.fetchNews();
if (fetcher.shouldFetchUnsigned())
@ -63,6 +65,7 @@ public class ConfigUpdateHandler extends FormHandler {
addFormNotice(_("Update available, click button on left to download"));
} else
addFormNotice(_("No update available"));
return;
}
if ( (_newsURL != null) && (_newsURL.length() > 0) ) {

View File

@ -25,8 +25,12 @@ public class Messages {
private static final String _localeLang = Locale.getDefault().getLanguage();
private static final Map<String, ResourceBundle> _bundles = new ConcurrentHashMap(2);
private static final Set<String> _missing = new ConcurrentHashSet(2);
/** use to look for untagged strings */
private static final String TEST_LANG = "xx";
private static final String TEST_STRING = "XXXX";
/** current locale **/
/* unused
public static String getString(String key) {
if (_localeLang.equals("en"))
return key;
@ -39,12 +43,15 @@ public class Messages {
return key;
}
}
*/
/** lang in routerconsole.lang property, else current locale */
public static String getString(String key, I2PAppContext ctx) {
String lang = getLanguage(ctx);
if (lang.equals("en"))
return key;
else if (lang.equals(TEST_LANG))
return TEST_STRING;
ResourceBundle bundle = findBundle(lang);
if (bundle == null)
return key;
@ -68,17 +75,20 @@ public class Messages {
* Use autoboxing to call with ints, longs, floats, etc.
*/
public static String getString(String s, Object o, I2PAppContext ctx) {
String lang = getLanguage(ctx);
if (lang.equals(TEST_LANG))
return TEST_STRING + '(' + o + ')' + TEST_STRING;
String x = getString(s, ctx);
Object[] oArray = new Object[1];
oArray[0] = o;
try {
MessageFormat fmt = new MessageFormat(x, new Locale(getLanguage(ctx)));
MessageFormat fmt = new MessageFormat(x, new Locale(lang));
return fmt.format(oArray, new StringBuffer(), null).toString();
} catch (IllegalArgumentException iae) {
System.err.println("Bad format: orig: \"" + s +
"\" trans: \"" + x +
"\" param: \"" + o +
"\" lang: " + getLanguage(ctx));
"\" lang: " + lang);
return "FIXME: " + x + ' ' + o;
}
}

View File

@ -74,10 +74,20 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
public String unsignedUpdateVersion() { return _unsignedUpdateVersion; }
public String status() {
StringBuilder buf = new StringBuilder(128);
long now = _context.clock().now();
return
(_lastUpdated > 0 ? "News last updated " + DataHelper.formatDuration(now - _lastUpdated) + " ago" : "") +
(_lastFetch > _lastUpdated ? "; last checked " + DataHelper.formatDuration(now - _lastFetch) + " ago." : "");
if (_lastUpdated > 0) {
buf.append(Messages.getString("News last updated {0} ago.",
DataHelper.formatDuration(now - _lastUpdated),
_context))
.append('\n');
}
if (_lastFetch > _lastUpdated) {
buf.append(Messages.getString("News last checked {0} ago.",
DataHelper.formatDuration(now - _lastFetch),
_context));
}
return buf.toString();
}
public void run() {

View File

@ -289,7 +289,7 @@ public class SummaryBarRenderer {
String uri = _helper.getRequestURI();
buf.append("<form action=\"").append(uri).append("\" method=\"GET\">\n");
buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n");
buf.append("<button type=\"submit\" >Reseed</button></form>\n");
buf.append("<button type=\"submit\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form>\n");
}
anotherLine = true;
}

View File

@ -0,0 +1,29 @@
package dummy;
/**
* Just more strings for xgettext, that don't appear in the source anywhere.
* I'm sure there's easier ways to do this, but this will do for now.
*
* Obviously, do not compile this.
*/
class Dummy {
void dummy {
// wars
_("addressbook");
_("i2psnark");
_("i2ptunnel");
_("susimail");
_("susidns");
_("routerconsole");
// clients, taken from clients.config
// note that if the wording changes in clients.config, we have to
// keep the old string here as well for existing installs
_("Web console");
_("SAM application bridge");
_("Application tunnels");
_("My eepsite web server");
_("Browser launch at startup");
_("BOB application bridge");
}
}

View File

@ -54,12 +54,20 @@
</td></tr></table></p></div></p>
<% int share = nethelper.getShareBandwidth();
if (share < 12) {
out.print("<p><b>"+intl._("NOTE")+"</b>: You have configured I2P to share only " + share + "KBps. ");
out.print("<p><b>");
out.print(intl._("NOTE"));
out.print("</b>: ");
out.print(intl._("You have configured I2P to share only {0} KBps.", share));
out.print("\n");
out.print(intl._("I2P requires at least 12KBps to enable sharing. "));
out.print(intl._("Please enable sharing (participating in tunnels) by configuring more bandwidth. "));
out.print(intl._("It improves your anonymity by creating cover traffic, and helps the network.")+"</p>");
} else {
out.print("<p>" + intl._("You have configured I2P to share") + "<b> " + share + "KBps</b>. ");
out.print("<p>");
out.print(intl._("You have configured I2P to share {0} KBps.", share));
out.print("\n");
out.print(intl._("The higher the share bandwidth the more you improve your anonymity and help the network.")+"</p><hr>");
}
%>
@ -76,7 +84,8 @@
<br>
-->
<h3><%=intl._("IP and Transport Configuration")%></h3><p>
<b><%=intl._("The default settings will work for most people.")%> There is <a href="#chelp">help below</a>.</b>
<b><%=intl._("The default settings will work for most people.")%>
<a href="#chelp"><%=intl._("There is help below.")%></a></b>
</p><p><b><%=intl._("UPnP Configuration")%>:</b><br>
<input type="checkbox" class="optbox" name="upnp" value="true" <jsp:getProperty name="nethelper" property="upnpChecked" /> />
<%=intl._("Enable UPnP to open firewall ports")%> - <a href="peers.jsp#upnp"><%=intl._("UPnP status")%></a>
@ -169,18 +178,18 @@
<li class="tidylist"><%=intl._("Multiple firewall/routers in the internet connection path")%>
<li class="tidylist"><%=intl._("UPnP device change, reset, or address change")%>
</ul></p><p>
Reviewing the <a href="peers.jsp#upnp">UPnP status</a> may help.
<a href="peers.jsp#upnp"><%=intl._("Review the UPnP status here.")%></a>
<%=intl._("UPnP may be enabled or disabled above, but a change requires a router restart to take effect.")%></p>
<p><%=intl._("Hostnames entered above will be published in the network database.")%>
They are <b>not private</b>.
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.
<%=intl._("They are <b>not private</b>.")%>
<%=intl._("Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.")%>
<%=intl._("If you specify the wrong IP address or hostname, or do not properly configure your NAT or firewall, your network performance will degrade substantially.")%>
<%=intl._("When in doubt, leave the settings at the defaults.")%>
</p>
<h3><a name="help"><%=intl._("Reachability Help")%>:</a></h3><p>
<%=intl._("While I2P will work fine behind most firewalls, your speeds and network integration will generally improve if the I2P port (generally 8887) is forwarded for both UDP and TCP.")%>
<%=intl._("If you think you have opened up your firewall and I2P still thinks you are firewalled, remember that you may have multiple firewalls, for example both software packages and external hardware routers.")%>
If there is an error, the <a href="logs.jsp">logs</a> may also help diagnose the problem.
<%=intl._("If there is an error, the <a href=\"logs.jsp\">logs</a> may also help diagnose the problem.")%>
<ul>
<li class="tidylist"><b><%=intl._("OK")%></b> -
<%=intl._("Your UDP port does not appear to be firewalled.")%>

View File

@ -21,14 +21,14 @@
<% String prev = System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.ConfigServiceHandler.noncePrev", prev);
System.setProperty("net.i2p.router.web.ConfigServiceHandler.nonce", new java.util.Random().nextLong()+""); %>
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce")%>" />
<input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigServiceHandler.nonce")%>" >
<h3><%=intl._("Shutdown the router")%></h3>
<p><%=intl._("Graceful shutdown lets the router satisfy the agreements it has already made before shutting down, but may take a few minutes.")%>
<%=intl._("If you need to kill the router immediately, that option is available as well.")%></p>
<hr><div class="formaction">
<input type="submit" name="action" value="<%=intl._("Shutdown gracefully")%>" />
<input type="submit" name="action" value="<%=intl._("Shutdown immediately")%>" />
<input type="submit" name="action" value="<%=intl._("Cancel graceful shutdown")%>" />
<input type="submit" name="action" value="<%=intl._("Shutdown gracefully")%>" >
<input type="submit" name="action" value="<%=intl._("Shutdown immediately")%>" >
<input type="submit" name="action" value="<%=intl._("Cancel graceful shutdown")%>" >
</div>
<% if (System.getProperty("wrapper.version") != null) { %>
<p><%=intl._("If you want the router to restart itself after shutting down, you can choose one of the following.")%>
@ -37,8 +37,8 @@
<%=intl._("A graceful restart will take a few minutes (but your peers will appreciate your patience), while a hard restart does so immediately.")%>
<%=intl._("After tearing down the router, it will wait 1 minute before starting back up again.")%></p>
<hr><div class="formaction">
<input type="submit" name="action" value="<%=intl._("Graceful restart")%>" />
<input type="submit" name="action" value="<%=intl._("Hard restart")%>" />
<input type="submit" name="action" value="<%=intl._("Graceful restart")%>" >
<input type="submit" name="action" value="<%=intl._("Hard restart")%>" >
<% } %></div>
<% if ( (System.getProperty("os.name") != null) && (System.getProperty("os.name").startsWith("Win")) ) { %>
@ -47,16 +47,16 @@
<%=intl._("(later on, I2P client applications will be able to integrate their own functionality into the system tray as well).")%>
<%=intl._("If you are on windows, you can either enable or disable that icon here.")%></p>
<hr><div class="formaction">
<input type="submit" name="action" value="<%=intl._("Show systray icon")%>" />
<input type="submit" name="action" value="<%=intl._("Hide systray icon")%>" />
<input type="submit" name="action" value="<%=intl._("Show systray icon")%>" >
<input type="submit" name="action" value="<%=intl._("Hide systray icon")%>" >
</div><h3><%=intl._("Run on startup")%></h3>
<p><%=intl._("You can control whether I2P is run on startup or not by selecting one of the following options")%> -
<%=intl._("I2P will install (or remove) a service accordingly.")%>
<%=intl._("If you prefer the command line, you can also run the ")%> <code>install_i2p_service_winnt.bat</code> (<%=intl._("or")%>
<code>uninstall_i2p_service_winnt.bat</code>).</p>
<hr><div class="formaction">
<input type="submit" name="action" value="<%=intl._("Run I2P on startup")%>" />
<input type="submit" name="action" value="<%=intl._("Don't run I2P on startup")%>" /></div>
<input type="submit" name="action" value="<%=intl._("Run I2P on startup")%>" >
<input type="submit" name="action" value="<%=intl._("Don't run I2P on startup")%>" ></div>
<p><b><%=intl._("Note")%>:</b> <%=intl._("If you are running I2P as service right now, removing it will shut down your router immediately.")%>
<%=intl._("You may want to consider shutting down gracefully, as above, then running uninstall_i2p_service_winnt.bat.")%></p>
<% } %>
@ -67,13 +67,13 @@
To do so, please select the following option and review the thread dumped to
<a href="logs.jsp#servicelogs">wrapper.log</a>.</p>
<hr><div class="formaction">
<input type="submit" name="action" value="Dump threads" />
<input type="submit" name="action" value="<%=intl._("Dump threads")%>" >
<% } %></div>
<h3><%=intl._("Launch browser on router startup?")%></h3>
<p><%=intl._("I2P's main configuration interface is this web console, so for your convenience I2P can launch a web browser on startup pointing at")%>
<a href="http://127.0.0.1:7657/index.jsp">http://127.0.0.1:7657/index.jsp</a> .</p>
<hr><div class="formaction">
<input type="submit" name="action" value="<%=intl._("View console on startup")%>" />
<input type="submit" name="action" value="<%=intl._("Do not view console on startup")%>" />
<input type="submit" name="action" value="<%=intl._("View console on startup")%>" >
<input type="submit" name="action" value="<%=intl._("Do not view console on startup")%>" >
</div></form></div></div></body></html>

View File

@ -1,6 +1,11 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* Do not tag this file for translation.
*/
%>
<html><head><title>I2P Router Console - Debug</title>
<%@include file="css.jsp" %>
</head><body>

View File

@ -16,11 +16,6 @@
<%@include file="css.jsp" %>
<%=intl.title("Page Not Found")%>
</head><body>
<%
if (System.getProperty("router.consoleNonce") == null) {
System.setProperty("router.consoleNonce", new java.util.Random().nextLong() + "");
}
%>
<%@include file="summary.jsp" %>
<h1><%=ERROR_CODE%> <%=ERROR_MESSAGE%></h1>
<div class="sorry" id="warning">

View File

@ -3,6 +3,8 @@
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/
/**

View File

@ -1,7 +1,11 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* Do not tag this file for translation - copy it to help_xx.jsp and translate inline.
*/
%>
<html><head><title>I2P Router Console - help</title>
<%@include file="css.jsp" %>
</head><body>

View File

@ -1,7 +1,11 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
/*
* Do not tag this file for translation.
*/
%>
<html><head><title>I2P Router Console - internals</title>
<%@include file="css.jsp" %>
</head><body>

View File

@ -23,8 +23,16 @@
// 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("<div class=\"refresh\"><form action=\"" + request.getRequestURI() + "\" method=\"GET\">\n");
out.print("<b>Refresh (s):</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\">Enable</button>\n");
out.print("<b>");
// We have intl defined when this is included, but not when compiled standalone.
// Not that we really need it standalone, but I can't figure out how to keep
// this from being compiled by JspC in the build file.
out.print(net.i2p.router.web.Messages.getString("Refresh (s)", net.i2p.I2PAppContext.getGlobalContext()));
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\" value=\"Enable\" >");
// ditto
out.print(net.i2p.router.web.Messages.getString("Enable", net.i2p.I2PAppContext.getGlobalContext()));
out.print("</button>\n");
out.print("</form></div></div>\n");
}
%>

View File

@ -55,12 +55,18 @@
if (!shutdownSoon) {
out.print("<hr><div class=\"refresh\"><form action=\"summaryframe.jsp\" method=\"GET\">\n");
if ("0".equals(d)) {
out.print("<b>Refresh (s):<b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\">Enable</button></div>\n");
out.print("<b>");
out.print(intl._("Refresh (s)"));
out.print(":</b> <input size=\"3\" type=\"text\" name=\"refresh\" value=\"60\" />\n");
out.print("<button type=\"submit\" value=\"Enable\" >");
out.print(intl._("Enable"));
out.print("</button></div>\n");
} else {
// this will load in the iframe but subsequent pages will not have the iframe
out.print("<input type=\"hidden\" name=\"refresh\" value=\"0\" />\n");
out.print("<button type=\"submit\">Disable " + d + "s Refresh</button></div>\n");
out.print("<button type=\"submit\" value=\"Disable\" >");
out.print(intl._("Disable {0}s Refresh", d));
out.print("</button></div>\n");
}
out.print("</form><hr>\n");
}

View File

@ -3,6 +3,8 @@
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/
boolean rendered = false;

View File

@ -3,6 +3,8 @@
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/
String uri = request.getRequestURI();

View File

@ -1,3 +1,14 @@
2009-10-26 zzz
* Console:
- Add parameterized tag
- Don't save config when checking for updates on configupdate.jsp
- Refactor confignav.jsp to java and tag
- Start tagging profiles.jsp
- Rework ConfigRestartBean and tag
- More tag fixups
- Add lang=xx for testing
- Add file for additional tagged strings
2009-10-23 zzz
* Certificate: Fix the (apparently unused) readBytes(byte[], int) method
for a null certificate - http://zzz.i2p/topics/388 - thanks HungryHobo

View File

@ -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 = 6;
public final static long BUILD = 7;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;