From 352f733a86920f4792ab8d9b50f1e72495518481 Mon Sep 17 00:00:00 2001 From: low012 Date: Sat, 12 Jan 2008 23:48:47 +0000 Subject: [PATCH] *) added "previous" and "next" links that make it possible to navigate through lists of comments (needed if there are more than 10 comments to one postig) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4328 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/BlogComments.html | 188 +++++++++++++++++++++------------------ htroot/BlogComments.java | 25 ++++-- htroot/env/base.css | 4 + 3 files changed, 125 insertions(+), 92 deletions(-) diff --git a/htroot/BlogComments.html b/htroot/BlogComments.html index c912353e7..b66e5ca7d 100644 --- a/htroot/BlogComments.html +++ b/htroot/BlogComments.html @@ -7,96 +7,110 @@ #%env/templates/header.template%# #(mode)# - -
-

#[subject]#

-
#[page]#
-
+

#[subject]#

+
#[page]#
+ +
+ -
- - #{entries}# -
-

#[subject]#

-
#[page]#
- -
- #{/entries}# - #(allow)# -
-

Comments are not allowed for this posting!

-
- :: -
-
-
-
-
- -
-
-
- -
-
-
- -

- You can use Yacy-Wiki Code here. -

-
-
- - - - -
-
- #(/allow)# +

Comments:

+ #{entries}# +
+

#[subject]#

+
#[page]#
+ +
+ #{/entries}# +
+ #(preventries)# + << previous entries + :: + << previous entries + #(/preventries)# +              + #(moreentries)# + next entries >> + :: + next entries >> + #(/moreentries)# +
+ #(allow)# +
+

Comments are not allowed for this posting!

+
+ :: +
+
+
+
+
+ +
+
+
+ +
+
+
+ +

+ You can use Yacy-Wiki Code here. +

+
+
+ + + + +
+
+ #(/allow)# :: - -
-

#[subject]#

-
#[page]#
-
+

#[subject]#

+
#[page]#
+ +
+ -
- -
-
-
-
-
- -
-
-
- -
-
-
- -

- You can use Yacy-Wiki Code here. -

-
-
- - - - - -
-
+
+
+
+
+
+ +
+
+
+ +
+
+
+ +

+ You can use Yacy-Wiki Code here. +

+
+
+ + + + + +
+
#(/mode)# #%env/templates/footer.template%# diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java index ddf332335..d66f6f86e 100644 --- a/htroot/BlogComments.java +++ b/htroot/BlogComments.java @@ -269,15 +269,22 @@ public class BlogComments { } int count = 0; //counts how many entries are shown to the user int start = post.getInt("start",0); //indicates from where entries should be shown - int num = post.getInt("num",20); //indicates how many entries should be shown + int num = post.getInt("num",10); //indicates how many entries should be shown + boolean prev = false; //indicates if there were previous comments to the ones that are dispalyed if(xml) num = 0; + if (start < 1) start = 1; // dirrrty fix for incorrect comment count, need to find reason + if (start > 1) prev = true; int nextstart = start+num; //indicates the starting offset for next results - while(i.hasNext()) { - if(count >= num && num > 0) - break; + int prevstart = start-num; //indicates the starting offset for previous results + while(i.hasNext() && count < num) { + pageid = (String) i.next(); - if(0 < start--) + + if(start > 0) { + start--; continue; + } + entry = switchboard.blogCommentDB.read(pageid); if (commentMode == 2 && !hasRights && !entry.isAllowed()) @@ -317,8 +324,16 @@ public class BlogComments { prop.put("mode_moreentries", "1"); //more entries are availible prop.put("mode_moreentries_start", nextstart); prop.put("mode_moreentries_num", num); + prop.put("mode_moreentries_pageid", page.key()); } else prop.put("moreentries", "0"); + if(prev) { + prop.put("mode_preventries", "1"); + if (prevstart < 0) prevstart = 0; + prop.put("mode_preventries_start", prevstart); + prop.put("mode_preventries_num", num); + prop.put("mode_preventries_pageid", page.key()); + } else prop.put("preventries", "0"); } catch (IOException e) { } diff --git a/htroot/env/base.css b/htroot/env/base.css index edb4dbed7..e56e897b0 100644 --- a/htroot/env/base.css +++ b/htroot/env/base.css @@ -732,6 +732,10 @@ margin: 0px 30px 0px 30px; background-color:#eeeeee; } +div.BlogCommentPrevNext { +text-align: center; +} + /* other ------------------------------------*/ ul#menu { padding:0;