From 6dd52422ea39f80de1d37aa7510b782926d720d6 Mon Sep 17 00:00:00 2001 From: apfelmaennchen Date: Wed, 28 Jan 2009 00:15:43 +0000 Subject: [PATCH] - added two dialogs to manage bookmark tags in YaCy-UI - fixed renameTag() in bookmarksDB - added /api/bookmarks/tags/addTag.xml - added /api/bookmarks/tags/editTag.xml git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5525 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/api/bookmarks/tags/addTag.java | 30 +++++++ htroot/api/bookmarks/tags/addTag.xml | 2 + htroot/api/bookmarks/tags/editTag.java | 22 +++++ htroot/api/bookmarks/tags/editTag.xml | 2 + htroot/yacy/ui/css/base.css | 9 ++ htroot/yacy/ui/index.html | 111 ++++++++++++++++++++++++- htroot/yacy/ui/yacyui-bookmarks.html | 46 ++++++---- htroot/yacy/ui/yacyui-welcome.html | 1 + source/de/anomic/data/bookmarksDB.java | 53 ++++++------ 9 files changed, 231 insertions(+), 45 deletions(-) create mode 100644 htroot/api/bookmarks/tags/addTag.java create mode 100644 htroot/api/bookmarks/tags/addTag.xml create mode 100755 htroot/api/bookmarks/tags/editTag.java create mode 100644 htroot/api/bookmarks/tags/editTag.xml diff --git a/htroot/api/bookmarks/tags/addTag.java b/htroot/api/bookmarks/tags/addTag.java new file mode 100644 index 000000000..fecc05e56 --- /dev/null +++ b/htroot/api/bookmarks/tags/addTag.java @@ -0,0 +1,30 @@ + +import de.anomic.http.httpRequestHeader; +import de.anomic.plasma.plasmaSwitchboard; +import de.anomic.server.serverObjects; +import de.anomic.server.serverSwitch; +import de.anomic.data.bookmarksDB.Bookmark; + + +public class addTag { + public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) { + // return variable that accumulates replacements + final plasmaSwitchboard switchboard = (plasmaSwitchboard) env; + final serverObjects prop = new serverObjects(); + prop.put("result", "0");//error + //rename tags + if(post != null) { + if (post.containsKey("selectTag") && post.containsKey("addTag")) { + switchboard.bookmarksDB.addTag(post.get("selectTag"), post.get("addTag")); + prop.put("result", "1");//success + } else if (post.containsKey("urlhash") && post.containsKey("addTag")) { + final Bookmark bm = switchboard.bookmarksDB.getBookmark(post.get("urlhash")); + bm.addTag(post.get("addTag")); + prop.put("result", "1");//success + } + } + // return rewrite properties + return prop; + } + +} \ No newline at end of file diff --git a/htroot/api/bookmarks/tags/addTag.xml b/htroot/api/bookmarks/tags/addTag.xml new file mode 100644 index 000000000..ec81dd621 --- /dev/null +++ b/htroot/api/bookmarks/tags/addTag.xml @@ -0,0 +1,2 @@ + +#(result)#something went wrong::done#(/result)# \ No newline at end of file diff --git a/htroot/api/bookmarks/tags/editTag.java b/htroot/api/bookmarks/tags/editTag.java new file mode 100755 index 000000000..ab41d1e7a --- /dev/null +++ b/htroot/api/bookmarks/tags/editTag.java @@ -0,0 +1,22 @@ + +import de.anomic.http.httpRequestHeader; +import de.anomic.plasma.plasmaSwitchboard; +import de.anomic.server.serverObjects; +import de.anomic.server.serverSwitch; + +public class editTag { + public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch env) { + // return variable that accumulates replacements + final plasmaSwitchboard switchboard = (plasmaSwitchboard) env; + final serverObjects prop = new serverObjects(); + prop.put("result", "0");//error + //rename tags + if(post != null && post.containsKey("old") && post.containsKey("new")){ + if(switchboard.bookmarksDB.renameTag(post.get("old"), post.get("new"))) + prop.put("result", "1");//success + } + // return rewrite properties + return prop; + } + +} diff --git a/htroot/api/bookmarks/tags/editTag.xml b/htroot/api/bookmarks/tags/editTag.xml new file mode 100644 index 000000000..a9a7241c5 --- /dev/null +++ b/htroot/api/bookmarks/tags/editTag.xml @@ -0,0 +1,2 @@ + +#(result)#something went wrong::done#(/result)# diff --git a/htroot/yacy/ui/css/base.css b/htroot/yacy/ui/css/base.css index beacd0d77..3d673a4bd 100644 --- a/htroot/yacy/ui/css/base.css +++ b/htroot/yacy/ui/css/base.css @@ -158,6 +158,15 @@ img.help { .flexigrid div.fbutton .load { background: url(../img/flexigrid/load.png) no-repeat center left; } +.flexigrid div.fbutton .addTag { + background: url(../img/tags/tag_blue_add.png) no-repeat center left; +} +.flexigrid div.fbutton .editTag { + background: url(../img/tags/tag_blue_edit.png) no-repeat center left; +} +.flexigrid div.fbutton .deleteTag { + background: url(../img/tags/tag_blue_delete.png) no-repeat center left; +} /* YaCy Bookmarks ---------------------------*/ .url { diff --git a/htroot/yacy/ui/index.html b/htroot/yacy/ui/index.html index dd62c897a..55c8c17d9 100644 --- a/htroot/yacy/ui/index.html +++ b/htroot/yacy/ui/index.html @@ -40,12 +40,22 @@ diff --git a/htroot/yacy/ui/yacyui-welcome.html b/htroot/yacy/ui/yacyui-welcome.html index c3b6e3ff6..8589a4123 100644 --- a/htroot/yacy/ui/yacyui-welcome.html +++ b/htroot/yacy/ui/yacyui-welcome.html @@ -8,6 +8,7 @@ apfelmaennchen

Change Log