add workflow buttons to comments viewlet (not working yet).

svn path=/plone.app.discussion/trunk/; revision=27408
This commit is contained in:
Timo Stollenwerk 2009-06-13 17:33:48 +00:00
parent 8fb254f73d
commit 22f50532ff
2 changed files with 11 additions and 7 deletions

View File

@ -98,12 +98,11 @@
</form> </form>
<!-- Workflow actions (e.g. 'publish') --> <!-- Workflow actions (e.g. 'publish') -->
<!--
<form name="" <form name=""
action="" action=""
method="get" method="get"
style="display: inline;" style="display: inline;"
tal:repeat="action python:view.get_workflow_actions(reply)" tal:repeat="action reply_dict/actions"
tal:attributes="action string:${reply/absolute_url}/content_status_modify; tal:attributes="action string:${reply/absolute_url}/content_status_modify;
name action/id"> name action/id">
<input type="hidden" name="workflow_action" tal:attributes="value action/id" /> <input type="hidden" name="workflow_action" tal:attributes="value action/id" />
@ -111,7 +110,7 @@
type="submit" type="submit"
tal:attributes="value action/title" tal:attributes="value action/title"
/> />
</form>--> </form>
<a href="#" class="reply-to-comment-button" title="reply to this comment" <a href="#" class="reply-to-comment-button" title="reply to this comment"
tal:condition="python:userHasReplyPermission and isDiscussionAllowed" tal:condition="python:userHasReplyPermission and isDiscussionAllowed"

View File

@ -76,12 +76,17 @@ class CommentsViewlet(ViewletBase):
for r in conversation.getThreads(): for r in conversation.getThreads():
comment_obj = r['comment'] comment_obj = r['comment']
actions = wf.listActionInfos(object=comment_obj) # list all possible workflow actions
return conversation.getThreads() actions = [a for a in wf.listActionInfos(object=comment_obj)
if a['category'] == 'workflow' and a['allowed']]
print actions
r = r.copy()
r['actions'] = actions
yield r
else: else:
return conversation.getThreads() yield conversation.getThreads()
else: else:
return [] yield []
def get_commenter_home_url(self, username): def get_commenter_home_url(self, username):
if username is None: if username is None: