Author: toad
Date: 2008-04-12 13:53:10 +0000 (Sat, 12 Apr 2008)
New Revision: 19229

Modified:
   trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
Log:
Fix 0002247: Cut and cancel -> bookmark "" does not exist

Modified: trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2008-04-12 13:16:36 UTC (rev 19228)
+++ trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2008-04-12 13:53:10 UTC (rev 19229)
@@ -16,6 +16,7 @@
 import freenet.node.NodeClientCore;
 import freenet.client.HighLevelSimpleClient;
 import freenet.support.HTMLNode;
+import freenet.support.Logger;
 import freenet.support.URLDecoder;
 import freenet.support.URLEncodedFormatException;
 import freenet.support.URLEncoder;
@@ -238,8 +239,9 @@
                        HTMLNode infoBox = 
content.addChild(pageMaker.getInfobox("infobox-normal", 
L10n.getString("BookmarkEditorToadlet.pasteTitle")));
                        HTMLNode infoBoxContent = 
pageMaker.getContentNode(infoBox);
                        infoBoxContent.addChild("#", 
L10n.getString("BookmarkEditorToadlet.pasteOrCancel"));
-                       HTMLNode cancelForm = ctx.addFormChild(infoBoxContent, 
"", "cancelCutForm");
+                       HTMLNode cancelForm = ctx.addFormChild(infoBoxContent, 
"/bookmarkEditor/", "cancelCutForm");
                        cancelForm.addChild("input", new String[]{"type", 
"name", "value"}, new String[]{"submit", "cancelCut", 
L10n.getString("BookmarkEditorToadlet.cancelCut")});
+                       cancelForm.addChild("input", new String[]{"type", 
"name", "value"}, new String[]{"hidden", "action", "cancelCut"});
                }

                HTMLNode bookmarksBox = 
content.addChild(pageMaker.getInfobox("infobox-normal", 
L10n.getString("BookmarkEditorToadlet.myBookmarksTitle")));
@@ -248,6 +250,9 @@
                HTMLNode addDefaultBookmarksForm = ctx.addFormChild(content, 
"", "AddDefaultBookmarks");
                addDefaultBookmarksForm.addChild("input", new String[]{"type", 
"name", "value"}, new String[]{"submit", "AddDefaultBookmarks", 
L10n.getString("BookmarkEditorToadlet.addDefaultBookmarks")});

+               if(Logger.shouldLog(Logger.DEBUG, this))
+                       Logger.debug(this, "Returning:\n"+pageNode.generate());
+               
                this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
        }

@@ -278,7 +283,7 @@
                                bookmark = 
bookmarkManager.getCategoryByPath(bookmarkPath);
                        else
                                bookmark = 
bookmarkManager.getItemByPath(bookmarkPath);
-                       if(bookmark == null) {
+                       if(bookmark == null && !req.isPartSet("cancelCut")) {
                                HTMLNode errorBox = 
content.addChild(pageMaker.getInfobox("infobox-error", 
L10n.getString("BookmarkEditorToadlet.error")));
                                
pageMaker.getContentNode(errorBox).addChild("#", 
L10n.getString("BookmarkEditorToadlet.bookmarkDoesNotExist", new 
String[]{"bookmark"}, new String[]{bookmarkPath}));
                                this.writeHTMLReply(ctx, 200, "OK", 
pageNode.generate());


Reply via email to