Author: zothar
Date: 2007-06-10 21:46:45 +0000 (Sun, 10 Jun 2007)
New Revision: 13512

Modified:
   trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
   trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
   trunk/freenet/src/freenet/clients/http/PluginToadlet.java
   trunk/freenet/src/freenet/clients/http/QueueToadlet.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
   trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
Log:
Clean up a few XHTML validation problems.  An HTML/XHTML guru may know of some 
ways to make these changes look better.  Also, we may want to consider 
siwtching from XHTML 1.1 back to XHTML 1.0 for now.

Modified: trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-06-10 20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-06-10 21:46:45 UTC (rev 13512)
@@ -116,7 +116,7 @@
        {
                HTMLNode bookmarks = new HTMLNode("ul", "id", "bookmarks");

-               HTMLNode root = bookmarks.addChild("li", "class", "cat,root", 
"/");
+               HTMLNode root = bookmarks.addChild("li", "class", "cat root", 
"/");
                HTMLNode actions = new HTMLNode("span", "class", "actions");
                String addBookmark = 
L10n.getString("BookmarkEditorToadlet.addBookmark");
                String addCategory = 
L10n.getString("BookmarkEditorToadlet.addCategory");
@@ -128,7 +128,7 @@
                        actions.addChild("a", "href", 
"?action=paste&bookmark=/").addChild("img", new String[] {"src", "alt", 
"title"}, new String[] {"/static/icon/paste.png", paste, paste});

                root.addChild(actions);
-               addCategoryToList(bookmarkManager.getMainCategory(), "/", 
root.addChild("li").addChild("ul"));
+               addCategoryToList(bookmarkManager.getMainCategory(), "/", 
root.addChild("ul"));

                return bookmarks;
        }

Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2007-06-10 
20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2007-06-10 
21:46:45 UTC (rev 13512)
@@ -179,7 +179,7 @@

                        if(displayedConfigElements>0) {
                                formNode.addChild("div", "class", 
"configprefix", sc[i].getPrefix());
-                               formNode.addChild("a", "name", 
sc[i].getPrefix());
+                               formNode.addChild("a", "id", sc[i].getPrefix());
                                formNode.addChild(configGroupUlNode);
                        }
                }

Modified: trunk/freenet/src/freenet/clients/http/PluginToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PluginToadlet.java   2007-06-10 
20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/clients/http/PluginToadlet.java   2007-06-10 
21:46:45 UTC (rev 13512)
@@ -227,7 +227,7 @@
                        tableRow.addChild("td", plugin.getPluginName());
                        tableRow.addChild("td", internalName);
                        if (plugin instanceof HttpPlugin) {
-                               tableRow.addChild("td").addChild("form", new 
String[] { "action", "method", "target" }, new String[] { internalName, "get", 
"_new" }).addChild("input", new String[] { "type", "value" }, new String[] { 
"submit", l10n("visit") });
+                               tableRow.addChild("td").addChild("form", new 
String[] { "action", "method", "target" }, new String[] { internalName, "get", 
"_new" }).addChild("div").addChild("input", new String[] { "type", "value" }, 
new String[] { "submit", l10n("visit") });
                        } else {
                                tableRow.addChild("td");
                        }

Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2007-06-10 
20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2007-06-10 
21:46:45 UTC (rev 13512)
@@ -293,7 +293,7 @@
                                                                        
HTMLNode alertContent = ctx.getPageMaker().getContentNode(alertNode);
                                                                        
alertContent.addChild("#", 
L10n.getString("QueueToadlet.warningUnsafeContentExplanation"));
                                                                        
HTMLNode optionListNode = alertContent.addChild("ul");
-                                                                       
HTMLNode optionForm = ctx.addFormChild(optionListNode, "/queue/", 
"queueDownloadNotFilteredConfirmForm");
+                                                                       
HTMLNode optionForm = ctx.addFormChild(optionListNode, "/queue/", 
"queueDownloadNotFilteredConfirmForm-" + identifier.hashCode());
                                                                        
optionForm.addChild("input", new String[] { "type", "name", "value" }, new 
String[] { "hidden", "identifier", identifier });
                                                                        
optionForm.addChild("input", new String[] { "type", "name", "value" }, new 
String[] { "hidden", "forceDownload", 
String.valueOf(System.currentTimeMillis()) });
                                                                        
