Author: mario
Date: 2007-02-24 21:24:35 +0000 (Sat, 24 Feb 2007)
New Revision: 11911

Modified:
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
Log:
add bookmark move {up|down} functionality

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-02-24 
21:21:31 UTC (rev 11910)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-02-24 
21:24:35 UTC (rev 11911)
@@ -173,6 +173,12 @@

                                if (request.isPartSet("delete_"+b.hashCode())) {
                                        bookmarks.removeBookmark(b, true);
+                               } else if 
(request.isPartSet("movedown_"+b.hashCode())) {
+                                       bookmarks.moveBookmarkDown(b, true);
+                                       break;
+                               } else if 
(request.isPartSet("moveup_"+b.hashCode())) {
+                                       bookmarks.moveBookmarkUp(b, true);
+                                       break;
                                } else if 
(request.isPartSet("edit_"+b.hashCode())) {
                                        this.sendBookmarkEditPage(ctx, b);
                                        return;
@@ -477,6 +483,8 @@
                        HTMLNode infoboxContent = 
ctx.getPageMaker().getContentNode(infobox);

                        Enumeration e = bookmarks.getBookmarks();
+                       boolean moveButtonsEnabled = (bookmarks.getSize() > 1); 
// activate move{up|down} buttons
+                       
                        if (!e.hasMoreElements()) {
                                infoboxContent.addChild("#", "You currently do 
not have any bookmarks defined.");
                        } else {
@@ -488,6 +496,10 @@
                                        HTMLNode bookmark = 
bookmarkList.addChild("li", "style", "clear: right;"); /* TODO */
                                        bookmark.addChild("input", new String[] 
{ "type", "name", "value", "style" }, new String[] { "submit", "delete_" + 
b.hashCode(), "Delete", "float: right;" });
                                        bookmark.addChild("input", new String[] 
{ "type", "name", "value", "style" }, new String[] { "submit", "edit_" + 
b.hashCode(), "Edit", "float: right;" });
+                                       if (moveButtonsEnabled) {
+                                               bookmark.addChild("input", new 
String[] { "type", "name", "value", "style" }, new String[] { "submit", 
"movedown_" + b.hashCode(), "Down", "float: right;" });
+                                               bookmark.addChild("input", new 
String[] { "type", "name", "value", "style" }, new String[] { "submit", 
"moveup_" + b.hashCode(), "Up", "float: right;" });
+                                       }
                                        bookmark.addChild("a", "href", '/' + 
b.getKey(), b.getDesc());
                                }
                                manageForm.addChild("input", new String[] { 
"type", "name", "value" }, new String[] { "hidden", "managebookmarks", "yes" });


Reply via email to