diff --git a/fields/ref.py b/fields/ref.py index dd9307f..797d883 100644 --- a/fields/ref.py +++ b/fields/ref.py @@ -106,9 +106,6 @@ class Ref(Field): src=":url('arrowDown')" title=":_('move_down')" onclick=":ajaxBaseCall.replace('**v**', 'down')"/> - - :tied.pxTransitions + + :tied.pxTransitions ''') diff --git a/fields/workflow.py b/fields/workflow.py index 4de2e3c..7fd1a6d 100644 --- a/fields/workflow.py +++ b/fields/workflow.py @@ -166,7 +166,7 @@ class State: class Transition: '''Represents a workflow transition.''' def __init__(self, states, condition=True, action=None, notify=None, - show=True, confirm=False, group=None): + show=True, confirm=False, group=None, icon=None): # In its simpler form, "states" is a list of 2 states: # (fromState, toState). But it can also be a list of several # (fromState, toState) sub-lists. This way, you may define only 1 @@ -184,6 +184,8 @@ class Transition: # the transition. It will only be possible by code. self.confirm = confirm # If True, a confirm popup will show up. self.group = Group.get(group) + # The user may specify a specific icon to show for this transition. + self.icon = icon or 'transition' def standardiseStates(self, states): '''Get p_states as a list or a list of lists. Indeed, the user may also @@ -331,7 +333,8 @@ class Transition: return msg def trigger(self, transitionName, obj, wf, comment, doAction=True, - doNotify=True, doHistory=True, doSay=True, reindex=True): + doNotify=True, doHistory=True, doSay=True, reindex=True, + noSecurity=False): '''This method triggers this transition on p_obj. The transition is supposed to be triggerable (call to self.isTriggerable must have been performed before calling this method). If p_doAction is False, the @@ -344,6 +347,9 @@ class Transition: trigger programmatically, and no message is returned to the user. If p_reindex is False, object reindexing will be performed by the calling method.''' + # Security check + if not noSecurity and not self.isTriggerable(obj, wf): + raise Exception('Transition "%s" can\'t be triggered.' % name) # Create the workflow_history dict if it does not exist. if not hasattr(obj.aq_base, 'workflow_history'): from persistent.mapping import PersistentMapping @@ -387,9 +393,6 @@ class Transition: def onUiRequest(self, obj, wf, name, rq): '''Executed when a user wants to trigger this transition from the UI.''' tool = obj.getTool() - # Is this transition triggerable? - if not self.isTriggerable(obj, wf): - raise Exception('Transition "%s" can\'t be triggered.' % name) # Trigger the transition self.trigger(name, obj, wf, rq.get('comment', ''), reindex=False) # Reindex obj if required. @@ -398,11 +401,12 @@ class Transition: class UiTransition: '''Represents a widget that displays a transition.''' - pxView = Px(''' + pxView = Px(''' - ''') + value=":label" title=":transition.reason"/>''') def __init__(self, name, transition, obj, mayTrigger, ): self.name = name self.transition = transition self.type = 'transition' + self.icon = transition.icon label = obj.getWorkflowLabel(name) self.title = obj.translate(label) if transition.confirm: diff --git a/gen/ui/appy.css b/gen/ui/appy.css index dca0bed..198cf72 100644 --- a/gen/ui/appy.css +++ b/gen/ui/appy.css @@ -67,9 +67,11 @@ img { border: 0; vertical-align: middle } .navigate td { padding: 4px 9px } .login { margin: 3px; color: black } input.button { color: #666666; height: 20px; width: 130px; - cursor:pointer; font-size: 90%; padding-left: 10px; + cursor:pointer; font-size: 90%; padding: 1px 0 0 10px; background-color: white; background-repeat: no-repeat; background-position: 5% 25%; box-shadow: 2px 2px 2px #888888} +input.buttonSmall { width: 100px !important; font-size: 85%; height: 18px; + margin-bottom: 3px} .fake { background-color: #e6e6e6 !important ; cursor:help !important } .buttons { margin-left: 4px } .message { position: absolute; top: -40px; left: 50%; font-size: 90%; diff --git a/gen/wrappers/ToolWrapper.py b/gen/wrappers/ToolWrapper.py index 0302a2e..21dabdb 100644 --- a/gen/wrappers/ToolWrapper.py +++ b/gen/wrappers/ToolWrapper.py @@ -190,7 +190,7 @@ class ToolWrapper(AbstractWrapper): - - + :targetObj.appy().pxTransitions + var2="targetObj=zobj; + buttonsMode='small'">:targetObj.appy().pxTransitions diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index 78eb486..d58702d 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -363,7 +363,7 @@ class AbstractWrapper(object): pxTransitions = Px('''
@@ -524,7 +524,7 @@ class AbstractWrapper(object): - :obj.pxTransitions