Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) blog-comments can now be moderated

hydrox44bac7dea169
diff --git a/htroot/Blog.html b/htroot/Blog.html
index e6dad42a1..4a5b4fe50 100644
--- a/htroot/Blog.html
+++ b/htroot/Blog.html
@@ -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>
diff --git a/htroot/BlogComments.html b/htroot/BlogComments.html
index 81c08b2e4..a3fd78e25 100644
--- a/htroot/BlogComments.html
+++ b/htroot/BlogComments.html
@@ -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}#
diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java
index 5f3c2bd5a..1f84494e4 100644
--- a/htroot/BlogComments.java
+++ b/htroot/BlogComments.java
@@ -193,7 +193,13 @@ public class BlogComments {
}
}
- if(post.containsKey("preview")) {
+ 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
prop.put("mode_pageid", pagename);
@@ -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;
diff --git a/source/de/anomic/data/blogBoardComments.java b/source/de/anomic/data/blogBoardComments.java
index defcc7fb4..3629341ac 100644
--- a/source/de/anomic/data/blogBoardComments.java
+++ b/source/de/anomic/data/blogBoardComments.java
@@ -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) {