work in progress: form and processing for state transitions
This commit is contained in:
parent
9d3f6a2fb3
commit
18f794bfe7
5 changed files with 56 additions and 17 deletions
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: 0.13.0\n"
|
||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||
"PO-Revision-Date: 2013-06-05 12:00 CET\n"
|
||||
"PO-Revision-Date: 2013-06-20 12:00 CET\n"
|
||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -1025,14 +1025,26 @@ msgid "Restrict to objects with certain states"
|
|||
msgstr "Auf Objekte mit bestimmtem Status beschränken"
|
||||
|
||||
msgid "Workflow"
|
||||
msgstr "Statusdefinition/Workflow"
|
||||
msgstr "Workflow"
|
||||
|
||||
msgid "States"
|
||||
msgstr "Statuswerte"
|
||||
|
||||
msgid "States Definition"
|
||||
msgstr "Workflowdefinition"
|
||||
|
||||
msgid "State Transition"
|
||||
msgstr "Workflow-Statusänderung"
|
||||
|
||||
msgid "Transition"
|
||||
msgstr "Aktion"
|
||||
|
||||
msgid "State information for $definition: $title"
|
||||
msgstr "Status ($definition): $title"
|
||||
|
||||
msgid "Available Transitions"
|
||||
msgstr "Übergänge"
|
||||
|
||||
msgid "classification_quality"
|
||||
msgstr "Klassifizierung"
|
||||
|
||||
|
@ -1045,6 +1057,12 @@ msgstr "Aufgabe"
|
|||
msgid "publishable_task"
|
||||
msgstr "Aufgabe/Zugriff"
|
||||
|
||||
msgid "label_transition_comments"
|
||||
msgstr "Bemerkung"
|
||||
|
||||
msgid "desc_transition_comments"
|
||||
msgstr "Notizen zum Statusübergang."
|
||||
|
||||
# state names
|
||||
|
||||
msgid "accepted"
|
||||
|
|
|
@ -52,7 +52,7 @@ def registerStatesPortlet(controller, view, statesDefs,
|
|||
cm = controller.macros
|
||||
stfs = [component.getAdapter(view.context, IStateful, name=std)
|
||||
for std in statesDefs]
|
||||
cm.register(region, 'states', title=_(u'States'),
|
||||
cm.register(region, 'states', title=_(u'Workflow'),
|
||||
subMacro=template.macros['portlet_states'],
|
||||
priority=priority, info=view, stfs=stfs)
|
||||
|
||||
|
@ -81,8 +81,9 @@ class StateAction(Action):
|
|||
|
||||
@Lazy
|
||||
def icon(self):
|
||||
icon = self.stateObject.icon or 'led%s.png' % self.stateObject.color
|
||||
return 'cybertools.icons/' + icon
|
||||
return self.stateObject.stateIcon
|
||||
#icon = self.stateObject.icon or 'led%s.png' % self.stateObject.color
|
||||
#return 'cybertools.icons/' + icon
|
||||
|
||||
|
||||
for std in statefulActions:
|
||||
|
@ -96,7 +97,7 @@ class ChangeStateBase(object):
|
|||
|
||||
@Lazy
|
||||
def stateful(self):
|
||||
return component.getAdapter(self.view.context, IStateful,
|
||||
return component.getAdapter(self.view.virtualTargetObject, IStateful,
|
||||
name=self.definition)
|
||||
|
||||
@Lazy
|
||||
|
@ -107,6 +108,10 @@ class ChangeStateBase(object):
|
|||
def action(self):
|
||||
return self.request.form.get('action') or u''
|
||||
|
||||
@Lazy
|
||||
def transition(self):
|
||||
return self.stateful.getStatesDefinition().transitions[self.action]
|
||||
|
||||
@Lazy
|
||||
def stateObject(self):
|
||||
return self.stateful.getStateObject()
|
||||
|
@ -121,24 +126,27 @@ class ChangeStateForm(ObjectForm, ChangeStateBase):
|
|||
def macro(self):
|
||||
return template.macros['change_state']
|
||||
|
||||
@Lazy
|
||||
def title(self):
|
||||
return self.virtualTargetObject.title
|
||||
|
||||
@Lazy
|
||||
def schema(self):
|
||||
# TODO: create schema directly, use field information specified
|
||||
# in transition
|
||||
commentsField = Field('comments', u'Comments', 'textarea',
|
||||
description=u'Enter comments.')
|
||||
commentsField = Field('comments', _(u'label_transition_comments'),
|
||||
'textarea',
|
||||
description=_(u'desc_transition_comments'))
|
||||
fields = [commentsField]
|
||||
return Schema(name='change_state', request=self.request,
|
||||
manager=self, *fields)
|
||||
#schemaFactory = ISchemaFactory(self.adapted)
|
||||
#return schemaFactory(self.typeInterface, manager=self,
|
||||
# request=self.request)
|
||||
|
||||
|
||||
class ChangeState(EditObject, ChangeStateBase):
|
||||
|
||||
def update(self):
|
||||
print '***', self.request.form
|
||||
self.stateful.doTransition(self.action)
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ def taskStates():
|
|||
Transition('finish', 'finish', 'finished'),
|
||||
Transition('cancel', 'cancel', 'cancelled'),
|
||||
Transition('reopen', 're-open', 'draft'),
|
||||
Transition('archive', 'archive', 'archived'),
|
||||
initialState='draft')
|
||||
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<metal:actions define-macro="portlet_states">
|
||||
<div tal:repeat="stf macro/stfs">
|
||||
<div tal:condition="python:len(macro.stfs) > 1">
|
||||
<span i18n:translate="">Workflow</span>
|
||||
<span i18n:translate="">States Definition</span>
|
||||
<span i18n:translate=""
|
||||
tal:content="stf/statesDefinition" />
|
||||
</div>
|
||||
|
@ -79,9 +79,10 @@
|
|||
<b i18n:translate="">State</b>:
|
||||
<span i18n:translate=""
|
||||
tal:content="stf/state" />
|
||||
<img tal:define="stateObject stf/getStateObject"
|
||||
tal:attributes="src string:/@@/${stateObject/stateIcon}" />
|
||||
</div>
|
||||
<div>
|
||||
<div><b i18n:translate="">Available Transitions</b>:</div>
|
||||
<div><b i18n:translate="">Available Transitions</b>:
|
||||
<ul>
|
||||
<li tal:repeat="action stf/getAvailableTransitionsForUser">
|
||||
<a i18n:translate=""
|
||||
|
@ -102,14 +103,25 @@
|
|||
<form name="stateful_changeState" method="post">
|
||||
<div dojoType="dijit.layout.BorderContainer"
|
||||
style="width: 70em; height: 600px">
|
||||
<div dojoType="dijit.layout.ContentPane" region="center">
|
||||
<h1 i18n:translate=""
|
||||
tal:content="view/title" />
|
||||
<div dojoType="dijit.layout.ContentPane" region="top">
|
||||
<h1><span i18n:translate="">State Transition</span> -
|
||||
<span tal:content="view/title" />
|
||||
</h1>
|
||||
<div>
|
||||
<span i18n:translate="">State</span>:
|
||||
<span i18n:translate=""
|
||||
tal:content="view/stateful/state" /> -
|
||||
<span i18n:translate="">Transition</span>:
|
||||
<span i18n:translate=""
|
||||
tal:content="view/transition/title" />
|
||||
</div>
|
||||
<input type="hidden" name="form.action" value="change_state">
|
||||
<input type="hidden" name="stdef"
|
||||
tal:attributes="value request/form/stdef|nothing">
|
||||
<input type="hidden" name="action"
|
||||
tal:attributes="value request/form/action|nothing">
|
||||
</div>
|
||||
<div dojoType="dijit.layout.ContentPane" region="center">
|
||||
<table cellpadding="3" class="form">
|
||||
<tbody><tr><td colspan="5" style="padding-right: 15px">
|
||||
<div id="form.fields">
|
||||
|
|
Loading…
Add table
Reference in a new issue