1 | #-*- mode: python; mode: fold -*- |
---|
2 | """ WAeUP Workflfow |
---|
3 | """ |
---|
4 | |
---|
5 | __author__ = "Joachim Schmitz <js@aixtraware.de>" |
---|
6 | |
---|
7 | import os, sys |
---|
8 | from zLOG import LOG, INFO, DEBUG |
---|
9 | |
---|
10 | from Products.CMFCore.permissions import View, ModifyPortalContent |
---|
11 | #from Products.WAeUP.permissions import |
---|
12 | |
---|
13 | from Products.CPSWorkflow.transitions import \ |
---|
14 | TRANSITION_INITIAL_CREATE, \ |
---|
15 | TRANSITION_ALLOWSUB_CHECKOUT, \ |
---|
16 | TRANSITION_ALLOWSUB_CREATE, \ |
---|
17 | TRANSITION_ALLOWSUB_DELETE, \ |
---|
18 | TRANSITION_ALLOWSUB_MOVE, \ |
---|
19 | TRANSITION_ALLOWSUB_COPY |
---|
20 | |
---|
21 | from Products.DCWorkflow.Transitions import \ |
---|
22 | TRIGGER_USER_ACTION |
---|
23 | |
---|
24 | def waeupWorkflowsInstall(self): |
---|
25 | """Install the workflow for the WAeUP Types |
---|
26 | """ |
---|
27 | |
---|
28 | portal = self.portal_url.getPortalObject() |
---|
29 | wftool = portal.portal_workflow |
---|
30 | |
---|
31 | wfids = wftool.objectIds() |
---|
32 | wfid = 'waeup_section_wf' ###( |
---|
33 | |
---|
34 | if wfid in wfids: |
---|
35 | wftool.manage_delObjects([wfid]) |
---|
36 | |
---|
37 | wftool.manage_addWorkflow(id=wfid, |
---|
38 | workflow_type='cps_workflow (Web-configurable workflow for CPS)') |
---|
39 | |
---|
40 | wf = wftool[wfid] |
---|
41 | |
---|
42 | for p in (View, |
---|
43 | ModifyPortalContent, |
---|
44 | ): |
---|
45 | wf.addManagedPermission(p) |
---|
46 | |
---|
47 | ########################################################################### |
---|
48 | ########################################################################### |
---|
49 | |
---|
50 | # STATES |
---|
51 | |
---|
52 | ########################################################################### |
---|
53 | ########################################################################### |
---|
54 | |
---|
55 | for s in ('work', |
---|
56 | ): |
---|
57 | wf.states.addState(s) |
---|
58 | |
---|
59 | ########################################################################## |
---|
60 | # WORK |
---|
61 | ########################################################################## |
---|
62 | |
---|
63 | s = wf.states.get('work') |
---|
64 | |
---|
65 | s.setPermission(View, 1, ('Student',)) |
---|
66 | s.setPermission(ModifyPortalContent, 1, ('StudentManager','UniversityManager',)) |
---|
67 | |
---|
68 | s.setInitialState('work') |
---|
69 | s.setProperties(title='Work', |
---|
70 | description='', |
---|
71 | transitions=('create_content', |
---|
72 | 'cut_copy_paste', |
---|
73 | 'close',),) |
---|
74 | |
---|
75 | ########################################################################## |
---|
76 | # CLOSED ###( |
---|
77 | ########################################################################## |
---|
78 | |
---|
79 | ## s = wf.states.get('closed') |
---|
80 | ## |
---|
81 | ## s.setPermission(View, 1, ('ChatPoster',)) |
---|
82 | ## s.setPermission(ModifyPortalContent, 1, ('ChatModerator',)) |
---|
83 | ## s.setPermission(chatReply, 1, ('ChatModerator',)) |
---|
84 | ## s.setPermission(chatPost, 1, ('ChatModerator',)) |
---|
85 | ## s.setPermission(chatModerate, 1, ('ChatModerator',)) |
---|
86 | |
---|
87 | ## s.setProperties(title='Closed', |
---|
88 | ## description='', |
---|
89 | ## transitions=('unclose', |
---|
90 | ## 'cut_copy_paste',),) |
---|
91 | ## |
---|
92 | ########################################################################### |
---|
93 | ########################################################################### |
---|
94 | ###) |
---|
95 | |
---|
96 | # TRANSITIONS |
---|
97 | |
---|
98 | ########################################################################### |
---|
99 | ########################################################################### |
---|
100 | |
---|
101 | for t in ('create', |
---|
102 | 'create_content', |
---|
103 | 'cut_copy_paste', |
---|
104 | ): |
---|
105 | wf.transitions.addTransition(t) |
---|
106 | |
---|
107 | |
---|
108 | ########################################################################### |
---|
109 | # CREATE |
---|
110 | ########################################################################### |
---|
111 | |
---|
112 | t = wf.transitions.get('create') |
---|
113 | t.setProperties(title='Initial creation', |
---|
114 | description='Intial transition like', |
---|
115 | new_state_id='work', |
---|
116 | transition_behavior=(TRANSITION_INITIAL_CREATE, ), |
---|
117 | clone_allowed_transitions=None, |
---|
118 | actbox_name='', actbox_category='workflow', actbox_url='', |
---|
119 | props={'guard_permissions':'', |
---|
120 | 'guard_roles':'Manager; StudentManager; UniversityManager', |
---|
121 | 'guard_expr':''},) |
---|
122 | |
---|
123 | ########################################################################### |
---|
124 | # CREATE CONTENT |
---|
125 | ########################################################################### |
---|
126 | |
---|
127 | t = wf.transitions.get('create_content') |
---|
128 | t.setProperties(title='Create content', |
---|
129 | description='Allow sub Object Create', |
---|
130 | new_state_id='work', |
---|
131 | transition_behavior=(TRANSITION_ALLOWSUB_CREATE, |
---|
132 | TRANSITION_ALLOWSUB_CHECKOUT,), |
---|
133 | trigger_type=TRIGGER_USER_ACTION, |
---|
134 | actbox_name='New', |
---|
135 | actbox_category='', |
---|
136 | actbox_url='', |
---|
137 | props={'guard_permissions':'', |
---|
138 | 'guard_roles':'Manager; StudentManager ; UniversityManager', |
---|
139 | 'guard_expr':''},) |
---|
140 | |
---|
141 | ########################################################################## |
---|
142 | # CUT/COPY/PASTE |
---|
143 | ########################################################################## |
---|
144 | |
---|
145 | t = wf.transitions.get('cut_copy_paste') |
---|
146 | t.setProperties(title='Cut/Copy/Paste', |
---|
147 | new_state_id='work', |
---|
148 | transition_behavior=(TRANSITION_ALLOWSUB_DELETE, |
---|
149 | TRANSITION_ALLOWSUB_MOVE, |
---|
150 | TRANSITION_ALLOWSUB_COPY), |
---|
151 | clone_allowed_transitions=None, |
---|
152 | trigger_type=TRIGGER_USER_ACTION, |
---|
153 | actbox_name='New', |
---|
154 | actbox_category='', |
---|
155 | actbox_url='', |
---|
156 | props={'guard_permissions':'', |
---|
157 | 'guard_roles':'Manager; StudentManager ; UniversityManager', |
---|
158 | 'guard_expr':''},) |
---|
159 | |
---|
160 | ########################################################################## |
---|
161 | # CLOSE ###( |
---|
162 | ########################################################################## |
---|
163 | |
---|
164 | ## t = wf.transitions.get('close') |
---|
165 | ## t.setProperties(title='close', |
---|
166 | ## new_state_id='closed', |
---|
167 | ## transition_behavior=(), |
---|
168 | ## clone_allowed_transitions=None, |
---|
169 | ## trigger_type=TRIGGER_USER_ACTION, |
---|
170 | ## actbox_name='label_chat_close', |
---|
171 | ## actbox_category='workflow', |
---|
172 | ## actbox_url='%(content_url)s/cps_chat_close', |
---|
173 | ## props={'guard_permissions':'', |
---|
174 | ## 'guard_roles':'Manager; SectionManager; SectionReviewer', |
---|
175 | ## 'guard_expr':''},) |
---|
176 | ## |
---|
177 | ## ########################################################################## |
---|
178 | ## # UNCLOSE |
---|
179 | ## ########################################################################## |
---|
180 | ## |
---|
181 | ## t = wf.transitions.get('unclose') |
---|
182 | ## t.setProperties(title='unclose', |
---|
183 | ## new_state_id='work', |
---|
184 | ## transition_behavior=(), |
---|
185 | ## clone_allowed_transitions=None, |
---|
186 | ## trigger_type=TRIGGER_USER_ACTION, |
---|
187 | ## actbox_name='label_chat_unclose', |
---|
188 | ## actbox_category='workflow', |
---|
189 | ## actbox_url='%(content_url)s/cps_chat_unclose', |
---|
190 | ## props={'guard_permissions':'', |
---|
191 | ## 'guard_roles':'Manager; SectionManager; SectionReviewer', |
---|
192 | ## 'guard_expr':''},) |
---|
193 | |
---|
194 | ###) |
---|
195 | |
---|
196 | ################################################################ |
---|
197 | # VARIABLES |
---|
198 | ################################################################ |
---|
199 | |
---|
200 | for v in ('action', |
---|
201 | 'actor', |
---|
202 | 'comments', |
---|
203 | 'review_history', |
---|
204 | 'time', |
---|
205 | 'dest_container', |
---|
206 | ): |
---|
207 | wf.variables.addVariable(v) |
---|
208 | |
---|
209 | |
---|
210 | wf.variables.setStateVar('review_state') |
---|
211 | |
---|
212 | vdef = wf.variables['action'] |
---|
213 | vdef.setProperties(description='The last transition', |
---|
214 | default_expr='transition/getId|nothing', |
---|
215 | for_status=1, update_always=1) |
---|
216 | |
---|
217 | vdef = wf.variables['actor'] |
---|
218 | vdef.setProperties(description='The ID of the user who performed ' |
---|
219 | 'the last transition', |
---|
220 | default_expr='user/getId', |
---|
221 | for_status=1, update_always=1) |
---|
222 | |
---|
223 | vdef = wf.variables['comments'] |
---|
224 | vdef.setProperties(description='Comments about the last transition', |
---|
225 | default_expr="python:state_change.kwargs.get('comment', '')", |
---|
226 | for_status=1, update_always=1) |
---|
227 | |
---|
228 | vdef = wf.variables['review_history'] |
---|
229 | vdef.setProperties(description='Provides access to workflow history', |
---|
230 | default_expr="state_change/getHistory", |
---|
231 | props={'guard_permissions':'', |
---|
232 | 'guard_roles':'Manager; WorkspaceManager; WorkspaceMember; WorkspaceReader; Member', |
---|
233 | 'guard_expr':''}) |
---|
234 | |
---|
235 | vdef = wf.variables['time'] |
---|
236 | vdef.setProperties(description='Time of the last transition', |
---|
237 | default_expr="state_change/getDateTime", |
---|
238 | for_status=1, update_always=1) |
---|
239 | |
---|
240 | vdef = wf.variables['dest_container'] |
---|
241 | vdef.setProperties(description='Destination container for the last paste/publish', |
---|
242 | default_expr="python:state_change.kwargs.get('dest_container', '')", |
---|
243 | for_status=1, update_always=1) |
---|
244 | |
---|
245 | |
---|
246 | ###################################################################################### |
---|
247 | ###################################################################################### |
---|
248 | ###) |
---|
249 | |
---|
250 | wfid = 'waeup_student_wf' ###( |
---|
251 | |
---|
252 | if wfid in wfids: |
---|
253 | wftool.manage_delObjects([wfid]) |
---|
254 | |
---|
255 | wftool.manage_addWorkflow(id=wfid, |
---|
256 | workflow_type='cps_workflow (Web-configurable workflow for CPS)') |
---|
257 | |
---|
258 | wf = wftool[wfid] |
---|
259 | |
---|
260 | for p in (View, |
---|
261 | ModifyPortalContent, |
---|
262 | ): |
---|
263 | wf.addManagedPermission(p) |
---|
264 | |
---|
265 | ########################################################################### |
---|
266 | ########################################################################### |
---|
267 | |
---|
268 | # STATES |
---|
269 | |
---|
270 | ########################################################################### |
---|
271 | ########################################################################### |
---|
272 | |
---|
273 | for s in ('work', |
---|
274 | ): |
---|
275 | wf.states.addState(s) |
---|
276 | |
---|
277 | ########################################################################## |
---|
278 | # WORK |
---|
279 | ########################################################################## |
---|
280 | |
---|
281 | s = wf.states.get('work') |
---|
282 | |
---|
283 | s.setPermission(View, 1, ('Student',)) |
---|
284 | s.setPermission(ModifyPortalContent, 1, ('StudentManager','UniversityManager','Student')) |
---|
285 | |
---|
286 | s.setInitialState('work') |
---|
287 | s.setProperties(title='Work', |
---|
288 | description='', |
---|
289 | transitions=('create_content', |
---|
290 | 'cut_copy_paste', |
---|
291 | 'close',),) |
---|
292 | |
---|
293 | ########################################################################## |
---|
294 | # CLOSED ###( |
---|
295 | ########################################################################## |
---|
296 | |
---|
297 | ## s = wf.states.get('closed') |
---|
298 | ## |
---|
299 | ## s.setPermission(View, 1, ('ChatPoster',)) |
---|
300 | ## s.setPermission(ModifyPortalContent, 1, ('ChatModerator',)) |
---|
301 | ## s.setPermission(chatReply, 1, ('ChatModerator',)) |
---|
302 | ## s.setPermission(chatPost, 1, ('ChatModerator',)) |
---|
303 | ## s.setPermission(chatModerate, 1, ('ChatModerator',)) |
---|
304 | |
---|
305 | ## s.setProperties(title='Closed', |
---|
306 | ## description='', |
---|
307 | ## transitions=('unclose', |
---|
308 | ## 'cut_copy_paste',),) |
---|
309 | ## |
---|
310 | ########################################################################### |
---|
311 | ########################################################################### |
---|
312 | ###) |
---|
313 | |
---|
314 | |
---|
315 | # TRANSITIONS |
---|
316 | |
---|
317 | ########################################################################### |
---|
318 | ########################################################################### |
---|
319 | |
---|
320 | for t in ('create', |
---|
321 | 'create_content', |
---|
322 | 'cut_copy_paste', |
---|
323 | ): |
---|
324 | wf.transitions.addTransition(t) |
---|
325 | |
---|
326 | |
---|
327 | ########################################################################### |
---|
328 | # CREATE |
---|
329 | ########################################################################### |
---|
330 | |
---|
331 | t = wf.transitions.get('create') |
---|
332 | t.setProperties(title='Initial creation', |
---|
333 | description='Intial transition like', |
---|
334 | new_state_id='work', |
---|
335 | transition_behavior=(TRANSITION_INITIAL_CREATE, ), |
---|
336 | clone_allowed_transitions=None, |
---|
337 | actbox_name='', actbox_category='workflow', actbox_url='', |
---|
338 | props={'guard_permissions':'', |
---|
339 | 'guard_roles':'Manager; StudentManager; UniversityManager; Student', |
---|
340 | 'guard_expr':''},) |
---|
341 | |
---|
342 | ########################################################################### |
---|
343 | # CREATE CONTENT |
---|
344 | ########################################################################### |
---|
345 | |
---|
346 | t = wf.transitions.get('create_content') |
---|
347 | t.setProperties(title='Create content', |
---|
348 | description='Allow sub Object Create', |
---|
349 | new_state_id='work', |
---|
350 | transition_behavior=(TRANSITION_ALLOWSUB_CREATE, |
---|
351 | TRANSITION_ALLOWSUB_CHECKOUT,), |
---|
352 | trigger_type=TRIGGER_USER_ACTION, |
---|
353 | actbox_name='New', |
---|
354 | actbox_category='', |
---|
355 | actbox_url='', |
---|
356 | props={'guard_permissions':'', |
---|
357 | 'guard_roles':'Manager; StudentManager ; UniversityManager; Student', |
---|
358 | 'guard_expr':''},) |
---|
359 | |
---|
360 | ########################################################################## |
---|
361 | # CUT/COPY/PASTE |
---|
362 | ########################################################################## |
---|
363 | |
---|
364 | t = wf.transitions.get('cut_copy_paste') |
---|
365 | t.setProperties(title='Cut/Copy/Paste', |
---|
366 | new_state_id='work', |
---|
367 | transition_behavior=(TRANSITION_ALLOWSUB_DELETE, |
---|
368 | TRANSITION_ALLOWSUB_MOVE, |
---|
369 | TRANSITION_ALLOWSUB_COPY), |
---|
370 | clone_allowed_transitions=None, |
---|
371 | trigger_type=TRIGGER_USER_ACTION, |
---|
372 | actbox_name='New', |
---|
373 | actbox_category='', |
---|
374 | actbox_url='', |
---|
375 | props={'guard_permissions':'', |
---|
376 | 'guard_roles':'Manager; StudentManager ; UniversityManager', |
---|
377 | 'guard_expr':''},) |
---|
378 | |
---|
379 | ########################################################################## |
---|
380 | # CLOSE ###( |
---|
381 | ########################################################################## |
---|
382 | |
---|
383 | ## t = wf.transitions.get('close') |
---|
384 | ## t.setProperties(title='close', |
---|
385 | ## new_state_id='closed', |
---|
386 | ## transition_behavior=(), |
---|
387 | ## clone_allowed_transitions=None, |
---|
388 | ## trigger_type=TRIGGER_USER_ACTION, |
---|
389 | ## actbox_name='label_chat_close', |
---|
390 | ## actbox_category='workflow', |
---|
391 | ## actbox_url='%(content_url)s/cps_chat_close', |
---|
392 | ## props={'guard_permissions':'', |
---|
393 | ## 'guard_roles':'Manager; SectionManager; SectionReviewer', |
---|
394 | ## 'guard_expr':''},) |
---|
395 | ## |
---|
396 | ## ########################################################################## |
---|
397 | ## # UNCLOSE |
---|
398 | ## ########################################################################## |
---|
399 | ## |
---|
400 | ## t = wf.transitions.get('unclose') |
---|
401 | ## t.setProperties(title='unclose', |
---|
402 | ## new_state_id='work', |
---|
403 | ## transition_behavior=(), |
---|
404 | ## clone_allowed_transitions=None, |
---|
405 | ## trigger_type=TRIGGER_USER_ACTION, |
---|
406 | ## actbox_name='label_chat_unclose', |
---|
407 | ## actbox_category='workflow', |
---|
408 | ## actbox_url='%(content_url)s/cps_chat_unclose', |
---|
409 | ## props={'guard_permissions':'', |
---|
410 | ## 'guard_roles':'Manager; SectionManager; SectionReviewer', |
---|
411 | ## 'guard_expr':''},) |
---|
412 | |
---|
413 | ###) |
---|
414 | |
---|
415 | ################################################################ |
---|
416 | # VARIABLES |
---|
417 | ################################################################ |
---|
418 | |
---|
419 | for v in ('action', |
---|
420 | 'actor', |
---|
421 | 'comments', |
---|
422 | 'review_history', |
---|
423 | 'time', |
---|
424 | 'dest_container', |
---|
425 | ): |
---|
426 | wf.variables.addVariable(v) |
---|
427 | |
---|
428 | |
---|
429 | wf.variables.setStateVar('review_state') |
---|
430 | |
---|
431 | vdef = wf.variables['action'] |
---|
432 | vdef.setProperties(description='The last transition', |
---|
433 | default_expr='transition/getId|nothing', |
---|
434 | for_status=1, update_always=1) |
---|
435 | |
---|
436 | vdef = wf.variables['actor'] |
---|
437 | vdef.setProperties(description='The ID of the user who performed ' |
---|
438 | 'the last transition', |
---|
439 | default_expr='user/getId', |
---|
440 | for_status=1, update_always=1) |
---|
441 | |
---|
442 | vdef = wf.variables['comments'] |
---|
443 | vdef.setProperties(description='Comments about the last transition', |
---|
444 | default_expr="python:state_change.kwargs.get('comment', '')", |
---|
445 | for_status=1, update_always=1) |
---|
446 | |
---|
447 | vdef = wf.variables['review_history'] |
---|
448 | vdef.setProperties(description='Provides access to workflow history', |
---|
449 | default_expr="state_change/getHistory", |
---|
450 | props={'guard_permissions':'', |
---|
451 | 'guard_roles':'Manager; WorkspaceManager; WorkspaceMember; WorkspaceReader; Member', |
---|
452 | 'guard_expr':''}) |
---|
453 | |
---|
454 | vdef = wf.variables['time'] |
---|
455 | vdef.setProperties(description='Time of the last transition', |
---|
456 | default_expr="state_change/getDateTime", |
---|
457 | for_status=1, update_always=1) |
---|
458 | |
---|
459 | vdef = wf.variables['dest_container'] |
---|
460 | vdef.setProperties(description='Destination container for the last paste/publish', |
---|
461 | default_expr="python:state_change.kwargs.get('dest_container', '')", |
---|
462 | for_status=1, update_always=1) |
---|
463 | |
---|
464 | |
---|
465 | ###################################################################################### |
---|
466 | ###################################################################################### |
---|
467 | ###) |
---|
468 | |
---|
469 | wfid = 'waeup_workspace_wf' ###( |
---|
470 | |
---|
471 | if wfid in wfids: |
---|
472 | wftool.manage_delObjects([wfid]) |
---|
473 | |
---|
474 | wftool.manage_addWorkflow(id=wfid, |
---|
475 | workflow_type='cps_workflow (Web-configurable workflow for CPS)') |
---|
476 | |
---|
477 | wf = wftool[wfid] |
---|
478 | |
---|
479 | for p in (View, |
---|
480 | ModifyPortalContent, |
---|
481 | ): |
---|
482 | wf.addManagedPermission(p) |
---|
483 | |
---|
484 | ########################################################################### |
---|
485 | ########################################################################### |
---|
486 | |
---|
487 | # STATES |
---|
488 | |
---|
489 | ########################################################################### |
---|
490 | ########################################################################### |
---|
491 | |
---|
492 | for s in ('work', |
---|
493 | 'closed'): |
---|
494 | wf.states.addState(s) |
---|
495 | |
---|
496 | ########################################################################## |
---|
497 | # WORK |
---|
498 | ########################################################################## |
---|
499 | |
---|
500 | s = wf.states.get('work') |
---|
501 | |
---|
502 | ## s.setPermission(View, 1, ('ChatPoster',)) |
---|
503 | ## s.setPermission(ModifyPortalContent, 1, ('ChatModerator',)) |
---|
504 | ## s.setPermission(chatReply, 1, ('ChatModerator', 'ChatGuest',)) |
---|
505 | ## s.setPermission(chatPost, 1, ('ChatModerator', 'ChatPoster', 'ChatGuest',)) |
---|
506 | ## s.setPermission(chatModerate, 1, ('ChatModerator',)) |
---|
507 | |
---|
508 | s.setInitialState('work') |
---|
509 | s.setProperties(title='Work', |
---|
510 | description='', |
---|
511 | transitions=('create_content', |
---|
512 | 'cut_copy_paste', |
---|
513 | 'close',),) |
---|
514 | |
---|
515 | |
---|
516 | ########################################################################## |
---|
517 | # CLOSED |
---|
518 | ########################################################################## |
---|
519 | |
---|
520 | s = wf.states.get('closed') |
---|
521 | |
---|
522 | ## s.setPermission(View, 1, ('ChatPoster',)) |
---|
523 | ## s.setPermission(ModifyPortalContent, 1, ('ChatModerator',)) |
---|
524 | ## s.setPermission(chatReply, 1, ('ChatModerator',)) |
---|
525 | ## s.setPermission(chatPost, 1, ('ChatModerator',)) |
---|
526 | ## s.setPermission(chatModerate, 1, ('ChatModerator',)) |
---|
527 | |
---|
528 | s.setProperties(title='Closed', |
---|
529 | description='', |
---|
530 | transitions=('unclose', |
---|
531 | 'cut_copy_paste',),) |
---|
532 | |
---|
533 | ########################################################################### |
---|
534 | ########################################################################### |
---|
535 | |
---|
536 | # TRANSITIONS |
---|
537 | |
---|
538 | ########################################################################### |
---|
539 | ########################################################################### |
---|
540 | |
---|
541 | for t in ('create', |
---|
542 | 'create_content', |
---|
543 | 'cut_copy_paste', |
---|
544 | 'close', |
---|
545 | 'unclose',): |
---|
546 | wf.transitions.addTransition(t) |
---|
547 | |
---|
548 | |
---|
549 | ########################################################################### |
---|
550 | # CREATE |
---|
551 | ########################################################################### |
---|
552 | |
---|
553 | t = wf.transitions.get('create') |
---|
554 | t.setProperties(title='Initial creation', |
---|
555 | description='Intial transition like', |
---|
556 | new_state_id='work', |
---|
557 | transition_behavior=(TRANSITION_INITIAL_CREATE, ), |
---|
558 | clone_allowed_transitions=None, |
---|
559 | actbox_name='', actbox_category='workflow', actbox_url='', |
---|
560 | props={'guard_permissions':'', |
---|
561 | 'guard_roles':'Manager; WorkspaceManager', |
---|
562 | 'guard_expr':''},) |
---|
563 | |
---|
564 | ########################################################################### |
---|
565 | # CREATE CONTENT |
---|
566 | ########################################################################### |
---|
567 | |
---|
568 | t = wf.transitions.get('create_content') |
---|
569 | t.setProperties(title='Create content', |
---|
570 | description='Allow sub Object Create', |
---|
571 | new_state_id='work', |
---|
572 | transition_behavior=(TRANSITION_ALLOWSUB_CREATE, |
---|
573 | TRANSITION_ALLOWSUB_CHECKOUT,), |
---|
574 | trigger_type=TRIGGER_USER_ACTION, |
---|
575 | actbox_name='New', |
---|
576 | actbox_category='', |
---|
577 | actbox_url='', |
---|
578 | props={'guard_permissions':'', |
---|
579 | 'guard_roles':'Manager; WorkspaceManager; WorkspaceMember; WorkspaceReader', |
---|
580 | 'guard_expr':''},) |
---|
581 | |
---|
582 | ########################################################################## |
---|
583 | # CUT/COPY/PASTE |
---|
584 | ########################################################################## |
---|
585 | |
---|
586 | t = wf.transitions.get('cut_copy_paste') |
---|
587 | t.setProperties(title='Cut/Copy/Paste', |
---|
588 | new_state_id='work', |
---|
589 | transition_behavior=(TRANSITION_ALLOWSUB_DELETE, |
---|
590 | TRANSITION_ALLOWSUB_MOVE, |
---|
591 | TRANSITION_ALLOWSUB_COPY), |
---|
592 | clone_allowed_transitions=None, |
---|
593 | trigger_type=TRIGGER_USER_ACTION, |
---|
594 | actbox_name='New', |
---|
595 | actbox_category='', |
---|
596 | actbox_url='', |
---|
597 | props={'guard_permissions':'', |
---|
598 | 'guard_roles':'Manager; WorkspaceManager; WorkspaceMember', |
---|
599 | 'guard_expr':''},) |
---|
600 | |
---|
601 | ## ########################################################################## |
---|
602 | ## # CLOSE |
---|
603 | ## ########################################################################## |
---|
604 | ## |
---|
605 | ## t = wf.transitions.get('close') |
---|
606 | ## t.setProperties(title='close', |
---|
607 | ## new_state_id='closed', |
---|
608 | ## transition_behavior=(), |
---|
609 | ## clone_allowed_transitions=None, |
---|
610 | ## trigger_type=TRIGGER_USER_ACTION, |
---|
611 | ## actbox_name='label_chat_close', |
---|
612 | ## actbox_category='workflow', |
---|
613 | ## actbox_url='%(content_url)s/cps_chat_close', |
---|
614 | ## props={'guard_permissions':'', |
---|
615 | ## 'guard_roles':'Manager; WorkspaceManager', |
---|
616 | ## 'guard_expr':''},) |
---|
617 | ## |
---|
618 | ## ########################################################################## |
---|
619 | ## # UNCLOSE |
---|
620 | ## ########################################################################## |
---|
621 | ## |
---|
622 | ## t = wf.transitions.get('unclose') |
---|
623 | ## t.setProperties(title='unclose', |
---|
624 | ## new_state_id='work', |
---|
625 | ## transition_behavior=(), |
---|
626 | ## clone_allowed_transitions=None, |
---|
627 | ## trigger_type=TRIGGER_USER_ACTION, |
---|
628 | ## actbox_name='label_chat_unclose', |
---|
629 | ## actbox_category='workflow', |
---|
630 | ## actbox_url='%(content_url)s/cps_chat_unclose', |
---|
631 | ## props={'guard_permissions':'', |
---|
632 | ## 'guard_roles':'Manager; WorkspaceManager; ChatModerator', |
---|
633 | ## 'guard_expr':''},) |
---|
634 | |
---|
635 | ################################################################ |
---|
636 | # VARIABLES |
---|
637 | ################################################################ |
---|
638 | |
---|
639 | for v in ('action', |
---|
640 | 'actor', |
---|
641 | 'comments', |
---|
642 | 'review_history', |
---|
643 | 'time', |
---|
644 | 'dest_container', |
---|
645 | ): |
---|
646 | wf.variables.addVariable(v) |
---|
647 | |
---|
648 | |
---|
649 | wf.variables.setStateVar('review_state') |
---|
650 | |
---|
651 | vdef = wf.variables['action'] |
---|
652 | vdef.setProperties(description='The last transition', |
---|
653 | default_expr='transition/getId|nothing', |
---|
654 | for_status=1, update_always=1) |
---|
655 | |
---|
656 | vdef = wf.variables['actor'] |
---|
657 | vdef.setProperties(description='The ID of the user who performed ' |
---|
658 | 'the last transition', |
---|
659 | default_expr='user/getId', |
---|
660 | for_status=1, update_always=1) |
---|
661 | |
---|
662 | vdef = wf.variables['comments'] |
---|
663 | vdef.setProperties(description='Comments about the last transition', |
---|
664 | default_expr="python:state_change.kwargs.get('comment', '')", |
---|
665 | for_status=1, update_always=1) |
---|
666 | |
---|
667 | vdef = wf.variables['review_history'] |
---|
668 | vdef.setProperties(description='Provides access to workflow history', |
---|
669 | default_expr="state_change/getHistory", |
---|
670 | props={'guard_permissions':'', |
---|
671 | 'guard_roles':'Manager; WorkspaceManager; WorkspaceMember; WorkspaceReader; Member', |
---|
672 | 'guard_expr':''}) |
---|
673 | |
---|
674 | vdef = wf.variables['time'] |
---|
675 | vdef.setProperties(description='Time of the last transition', |
---|
676 | default_expr="state_change/getDateTime", |
---|
677 | for_status=1, update_always=1) |
---|
678 | |
---|
679 | vdef = wf.variables['dest_container'] |
---|
680 | vdef.setProperties(description='Destination container for the last paste/publish', |
---|
681 | default_expr="python:state_change.kwargs.get('dest_container', '')", |
---|
682 | for_status=1, update_always=1) |
---|
683 | |
---|
684 | ###) |
---|