From 1e71258a0d778899b566b744cf92bca11f218962 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Wed, 10 Jun 2009 20:14:44 +0000 Subject: [PATCH] add moderate-comments view. svn path=/plone.app.discussion/trunk/; revision=27369 --- plone/app/discussion/browser/configure.zcml | 9 ++ plone/app/discussion/browser/moderation.pt | 125 ++++++++++++++++++ plone/app/discussion/browser/moderation.py | 40 ++++++ .../discussion/profiles/default/actions.xml | 16 +++ 4 files changed, 190 insertions(+) create mode 100644 plone/app/discussion/browser/moderation.pt create mode 100644 plone/app/discussion/browser/moderation.py create mode 100644 plone/app/discussion/profiles/default/actions.xml diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index dd8542c..e413914 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -8,6 +8,15 @@ + + + + + + + + + + + + +

+ Review comments +

+ +

+ No comments to review. To look for more comments, + + click here to refresh. + +

+ +

+ Comments for review are listed below. For each one, click + Delete to remove the comment or Publish to + publish it. Note that at most + comments will be shown at a time. If there are further comments, + you will be able to see them once you have published or deleted + the first batch. +

+ + + + + + + + + + + + + + + + + + + + + + + +
AuthorDateContextSubjectCommentAction
+ + + + + + + +
+ + + +
+
+ + +
+
+ +
+
+ + + \ No newline at end of file diff --git a/plone/app/discussion/browser/moderation.py b/plone/app/discussion/browser/moderation.py new file mode 100644 index 0000000..b424a12 --- /dev/null +++ b/plone/app/discussion/browser/moderation.py @@ -0,0 +1,40 @@ +from Acquisition import aq_inner, aq_parent + +from Products.Five.browser import BrowserView +from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile + +from Products.CMFCore.utils import getToolByName + +class View(BrowserView): + """ + """ + + template = ViewPageTemplateFile('moderation.pt') + + def __call__(self): + return self.template() + + def cook(self, text): + return "" + + def format_time(self, time): + context = aq_inner(self.context) + util = getToolByName(context, 'translation_service') + return util.ulocalized_time(time, 1, context, domain='plonelocales') + + def comments_pending_review(self): + + self.state = self.request.get('review_state', 'pending') + self.transition = self.request.get('publish_transition', 'pending') + self.limit = self.request.get('limit', 100) + + context = aq_inner(self.context) + catalog = getToolByName(context, 'portal_catalog') + + return catalog( + path='/'.join(context.getPhysicalPath()), + portal_type='Discussion Item', + review_state=self.state, + sort_on='created', + sort_limit=self.limit, + ) \ No newline at end of file diff --git a/plone/app/discussion/profiles/default/actions.xml b/plone/app/discussion/profiles/default/actions.xml new file mode 100644 index 0000000..27c57a1 --- /dev/null +++ b/plone/app/discussion/profiles/default/actions.xml @@ -0,0 +1,16 @@ + + + + + Moderate comments + + string:$portal_url/@@moderate-comments + + + + + + True + + +