Commit 0db357c6 authored by Jean-Paul Smets's avatar Jean-Paul Smets

interaction workflow upgrade: ability to use multiple method triggers rather than only one


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1356 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e49a271f
......@@ -56,7 +56,8 @@ class InteractionDefinition (SimpleItem):
script_name = () # Executed before transition
after_script_name = () # Executed after transition
activate_script_name = () # Executed as activity
method_id = None
method_id = ()
portal_type_filter = None
manage_options = (
{'label': 'Properties', 'action': 'manage_properties'},
......@@ -121,13 +122,16 @@ class InteractionDefinition (SimpleItem):
activate_script_name=(),
actbox_name='', actbox_url='',
actbox_category='workflow',
method_id=None,
method_id=(),
props=None, REQUEST=None, description=''):
'''
Update transition properties
XXX - then make sure that method_id is WorkflowMethod for portal_type_filter
XXX - this will likely require dynamic
'''
if type(method_id) is type(''):
self.method_id = method_id.split()
else:
self.method_id = method_id
self.portal_type_filter = portal_type_filter
self.title = str(title)
......
......@@ -265,7 +265,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
return 0
for t in self.interactions.values():
if t.trigger_type == TRIGGER_WORKFLOW_METHOD:
if t.method_id == method_id:
if method_id in t.method_id:
if t.portal_type_filter is None:
return 1
elif ob.getPortalType() in t.portal_type_filter:
......@@ -283,7 +283,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
for t in self.interactions.values():
tdef = None
if t.trigger_type == TRIGGER_WORKFLOW_METHOD:
if t.method_id == method_id:
if method_id in t.method_id:
if t.portal_type_filter is None:
tdef = t
elif ob.getPortalType() in t.portal_type_filter:
......@@ -318,7 +318,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
elif ob.getPortalType() in t.portal_type_filter:
tdef = t
elif t.trigger_type == TRIGGER_WORKFLOW_METHOD:
if t.method_id == action:
if action in t.method_id:
if t.portal_type_filter is None:
tdef = t
elif ob.getPortalType() in t.portal_type_filter:
......@@ -351,7 +351,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
elif ob.getPortalType() in t.portal_type_filter:
tdef = t
elif t.trigger_type == TRIGGER_WORKFLOW_METHOD:
if t.method_id == action:
if action in t.method_id:
if t.portal_type_filter is None:
tdef = t
elif ob.getPortalType() in t.portal_type_filter:
......
......@@ -22,12 +22,16 @@
<tr>
<th align="left">Filter</th>
<td>
<select name="portal_type_filter" size="5">
<select name="portal_type_filter:list" multiple size="5">
<option value="">(None)</option>
<dtml-in "portal_types.objectIds()" sort>
<dtml-let selected="after_script_name == _['sequence-item'] and 'selected' or ' '">
<dtml-if portal_type_filter>
<dtml-let selected="_['sequence-item'] in portal_type_filter and 'selected' or ' '">
<option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let>
<dtml-else>
<option value="&dtml-sequence-item;">&dtml-sequence-item;</option>
</dtml-if>
</dtml-in>
</select>
</td>
......@@ -54,17 +58,17 @@ Initiated by WorkflowMethod
</tr>
<tr>
<th align="left">Method Id</th>
<td><input type="text" name="method_id" value="&dtml-title;" size="50" /></td>
<th align="left">Trigger Method Id(s)</th>
<td><input type="text" name="method_id" value="<dtml-var "' '.join(method_id)">" size="50" /></td>
</tr>
<tr>
<th align="left">Script (before)</th>
<td>
<select name="script_name" size="5">
<select name="script_name:list" multiple size="5">
<option value="">(None)</option>
<dtml-in getAvailableScriptIds sort>
<dtml-let selected="script_name == _['sequence-item'] and 'selected' or ' '">
<dtml-let selected="_['sequence-item'] in script_name and 'selected' or ' '">
<option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let>
</dtml-in>
......@@ -75,10 +79,10 @@ Initiated by WorkflowMethod
<tr>
<th align="left">Script (after)</th>
<td>
<select name="after_script_name" size="5">
<select name="after_script_name:list" multiple size="5">
<option value="">(None)</option>
<dtml-in getAvailableScriptIds sort>
<dtml-let selected="after_script_name == _['sequence-item'] and 'selected' or ' '">
<dtml-let selected="_['sequence-item'] in after_script_name and 'selected' or ' '">
<option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let>
</dtml-in>
......@@ -89,10 +93,10 @@ Initiated by WorkflowMethod
<tr>
<th align="left">Activities (later)</th>
<td>
<select name="after_script_name" size="5">
<select name="activate_script_name:list" multiple size="5">
<option value="">(None)</option>
<dtml-in getAvailableScriptIds sort>
<dtml-let selected="after_script_name == _['sequence-item'] and 'selected' or ' '">
<dtml-let selected="_['sequence-item'] in activate_script_name and 'selected' or ' '">
<option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let>
</dtml-in>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment