- another update to Bookmarks.html

- only calculate tags and folders if display = 0

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5556 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
apfelmaennchen 16 years ago
parent ab1a09ab95
commit 35a5116606

@ -71,6 +71,7 @@ public class Bookmarks {
int max_count = 10; int max_count = 10;
int start=0; int start=0;
int display = 0;
String tagName = ""; String tagName = "";
String username=""; String username="";
@ -124,9 +125,11 @@ public class Bookmarks {
if(mode.equals("add")){ if(mode.equals("add")){
prop.put("mode", "2"); prop.put("mode", "2");
prop.put("display", "1"); prop.put("display", "1");
display = 1;
}else if(mode.equals("importxml")){ }else if(mode.equals("importxml")){
prop.put("mode", "3"); prop.put("mode", "3");
prop.put("display", "1"); prop.put("display", "1");
display = 1;
} }
}else if(post.containsKey("add")){ //add an Entry }else if(post.containsKey("add")){ //add an Entry
final String url=post.get("url"); final String url=post.get("url");
@ -166,6 +169,7 @@ public class Bookmarks {
final String urlHash=post.get("edit"); final String urlHash=post.get("edit");
prop.put("mode", "2"); prop.put("mode", "2");
prop.put("display", "1"); prop.put("display", "1");
display = 1;
if (urlHash.length() == 0) { if (urlHash.length() == 0) {
prop.put("mode_edit", "0"); // create mode prop.put("mode_edit", "0"); // create mode
prop.putHTML("mode_title", post.get("title")); prop.putHTML("mode_title", post.get("title"));
@ -251,101 +255,101 @@ public class Bookmarks {
} }
} // END if(post != null) } // END if(post != null)
if (display == 0) {
//-----------------------
// create tag list //-----------------------
//----------------------- // create tag list
printTagList("taglist", tagName, SORT_SIZE, 25, false); //-----------------------
printTagList("optlist", tagName, SORT_ALPHA, SHOW_ALL, true); printTagList("taglist", tagName, SORT_SIZE, 25, false);
printTagList("optlist", tagName, SORT_ALPHA, SHOW_ALL, true);
//-----------------------
// create bookmark list //-----------------------
//----------------------- // create bookmark list
int count=0; //-----------------------
Iterator<String> it = null; int count=0;
bookmarksDB.Bookmark bookmark; Iterator<String> it = null;
Set<String> tags; bookmarksDB.Bookmark bookmark;
Iterator<String> tagsIt; Set<String> tags;
int tagCount; Iterator<String> tagsIt;
int tagCount;
prop.put("display_num-bookmarks", sb.bookmarksDB.bookmarksSize());
prop.put("display_num-bookmarks", sb.bookmarksDB.bookmarksSize());
count=0;
if(!tagName.equals("")){ count=0;
prop.put("display_selected", ""); if(!tagName.equals("")){
it=sb.bookmarksDB.getBookmarksIterator(tagName, isAdmin); prop.put("display_selected", "");
}else{ it=sb.bookmarksDB.getBookmarksIterator(tagName, isAdmin);
prop.put("display_selected", " selected=\"selected\""); }else{
it=sb.bookmarksDB.getBookmarksIterator(isAdmin); prop.put("display_selected", " selected=\"selected\"");
} it=sb.bookmarksDB.getBookmarksIterator(isAdmin);
}
//skip the first entries (display next page)
count=0; //skip the first entries (display next page)
while(count < start && it.hasNext()){ count=0;
it.next(); while(count < start && it.hasNext()){
count++; it.next();
} count++;
}
count=0;
while(count<max_count && it.hasNext()){ count=0;
bookmark=sb.bookmarksDB.getBookmark(it.next()); while(count<max_count && it.hasNext()){
if(bookmark!=null){ bookmark=sb.bookmarksDB.getBookmark(it.next());
if(bookmark.getFeed() && isAdmin) if(bookmark!=null){
prop.put("display_bookmarks_"+count+"_link", "/FeedReader_p.html?url="+bookmark.getUrl()); if(bookmark.getFeed() && isAdmin)
else prop.put("display_bookmarks_"+count+"_link", "/FeedReader_p.html?url="+bookmark.getUrl());
prop.put("display_bookmarks_"+count+"_link",bookmark.getUrl()); else
prop.putHTML("display_bookmarks_"+count+"_title", bookmark.getTitle()); prop.put("display_bookmarks_"+count+"_link",bookmark.getUrl());
prop.putHTML("display_bookmarks_"+count+"_description", bookmark.getDescription()); prop.putHTML("display_bookmarks_"+count+"_title", bookmark.getTitle());
prop.put("display_bookmarks_"+count+"_date", DateFormatter.formatISO8601(new Date(bookmark.getTimeStamp()))); prop.putHTML("display_bookmarks_"+count+"_description", bookmark.getDescription());
prop.put("display_bookmarks_"+count+"_rfc822date", DateFormatter.formatRFC1123(new Date(bookmark.getTimeStamp()))); prop.put("display_bookmarks_"+count+"_date", DateFormatter.formatISO8601(new Date(bookmark.getTimeStamp())));
prop.put("display_bookmarks_"+count+"_public", (bookmark.getPublic() ? "1" : "0")); prop.put("display_bookmarks_"+count+"_rfc822date", DateFormatter.formatRFC1123(new Date(bookmark.getTimeStamp())));
prop.put("display_bookmarks_"+count+"_public", (bookmark.getPublic() ? "1" : "0"));
//List Tags.
tags=bookmark.getTags(); //List Tags.
tagsIt=tags.iterator(); tags=bookmark.getTags();
tagCount=0; tagsIt=tags.iterator();
while (tagsIt.hasNext()) { tagCount=0;
final String tname = tagsIt.next(); while (tagsIt.hasNext()) {
if ((!tname.startsWith("/")) && (!tname.equals(""))) { final String tname = tagsIt.next();
prop.putHTML("display_bookmarks_"+count+"_tags_"+tagCount+"_tag", tname); if ((!tname.startsWith("/")) && (!tname.equals(""))) {
tagCount++; prop.putHTML("display_bookmarks_"+count+"_tags_"+tagCount+"_tag", tname);
} tagCount++;
} }
prop.put("display_bookmarks_"+count+"_tags", tagCount); }
prop.put("display_bookmarks_"+count+"_hash", bookmark.getUrlHash()); prop.put("display_bookmarks_"+count+"_tags", tagCount);
count++; prop.put("display_bookmarks_"+count+"_hash", bookmark.getUrlHash());
} count++;
} }
prop.putHTML("display_tag", tagName); }
prop.put("display_start", start); prop.putHTML("display_tag", tagName);
if(it.hasNext()){ prop.put("display_start", start);
prop.put("display_next-page", "1"); if(it.hasNext()){
prop.put("display_next-page_start", start+max_count); prop.put("display_next-page", "1");
prop.putHTML("display_next-page_tag", tagName); prop.put("display_next-page_start", start+max_count);
prop.put("display_next-page_num", max_count); prop.putHTML("display_next-page_tag", tagName);
} prop.put("display_next-page_num", max_count);
if(start >= max_count){ }
start=start-max_count; if(start >= max_count){
if(start <0){ start=start-max_count;
start=0; if(start <0){
} start=0;
prop.put("display_prev-page", "1"); }
prop.put("display_prev-page_start", start); prop.put("display_prev-page", "1");
prop.putHTML("display_prev-page_tag", tagName); prop.put("display_prev-page_start", start);
prop.put("display_prev-page_num", max_count); prop.putHTML("display_prev-page_tag", tagName);
} prop.put("display_prev-page_num", max_count);
prop.put("display_bookmarks", count); }
prop.put("display_bookmarks", count);
//-----------------------
// create folder list //-----------------------
//----------------------- // create folder list
//-----------------------
count = 0;
count = recurseFolders(sb.bookmarksDB.getFolderList(isAdmin),"/",0,true,""); count = 0;
prop.put("display_folderlist", count); count = recurseFolders(sb.bookmarksDB.getFolderList(isAdmin),"/",0,true,"");
prop.put("display_folderlist", count);
}
return prop; // return from serverObjects respond() return prop; // return from serverObjects respond()
} }

Loading…
Cancel
Save