Refactoring, commentaires.
[Plinn.git] / profiles / photo / workflows / folder_workflow / definition.xml
1 <?xml version="1.0"?>
2 <dc-workflow workflow_id="folder_workflow"
3 title="Plinn folder workflow" description=""
4 state_variable="review_state"
5 initial_state="private" manager_bypass="0">
6
7 <permission>Manage properties</permission>
8 <permission>Modify portal content</permission>
9 <permission>View</permission>
10 <state state_id="pending" title="">
11 <exit-transition transition_id="publish"/>
12 <exit-transition transition_id="reject"/>
13 <exit-transition transition_id="retract"/>
14 <permission-map name="Manage properties" acquired="False">
15 <permission-role>Manager</permission-role>
16 <permission-role>Reviewer</permission-role>
17 </permission-map>
18 <permission-map name="Modify portal content"
19 acquired="False">
20 <permission-role>Manager</permission-role>
21 <permission-role>Reviewer</permission-role>
22 </permission-map>
23 <permission-map name="View" acquired="False">
24 <permission-role>Contributor</permission-role>
25 <permission-role>Manager</permission-role>
26 <permission-role>Owner</permission-role>
27 <permission-role>Reader</permission-role>
28 <permission-role>Reviewer</permission-role>
29 </permission-map>
30 </state>
31 <state state_id="private" title="">
32 <exit-transition transition_id="direct_publish"/>
33 <exit-transition transition_id="submit"/>
34 <permission-map name="Manage properties" acquired="False">
35 <permission-role>Contributor</permission-role>
36 <permission-role>Manager</permission-role>
37 <permission-role>Owner</permission-role>
38 </permission-map>
39 <permission-map name="Modify portal content"
40 acquired="False">
41 <permission-role>Contributor</permission-role>
42 <permission-role>Manager</permission-role>
43 <permission-role>Owner</permission-role>
44 </permission-map>
45 <permission-map name="View" acquired="False">
46 <permission-role>Contributor</permission-role>
47 <permission-role>Manager</permission-role>
48 <permission-role>Owner</permission-role>
49 <permission-role>Reader</permission-role>
50 </permission-map>
51 </state>
52 <state state_id="published" title="">
53 <exit-transition transition_id="reject"/>
54 <exit-transition transition_id="retract"/>
55 <permission-map name="Manage properties" acquired="False">
56 <permission-role>Manager</permission-role>
57 </permission-map>
58 <permission-map name="Modify portal content"
59 acquired="False">
60 <permission-role>Manager</permission-role>
61 </permission-map>
62 <permission-map name="View" acquired="True">
63 <permission-role>Anonymous</permission-role>
64 </permission-map>
65 </state>
66 <transition transition_id="direct_publish"
67 title="Reviewer publishes content"
68 new_state="published" trigger="USER"
69 before_script="" after_script="">
70 <description>Reviewer can directly publish content if he have de Owner role (not necessarily ownership)</description>
71 <action url="%(content_url)s/content_publish_form?direct:boolean=True"
72 category="workflow">Publish</action>
73 <guard>
74 <guard-permission>Review portal content</guard-permission>
75 <guard-expression>python:user.allowed(here, ['Owner'])</guard-expression>
76 </guard>
77 </transition>
78 <transition transition_id="publish"
79 title="Reviewer publishes content"
80 new_state="published" trigger="USER"
81 before_script="" after_script="">
82 <action url="%(content_url)s/content_publish_form"
83 category="workflow">Publish</action>
84 <guard>
85 <guard-permission>Review portal content</guard-permission>
86 </guard>
87 </transition>
88 <transition transition_id="reject"
89 title="Reviewer rejects submission"
90 new_state="private" trigger="USER"
91 before_script="" after_script="">
92 <action url="%(content_url)s/content_reject_form"
93 category="workflow">Reject</action>
94 <guard>
95 <guard-permission>Review portal content</guard-permission>
96 </guard>
97 </transition>
98 <transition transition_id="retract"
99 title="Member retracts submission"
100 new_state="private" trigger="USER"
101 before_script="" after_script="">
102 <action url="%(content_url)s/content_retract_form"
103 category="workflow">Retract</action>
104 <guard>
105 <guard-permission>Request review</guard-permission>
106 <guard-expression>python:not(here.portal_membership.checkPermission('Review portal content', here))</guard-expression>
107 </guard>
108 </transition>
109 <transition transition_id="submit"
110 title="Member requests publishing"
111 new_state="pending" trigger="USER"
112 before_script="" after_script="">
113 <action url="%(content_url)s/content_submit_form"
114 category="workflow">Submit</action>
115 <guard>
116 <guard-permission>Request review</guard-permission>
117 </guard>
118 </transition>
119 <variable variable_id="action" for_catalog="False"
120 for_status="True" update_always="True">
121 <description>The last transition</description>
122 <default>
123
124 <expression>transition/getId|nothing</expression>
125 </default>
126 <guard>
127 </guard>
128 </variable>
129 <variable variable_id="actor" for_catalog="False"
130 for_status="True" update_always="True">
131 <description>The ID of the user who performed the last transition</description>
132 <default>
133
134 <expression>user/getId</expression>
135 </default>
136 <guard>
137 </guard>
138 </variable>
139 <variable variable_id="comments" for_catalog="False"
140 for_status="True" update_always="True">
141 <description>Comments about the last transition</description>
142 <default>
143
144 <expression>python:state_change.kwargs.get('comment', '')</expression>
145 </default>
146 <guard>
147 </guard>
148 </variable>
149 <variable variable_id="email_sent" for_catalog="False"
150 for_status="True" update_always="True">
151 <default>
152
153 <expression>python:scripts.sendNotificationEmail(state_change) or state_change.kwargs.get('email_sent', [])</expression>
154 </default>
155 <guard>
156 </guard>
157 </variable>
158 <variable variable_id="review_history" for_catalog="False"
159 for_status="False" update_always="False">
160 <description>Provides access to workflow history</description>
161 <default>
162
163 <expression>state_change/getHistory</expression>
164 </default>
165 <guard>
166 <guard-permission>Request review</guard-permission>
167 <guard-permission>Review portal content</guard-permission>
168 </guard>
169 </variable>
170 <variable variable_id="time" for_catalog="False"
171 for_status="True" update_always="True">
172 <description>Time of the last transition</description>
173 <default>
174
175 <expression>state_change/getDateTime</expression>
176 </default>
177 <guard>
178 </guard>
179 </variable>
180 <script script_id="sendNotificationEmail"
181 type="Script (Python)"
182 filename="workflows/folder_workflow/scripts/sendNotificationEmail.py"
183 module="" function=""/>
184 </dc-workflow>