Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Products.DCWorkflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Products.DCWorkflow
Commits
29643f76
Commit
29643f76
authored
Feb 17, 2014
by
Kazuhiko Shiozaki
Committed by
Kirill Smelkov
Sep 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workflow_method.patch
parent
57a461b7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
2 deletions
+61
-2
Products/DCWorkflow/DCWorkflow.py
Products/DCWorkflow/DCWorkflow.py
+47
-0
Products/DCWorkflow/Transitions.py
Products/DCWorkflow/Transitions.py
+1
-0
Products/DCWorkflow/dtml/transition_properties.dtml
Products/DCWorkflow/dtml/transition_properties.dtml
+10
-0
Products/DCWorkflow/dtml/transitions.dtml
Products/DCWorkflow/dtml/transitions.dtml
+2
-1
Products/DCWorkflow/exportimport.py
Products/DCWorkflow/exportimport.py
+1
-1
No files found.
Products/DCWorkflow/DCWorkflow.py
View file @
29643f76
...
@@ -40,6 +40,7 @@ from Products.DCWorkflow.interfaces import IDCWorkflowDefinition
...
@@ -40,6 +40,7 @@ from Products.DCWorkflow.interfaces import IDCWorkflowDefinition
from
Products.DCWorkflow.permissions
import
ManagePortal
from
Products.DCWorkflow.permissions
import
ManagePortal
from
Products.DCWorkflow.Transitions
import
TRIGGER_AUTOMATIC
from
Products.DCWorkflow.Transitions
import
TRIGGER_AUTOMATIC
from
Products.DCWorkflow.Transitions
import
TRIGGER_USER_ACTION
from
Products.DCWorkflow.Transitions
import
TRIGGER_USER_ACTION
from
Products.DCWorkflow.Transitions
import
TRIGGER_WORKFLOW_METHOD
from
Products.DCWorkflow.utils
import
Message
as
_
from
Products.DCWorkflow.utils
import
Message
as
_
from
Products.DCWorkflow.utils
import
modifyRolesForGroup
from
Products.DCWorkflow.utils
import
modifyRolesForGroup
from
Products.DCWorkflow.utils
import
modifyRolesForPermission
from
Products.DCWorkflow.utils
import
modifyRolesForPermission
...
@@ -281,6 +282,52 @@ class DCWorkflowDefinition(WorkflowUIMixin, Folder):
...
@@ -281,6 +282,52 @@ class DCWorkflowDefinition(WorkflowUIMixin, Folder):
raise
Unauthorized
(
action
)
raise
Unauthorized
(
action
)
self
.
_changeStateOf
(
ob
,
tdef
,
kw
)
self
.
_changeStateOf
(
ob
,
tdef
,
kw
)
security
.
declarePrivate
(
'isWorkflowMethodSupported'
)
def
isWorkflowMethodSupported
(
self
,
ob
,
method_id
):
'''
Returns a true value if the given workflow method
is supported in the current state.
'''
sdef
=
self
.
_getWorkflowStateOf
(
ob
)
if
sdef
is
None
:
return
0
if
method_id
in
sdef
.
transitions
:
tdef
=
self
.
transitions
.
get
(
method_id
,
None
)
if
(
tdef
is
not
None
and
tdef
.
trigger_type
==
TRIGGER_WORKFLOW_METHOD
and
self
.
_checkTransitionGuard
(
tdef
,
ob
)):
return
1
return
0
security
.
declarePrivate
(
'wrapWorkflowMethod'
)
def
wrapWorkflowMethod
(
self
,
ob
,
method_id
,
func
,
args
,
kw
):
'''
Allows the user to request a workflow action. This method
must perform its own security checks.
'''
sdef
=
self
.
_getWorkflowStateOf
(
ob
)
if
sdef
is
None
:
raise
WorkflowException
,
'Object is in an undefined state'
if
method_id
not
in
sdef
.
transitions
:
raise
Unauthorized
(
method_id
)
tdef
=
self
.
transitions
.
get
(
method_id
,
None
)
if
tdef
is
None
or
tdef
.
trigger_type
!=
TRIGGER_WORKFLOW_METHOD
:
raise
WorkflowException
,
(
'Transition %s is not triggered by a workflow method'
%
method_id
)
if
not
self
.
_checkTransitionGuard
(
tdef
,
ob
):
raise
Unauthorized
(
method_id
)
res
=
func
(
*
args
,
**
kw
)
try
:
self
.
_changeStateOf
(
ob
,
tdef
)
except
ObjectDeleted
:
# Re-raise with a different result.
raise
ObjectDeleted
(
res
)
except
ObjectMoved
,
ex
:
# Re-raise with a different result.
raise
ObjectMoved
(
ex
.
getNewObject
(),
res
)
return
res
security
.
declarePrivate
(
'isInfoSupported'
)
security
.
declarePrivate
(
'isInfoSupported'
)
def
isInfoSupported
(
self
,
ob
,
name
):
def
isInfoSupported
(
self
,
ob
,
name
):
'''
'''
...
...
Products/DCWorkflow/Transitions.py
View file @
29643f76
...
@@ -31,6 +31,7 @@ from Products.DCWorkflow.utils import _dtmldir
...
@@ -31,6 +31,7 @@ from Products.DCWorkflow.utils import _dtmldir
TRIGGER_AUTOMATIC
=
0
TRIGGER_AUTOMATIC
=
0
TRIGGER_USER_ACTION
=
1
TRIGGER_USER_ACTION
=
1
TRIGGER_WORKFLOW_METHOD
=
2
class
TransitionDefinition
(
SimpleItem
):
class
TransitionDefinition
(
SimpleItem
):
...
...
Products/DCWorkflow/dtml/transition_properties.dtml
View file @
29643f76
...
@@ -55,6 +55,16 @@ Initiated by user action
...
@@ -55,6 +55,16 @@ Initiated by user action
</td>
</td>
</tr>
</tr>
<tr>
<th></th>
<td>
<dtml-let checked="trigger_type==2 and 'checked' or ' '">
<input type="radio" name="trigger_type" value="2" &dtml-checked; />
Initiated by WorkflowMethod
</dtml-let>
</td>
</tr>
<tr>
<tr>
<th align="left">Script (before)</th>
<th align="left">Script (before)</th>
<td>
<td>
...
...
Products/DCWorkflow/dtml/transitions.dtml
View file @
29643f76
...
@@ -17,7 +17,8 @@
...
@@ -17,7 +17,8 @@
<td>
<td>
Destination state: <code><dtml-if new_state_id>&dtml-new_state_id;<dtml-else>(Remain in state)</dtml-if></code> <br />
Destination state: <code><dtml-if new_state_id>&dtml-new_state_id;<dtml-else>(Remain in state)</dtml-if></code> <br />
Trigger: <dtml-var expr="(trigger_type == 0 and 'Automatic') or
Trigger: <dtml-var expr="(trigger_type == 0 and 'Automatic') or
(trigger_type == 1 and 'User action')">
(trigger_type == 1 and 'User action') or
(trigger_type == 2 and 'WorkflowMethod')">
<br />
<br />
<dtml-if script_name>
<dtml-if script_name>
Script (before): &dtml-script_name;
Script (before): &dtml-script_name;
...
...
Products/DCWorkflow/exportimport.py
View file @
29643f76
...
@@ -34,7 +34,7 @@ from Products.DCWorkflow.utils import _xmldir
...
@@ -34,7 +34,7 @@ from Products.DCWorkflow.utils import _xmldir
from
Products.GenericSetup.interfaces
import
ISetupEnviron
from
Products.GenericSetup.interfaces
import
ISetupEnviron
from
Products.GenericSetup.utils
import
BodyAdapterBase
from
Products.GenericSetup.utils
import
BodyAdapterBase
TRIGGER_TYPES
=
(
'AUTOMATIC'
,
'USER'
)
TRIGGER_TYPES
=
(
'AUTOMATIC'
,
'USER'
,
'METHOD'
)
_FILENAME
=
'workflows.xml'
_FILENAME
=
'workflows.xml'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment