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