Skip to content

Commit

Permalink
add delete and workflow actions buttons to comments viewlet.
Browse files Browse the repository at this point in the history
svn path=/plone.app.discussion/trunk/; revision=27384
  • Loading branch information
Timo Stollenwerk committed Jun 11, 2009
1 parent 7692186 commit dd0133e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
29 changes: 29 additions & 0 deletions plone/app/discussion/browser/comments.pt
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
3 changes: 3 additions & 0 deletions plone/app/discussion/browser/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def update(self):
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
Expand Down
18 changes: 18 additions & 0 deletions plone/app/discussion/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit dd0133e

Please sign in to comment.