*) it was possible to post comments even if they were turned of if one knew the ID of a posting in the blog

*) Login link was displayed even if user was already logged in

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4327 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 17 years ago
parent f3f02b08ec
commit 2018f33e7b

@ -16,7 +16,7 @@
</p>
</div>
<p class="Navigation">
#(admin)#<a href="Blog.html?login=true">Login</a> #(/admin)#<a href="Blog.html">Blog-Home</a>
#(admin)#<a href="Blog.html?login=true">Login</a> - ::#(/admin)#<a href="Blog.html">Blog-Home</a>
</p>
#{entries}#
<div class="BlogCommentPost">
@ -28,6 +28,11 @@
</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>
@ -53,6 +58,7 @@
<input type="submit" name="view" value="Discard" />
</fieldset>
</form>
#(/allow)#
::
<!-- 1: preview -->
<div class="Post">
@ -92,6 +98,7 @@
</fieldset>
</form>
#(/mode)#
#%env/templates/footer.template%#
</body>
</html>

@ -126,7 +126,16 @@ public class BlogComments {
author = StrAuthor.getBytes();
}
if (post.containsKey("submit")) {
page = switchboard.blogDB.read(pagename); //maybe "if(page == null)"
// comments not allowed
if (page.getCommentMode() == 0) {
prop.put("mode_allow", 0);
} else {
prop.put("mode_allow", 1);
}
if (post.containsKey("submit") && page.getCommentMode() != 0) {
// store a new/edited blog-entry
byte[] content;
if(!post.get("content", "").equals(""))
@ -186,7 +195,6 @@ public class BlogComments {
}
}
page = switchboard.blogDB.read(pagename); //maybe "if(page == null)"
if(hasRights && post.containsKey("delete") && post.containsKey("page") && post.containsKey("comment")) {
if(page.removeComment((String) post.get("comment"))) {
switchboard.blogCommentDB.delete((String) post.get("comment"));
@ -199,14 +207,17 @@ public class BlogComments {
switchboard.blogCommentDB.write(entry);
}
if(post.containsKey("preview")) {
if(post.containsKey("preview") && page.getCommentMode() != 0) {
//preview the page
prop.put("mode", "1");//preview
prop.put("mode_pageid", pagename);
prop.put("mode_allow_pageid", pagename);
try {
prop.putHTML("mode_author", new String(author, "UTF-8"));
prop.putHTML("mode_allow_author", new String(author, "UTF-8"));
} catch (UnsupportedEncodingException e) {
prop.putHTML("mode_author", new String(author));
prop.putHTML("mode_allow_author", new String(author));
}
prop.putHTML("mode_subject", post.get("subject",""));
prop.put("mode_date", dateString(new Date()));
@ -222,6 +233,7 @@ public class BlogComments {
else {
//show 1 blog entry
prop.put("mode_pageid", page.key());
prop.put("mode_allow_pageid", pagename);
try {
prop.putHTML("mode_subject", new String(page.subject(),"UTF-8"));
} catch (UnsupportedEncodingException e) {
@ -229,8 +241,10 @@ public class BlogComments {
}
try {
prop.putHTML("mode_author", new String(page.author(),"UTF-8"));
prop.putHTML("mode_allow_author", new String(author, "UTF-8"));
} catch (UnsupportedEncodingException e) {
prop.putHTML("mode_author", new String(page.author()));
prop.putHTML("mode_allow_author", new String(author));
}
try {
prop.put("mode_comments", new String(page.commentsSize(),"UTF-8"));

Loading…
Cancel
Save