Author: low012
Date: 2008-01-17 22:01:30 +0100 (Thu, 17 Jan 2008)
New Revision: 4339
Modified:
trunk/htroot/Blog.html
trunk/htroot/Blog.java
trunk/htroot/BlogComments.html
Log:
*) added previous/next links to blog (in case blog has more entries than get
displayed on one page)
The blog still has a major problem: entries are displayed in random(?) order if
there are several entries in the blog
Modified: trunk/htroot/Blog.html
===================================================================
--- trunk/htroot/Blog.html 2008-01-17 18:43:01 UTC (rev 4338)
+++ trunk/htroot/Blog.html 2008-01-17 21:01:30 UTC (rev 4339)
@@ -6,14 +6,14 @@
<link rel="alternate" type="application/rss+xml" title="RSS"
href="Blog.rss" />
</head>
<body id="Blog">
- #(display)#
- #%env/templates/simpleheader.template%#
- #%env/templates/submenuPublication.template%#
- ::
- #%env/templates/header.template%#
- #%env/templates/submenuPublication.template%#
- ::
- #%env/templates/embeddedheader.template%#
+ #(display)#
+ #%env/templates/simpleheader.template%#
+ #%env/templates/submenuPublication.template%#
+ ::
+ #%env/templates/header.template%#
+ #%env/templates/submenuPublication.template%#
+ ::
+ #%env/templates/embeddedheader.template%#
#(/display)#
#(mode)#
<!-- 0: viewing -->
@@ -28,7 +28,21 @@
</p>
</div>
#{/entries}#
- #(moreentries)#::<p class="Navigation"><a
href="Blog.html?start=#[start]#&num=#[num]#">show more
entries...</a></p>#(/moreentries)#
+ <div class="BlogCommentPrevNext">
+ <p>
+ #(preventries)#
+ << previous entries
+ ::
+ <a href="Blog.html?start=#[start]#&num=#[num]#"><< previous
entries</a>
+ #(/preventries)#
+
+ #(moreentries)#
+ next entries >>
+ ::
+ <a href="Blog.html?start=#[start]#&num=#[num]#">next entries
>></a>
+ #(/moreentries)#
+ </p>
+ </div>
<p class="Navigation">
#(admin)#<a href="Blog.html?login=true">Login</a> - ::<a
href="Blog.html?edit=true">new entry</a> - <a
href="Blog.html?import=xml">import XML-File</a> - <a
href="Blog.xml?xml=1">export as XML</a> - #(/admin)#<a
href="Blog.html">Blog-Home</a>
</p>
Modified: trunk/htroot/Blog.java
===================================================================
--- trunk/htroot/Blog.java 2008-01-17 18:43:01 UTC (rev 4338)
+++ trunk/htroot/Blog.java 2008-01-17 21:01:30 UTC (rev 4339)
@@ -99,11 +99,11 @@
if (post == null) {
prop.putHTML("peername", yacyCore.seedDB.mySeed().getName());
prop.put("address", address);
- return putBlogDefault(prop, switchboard, address, 0, 20,
hasRights, xml);
+ return putBlogDefault(prop, switchboard, address, 0, 10,
hasRights, xml);
}
final int start = post.getInt("start",0); //indicates from where
entries should be shown
- final int num = post.getInt("num",20); //indicates how many entries
should be shown
+ final int num = post.getInt("num",10); //indicates how many entries
should be shown
if(!hasRights){
final userDB.Entry userentry =
switchboard.userDB.proxyAuth((String)header.get("Authorization", "xxxxxx"));
@@ -294,9 +294,12 @@
try {
final Iterator i = switchboard.blogDB.keys(false);
String pageid;
- int count = 0; //counts how many entries are shown to the user
+ int count = 0; //counts how many entries
are shown to the user
if(xml) num = 0;
final int nextstart = start+num; //indicates the starting
offset for next results
+ int prevstart = start-num; //indicates the starting
offset for previous results
+ boolean prev = false; //indicates if there were
previous comments to the ones that are dispalyed
+ if (start > 0) prev = true;
while(i.hasNext() && (num == 0 || num > count)) {
pageid = (String) i.next();
if(0 < start--) continue;
@@ -317,6 +320,15 @@
} 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);
+ } else prop.put("mode_preventries", "0");
+
+
} catch (IOException e) { serverLog.logSevere("BLOG", "Error reading
blog-DB", e); }
return prop;
}
Modified: trunk/htroot/BlogComments.html
===================================================================
--- trunk/htroot/BlogComments.html 2008-01-17 18:43:01 UTC (rev 4338)
+++ trunk/htroot/BlogComments.html 2008-01-17 21:01:30 UTC (rev 4339)
@@ -30,17 +30,19 @@
</div>
#{/entries}#
<div class="BlogCommentPrevNext">
- #(preventries)#
- << previous entries
- ::
- <a
href="BlogComments.html?page=#[pageid]#&start=#[start]#&num=#[num]#"><<
previous entries</a>
- #(/preventries)#
-
- #(moreentries)#
- next entries >>
- ::
- <a
href="BlogComments.html?page=#[pageid]#&start=#[start]#&num=#[num]#">next
entries >></a>
- #(/moreentries)#
+ <p>
+ #(preventries)#
+ << previous entries
+ ::
+ <a
href="BlogComments.html?page=#[pageid]#&start=#[start]#&num=#[num]#"><<
previous entries</a>
+ #(/preventries)#
+
+ #(moreentries)#
+ next entries >>
+ ::
+ <a
href="BlogComments.html?page=#[pageid]#&start=#[start]#&num=#[num]#">next
entries >></a>
+ #(/moreentries)#
+ </p>
</div>
#(allow)#
<fieldset>
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn