From 140ffc5c5eebfdfda20246cb2af6c957f5c7137c Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 3 Mar 2012 22:55:24 +0000
Subject: [PATCH]   - /confighome validation fixes   - AJAX fixes   - Translate
 'router is down' message

---
 .../java/src/org/klomp/snark/web/I2PSnarkServlet.java     | 1 +
 .../java/src/net/i2p/router/web/HomeHelper.java           | 8 ++++----
 apps/routerconsole/jsp/confighome.jsp                     | 2 +-
 apps/routerconsole/jsp/home.jsp                           | 3 ++-
 apps/routerconsole/jsp/js/ajax.js                         | 3 +--
 router/java/src/net/i2p/router/RouterVersion.java         | 2 +-
 6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index 24094515c5..22e400b764 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -230,6 +230,7 @@ public class I2PSnarkServlet extends Default {
                 //out.write("<meta http-equiv=\"refresh\" content=\"" + delay + ";/i2psnark/" + peerString + "\">\n");
                 out.write("<script src=\"/js/ajax.js\" type=\"text/javascript\"></script>\n" +
                           "<script type=\"text/javascript\">\n"  +
+                          "var failMessage = \"<b>" + _("Router is down") + "</b>\";\n" +
                           "function requestAjax1() { ajax(\"/i2psnark/.ajax/xhr1.html" + peerString + "\", \"mainsection\", " + (delay*1000) + "); }\n" +
                           "function initAjax(delayMs) { setTimeout(requestAjax1, " + (delay*1000) +");  }\n"  +
                           "</script>\n");
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java
index 189821cc2c..6683d2b3ba 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java
@@ -43,7 +43,7 @@ public class HomeHelper extends HelperBase {
         _x("FAQ") + S + _x("Frequently Asked Questions") + S + "http://www.i2p2.i2p/faq" + S + I + "help.png" + S +
         _x("Forum") + S + _x("Community forum") + S + "http://forum.i2p/" + S + I + "itoopie_sm.png" + S +
         //"ident.i2p" + S + _x("Short message service") + S + "http://ident.i2p/" + S + I + "itoopie_sm.png" + S +
-        _x("Javadocs") + S + _x("Technical documentation") + S + "http://docs.i2p-projekt.i2p/javadoc/" + S + I + "book.png" + S +
+        _x("Javadocs") + S + _x("Technical documentation") + S + "http://update.killyourtv.i2p/javadoc/" + S + I + "book.png" + S +
         _x("Key Server") + S + _x("OpenPGP Keyserver") + S + "http://keys.i2p/" + S + I + "book.png" + S +
         _x("Pastebin") + S + _x("I2P Pastebin") + S + "http://pastethis.i2p/" + S + I + "itoopie_sm.png" + S +
         "Planet I2P" + S + _x("I2P News") + S + "http://planet.i2p/" + S + I + "itoopie_sm.png" + S +
@@ -186,14 +186,14 @@ public class HomeHelper extends HelperBase {
                .append(app.name)
                .append("\"></td><td align=\"center\">");
             if (app.icon != null) {
-                buf.append("<img height=\"16\" src=\"").append(app.icon).append("\">");
+                buf.append("<img height=\"16\" alt=\"\" src=\"").append(app.icon).append("\">");
             }
             buf.append("</td><td align=\"left\">")
                .append(app.name)
                .append("</td><td align=\"left\"><a href=\"")
-               .append(app.url)
+               .append(app.url.replace("&", "&amp;"))
                .append("\">")
-               .append(app.url)
+               .append(app.url.replace("&", "&amp;"))
                .append("</a></td></tr>\n");
         }
         buf.append("<tr><td colspan=\"2\" align=\"center\"><b>")
diff --git a/apps/routerconsole/jsp/confighome.jsp b/apps/routerconsole/jsp/confighome.jsp
index 728527b854..14310c1df8 100644
--- a/apps/routerconsole/jsp/confighome.jsp
+++ b/apps/routerconsole/jsp/confighome.jsp
@@ -81,4 +81,4 @@ input.default {
   <input type="submit" name="action" class="add" value="<%=intl._("Add item")%>" >
  </div>
 </form>
-</div></div></body></html>
+</div></body></html>
diff --git a/apps/routerconsole/jsp/home.jsp b/apps/routerconsole/jsp/home.jsp
index be6073b66b..8c1bcc45a2 100644
--- a/apps/routerconsole/jsp/home.jsp
+++ b/apps/routerconsole/jsp/home.jsp
@@ -6,8 +6,9 @@
 <%=intl.title("home")%>
 <script src="/js/ajax.js" type="text/javascript"></script>
 <script type="text/javascript">
+  var failMessage = "<b><%=intl._("Router is down")%></b>";
   function requestAjax1() { ajax("/xhr1.jsp", "xhr", 15000); }
-  function initAjax() { setInterval(requestAjax1, 15000);  }
+  function initAjax() { setTimeout(requestAjax1, 15000);  }
 </script>
 </head><body onload="initAjax()">
 <%
diff --git a/apps/routerconsole/jsp/js/ajax.js b/apps/routerconsole/jsp/js/ajax.js
index 8219dc4242..3743a08b5e 100644
--- a/apps/routerconsole/jsp/js/ajax.js
+++ b/apps/routerconsole/jsp/js/ajax.js
@@ -25,8 +25,7 @@ function ajaxDone(url, target, refresh) {
       document.getElementById(target).innerHTML = results;
       //document.getElementsbyClassName("hideifdown").style.display="block";
     } else {
-      // TODO take from a translated variable
-      document.getElementById(target).innerHTML="<b>Router is down</b>";
+      document.getElementById(target).innerHTML = failMessage;
       //document.getElementByClassName("hideifdown").style.display="none";
     }
     setTimeout(function() {ajax(url, target, refresh);}, refresh);
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 282c18b422..0725033fa6 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -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 = 2;
+    public final static long BUILD = 3;
 
     /** for example "-test" */
     public final static String EXTRA = "";
-- 
GitLab