optionForm.addChild("input", new String[] { "type", "name", "value" }, new 
String[] { "submit", "get", "Download anyway" });
@@ -578,7 +578,7 @@
                boolean advancedModeEnabled = core.isAdvancedModeEnabled();

                if (!completedDownloadToTemp.isEmpty()) {
-                       contentNode.addChild("a", "name", 
"completedDownloadToTemp");
+                       contentNode.addChild("a", "id", 
"completedDownloadToTemp");
                        HTMLNode completedDownloadsTempInfobox = 
contentNode.addChild(pageMaker.getInfobox("completed_requests", 
L10n.getString("QueueToadlet.completedDinTempDirectory", new String[]{ "size" 
}, new String[]{ String.valueOf(completedDownloadToTemp.size()) })));
                        HTMLNode completedDownloadsToTempContent = 
pageMaker.getContentNode(completedDownloadsTempInfobox);
                        if (advancedModeEnabled) {
@@ -589,7 +589,7 @@
                }

                if (!completedDownloadToDisk.isEmpty()) {
-                       contentNode.addChild("a", "name", 
"completedDownloadToDisk");
+                       contentNode.addChild("a", "id", 
"completedDownloadToDisk");
                        HTMLNode completedToDiskInfobox = 
contentNode.addChild(pageMaker.getInfobox("completed_requests", 
L10n.getString("QueueToadlet.completedDinDownloadDirectory", new String[]{ 
"size" }, new String[]{ String.valueOf(completedDownloadToDisk.size()) })));
                        HTMLNode completedToDiskInfoboxContent = 
pageMaker.getContentNode(completedToDiskInfobox);
                        if (advancedModeEnabled) {
@@ -600,7 +600,7 @@
                }

                if (!completedUpload.isEmpty()) {
-                       contentNode.addChild("a", "name", "completedUpload");
+                       contentNode.addChild("a", "id", "completedUpload");
                        HTMLNode completedUploadInfobox = 
contentNode.addChild(pageMaker.getInfobox("completed_requests", 
L10n.getString("QueueToadlet.completedU", new String[]{ "size" }, new String[]{ 
String.valueOf(completedUpload.size()) })));
                        HTMLNode completedUploadInfoboxContent = 
pageMaker.getContentNode(completedUploadInfobox);
                        if (advancedModeEnabled) {
@@ -611,7 +611,7 @@
                }

                if (!completedDirUpload.isEmpty()) {
-                       contentNode.addChild("a", "name", "completedDirUpload");
+                       contentNode.addChild("a", "id", "completedDirUpload");
                        HTMLNode completedUploadDirInfobox = 
contentNode.addChild(pageMaker.getInfobox("completed_requests", 
L10n.getString("QueueToadlet.completedUDirectory", new String[]{ "size" }, new 
String[]{ String.valueOf(completedDirUpload.size()) })));
                        HTMLNode completedUploadDirContent = 
pageMaker.getContentNode(completedUploadDirInfobox);
                        if (advancedModeEnabled) {
@@ -622,7 +622,7 @@
                }

                if (!failedDownload.isEmpty()) {
-                       contentNode.addChild("a", "name", "failedDownload");
+                       contentNode.addChild("a", "id", "failedDownload");
                        HTMLNode failedInfobox = 
contentNode.addChild(pageMaker.getInfobox("failed_requests", 
L10n.getString("QueueToadlet.failedD", new String[]{ "size" }, new String[]{ 
String.valueOf(failedDownload.size()) })));
                        HTMLNode failedContent = 
pageMaker.getContentNode(failedInfobox);
                        if (advancedModeEnabled) {
@@ -633,7 +633,7 @@
                }

                if (!failedUpload.isEmpty()) {
-                       contentNode.addChild("a", "name", "failedUpload");
+                       contentNode.addChild("a", "id", "failedUpload");
                        HTMLNode failedInfobox = 
contentNode.addChild(pageMaker.getInfobox("failed_requests", 
L10n.getString("QueueToadlet.failedU", new String[]{ "size" }, new String[]{ 
String.valueOf(failedUpload.size()) })));
                        HTMLNode failedContent = 
pageMaker.getContentNode(failedInfobox);
                        if (advancedModeEnabled) {
@@ -644,7 +644,7 @@
                }

                if (!failedDirUpload.isEmpty()) {
-                       contentNode.addChild("a", "name", "failedDirUpload");
+                       contentNode.addChild("a", "id", "failedDirUpload");
                        HTMLNode failedInfobox = 
contentNode.addChild(pageMaker.getInfobox("failed_requests", 
L10n.getString("QueueToadlet.failedU", new String[]{ "size" }, new String[]{ 
String.valueOf(failedDirUpload.size()) })));
                        HTMLNode failedContent = 
pageMaker.getContentNode(failedInfobox);
                        if (advancedModeEnabled) {
@@ -655,7 +655,7 @@
                }

                if (!uncompletedDownload.isEmpty()) {
-                       contentNode.addChild("a", "name", 
"uncompletedDownload");
+                       contentNode.addChild("a", "id", "uncompletedDownload");
                        HTMLNode uncompletedInfobox = 
contentNode.addChild(pageMaker.getInfobox("requests_in_progress", 
L10n.getString("QueueToadlet.wipD", new String[]{ "size" }, new String[]{ 
String.valueOf(uncompletedDownload.size()) })));
                        HTMLNode uncompletedContent = 
pageMaker.getContentNode(uncompletedInfobox);
                        if (advancedModeEnabled) {
@@ -666,7 +666,7 @@
                }

                if (!uncompletedUpload.isEmpty()) {
-                       contentNode.addChild("a", "name", "uncompletedUpload");
+                       contentNode.addChild("a", "id", "uncompletedUpload");
                        HTMLNode uncompletedInfobox = 
contentNode.addChild(pageMaker.getInfobox("requests_in_progress", 
L10n.getString("QueueToadlet.wipU", new String[]{ "size" }, new String[]{ 
String.valueOf(uncompletedUpload.size()) })));
                        HTMLNode uncompletedContent = 
pageMaker.getContentNode(uncompletedInfobox);
                        if (advancedModeEnabled) {
@@ -677,7 +677,7 @@
                }

                if (!uncompletedDirUpload.isEmpty()) {
-                       contentNode.addChild("a", "name", 
"uncompletedDirUpload");
+                       contentNode.addChild("a", "id", "uncompletedDirUpload");
                        HTMLNode uncompletedInfobox = 
contentNode.addChild(pageMaker.getInfobox("requests_in_progress", 
L10n.getString("QueueToadlet.wipDU", new String[]{ "size" }, new String[]{ 
String.valueOf(uncompletedDirUpload.size()) })));
                        HTMLNode uncompletedContent = 
pageMaker.getContentNode(uncompletedInfobox);
                        if (advancedModeEnabled) {
@@ -761,7 +761,7 @@
        private HTMLNode createPriorityCell(PageMaker pageMaker, String 
identifier, short priorityClass, ToadletContext ctx, String[] priorityClasses) {

                HTMLNode priorityCell = new HTMLNode("td", "class", 
"request-priority nowrap");
-               HTMLNode priorityForm = ctx.addFormChild(priorityCell, 
"/queue/", "queueChangePriorityCell");
+               HTMLNode priorityForm = ctx.addFormChild(priorityCell, 
"/queue/", "queueChangePriorityCell-" + identifier.hashCode());
                priorityForm.addChild("input", new String[] { "type", "name", 
"value" }, new String[] { "hidden", "identifier", identifier });
                HTMLNode prioritySelect = priorityForm.addChild("select", 
"name", "priority");
                for (int p = 0; p < RequestStarter.NUMBER_OF_PRIORITY_CLASSES; 
p++) {
@@ -777,14 +777,14 @@

        private HTMLNode createDeleteCell(PageMaker pageMaker, String 
identifier, ClientRequest clientRequest, ToadletContext ctx) {
                HTMLNode deleteNode = new HTMLNode("td", "class", 
"request-delete");
-               HTMLNode deleteForm = ctx.addFormChild(deleteNode, "/queue/", 
"queueDeleteForm");
+               HTMLNode deleteForm = ctx.addFormChild(deleteNode, "/queue/", 
"queueDeleteForm-" + identifier.hashCode());
                deleteForm.addChild("input", new String[] { "type", "name", 
"value" }, new String[] { "hidden", "identifier", identifier });
                deleteForm.addChild("input", new String[] { "type", "name", 
"value" }, new String[] { "submit", "remove_request", 
L10n.getString("QueueToadlet.remove") });

                // If it's failed, offer to restart it

                if(clientRequest.hasFinished() && !clientRequest.hasSucceeded() 
&& clientRequest.canRestart()) {
-                       HTMLNode retryForm = ctx.addFormChild(deleteNode, 
"/queue/", "queueRestartForm");
+                       HTMLNode retryForm = ctx.addFormChild(deleteNode, 
"/queue/", "queueRestartForm-" + identifier.hashCode());
                        String restartName = L10n.getString(clientRequest 
instanceof ClientGet && ((ClientGet)clientRequest).hasPermRedirect() ? 
"QueueToadlet.follow" : "QueueToadlet.restart");
                        retryForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "hidden", "identifier", identifier });
                        retryForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "restart_request", restartName });

Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-06-10 20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-06-10 21:46:45 UTC (rev 13512)
@@ -483,10 +483,10 @@
                return L10n.getString("SimpleToadletServer."+key);
        }

-       public HTMLNode addFormChild(HTMLNode parentNode, String target, String 
name) {
+       public HTMLNode addFormChild(HTMLNode parentNode, String target, String 
id) {
                HTMLNode formNode =
-                       parentNode.addChild("form", new String[] { "action", 
"method", "enctype", "id", "name", "accept-charset" }, 
-                                       new String[] { target, "post", 
"multipart/form-data", name, name, "utf-8"} );
+                       parentNode.addChild("form", new String[] { "action", 
"method", "enctype", "id",  "accept-charset" }, 
+                                       new String[] { target, "post", 
"multipart/form-data", id, "utf-8"} ).addChild("div");
                formNode.addChild("input", new String[] { "type", "name", 
"value" }, 
                                new String[] { "hidden", "formPassword", 
getFormPassword() });


Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-06-10 
20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-06-10 
21:46:45 UTC (rev 13512)
@@ -526,7 +526,7 @@
                HTMLNode fetchKeyBox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal", 
l10n("fetchKeyLabel")));
                HTMLNode fetchKeyContent = 
ctx.getPageMaker().getContentNode(fetchKeyBox);
                fetchKeyContent.addAttribute("id", "keyfetchbox");
-               HTMLNode fetchKeyForm = fetchKeyContent.addChild("form", new 
String[] { "action", "method" }, new String[] { "/", "get" });
+               HTMLNode fetchKeyForm = fetchKeyContent.addChild("form", new 
String[] { "action", "method" }, new String[] { "/", "get" }).addChild("div");
                fetchKeyForm.addChild("#", "Key: ");
                fetchKeyForm.addChild("input", new String[] { "type", "size", 
"name" }, new String[] { "text", "80", "key" });
                fetchKeyForm.addChild("input", new String[] { "type", "value" 
}, new String[] { "submit", l10n("fetch") });
@@ -563,11 +563,11 @@
                }
                versionContent.addChild("br");
                if(ctx.isAllowedFullAccess()){
-                       HTMLNode shutdownForm = versionContent.addChild("form", 
new String[] { "action", "method" }, new String[] { ".", "get" });
+                       HTMLNode shutdownForm = versionContent.addChild("form", 
new String[] { "action", "method" }, new String[] { ".", "get" 
}).addChild("div");
                        shutdownForm.addChild("input", new String[] { "type", 
"name" }, new String[] { "hidden", "exit" });
                        shutdownForm.addChild("input", new String[] { "type", 
"value" }, new String[] { "submit", l10n("shutdownNode") });
                        if(node.isUsingWrapper()){
-                               HTMLNode restartForm = 
versionContent.addChild("form", new String[] { "action", "method" }, new 
String[] { ".", "get" });
+                               HTMLNode restartForm = 
versionContent.addChild("form", new String[] { "action", "method" }, new 
String[] { ".", "get" }).addChild("div");
                                restartForm.addChild("input", new String[] { 
"type", "name" }, new String[] { "hidden", "restart" });
                                restartForm.addChild("input", new String[] { 
"type", "name", "value" }, new String[] { "submit", "restart2", 
l10n("restartNode") });
                        }

Modified: trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java     
2007-06-10 20:04:27 UTC (rev 13511)
+++ trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java     
2007-06-10 21:46:45 UTC (rev 13512)
@@ -91,7 +91,7 @@
                        HTMLNode alertContentNode = alertNode.addChild("div", 
"class", "infobox-content");
                        alertContentNode.addChild(alert.getHTMLText());
                        if (alert.userCanDismiss()) {
-                               HTMLNode dismissFormNode = 
alertContentNode.addChild("form", new String[] { "action", "method" }, new 
String[] { ".", "post" });
+                               HTMLNode dismissFormNode = 
alertContentNode.addChild("form", new String[] { "action", "method" }, new 
String[] { ".", "post" }).addChild("div");
                                dismissFormNode.addChild("input", new String[] 
{ "type", "name", "value" }, new String[] { "hidden", "disable", 
String.valueOf(alert.hashCode()) });
                                dismissFormNode.addChild("input", new String[] 
{ "type", "name", "value" }, new String[] { "hidden", "formPassword", 
core.formPassword });
                                dismissFormNode.addChild("input", new String[] 
{ "type", "value" }, new String[] { "submit", alert.dismissButtonText() });


Reply via email to