mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-07-19 08:44:42 -04:00
Integration of FeedReader in Bookmarks.
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3841 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
@ -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" />
|
||||
|
@ -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 newsfeed
|
||||
if(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())));
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user