From 90440cfeca66ea9d3c435ac6c2cb5549cbc04335 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Fri, 26 Jun 2009 14:57:45 +0000 Subject: [PATCH] add bulk actions and filter to the moderation view. move delete- and publish-comment methods from comment.py to moderation.py. svn path=/plone.app.discussion/trunk/; revision=27670 --- plone/app/discussion/browser/comments.py | 42 +------- plone/app/discussion/browser/configure.zcml | 13 ++- plone/app/discussion/browser/moderation.pt | 77 +++++++-------- plone/app/discussion/browser/moderation.py | 97 ++++++++++++++++++- .../browser/stylesheets/discussion.css | 12 ++- 5 files changed, 152 insertions(+), 89 deletions(-) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 4949db1..e4e736c 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -20,8 +20,6 @@ from Products.CMFCore.utils import getToolByName from Products.CMFPlone import PloneMessageFactory as _ -from Products.statusmessages.interfaces import IStatusMessage - from plone.registry.interfaces import IRegistry from plone.app.layout.viewlets.common import ViewletBase @@ -283,42 +281,4 @@ class ReplyToComment(BrowserView): #self.request.response.redirect(aq_parent(aq_inner(context)).absolute_url() + '#comment-' + str(reply_to_comment_id)) # Todo: Temporarily remove the "#comment-" to fix a bug # in CMFPlone/skins/plone_ecmascript/form_tabbing.js - self.request.response.redirect(aq_parent(aq_inner(context)).absolute_url() + '#' + str(reply_to_comment_id)) - -class DeleteComment(BrowserView): - """Delete a comment from a conversation - """ - - def __call__(self): - - context = aq_inner(self.context) - comment_id = self.context.id - - conversation = aq_parent(context) - - del conversation[comment_id] - - # Todo: i18n - IStatusMessage(self.request).addStatusMessage( - _('Comment %s deleted' % comment_id), - type="info") - return context.REQUEST.RESPONSE.redirect(context.REQUEST.HTTP_REFERER) - -class PublishComment(BrowserView): - """Publish a comment - """ - - def __call__(self): - - comment = aq_inner(self.context) - comment_id = self.context.id - - workflow_action = self.request.form['workflow_action'] - portal_workflow = getToolByName(comment, 'portal_workflow') - portal_workflow.doActionFor(comment, workflow_action) - - # Todo: i18n - IStatusMessage(self.request).addStatusMessage( - _('Workflow action for commment %s changed (%s)' % (comment_id, workflow_action)), - type="info") - return self.context.REQUEST.RESPONSE.redirect(self.context.REQUEST.HTTP_REFERER) + self.request.response.redirect(aq_parent(aq_inner(context)).absolute_url() + '#' + str(reply_to_comment_id)) \ No newline at end of file diff --git a/plone/app/discussion/browser/configure.zcml b/plone/app/discussion/browser/configure.zcml index 98bca4d..972b37a 100644 --- a/plone/app/discussion/browser/configure.zcml +++ b/plone/app/discussion/browser/configure.zcml @@ -17,12 +17,21 @@ permission="cmf.ManagePortal" /> + + + @@ -31,7 +40,7 @@ for="plone.app.discussion.interfaces.IComment" name="moderate-publish-comment" layer="..interfaces.IDiscussionLayer" - class=".comments.PublishComment" + class=".moderation.PublishComment" permission="plone.app.discussion.ReviewComments" /> diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt index 61d6e73..8bb8927 100644 --- a/plone/app/discussion/browser/moderation.pt +++ b/plone/app/discussion/browser/moderation.pt @@ -35,61 +35,56 @@ + tal:define="items view/comments">

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. -

- - - +
+ + +
@@ -152,7 +147,7 @@ style="display: inline" tal:attributes="action string:${item/getURL}/@@moderate-publish-comment"> - +