*) blog-comments can now be moderated

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3778 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hydrox 18 years ago
parent 2ab020445a
commit 44bac7dea1

@ -49,6 +49,7 @@
<select name="commentMode" id="commentMode">
<option value="0" #(commentMode)#selected="selected"::#(/commentMode)#>deactivated</option>
<option value="1" #(commentMode)#::selected="selected"#(/commentMode)#>activated</option>
<option value="2" #(commentMode)#::::selected="selected"#(/commentMode)#>moderated</option>
</select>
</dd>
</dl>

@ -24,7 +24,7 @@
<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>#(/admin)#
#(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}#

@ -193,6 +193,12 @@ public class BlogComments {
}
}
if(hasRights && post.containsKey("allow") && post.containsKey("page") && post.containsKey("comment")) {
blogBoardComments.CommentEntry entry = switchboard.blogCommentDB.read((String) post.get("comment"));
entry.allow();
switchboard.blogCommentDB.write(entry);
}
if(post.containsKey("preview")) {
//preview the page
prop.put("mode", 1);//preview
@ -240,6 +246,7 @@ public class BlogComments {
//show all commments
try {
Iterator i = page.comments().iterator();
int commentMode = page.getCommentMode();
String pageid;
blogBoardComments.CommentEntry entry;
boolean xml = false;
@ -258,6 +265,9 @@ public class BlogComments {
continue;
entry = switchboard.blogCommentDB.read(pageid);
if (commentMode == 2 && !hasRights && !entry.isAllowed())
continue;
prop.put("mode", 0);
prop.put("mode_entries_"+count+"_pageid",entry.key());
if(!xml) {
@ -277,6 +287,12 @@ public class BlogComments {
prop.put("mode_entries_"+count+"_admin", 1);
prop.put("mode_entries_"+count+"_admin_pageid",page.key());
prop.put("mode_entries_"+count+"_admin_commentid",pageid);
if(!entry.isAllowed()) {
prop.put("mode_entries_"+count+"_admin_moderate", 1);
prop.put("mode_entries_"+count+"_admin_moderate_pageid",page.key());
prop.put("mode_entries_"+count+"_admin_moderate_commentid",pageid);
}
}
else prop.put("mode_entries_"+count+"_admin", 0);
++count;

@ -209,6 +209,16 @@ public class blogBoardComments {
return b;
}
public boolean isAllowed() {
Boolean moderated = (Boolean) record.get("moderated");
if (moderated == null) return false;
return moderated.booleanValue();
}
public void allow() {
record.put("moderated", new Boolean(true));
}
}
public String write(CommentEntry page) {

Loading…
Cancel
Save