Author: zothar
Date: 2008-01-27 21:26:30 +0000 (Sun, 27 Jan 2008)
New Revision: 17329

Added:
   
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java
Modified:
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
Commit the first draft of InvalidAddressOverrideUserAlert (not used yet)

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-01-27 
20:59:18 UTC (rev 17328)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-01-27 
21:26:30 UTC (rev 17329)
@@ -495,6 +495,9 @@
 InsertException.shortError.7=Some blocks ran out of retries
 InsertException.shortError.8=Request could not leave the node
 InsertException.shortError.9=Collided with existing data
+InvalidAddressOverrideUserAlert.unknownAddress=Freenet has determined that the 
currently configured ipAddressOverride value is invalid, meaning that it does 
not match the syntax for a valid hostname, IPv4 address or IPv6 address (in the 
opinion of the currently implementation of the function that checks the IPv6 
address syntax).
+InvalidAddressOverrideUserAlert.unknownAddressTitle=Invalid Address Override 
Value
+InvalidAddressOverrideUserAlert.unknownAddressWithConfigLink=Freenet has 
determined that the currently configured ipAddressOverride value is invalid, 
meaning that it does not match the syntax for a valid hostname, IPv4 address or 
IPv6 address (in the opinion of the currently implementation of the function 
that checks the IPv6 address syntax). You can correct the 'IP address override' 
${link}configuration parameter${/link}.
 IntOption.parseError=The value specified can't be parsed as a 32-bit integer : 
${val}
 JPEGFilter.notJpeg=The file you tried to fetch is not a JPEG. It might be some 
other file format, and your browser may do something dangerous with it, 
therefore we have blocked it.
 JPEGFilter.tooShort=The file is too short to be a JPEG.

Copied: 
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java 
(from rev 17326, 
trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java)
===================================================================
--- 
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java  
                            (rev 0)
+++ 
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java  
    2008-01-27 21:26:30 UTC (rev 17329)
@@ -0,0 +1,65 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+package freenet.node.useralerts;
+
+import freenet.config.Option;
+import freenet.config.SubConfig;
+import freenet.l10n.L10n;
+import freenet.node.Node;
+import freenet.support.HTMLNode;
+
+public class InvalidAddressOverrideUserAlert extends AbstractUserAlert {
+       
+       public InvalidAddressOverrideUserAlert(Node n) {
+               super(false, null, null, null, (short) 0, true, null, false, 
null);
+               this.node = n;
+       }
+       
+       final Node node;
+       
+       public String getTitle() {
+               return l10n("unknownAddressTitle");
+       }
+
+       public String getText() {
+               return l10n("unknownAddress");
+       }
+
+       private String l10n(String key) {
+               return L10n.getString("InvalidAddressOverrideUserAlert."+key);
+       }
+
+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("InvalidAddressOverrideUserAlert."+key, 
pattern, value);
+       }
+
+       private String l10n(String key, String[] patterns, String[] values) {
+               return L10n.getString("InvalidAddressOverrideUserAlert."+key, 
patterns, values);
+       }
+
+       public HTMLNode getHTMLText() {
+               SubConfig sc = node.config.get("node");
+               Option o = sc.getOption("ipAddressOverride");
+               
+               HTMLNode textNode = new HTMLNode("div");
+               L10n.addL10nSubstitution(textNode, 
"InvalidAddressOverrideUserAlert.unknownAddressWithConfigLink"), 
+                               new String[] { "link", "/link" }, 
+                               new String[] { "<a href=\"/config/\">", "</a>" 
});
+               addPortForwardSuggestion(textNode);
+               HTMLNode formNode = textNode.addChild("form", new String[] { 
"action", "method" }, new String[] { "/config/", "post" });
+               formNode.addChild("input", new String[] { "type", "name", 
"value" }, new String[] { "hidden", "formPassword", 
node.clientCore.formPassword });
+               HTMLNode listNode = formNode.addChild("ul", "class", "config");
+               HTMLNode itemNode = listNode.addChild("li");
+               itemNode.addChild("span", "class", "configshortdesc", 
L10n.getString(o.getShortDesc())).addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "text", sc.getPrefix() + 
".ipAddressOverride", o.getValueString() });
+               itemNode.addChild("span", "class", "configlongdesc", 
L10n.getString(o.getLongDesc()));
+               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "submit", L10n.getString("UserAlert.apply") });
+               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "reset", L10n.getString("UserAlert.reset") });
+               return textNode;
+       }
+
+       public short getPriorityClass() {
+               return UserAlert.ERROR;
+       }
+
+}


Reply via email to