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