Commit ac25989c authored by Jens Vagelpohl's avatar Jens Vagelpohl

- Worklists and Transitions: Add icon expression properties to worklist

  and transition actions and their GenericSetup profiles.
parent 350bae91
...@@ -4,6 +4,9 @@ Products.DCWorkflow Changelog ...@@ -4,6 +4,9 @@ Products.DCWorkflow Changelog
2.2.0 (unreleased) 2.2.0 (unreleased)
------------------ ------------------
- Worklists and Transitions: Add icon expression properties to worklist
and transition actions and their GenericSetup profiles.
- Fixed an import error (Products.PageTemplates.TALES is gone on - Fixed an import error (Products.PageTemplates.TALES is gone on
Zope trunk). Because we require Zope >= 2.10, we don't need a Zope trunk). Because we require Zope >= 2.10, we don't need a
BBB conditional import. BBB conditional import.
......
...@@ -200,6 +200,7 @@ class DCWorkflowDefinition(WorkflowUIMixin, Folder): ...@@ -200,6 +200,7 @@ class DCWorkflowDefinition(WorkflowUIMixin, Folder):
'id': tid, 'id': tid,
'name': tdef.actbox_name % info, 'name': tdef.actbox_name % info,
'url': tdef.actbox_url % info, 'url': tdef.actbox_url % info,
'icon': tdef.actbox_icon % info,
'permissions': (), # Predetermined. 'permissions': (), # Predetermined.
'category': tdef.actbox_category, 'category': tdef.actbox_category,
'transition': tdef})) 'transition': tdef}))
...@@ -243,6 +244,7 @@ class DCWorkflowDefinition(WorkflowUIMixin, Folder): ...@@ -243,6 +244,7 @@ class DCWorkflowDefinition(WorkflowUIMixin, Folder):
res.append((id, {'id': id, res.append((id, {'id': id,
'name': qdef.actbox_name % fmt_data, 'name': qdef.actbox_name % fmt_data,
'url': qdef.actbox_url % fmt_data, 'url': qdef.actbox_url % fmt_data,
'icon': qdef.actbox_icon % fmt_data,
'permissions': (), # Predetermined. 'permissions': (), # Predetermined.
'category': qdef.actbox_category})) 'category': qdef.actbox_category}))
fmt_data._pop() fmt_data._pop()
......
...@@ -48,6 +48,7 @@ class TransitionDefinition (SimpleItem): ...@@ -48,6 +48,7 @@ class TransitionDefinition (SimpleItem):
guard = None guard = None
actbox_name = '' actbox_name = ''
actbox_url = '' actbox_url = ''
actbox_icon = ''
actbox_category = 'workflow' actbox_category = 'workflow'
var_exprs = None # A mapping. var_exprs = None # A mapping.
script_name = None # Executed before transition script_name = None # Executed before transition
...@@ -112,7 +113,7 @@ class TransitionDefinition (SimpleItem): ...@@ -112,7 +113,7 @@ class TransitionDefinition (SimpleItem):
trigger_type=TRIGGER_USER_ACTION, script_name='', trigger_type=TRIGGER_USER_ACTION, script_name='',
after_script_name='', after_script_name='',
actbox_name='', actbox_url='', actbox_name='', actbox_url='',
actbox_category='workflow', actbox_category='workflow', actbox_icon='',
props=None, REQUEST=None, description=''): props=None, REQUEST=None, description=''):
''' '''
''' '''
...@@ -129,6 +130,7 @@ class TransitionDefinition (SimpleItem): ...@@ -129,6 +130,7 @@ class TransitionDefinition (SimpleItem):
self.guard = None self.guard = None
self.actbox_name = str(actbox_name) self.actbox_name = str(actbox_name)
self.actbox_url = str(actbox_url) self.actbox_url = str(actbox_url)
self.actbox_icon = str(actbox_icon)
self.actbox_category = str(actbox_category) self.actbox_category = str(actbox_category)
if REQUEST is not None: if REQUEST is not None:
return self.manage_properties(REQUEST, 'Properties changed.') return self.manage_properties(REQUEST, 'Properties changed.')
......
...@@ -41,6 +41,7 @@ class WorklistDefinition(SimpleItem): ...@@ -41,6 +41,7 @@ class WorklistDefinition(SimpleItem):
var_matches = None # Compared with catalog when set. var_matches = None # Compared with catalog when set.
actbox_name = '' actbox_name = ''
actbox_url = '' actbox_url = ''
actbox_icon = ''
actbox_category = 'global' actbox_category = 'global'
guard = None guard = None
...@@ -108,7 +109,7 @@ class WorklistDefinition(SimpleItem): ...@@ -108,7 +109,7 @@ class WorklistDefinition(SimpleItem):
def setProperties(self, description, def setProperties(self, description,
actbox_name='', actbox_url='', actbox_category='global', actbox_name='', actbox_url='', actbox_category='global',
props=None, REQUEST=None): actbox_icon='', props=None, REQUEST=None):
''' '''
''' '''
if props is None: if props is None:
...@@ -129,6 +130,7 @@ class WorklistDefinition(SimpleItem): ...@@ -129,6 +130,7 @@ class WorklistDefinition(SimpleItem):
self.actbox_name = str(actbox_name) self.actbox_name = str(actbox_name)
self.actbox_url = str(actbox_url) self.actbox_url = str(actbox_url)
self.actbox_category = str(actbox_category) self.actbox_category = str(actbox_category)
self.actbox_icon = str(actbox_icon)
g = Guard() g = Guard()
if g.changeFromProperties(props or REQUEST): if g.changeFromProperties(props or REQUEST):
self.guard = g self.guard = g
......
...@@ -110,6 +110,13 @@ Initiated by user action ...@@ -110,6 +110,13 @@ Initiated by user action
value="&dtml-actbox_url;" size="50" /> value="&dtml-actbox_url;" size="50" />
</td> </td>
</tr> </tr>
<tr>
<th align="left">Icon URL (formatted)</th>
<td>
<input type="text" name="actbox_icon"
value="&dtml-actbox_icon;" size="50" />
</td>
</tr>
<tr> <tr>
<th align="left">Category</th> <th align="left">Category</th>
<td> <td>
......
...@@ -57,6 +57,13 @@ ...@@ -57,6 +57,13 @@
value="&dtml-actbox_url;" size="50" /> value="&dtml-actbox_url;" size="50" />
</td> </td>
</tr> </tr>
<tr>
<th align="left">Icon URL (formatted)</th>
<td>
<input type="text" name="actbox_icon"
value="&dtml-actbox_icon;" size="50" />
</td>
</tr>
<tr> <tr>
<th align="left">Category</th> <th align="left">Category</th>
<td> <td>
......
...@@ -437,6 +437,9 @@ class WorkflowDefinitionConfigurator( Implicit ): ...@@ -437,6 +437,9 @@ class WorkflowDefinitionConfigurator( Implicit ):
'actbox_url' -- the URL of the action by which the user 'actbox_url' -- the URL of the action by which the user
triggers the transition triggers the transition
'actbox_icon' -- the icon URL for the action by which the user
triggers the transition
'actbox_category' -- the category of the action by which the user 'actbox_category' -- the category of the action by which the user
triggers the transition triggers the transition
...@@ -475,6 +478,7 @@ class WorkflowDefinitionConfigurator( Implicit ): ...@@ -475,6 +478,7 @@ class WorkflowDefinitionConfigurator( Implicit ):
, 'after_script_name' : v.after_script_name , 'after_script_name' : v.after_script_name
, 'actbox_name' : v.actbox_name , 'actbox_name' : v.actbox_name
, 'actbox_url' : v.actbox_url , 'actbox_url' : v.actbox_url
, 'actbox_icon' : v.actbox_icon
, 'actbox_category' : v.actbox_category , 'actbox_category' : v.actbox_category
, 'variables' : v_info , 'variables' : v_info
, 'guard_permissions' : guard.permissions , 'guard_permissions' : guard.permissions
...@@ -509,6 +513,9 @@ class WorkflowDefinitionConfigurator( Implicit ): ...@@ -509,6 +513,9 @@ class WorkflowDefinitionConfigurator( Implicit ):
'actbox_url' -- the URL of the "action" corresponding to the 'actbox_url' -- the URL of the "action" corresponding to the
worklist worklist
'actbox_icon' -- the icon URL of the "action" corresponding to
the worklist
'actbox_category' -- the category of the "action" corresponding 'actbox_category' -- the category of the "action" corresponding
to the worklist to the worklist
...@@ -539,6 +546,7 @@ class WorkflowDefinitionConfigurator( Implicit ): ...@@ -539,6 +546,7 @@ class WorkflowDefinitionConfigurator( Implicit ):
, 'var_match' : var_match , 'var_match' : var_match
, 'actbox_name' : v.actbox_name , 'actbox_name' : v.actbox_name
, 'actbox_url' : v.actbox_url , 'actbox_url' : v.actbox_url
, 'actbox_icon' : v.actbox_icon
, 'actbox_category' : v.actbox_category , 'actbox_category' : v.actbox_category
, 'guard_permissions' : guard.permissions , 'guard_permissions' : guard.permissions
, 'guard_roles' : guard.roles , 'guard_roles' : guard.roles
...@@ -800,13 +808,14 @@ def _extractActionNode( parent, encoding=None ): ...@@ -800,13 +808,14 @@ def _extractActionNode( parent, encoding=None ):
assert len( nodes ) <= 1, nodes assert len( nodes ) <= 1, nodes
if len( nodes ) < 1: if len( nodes ) < 1:
return { 'name' : '', 'url' : '', 'category' : '' } return { 'name' : '', 'url' : '', 'category' : '', 'icon': ''}
node = nodes[ 0 ] node = nodes[ 0 ]
return { 'name' : _coalesceTextNodeChildren( node, encoding ) return { 'name' : _coalesceTextNodeChildren( node, encoding )
, 'url' : _getNodeAttribute( node, 'url', encoding ) , 'url' : _getNodeAttribute( node, 'url', encoding )
, 'category' : _getNodeAttribute( node, 'category', encoding ) , 'category' : _getNodeAttribute( node, 'category', encoding )
, 'icon' : _queryNodeAttribute( node, 'icon', '', encoding )
} }
def _extractGuardNode( parent, encoding=None ): def _extractGuardNode( parent, encoding=None ):
...@@ -1087,6 +1096,7 @@ def _initDCWorkflowTransitions( workflow, transitions ): ...@@ -1087,6 +1096,7 @@ def _initDCWorkflowTransitions( workflow, transitions ):
, actbox_name = action[ 'name' ] , actbox_name = action[ 'name' ]
, actbox_url = action[ 'url' ] , actbox_url = action[ 'url' ]
, actbox_category = action[ 'category' ] , actbox_category = action[ 'category' ]
, actbox_icon = action.get('icon', '')
, props = props , props = props
) )
var_mapping = [(name, Expression(text)) for name, text in var_mapping = [(name, Expression(text)) for name, text in
...@@ -1121,6 +1131,7 @@ def _initDCWorkflowWorklists( workflow, worklists ): ...@@ -1121,6 +1131,7 @@ def _initDCWorkflowWorklists( workflow, worklists ):
, actbox_name = action[ 'name' ] , actbox_name = action[ 'name' ]
, actbox_url = action[ 'url' ] , actbox_url = action[ 'url' ]
, actbox_category = action[ 'category' ] , actbox_category = action[ 'category' ]
, actbox_icon = action.get('icon', '')
, props = props , props = props
) )
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
new_state="private" trigger="USER" new_state="private" trigger="USER"
before_script="" after_script=""> before_script="" after_script="">
<action url="%(content_url)s/content_hide_form" <action url="%(content_url)s/content_hide_form"
icon="%(portal_url)s/retract_icon.png"
category="workflow">Make private</action> category="workflow">Make private</action>
<guard> <guard>
<guard-role>Owner</guard-role> <guard-role>Owner</guard-role>
...@@ -108,6 +109,7 @@ ...@@ -108,6 +109,7 @@
new_state="published" trigger="USER" new_state="published" trigger="USER"
before_script="" after_script=""> before_script="" after_script="">
<action url="%(object_url)s/content_publish_form" <action url="%(object_url)s/content_publish_form"
icon="%(portal_url)s/approve_icon.png"
category="workflow">Publish</action> category="workflow">Publish</action>
<guard> <guard>
<guard-permission>Review portal content</guard-permission> <guard-permission>Review portal content</guard-permission>
...@@ -119,6 +121,7 @@ ...@@ -119,6 +121,7 @@
new_state="visible" trigger="USER" new_state="visible" trigger="USER"
before_script="" after_script=""> before_script="" after_script="">
<action url="%(object_url)s/content_reject_form" <action url="%(object_url)s/content_reject_form"
icon="%(portal_url)s/reject_icon.png"
category="workflow">Reject</action> category="workflow">Reject</action>
<guard> <guard>
<guard-permission>Review portal content</guard-permission> <guard-permission>Review portal content</guard-permission>
...@@ -130,6 +133,7 @@ ...@@ -130,6 +133,7 @@
new_state="visible" trigger="USER" new_state="visible" trigger="USER"
before_script="" after_script=""> before_script="" after_script="">
<action url="%(object_url)s/content_retract_form" <action url="%(object_url)s/content_retract_form"
icon="%(portal_url)s/retract_icon.png"
category="workflow">Retract</action> category="workflow">Retract</action>
<guard> <guard>
<guard-permission>Request review</guard-permission> <guard-permission>Request review</guard-permission>
...@@ -141,6 +145,7 @@ ...@@ -141,6 +145,7 @@
new_state="visible" trigger="USER" new_state="visible" trigger="USER"
before_script="" after_script=""> before_script="" after_script="">
<action url="%(content_url)s/content_show_form" <action url="%(content_url)s/content_show_form"
icon="%(portal_url)s/approve_icon.png"
category="workflow">Make visible</action> category="workflow">Make visible</action>
<guard> <guard>
<guard-role>Owner</guard-role> <guard-role>Owner</guard-role>
...@@ -152,6 +157,7 @@ ...@@ -152,6 +157,7 @@
new_state="pending" trigger="USER" new_state="pending" trigger="USER"
before_script="" after_script=""> before_script="" after_script="">
<action url="%(object_url)s/content_submit_form" <action url="%(object_url)s/content_submit_form"
icon="%(portal_url)s/submit_icon.png"
category="workflow">Submit</action> category="workflow">Submit</action>
<guard> <guard>
<guard-permission>Request review</guard-permission> <guard-permission>Request review</guard-permission>
...@@ -161,6 +167,7 @@ ...@@ -161,6 +167,7 @@
<worklist worklist_id="reviewer_queue" title=""> <worklist worklist_id="reviewer_queue" title="">
<description>Reviewer tasks</description> <description>Reviewer tasks</description>
<action url="%(portal_url)s/search?review_state=pending" <action url="%(portal_url)s/search?review_state=pending"
icon="%(portal_url)s/worklist_icon.png"
category="global">Pending (%(count)d)</action> category="global">Pending (%(count)d)</action>
<guard> <guard>
<guard-permission>Review portal content</guard-permission> <guard-permission>Review portal content</guard-permission>
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
category="CATEGORY" category="CATEGORY"
tal:condition="transition/actbox_name" tal:condition="transition/actbox_name"
tal:attributes="url transition/actbox_url; tal:attributes="url transition/actbox_url;
icon transition/actbox_icon;
category transition/actbox_category; category transition/actbox_category;
" "
tal:content="transition/actbox_name">ACTION NAME</action> tal:content="transition/actbox_name">ACTION NAME</action>
...@@ -126,6 +127,7 @@ ...@@ -126,6 +127,7 @@
tal:condition="worklist/actbox_name" tal:condition="worklist/actbox_name"
tal:attributes="url worklist/actbox_url; tal:attributes="url worklist/actbox_url;
category worklist/actbox_category; category worklist/actbox_category;
icon worklist/actbox_icon;
" "
tal:content="worklist/actbox_name">ACTION NAME</action> tal:content="worklist/actbox_name">ACTION NAME</action>
<guard <guard
......
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