add delete and workflow actions buttons to comments viewlet.

svn path=/plone.app.discussion/trunk/; revision=27384
This commit is contained in:
Timo Stollenwerk 2009-06-11 13:51:33 +00:00
parent 7692186880
commit dd0133e0c0
3 changed files with 50 additions and 0 deletions

View File

@ -83,6 +83,35 @@
This is the body text of the comment.
</div>
<form name="delete"
action=""
method="post"
style="display: inline;"
tal:condition="view/can_manage"
tal:attributes="action string:${reply/absolute_url}/@@moderate-delete-comment">
<input class="destructive"
type="submit"
value="Remove"
i18n:attributes="value label_remove;"
/>
</form>
<!-- Workflow actions (e.g. 'publish') -->
<!--
<form name=""
action=""
method="get"
style="display: inline;"
tal:repeat="action reply_dict/actions"
tal:attributes="action string:${reply/absolute_url}/content_status_modify;
name action/id">
<input type="hidden" name="workflow_action" tal:attributes="value action/id" />
<input class="context"
type="submit"
tal:attributes="value action/title"
/>
</form>-->
<a href="#" class="reply-to-comment-button" title="reply to this comment"
tal:condition="python:userHasReplyPermission and isDiscussionAllowed"
tal:attributes="onclick string:createReplyToCommentForm(${reply/id});

View File

@ -53,6 +53,9 @@ class CommentsViewlet(ViewletBase):
def can_reply(self):
return getSecurityManager().checkPermission('Reply to item', aq_inner(self.context))
def can_manage(self):
return getSecurityManager().checkPermission('Manage portal', aq_inner(self.context))
def is_discussion_allowed(self):
conversation = conversationAdapterFactory(self.context)
return conversation.enabled

View File

@ -17,6 +17,24 @@
permission="cmf.ManagePortal"
/>
<!-- Delete comment view -->
<browser:view
for="plone.app.discussion.interfaces.IComment"
name="moderate-delete-comment"
layer="..interfaces.IDiscussionLayer"
class=".comments.DeleteComment"
permission="cmf.ManagePortal"
/>
<!-- Publish comment view -->
<browser:view
for="plone.app.discussion.interfaces.IComment"
name="moderate-publish-comment"
layer="..interfaces.IDiscussionLayer"
class=".comments.PublishComment"
permission="cmf.ManagePortal"
/>
<!-- Comments viewlet -->
<browser:viewlet
name="plone.comments"