Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Integration of FeedReader in Bookmarks.
allo7a5b22a0b8ba
diff --git a/htroot/Bookmarks.html b/htroot/Bookmarks.htmlindex b76c3612f..41083d96e 100644--- a/htroot/Bookmarks.html+++ b/htroot/Bookmarks.html@@ -38,6 +38,7 @@<option value="private" #(public)#selected="selected"::#(/public)#>no</option></select></dd>+ <dt><input type="checkbox" value="true" name="feed" id="feed" #(feed)#::checked#(/feed)# /><label for="feed">Bookmark is a newsfeed</label></dt></dl>#(edit)#<input type="submit" name="add" value="create" />diff --git a/htroot/Bookmarks.java b/htroot/Bookmarks.javaindex 7e5ceb266..011436b4f 100644--- a/htroot/Bookmarks.java+++ b/htroot/Bookmarks.java@@ -77,7 +77,7 @@ public class Bookmarks {String tagName="";int start=0;userDB.Entry user=switchboard.userDB.getUser(header);- boolean isAdmin=(switchboard.verifyAuthentication(header, true) || user!= null && user.hasBookmarkRight());+ boolean isAdmin=(switchboard.verifyAuthentication(header, true) || user!= null && user.hasRight(userDB.Entry.BOOKMARK_RIGHT));String username="";if(user != null) username=user.getUserName();else if(isAdmin) username="admin";@@ -102,6 +102,7 @@ public class Bookmarks {prop.put("mode_url", "");prop.put("mode_tags", "");prop.put("mode_public", 1); //1=is public+ prop.put("mode_feed", 0); //no newsfeedif(post != null){if(!isAdmin){@@ -140,6 +141,11 @@ public class Bookmarks {}else{bookmark.setPublic(false);}+ if(((String) post.get("public")).equals("public")){+ bookmark.setFeed(true);+ }else{+ bookmark.setFeed(false);+ }bookmark.setTags(tags, true);switchboard.bookmarksDB.saveBookmark(bookmark);@@ -157,6 +163,7 @@ public class Bookmarks {prop.put("mode_url", (String) post.get("url"));prop.put("mode_tags", (String) post.get("tags"));prop.put("mode_public", 0);+ prop.put("mode_feed", 0);} else {bookmarksDB.Bookmark bookmark = switchboard.bookmarksDB.getBookmark(urlHash);if (bookmark == null) {@@ -173,6 +180,7 @@ public class Bookmarks {prop.put("mode_author", comp.author());prop.put("mode_tags", (document == null) ? comp.tags() : document.getKeywords(','));prop.put("mode_public", 0);+ prop.put("mode_feed", 0); //TODO: check if it IS a feed}if (document != null) document.close();} else {@@ -256,7 +264,10 @@ public class Bookmarks {while(count<max_count && it.hasNext()){bookmark=switchboard.bookmarksDB.getBookmark((String)it.next());if(bookmark!=null){- prop.put("bookmarks_"+count+"_link", de.anomic.data.htmlTools.replaceXMLEntities(bookmark.getUrl()));+ if(bookmark.getFeed())+ prop.put("bookmarks_"+count+"_link", "/FeedReader_p.html?url="+de.anomic.data.htmlTools.replaceXMLEntities(bookmark.getUrl()));+ else+ prop.put("bookmarks_"+count+"_link", de.anomic.data.htmlTools.replaceXMLEntities(bookmark.getUrl()));prop.put("bookmarks_"+count+"_title", bookmark.getTitle());prop.put("bookmarks_"+count+"_description", bookmark.getDescription());prop.put("bookmarks_"+count+"_date", serverDate.dateToiso8601(new Date(bookmark.getTimeStamp())));diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.javaindex 346af9ab6..348b9c5c7 100644--- a/source/de/anomic/data/bookmarksDB.java+++ b/source/de/anomic/data/bookmarksDB.java@@ -694,6 +694,7 @@ public class bookmarksDB {public static final String BOOKMARK_PUBLIC="bookmarkPublic";public static final String BOOKMARK_TIMESTAMP="bookmarkTimestamp";public static final String BOOKMARK_OWNER="bookmarkOwner";+ public static final String BOOKMARK_IS_FEED="bookmarkIsFeed";private String urlHash;private HashSet tags;private long timestamp;@@ -796,6 +797,13 @@ public class bookmarksDB {return false;}}+ public boolean getFeed(){+ if(entry.containsKey(BOOKMARK_IS_FEED)){+ return ((String) entry.get(BOOKMARK_IS_FEED)).equals("true");+ }else{+ return false;+ }+ }public void setPublic(boolean isPublic){if(isPublic){entry.put(BOOKMARK_PUBLIC, "public");@@ -803,6 +811,13 @@ public class bookmarksDB {entry.put(BOOKMARK_PUBLIC, "private");}}+ public void setFeed(boolean isFeed){+ if(isFeed){+ entry.put(BOOKMARK_IS_FEED, "true");+ }else{+ entry.put(BOOKMARK_IS_FEED, "false");+ }+ }public void setProperty(String name, String value){entry.put(name, value);//setBookmarksTable();