Merge branch 'master' into bbmaster
This commit is contained in:
commit
fc883f4446
3 changed files with 23 additions and 8 deletions
|
@ -7,8 +7,10 @@
|
||||||
tal:attributes="class string:content-$level">
|
tal:attributes="class string:content-$level">
|
||||||
<h3>
|
<h3>
|
||||||
<a tal:attributes="href python:view.getUrlForTarget(related)"
|
<a tal:attributes="href python:view.getUrlForTarget(related)"
|
||||||
tal:content="related/title" /></h3>
|
tal:content="related/title" />
|
||||||
|
</h3>
|
||||||
<div tal:content="structure related/renderedDescription" />
|
<div tal:content="structure related/renderedDescription" />
|
||||||
|
<!-- TODO: show next level (+/-) -->
|
||||||
</div>
|
</div>
|
||||||
</metal:children>
|
</metal:children>
|
||||||
|
|
||||||
|
@ -91,6 +93,7 @@
|
||||||
<img tal:attributes="src image/src;
|
<img tal:attributes="src image/src;
|
||||||
alt image/title" /></a>
|
alt image/title" /></a>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- TODO: links to files -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</metal:text>
|
</metal:text>
|
||||||
|
|
|
@ -23,7 +23,9 @@ Views and actions for states management.
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
from zope.event import notify
|
||||||
from zope.i18n import translate
|
from zope.i18n import translate
|
||||||
|
from zope.lifecycleevent import ObjectModifiedEvent, Attributes
|
||||||
|
|
||||||
from cybertools.browser.action import Action, actions
|
from cybertools.browser.action import Action, actions
|
||||||
from cybertools.composer.schema.field import Field
|
from cybertools.composer.schema.field import Field
|
||||||
|
@ -138,8 +140,7 @@ class ChangeStateForm(ObjectForm, ChangeStateBase):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def schema(self):
|
def schema(self):
|
||||||
# TODO: create schema directly, use field information specified
|
# TODO: use field information specified in transition
|
||||||
# in transition
|
|
||||||
commentsField = Field('comments', _(u'label_transition_comments'),
|
commentsField = Field('comments', _(u'label_transition_comments'),
|
||||||
'textarea',
|
'textarea',
|
||||||
description=_(u'desc_transition_comments'))
|
description=_(u'desc_transition_comments'))
|
||||||
|
@ -151,8 +152,11 @@ class ChangeStateForm(ObjectForm, ChangeStateBase):
|
||||||
class ChangeState(EditObject, ChangeStateBase):
|
class ChangeState(EditObject, ChangeStateBase):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
print '***', self.request.form
|
comments = self.request.form.get('comments') or u''
|
||||||
self.stateful.doTransition(self.action)
|
self.stateful.doTransition(self.action)
|
||||||
|
notify(ObjectModifiedEvent(self.view.virtualTargetObject,
|
||||||
|
dict(transition=self.action, comments=comments)))
|
||||||
|
#Attributes(IStateful, 'state', 'comments')))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,12 @@ class ChangeManager(BaseRecordManager):
|
||||||
if relation is not None:
|
if relation is not None:
|
||||||
data['predicate'] = util.getUidForObject(relation.predicate)
|
data['predicate'] = util.getUidForObject(relation.predicate)
|
||||||
data['second'] = util.getUidForObject(relation.second)
|
data['second'] = util.getUidForObject(relation.second)
|
||||||
|
event = kw.get('event')
|
||||||
|
if event is not None:
|
||||||
|
desc = getattr(event, 'descriptions', ())
|
||||||
|
for item in desc:
|
||||||
|
if isinstance(item, dict):
|
||||||
|
data.update(item)
|
||||||
if update:
|
if update:
|
||||||
self.storage.updateTrack(last, data)
|
self.storage.updateTrack(last, data)
|
||||||
else:
|
else:
|
||||||
|
@ -90,16 +96,18 @@ class ChangeRecord(Track):
|
||||||
|
|
||||||
@adapter(ILoopsObject, IObjectModifiedEvent)
|
@adapter(ILoopsObject, IObjectModifiedEvent)
|
||||||
def recordModification(obj, event):
|
def recordModification(obj, event):
|
||||||
ChangeManager(obj).recordModification()
|
ChangeManager(obj).recordModification(event=event)
|
||||||
|
|
||||||
@adapter(ILoopsObject, IObjectAddedEvent)
|
@adapter(ILoopsObject, IObjectAddedEvent)
|
||||||
def recordAdding(obj, event):
|
def recordAdding(obj, event):
|
||||||
ChangeManager(obj).recordModification('add')
|
ChangeManager(obj).recordModification('add', event=event)
|
||||||
|
|
||||||
@adapter(ILoopsObject, IAssignmentEvent)
|
@adapter(ILoopsObject, IAssignmentEvent)
|
||||||
def recordAssignment(obj, event):
|
def recordAssignment(obj, event):
|
||||||
ChangeManager(obj).recordModification('assign', relation=event.relation)
|
ChangeManager(obj).recordModification('assign',
|
||||||
|
event=event, relation=event.relation)
|
||||||
|
|
||||||
@adapter(ILoopsObject, IDeassignmentEvent)
|
@adapter(ILoopsObject, IDeassignmentEvent)
|
||||||
def recordDeassignment(obj, event):
|
def recordDeassignment(obj, event):
|
||||||
ChangeManager(obj).recordModification('deassign', relation=event.relation)
|
ChangeManager(obj).recordModification('deassign',
|
||||||
|
event=event, relation=event.relation)
|
||||||
|
|
Loading…
Add table
Reference in a new issue