Show "moderate comments" link in the admin panel only if a moderation workflow is enabled for comments.
svn path=/plone.app.discussion/trunk/; revision=46206
This commit is contained in:
parent
6e354718f4
commit
583b25530e
@ -4,6 +4,10 @@ Changelog
|
|||||||
1.0RC1 (unreleased)
|
1.0RC1 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- Show "moderate comments" link in the admin panel only if a moderation
|
||||||
|
workflow is enabled for comments.
|
||||||
|
[timo]
|
||||||
|
|
||||||
- Do not allow to change the mail settings in the discussion control panel, if
|
- Do not allow to change the mail settings in the discussion control panel, if
|
||||||
there is no valid mail setup.
|
there is no valid mail setup.
|
||||||
[timo]
|
[timo]
|
||||||
|
@ -54,6 +54,23 @@
|
|||||||
permission="plone.app.discussion.ReviewComments"
|
permission="plone.app.discussion.ReviewComments"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Moderate comments enabled view -->
|
||||||
|
<browser:page
|
||||||
|
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
|
||||||
|
name="moderate-comments-enabled"
|
||||||
|
layer="..interfaces.IDiscussionLayer"
|
||||||
|
class=".moderation.ModerateCommentsEnabled"
|
||||||
|
permission="zope2.View"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<browser:page
|
||||||
|
for="plone.app.layout.navigation.interfaces.INavigationRoot"
|
||||||
|
name="moderate-comments-enabled"
|
||||||
|
layer="..interfaces.IDiscussionLayer"
|
||||||
|
class=".moderation.ModerateCommentsEnabled"
|
||||||
|
permission="zope2.View"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Delete comment view -->
|
<!-- Delete comment view -->
|
||||||
<browser:page
|
<browser:page
|
||||||
for="plone.app.discussion.interfaces.IComment"
|
for="plone.app.discussion.interfaces.IComment"
|
||||||
|
@ -75,6 +75,23 @@ class View(BrowserView):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class ModerateCommentsEnabled(BrowserView):
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
"""Returns true if a 'review workflow' is enabled on 'Discussion Item'
|
||||||
|
content type. A 'review workflow' is characterized by implementing
|
||||||
|
a 'pending' workflow state.
|
||||||
|
"""
|
||||||
|
context = aq_inner(self.context)
|
||||||
|
wf_tool = getToolByName(context, 'portal_workflow', None)
|
||||||
|
comment_workflow = wf_tool.getChainForPortalType('Discussion Item')[0]
|
||||||
|
comment_workflow = wf_tool[comment_workflow]
|
||||||
|
if 'pending' in comment_workflow.states:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class DeleteComment(BrowserView):
|
class DeleteComment(BrowserView):
|
||||||
"""Delete a comment from a conversation.
|
"""Delete a comment from a conversation.
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<property name="description" i18n:translate=""></property>
|
<property name="description" i18n:translate=""></property>
|
||||||
<property name="url_expr">string:${globals_view/navigationRootUrl}/@@moderate-comments</property>
|
<property name="url_expr">string:${globals_view/navigationRootUrl}/@@moderate-comments</property>
|
||||||
<property name="icon_expr"></property>
|
<property name="icon_expr"></property>
|
||||||
<property name="available_expr"></property>
|
<property name="available_expr">portal/@@moderate-comments-enabled|nothing</property>
|
||||||
<property name="permissions">
|
<property name="permissions">
|
||||||
<element value="Review comments"/>
|
<element value="Review comments"/>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user