Skip to content

Commit

Permalink
changed bookmark hand-over method: read from database
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1583 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Feb 9, 2006
1 parent fe39493 commit 5a38bf7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
36 changes: 27 additions & 9 deletions htroot/Bookmarks_p.java
Expand Up @@ -45,13 +45,15 @@
// 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;

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;

Expand Down Expand Up @@ -107,17 +109,33 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
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");
Expand Down
2 changes: 1 addition & 1 deletion htroot/index.html
Expand Up @@ -152,7 +152,7 @@
#{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">
Expand Down

0 comments on commit 5a38bf7

Please sign in to comment.