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): ...@@ -56,7 +56,8 @@ class InteractionDefinition (SimpleItem):
script_name = () # Executed before transition script_name = () # Executed before transition
after_script_name = () # Executed after transition after_script_name = () # Executed after transition
activate_script_name = () # Executed as activity activate_script_name = () # Executed as activity
method_id = None method_id = ()
portal_type_filter = None
manage_options = ( manage_options = (
{'label': 'Properties', 'action': 'manage_properties'}, {'label': 'Properties', 'action': 'manage_properties'},
...@@ -121,14 +122,17 @@ class InteractionDefinition (SimpleItem): ...@@ -121,14 +122,17 @@ class InteractionDefinition (SimpleItem):
activate_script_name=(), activate_script_name=(),
actbox_name='', actbox_url='', actbox_name='', actbox_url='',
actbox_category='workflow', actbox_category='workflow',
method_id=None, method_id=(),
props=None, REQUEST=None, description=''): props=None, REQUEST=None, description=''):
''' '''
Update transition properties Update transition properties
XXX - then make sure that method_id is WorkflowMethod for portal_type_filter XXX - then make sure that method_id is WorkflowMethod for portal_type_filter
XXX - this will likely require dynamic XXX - this will likely require dynamic
''' '''
self.method_id = method_id 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.portal_type_filter = portal_type_filter
self.title = str(title) self.title = str(title)
self.description = str(description) self.description = str(description)
......
...@@ -265,7 +265,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -265,7 +265,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
return 0 return 0
for t in self.interactions.values(): for t in self.interactions.values():
if t.trigger_type == TRIGGER_WORKFLOW_METHOD: 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: if t.portal_type_filter is None:
return 1 return 1
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
...@@ -283,7 +283,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -283,7 +283,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
for t in self.interactions.values(): for t in self.interactions.values():
tdef = None tdef = None
if t.trigger_type == TRIGGER_WORKFLOW_METHOD: 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: if t.portal_type_filter is None:
tdef = t tdef = t
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
...@@ -318,7 +318,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -318,7 +318,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
tdef = t tdef = t
elif t.trigger_type == TRIGGER_WORKFLOW_METHOD: 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: if t.portal_type_filter is None:
tdef = t tdef = t
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
...@@ -351,7 +351,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject): ...@@ -351,7 +351,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
tdef = t tdef = t
elif t.trigger_type == TRIGGER_WORKFLOW_METHOD: 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: if t.portal_type_filter is None:
tdef = t tdef = t
elif ob.getPortalType() in t.portal_type_filter: elif ob.getPortalType() in t.portal_type_filter:
......
...@@ -22,12 +22,16 @@ ...@@ -22,12 +22,16 @@
<tr> <tr>
<th align="left">Filter</th> <th align="left">Filter</th>
<td> <td>
<select name="portal_type_filter" size="5"> <select name="portal_type_filter:list" multiple size="5">
<option value="">(None)</option> <option value="">(None)</option>
<dtml-in "portal_types.objectIds()" sort> <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> <option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let> </dtml-let>
<dtml-else>
<option value="&dtml-sequence-item;">&dtml-sequence-item;</option>
</dtml-if>
</dtml-in> </dtml-in>
</select> </select>
</td> </td>
...@@ -54,17 +58,17 @@ Initiated by WorkflowMethod ...@@ -54,17 +58,17 @@ Initiated by WorkflowMethod
</tr> </tr>
<tr> <tr>
<th align="left">Method Id</th> <th align="left">Trigger Method Id(s)</th>
<td><input type="text" name="method_id" value="&dtml-title;" size="50" /></td> <td><input type="text" name="method_id" value="<dtml-var "' '.join(method_id)">" size="50" /></td>
</tr> </tr>
<tr> <tr>
<th align="left">Script (before)</th> <th align="left">Script (before)</th>
<td> <td>
<select name="script_name" size="5"> <select name="script_name:list" multiple size="5">
<option value="">(None)</option> <option value="">(None)</option>
<dtml-in getAvailableScriptIds sort> <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> <option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let> </dtml-let>
</dtml-in> </dtml-in>
...@@ -75,10 +79,10 @@ Initiated by WorkflowMethod ...@@ -75,10 +79,10 @@ Initiated by WorkflowMethod
<tr> <tr>
<th align="left">Script (after)</th> <th align="left">Script (after)</th>
<td> <td>
<select name="after_script_name" size="5"> <select name="after_script_name:list" multiple size="5">
<option value="">(None)</option> <option value="">(None)</option>
<dtml-in getAvailableScriptIds sort> <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> <option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let> </dtml-let>
</dtml-in> </dtml-in>
...@@ -89,10 +93,10 @@ Initiated by WorkflowMethod ...@@ -89,10 +93,10 @@ Initiated by WorkflowMethod
<tr> <tr>
<th align="left">Activities (later)</th> <th align="left">Activities (later)</th>
<td> <td>
<select name="after_script_name" size="5"> <select name="activate_script_name:list" multiple size="5">
<option value="">(None)</option> <option value="">(None)</option>
<dtml-in getAvailableScriptIds sort> <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> <option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
</dtml-let> </dtml-let>
</dtml-in> </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