Commit 23685d16 authored by Fabien Morin's avatar Fabien Morin

enable worklist displaying on another workflow

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23258 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3be25e2b
......@@ -39,7 +39,7 @@ def getPoralTypeListForWorkflow(self, workflow):
return portal_type_list
def getPortalTypeWorklistDictForWorkflow(self, workflow):
def getPortalTypeWorklistDictForWorkflow(self, workflow_list):
"""
return a dict containing portal_type and all informations about work_list
of workflow :
......@@ -56,43 +56,50 @@ def getPortalTypeWorklistDictForWorkflow(self, workflow):
.....
}
"""
portal_type_list = self.getPoralTypeListForWorkflow(self, workflow=workflow)
portal_workflow = self.getPortalObject().portal_workflow
workflow = getattr(portal_workflow, workflow, None)
portal_type_worklist_dict = {}
portal_workflow = self.getPortalObject().portal_workflow
if workflow is not None:
worklist_dict = workflow.worklists._mapping
for portal_type in portal_type_list:
for worklist_id, worklist in worklist_dict.items():
state = None
if worklist.var_matches.has_key('validation_state'):
state=worklist.var_matches['validation_state']
local_role_list=worklist.guard.roles
if state is None:
continue
result = self.getPortalObject().portal_catalog(portal_type=portal_type,
local_roles=local_role_list,
validation_state=state)
if not len(result):
continue
if not portal_type_worklist_dict.has_key(portal_type):
portal_type_worklist_dict[portal_type] = {}
portal_type_worklist_dict[portal_type][worklist_id] = {}
result_dict = portal_type_worklist_dict[portal_type][worklist_id]
result_dict['id']=worklist_id
result_dict['count']=len(result)
result_dict['description']=worklist.description
result_dict['validation_state']=state
result_dict['formated_name']=worklist.actbox_name
result_dict['formated_url']=worklist.actbox_url
result_dict['formated_url']='Base_viewSearchResultList?validation_state=%s&local_roles=%s&reset=1&portal_type=%s'\
% (state[0], local_role_list[0], portal_type)
result_dict['category']=worklist.actbox_category
result_dict.update(worklist.guard.__dict__)
if not isinstance(workflow_list, list):
workflow = [workflow_list]
for workflow in workflow_list:
portal_type_list = self.getPoralTypeListForWorkflow(self,
workflow=workflow)
workflow = getattr(portal_workflow, workflow, None)
if workflow is not None:
worklist_dict = workflow.worklists._mapping
for portal_type in portal_type_list:
for worklist_id, worklist in worklist_dict.items():
state = None
if worklist.var_matches.has_key('validation_state'):
state=worklist.var_matches['validation_state']
local_role_list=worklist.guard.roles
if state is None:
continue
result = self.getPortalObject().portal_catalog(\
portal_type=portal_type,
local_roles=local_role_list,
validation_state=state)
if not len(result):
continue
if not portal_type_worklist_dict.has_key(portal_type):
portal_type_worklist_dict[portal_type] = {}
portal_type_worklist_dict[portal_type][worklist_id] = {}
result_dict = portal_type_worklist_dict[portal_type][worklist_id]
result_dict['id']=worklist_id
result_dict['count']=len(result)
result_dict['description']=worklist.description
result_dict['validation_state']=state
result_dict['formated_name']=worklist.actbox_name
result_dict['formated_url']=worklist.actbox_url
result_dict['formated_url']='Base_viewSearchResultList?validation_state=%s&local_roles=%s&reset=1&portal_type=%s'\
% (state[0], local_role_list[0], portal_type)
result_dict['category']=worklist.actbox_category
result_dict.update(worklist.guard.__dict__)
return portal_type_worklist_dict
......@@ -70,7 +70,7 @@ Description:\n
\n
\n
<tal:block tal:define="global portal_type_dict python:\n
here.getPortalTypeWorklistDictForWorkflow(context, workflow=\'egov_universal_workflow\')" />\n
here.getPortalTypeWorklistDictForWorkflow(context, workflow_list=[\'egov_universal_workflow\', \'egov_anonymous_workflow\'])" />\n
<ul tal:condition="python: portal_type_dict">\n
<li tal:repeat="portal_type python: portal_type_dict.keys()">\n
<span class ="portal_type" tal:content="portal_type" i18n:domain="ui" i18n:translate="">portal_type</span>\n
......@@ -150,6 +150,12 @@ Description:\n
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
......
256
\ No newline at end of file
258
\ No newline at end of file
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