Author: toad
Date: 2009-01-13 18:19:34 +0000 (Tue, 13 Jan 2009)
New Revision: 25049

Modified:
   trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
   
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java
   trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java
   
trunk/freenet/src/freenet/node/useralerts/UpdatedVersionAvailableUserAlert.java
   trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
Log:
Make forms use ToadletContainer.addFormChild. Some didn't have the formPassword 
- fix bug #2867 hopefully.


Modified: trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java        
2009-01-13 18:11:56 UTC (rev 25048)
+++ trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java        
2009-01-13 18:19:34 UTC (rev 25049)
@@ -62,8 +62,7 @@
                                new String[] { "link", "/link" }, 
                                new String[] { "<a 
href=\""+fixer.fixLink("/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 formNode = fixer.addFormChild(textNode, "/config/", 
"setTempAddressAlertForm");
                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() + 
".tempIPAddressHint", o.getValueString() });

Modified: 
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java
===================================================================
--- 
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java  
    2009-01-13 18:11:56 UTC (rev 25048)
+++ 
trunk/freenet/src/freenet/node/useralerts/InvalidAddressOverrideUserAlert.java  
    2009-01-13 18:19:34 UTC (rev 25049)
@@ -43,8 +43,7 @@
                L10n.addL10nSubstitution(textNode, 
"InvalidAddressOverrideUserAlert.unknownAddressWithConfigLink", 
                                new String[] { "link", "/link" }, 
                                new String[] { "<a href=\"/config/\">", "</a>" 
});
-               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 formNode = fixer.addFormChild(textNode, "/config/", 
"setAddressInvalidForm");
                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() });

Modified: 
trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java  
2009-01-13 18:11:56 UTC (rev 25048)
+++ trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java  
2009-01-13 18:19:34 UTC (rev 25049)
@@ -46,8 +46,7 @@
                HTMLNode alertNode = new HTMLNode("div");
                HTMLNode textNode = alertNode.addChild("div");
                textNode.addChild("#", l10n("noNodeNick"));
-               HTMLNode formNode = alertNode.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 formNode = fixer.addFormChild(alertNode, "/config/", 
"setNameAlertForm");
                HTMLNode listNode = formNode.addChild("ul", "class", "config");
                HTMLNode itemNode = listNode.addChild("li");
                itemNode.addChild("span", new String[]{ "class", "title", 
"style" },

Modified: 
trunk/freenet/src/freenet/node/useralerts/UpdatedVersionAvailableUserAlert.java
===================================================================
--- 
trunk/freenet/src/freenet/node/useralerts/UpdatedVersionAvailableUserAlert.java 
    2009-01-13 18:11:56 UTC (rev 25048)
+++ 
trunk/freenet/src/freenet/node/useralerts/UpdatedVersionAvailableUserAlert.java 
    2009-01-13 18:19:34 UTC (rev 25049)
@@ -86,7 +86,8 @@
                alertNode.addChild("#", ut.firstBit);
                
                if(ut.formText != null) {
-                       alertNode.addChild("form", new String[] { "action", 
"method" }, new String[] { "/", "post" }).addChild("input", new String[] { 
"type", "name", "value" }, new String[] { "submit", "update", ut.formText });
+                       fixer.addFormChild(alertNode, "/", "updateNowForm").
+                               addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "update", ut.formText });
                }
                
                return alertNode;

Modified: trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java     
2009-01-13 18:11:56 UTC (rev 25048)
+++ trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java     
2009-01-13 18:19:34 UTC (rev 25049)
@@ -126,7 +126,7 @@
         * Write each alert in uber-concise form as HTML, with a link to 
         * /alerts/[ anchor pointing to the real alert].
         */
-       public HTMLNode createAlertsShort(String title, boolean advancedMode, 
boolean drawDumpEventsForm, LinkFixer ctx) {
+       public HTMLNode createAlertsShort(String title, boolean advancedMode, 
boolean drawDumpEventsForm, ToadletContainer ctx) {
                UserAlert[] currentAlerts = getAlerts();
                short maxLevel = Short.MAX_VALUE;
                int events = 0;
@@ -156,8 +156,7 @@
                        totalNumber++;
                }
                if(drawDumpEventsForm) {
-                       HTMLNode dumpFormNode = contentNode.addChild("form", 
new String[] { "action", "method" }, new String[] { "/", "post" 
}).addChild("div");
-                       dumpFormNode.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "hidden", "formPassword", core.formPassword 
});
+                       HTMLNode dumpFormNode = ctx.addFormChild(contentNode, 
"/", "dropAlertsForm");
                        StringBuilder sb = new StringBuilder();
                        for(int i=0;i<currentAlerts.length;i++) {
                                if(!currentAlerts[i].isEventNotification()) 
continue;
@@ -187,9 +186,8 @@
                HTMLNode alertContentNode = userAlertNode.addChild("div", 
"class", "infobox-content");
                alertContentNode.addChild(userAlert.getHTMLText(fixer));
                if (userAlert.userCanDismiss()) {
-                       HTMLNode dismissFormNode = 
alertContentNode.addChild("form", new String[] { "action", "method" }, new 
String[] { "/", "post" }).addChild("div");
+                       HTMLNode dismissFormNode = 
fixer.addFormChild(alertContentNode, "/", "dismissAlert-" + userAlert.anchor());
                        dismissFormNode.addChild("input", new String[] { 
"type", "name", "value" }, new String[] { "hidden", "disable", 
String.valueOf(userAlert.hashCode()) });
-                       dismissFormNode.addChild("input", new String[] { 
"type", "name", "value" }, new String[] { "hidden", "formPassword", 
core.formPassword });
                        dismissFormNode.addChild("input", new String[] { 
"type", "name", "value" }, new String[] { "submit", "dismiss-user-alert", 
userAlert.dismissButtonText() });
                }
                return userAlertNode;

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to