Commit f65c398e authored by Jérome Perrin's avatar Jérome Perrin

added getChainedPortalTypeList method in InteractionWorkflow to minimize code in the dtml page.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4209 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6de09508
......@@ -19,16 +19,13 @@
import Globals
import App
from AccessControl import getSecurityManager, ClassSecurityInfo
from Products.CMFCore.utils import getToolByName, _getAuthenticatedUser
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
from Products.CMFCore.utils import getToolByName
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC, TRIGGER_WORKFLOW_METHOD
from Products.CMFCore.WorkflowCore import WorkflowException, \
ObjectDeleted, ObjectMoved
from Products.DCWorkflow.Expression import StateChangeInfo, createExprContext
from Products.CMFCore.WorkflowTool import addWorkflowFactory
from Products.CMFActivity.ActiveObject import ActiveObject
from Products.ERP5Type import Permissions
from zLOG import LOG
......@@ -113,6 +110,18 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
from Products.DCWorkflow.Scripts import Scripts
self._addObject(Scripts('scripts'))
security.declareProtected(Permissions.View, 'getChainedPortalTypeList')
def getChainedPortalTypeList(self):
"""Returns the list of portal types that are chained to this
interaction workflow."""
chained_ptype_list = []
wf_tool = getToolByName(self, 'portal_workflow')
types_tool = getToolByName(self, 'portal_types')
for ptype in types_tool.objectIds():
if self.getId() in wf_tool._chains_by_type.get(ptype, []) :
chained_ptype_list.append(ptype)
return chained_ptype_list
security.declarePrivate('listObjectActions')
def listObjectActions(self, info):
return []
......
......@@ -25,7 +25,7 @@
<select name="portal_type_filter:list" multiple size="5">
<option value="None">(None)</option>
<dtml-in "portal_types.objectIds()" sort>
<dtml-if expr="aq_parent.aq_parent.id in portal_workflow._chains_by_type.get(_['sequence-item'], [])">
<dtml-if expr="_['sequence-item'] in getChainedPortalTypeList()">
<dtml-if portal_type_filter>
<dtml-let selected="_['sequence-item'] in (portal_type_filter or []) and 'selected' or ' '">
<option value="&dtml-sequence-item;" &dtml-selected;>&dtml-sequence-item;</option>
......
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