*) 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
pull/1/head
low012 17 years ago
parent 2018f33e7b
commit 352f733a86

@ -7,96 +7,110 @@
<body id="Blog">
#%env/templates/header.template%#
#(mode)#
<!-- 0: viewing -->
<div class="Post">
<h2 class="PostSubject"><a href="Blog.html?page=#[pageid]#">#[subject]#</a></h2>
<div class="PostBody">#[page]#</div>
<p class="PostInfo">
#[date]# | by #[author]# | <a href="BlogComments.html?page=#[pageid]#">#[comments]# Comments</a>
<!-- 0: viewing -->
<div class="Post">
<h2 class="PostSubject"><a href="Blog.html?page=#[pageid]#">#[subject]#</a></h2>
<div class="PostBody">#[page]#</div>
<p class="PostInfo">
#[date]# | by #[author]# | <a href="BlogComments.html?page=#[pageid]#">#[comments]# Comments</a>
</p>
</div>
<p class="Navigation">
#(admin)#<a href="Blog.html?login=true">Login</a> - ::#(/admin)#<a href="Blog.html">Blog-Home</a>
</p>
</div>
<p class="Navigation">
#(admin)#<a href="Blog.html?login=true">Login</a> - ::#(/admin)#<a href="Blog.html">Blog-Home</a>
</p>
#{entries}#
<div class="BlogCommentPost">
<h2 class="PostSubject">#[subject]#</h2>
<div class="PostBody">#[page]#</div>
<p class="PostInfo">
#[date]# | by #[author]#
#(admin)#::| <a href="BlogComments.html?page=#[pageid]#&amp;comment=#[commentid]#&amp;delete=try">delete</a> #(moderate)#::| <a href="BlogComments.html?page=#[pageid]#&amp;comment=#[commentid]#&amp;allow=try">allow</a>#(/moderate)##(/admin)#
</p>
</div>
#{/entries}#
#(allow)#
<fieldset>
<p>Comments are not allowed for this posting!</p>
</fieldset>
::
<form action="BlogComments.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<dl>
<dt><label for="author">Author:</label></dt>
<dd>
<input name="author" id="author" type="text" size="20" maxlength="80" value="#[author]#" />
</dd>
<dt><label for="subject">Subject:</label></dt>
<dd>
<input name="subject" id="subject" type="text" size="20" maxlength="80" value="" />
</dd>
<dt><label for="content">Text:</label></dt>
<dd>
<textarea name="content" id="content" cols="80" rows="12"></textarea>
<p class="help">
You can use <a href="WikiHelp.html" onclick="window.open('WikiHelp.html','WikiHelp','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');return false;">Yacy-Wiki Code</a> here.
</p>
</dd>
</dl>
<input type="hidden" name="page" value="#[pageid]#" />
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
<input type="submit" name="view" value="Discard" />
</fieldset>
</form>
#(/allow)#
<h3>Comments:</h3>
#{entries}#
<div class="BlogCommentPost">
<h2 class="PostSubject">#[subject]#</h2>
<div class="PostBody">#[page]#</div>
<p class="PostInfo">
#[date]# | by #[author]#
#(admin)#::| <a href="BlogComments.html?page=#[pageid]#&amp;comment=#[commentid]#&amp;delete=try">delete</a> #(moderate)#::| <a href="BlogComments.html?page=#[pageid]#&amp;comment=#[commentid]#&amp;allow=try">allow</a>#(/moderate)##(/admin)#
</p>
</div>
#{/entries}#
<div class="BlogCommentPrevNext">
#(preventries)#
&lt;&lt; previous entries
::
<a href="BlogComments.html?page=#[pageid]#&start=#[start]#&num=#[num]#">&lt;&lt; previous entries</a>
#(/preventries)#
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
#(moreentries)#
next entries &gt;&gt;
::
<a href="BlogComments.html?page=#[pageid]#&start=#[start]#&num=#[num]#">next entries &gt;&gt;</a>
#(/moreentries)#
</div>
#(allow)#
<fieldset>
<p>Comments are not allowed for this posting!</p>
</fieldset>
::
<form action="BlogComments.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<dl>
<dt><label for="author">Author:</label></dt>
<dd>
<input name="author" id="author" type="text" size="20" maxlength="80" value="#[author]#" />
</dd>
<dt><label for="subject">Subject:</label></dt>
<dd>
<input name="subject" id="subject" type="text" size="20" maxlength="80" value="" />
</dd>
<dt><label for="content">Text:</label></dt>
<dd>
<textarea name="content" id="content" cols="80" rows="12"></textarea>
<p class="help">
You can use <a href="WikiHelp.html" onclick="window.open('WikiHelp.html','WikiHelp','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');return false;">Yacy-Wiki Code</a> here.
</p>
</dd>
</dl>
<input type="hidden" name="page" value="#[pageid]#" />
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
<input type="submit" name="view" value="Discard" />
</fieldset>
</form>
#(/allow)#
::
<!-- 1: preview -->
<div class="Post">
<h2 class="PostSubject"><a href="Blog.html?page=#[pageid]#">#[subject]#</a></h2>
<div class="PostBody">#[page]#</div>
<p class="PostInfo">
#[date]# | by #[author]#
<!-- 1: preview -->
<div class="Post">
<h2 class="PostSubject"><a href="Blog.html?page=#[pageid]#">#[subject]#</a></h2>
<div class="PostBody">#[page]#</div>
<p class="PostInfo">
#[date]# | by #[author]#
</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>
</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>
<form action="BlogComments.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<dl>
<dt><label for="author">Author:</label></dt>
<dd>
<input name="author" id="author" type="text" size="20" maxlength="80" value="#[author]#" />
</dd>
<dt><label for="subject">Subject:</label></dt>
<dd>
<input name="subject" id="subject" type="text" size="20" maxlength="80" value="#[subject]#" />
</dd>
<dt><label for="content">Text:</label></dt>
<dd>
<textarea name="content" id="conten t" cols="80" rows="12">#[page-code]#</textarea>
<p class="help">
You can use <a href="WikiHelp.html" onclick="window.open('WikiHelp.html','WikiHelp','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');return false;">Yacy-Wiki Code</a> here.
</p>
</dd>
</dl>
<input type="hidden" name="page" value="#[pageid]#" />
<input type="text" name="page" value="#[pageid]#" />
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
<input type="submit" name="view" value="Discard" />
</fieldset>
</form>
<form action="BlogComments.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<dl>
<dt><label for="author">Author:</label></dt>
<dd>
<input name="author" id="author" type="text" size="20" maxlength="80" value="#[author]#" />
</dd>
<dt><label for="subject">Subject:</label></dt>
<dd>
<input name="subject" id="subject" type="text" size="20" maxlength="80" value="#[subject]#" />
</dd>
<dt><label for="content">Text:</label></dt>
<dd>
<textarea name="content" id="conten t" cols="80" rows="12">#[page-code]#</textarea>
<p class="help">
You can use <a href="WikiHelp.html" onclick="window.open('WikiHelp.html','WikiHelp','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');return false;">Yacy-Wiki Code</a> here.
</p>
</dd>
</dl>
<input type="hidden" name="page" value="#[pageid]#" />
<input type="text" name="page" value="#[pageid]#" />
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" />
<input type="submit" name="view" value="Discard" />
</fieldset>
</form>
#(/mode)#
#%env/templates/footer.template%#

@ -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) {
}

@ -732,6 +732,10 @@ margin: 0px 30px 0px 30px;
background-color:#eeeeee;
}
div.BlogCommentPrevNext {
text-align: center;
}
/* other ------------------------------------*/
ul#menu {
padding:0;

Loading…
Cancel
Save