Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

changed bookmark hand-over method: read from database

orbiter5a38bf7017a8
diff --git a/htroot/Bookmarks_p.java b/htroot/Bookmarks_p.java
index f90c53d45..e318c03a9 100644
--- a/htroot/Bookmarks_p.java
+++ b/htroot/Bookmarks_p.java
@@ -45,6 +45,7 @@
// javac -classpath .:../Classes Blacklist_p.java
// if the shell's current path is HTROOT
+import java.io.IOException;
import java.util.Iterator;
import java.util.Vector;
@@ -52,6 +53,7 @@ import de.anomic.data.bookmarksDB;
import de.anomic.data.bookmarksDB.Tag;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
+import de.anomic.plasma.plasmaCrawlLURL;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -107,17 +109,33 @@ public class Bookmarks_p {
prop.put("public", 0);
} else {
bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);
- prop.put("edit", 1); // edit mode
- prop.put("title", bookmark.getTitle());
- prop.put("description", bookmark.getDescription());
- prop.put("url", bookmark.getUrl());
- prop.put("tags", bookmark.getTags());
- if (bookmark.getPublic()) {
- prop.put("public", 1);
+ if (bookmark == null) {
+ // try to get the bookmark from the LURL database
+ try {
+ plasmaCrawlLURL.Entry urlentry = switchboard.urlPool.loadedURL.getEntry(urlHash, null);
+ prop.put("edit", 0); // create mode
+ prop.put("title", urlentry.descr());
+ prop.put("description", urlentry.descr());
+ prop.put("url", urlentry.url());
+ prop.put("tags", "");
+ prop.put("public", 0);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
} else {
- prop.put("public", 0);
+ // get from the bookmark database
+ prop.put("edit", 1); // edit mode
+ prop.put("title", bookmark.getTitle());
+ prop.put("description", bookmark.getDescription());
+ prop.put("url", bookmark.getUrl());
+ prop.put("tags", bookmark.getTags());
+ if (bookmark.getPublic()) {
+ prop.put("public", 1);
+ } else {
+ prop.put("public", 0);
+ }
}
- }
+ }
}
if(post.containsKey("delete")){
String urlHash=(String) post.get("delete");
diff --git a/htroot/index.html b/htroot/index.html
index 9de6404d3..95e977e0e 100644
--- a/htroot/index.html
+++ b/htroot/index.html
@@ -152,7 +152,7 @@ from 'late' peers.
#{results}#
<!-- link begin -->
<p style="border-bottom:1px #000 dashed; padding-bottom: 1em;">
-<a href="/Bookmarks_p.html?edit=&title=#[description]#&description=&url=#[url]#&tags=quickadd" onMouseover="document.plus_#[urlhexhash]#.src=picPlus.src" onMouseout="document.plus_#[urlhexhash]#.src=picEmpty.src">
+<a href="/Bookmarks_p.html?edit=#[urlhash]#" onMouseover="document.plus_#[urlhexhash]#.src=picPlus.src" onMouseout="document.plus_#[urlhexhash]#.src=picEmpty.src">
<img src="/env/grafics/empty.gif" title="bookmark" alt="bookmark" name="plus_#[urlhexhash]#" border="0"></a>&nbsp;
<b><font color="#4070a0">#[description]#</font></b><br>
<a href="#[delete]#" onMouseover="document.minus_#[urlhexhash]#.src=picMinus.src" onMouseout="document.minus_#[urlhexhash]#.src=picEmpty.src">