From c55316d21245176673ff97d0373b13dff2ef0ed0 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 8 Jun 2009 21:16:51 +0000 Subject: [PATCH] comment_review_workflow added. svn path=/plone.app.discussion/trunk/; revision=27361 --- plone/app/discussion/configure.zcml | 3 + plone/app/discussion/permissions.zcml | 5 + .../discussion/profiles/default/rolemap.xml | 9 ++ .../discussion/profiles/default/workflows.xml | 9 ++ .../comment_review_workflow/definition.xml | 134 ++++++++++++++++++ plone/app/discussion/tests/test_workflow.py | 22 +++ 6 files changed, 182 insertions(+) create mode 100644 plone/app/discussion/profiles/default/rolemap.xml create mode 100644 plone/app/discussion/profiles/default/workflows.xml create mode 100644 plone/app/discussion/profiles/default/workflows/comment_review_workflow/definition.xml create mode 100644 plone/app/discussion/tests/test_workflow.py diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index 89fc5c5..5821612 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -3,6 +3,9 @@ xmlns:genericsetup="http://namespaces.zope.org/genericsetup" i18n_domain="plone.app.discussion"> + + + diff --git a/plone/app/discussion/permissions.zcml b/plone/app/discussion/permissions.zcml index bfd6c8f..e37f758 100644 --- a/plone/app/discussion/permissions.zcml +++ b/plone/app/discussion/permissions.zcml @@ -6,4 +6,9 @@ + + diff --git a/plone/app/discussion/profiles/default/rolemap.xml b/plone/app/discussion/profiles/default/rolemap.xml new file mode 100644 index 0000000..9ccf86d --- /dev/null +++ b/plone/app/discussion/profiles/default/rolemap.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/plone/app/discussion/profiles/default/workflows.xml b/plone/app/discussion/profiles/default/workflows.xml new file mode 100644 index 0000000..22e5237 --- /dev/null +++ b/plone/app/discussion/profiles/default/workflows.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/plone/app/discussion/profiles/default/workflows/comment_review_workflow/definition.xml b/plone/app/discussion/profiles/default/workflows/comment_review_workflow/definition.xml new file mode 100644 index 0000000..cdad5f6 --- /dev/null +++ b/plone/app/discussion/profiles/default/workflows/comment_review_workflow/definition.xml @@ -0,0 +1,134 @@ + + + + Access contents information + Modify portal content + View + Reply to item + + + + + Submitted, pending review. + + + Manager + Owner + Reviewer + + + Manager + Owner + Reviewer + + + Manager + Owner + Reviewer + + + + + + + + Visible to everyone, non-editable. + + + Anonymous + + + Manager + + + Anonymous + + + + + + + + Publishing the comment makes it visible to other users. + + Publish + + Review comments + + + + + Previous transition + + + transition/getId|nothing + + + + + + + The ID of the user who performed the previous transition + + + + user/getUserName + + + + + + + Comment about the last transition + + + + python:state_change.kwargs.get('comment', '') + + + + + + + Provides access to workflow history + + + + state_change/getHistory + + + Request review + Review portal content + + + + + When the previous transition was performed + + + + state_change/getDateTime + + + + + + diff --git a/plone/app/discussion/tests/test_workflow.py b/plone/app/discussion/tests/test_workflow.py new file mode 100644 index 0000000..c3de350 --- /dev/null +++ b/plone/app/discussion/tests/test_workflow.py @@ -0,0 +1,22 @@ +import unittest + +from Products.PloneTestCase.ptc import PloneTestCase +from plone.app.discussion.tests.layer import DiscussionLayer + +class WorkflowTest(PloneTestCase): + + layer = DiscussionLayer + + def test_permission(self): + self.setRoles(('Reviewer',)) + self.failUnless(self.portal.portal_membership.checkPermission('Review comments', self.folder), self.folder) + self.setRoles(('Member',)) + self.failIf(self.portal.portal_membership.checkPermission('Review comments', self.folder), self.folder) + + def test_workflows_installed(self): + self.failUnless('comment_review_workflow' in self.portal.portal_workflow.objectIds()) + self.assertEquals(('one_state_workflow',), + self.portal.portal_workflow.getChainForPortalType('Discussion Item')) + +def test_suite(): + return unittest.defaultTestLoader.loadTestsFromName(__name__) \ No newline at end of file