Merge branch 'bbmaster' of ssh://git.cy55.de/home/git/loops into bbmaster
This commit is contained in:
commit
8510b2997d
4 changed files with 28 additions and 12 deletions
|
@ -7,8 +7,10 @@
|
|||
tal:attributes="class string:content-$level">
|
||||
<h3>
|
||||
<a tal:attributes="href python:view.getUrlForTarget(related)"
|
||||
tal:content="related/title" /></h3>
|
||||
tal:content="related/title" />
|
||||
</h3>
|
||||
<div tal:content="structure related/renderedDescription" />
|
||||
<!-- TODO: show next level (+/-) -->
|
||||
</div>
|
||||
</metal:children>
|
||||
|
||||
|
@ -91,6 +93,7 @@
|
|||
<img tal:attributes="src image/src;
|
||||
alt image/title" /></a>
|
||||
</div>
|
||||
<!-- TODO: links to files -->
|
||||
</div>
|
||||
</div>
|
||||
</metal:text>
|
||||
|
|
|
@ -23,7 +23,9 @@ Views and actions for states management.
|
|||
from zope import component
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.event import notify
|
||||
from zope.i18n import translate
|
||||
from zope.lifecycleevent import ObjectModifiedEvent, Attributes
|
||||
|
||||
from cybertools.browser.action import Action, actions
|
||||
from cybertools.composer.schema.field import Field
|
||||
|
@ -138,8 +140,7 @@ class ChangeStateForm(ObjectForm, ChangeStateBase):
|
|||
|
||||
@Lazy
|
||||
def schema(self):
|
||||
# TODO: create schema directly, use field information specified
|
||||
# in transition
|
||||
# TODO: use field information specified in transition
|
||||
commentsField = Field('comments', _(u'label_transition_comments'),
|
||||
'textarea',
|
||||
description=_(u'desc_transition_comments'))
|
||||
|
@ -151,8 +152,10 @@ class ChangeStateForm(ObjectForm, ChangeStateBase):
|
|||
class ChangeState(EditObject, ChangeStateBase):
|
||||
|
||||
def update(self):
|
||||
print '***', self.request.form
|
||||
comments = self.request.form.get('comments') or u''
|
||||
self.stateful.doTransition(self.action)
|
||||
notify(ObjectModifiedEvent(self.view.virtualTargetObject,
|
||||
dict(transition=self.action, comments=comments)))
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -112,7 +112,8 @@
|
|||
<div>
|
||||
<span i18n:translate="">State</span>:
|
||||
<span i18n:translate=""
|
||||
tal:content="view/stateful/state" /> -
|
||||
tal:define="stateObject view/stateful/getStateObject"
|
||||
tal:content="stateObject/title" /> -
|
||||
<span i18n:translate="">Transition</span>:
|
||||
<span i18n:translate=""
|
||||
tal:content="view/transition/title" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,8 +18,6 @@
|
|||
|
||||
"""
|
||||
Recording changes to loops objects.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
from zope.app.container.interfaces import IObjectAddedEvent, IObjectRemovedEvent
|
||||
|
@ -53,6 +51,9 @@ class ChangeManager(BaseRecordManager):
|
|||
|
||||
@Lazy
|
||||
def valid(self):
|
||||
req = util.getRequest()
|
||||
if req and req.form.get('organize.suppress_tracking'):
|
||||
return False
|
||||
return (not (self.context is None or
|
||||
self.storage is None or
|
||||
self.personId is None)
|
||||
|
@ -70,6 +71,12 @@ class ChangeManager(BaseRecordManager):
|
|||
if relation is not None:
|
||||
data['predicate'] = util.getUidForObject(relation.predicate)
|
||||
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:
|
||||
self.storage.updateTrack(last, data)
|
||||
else:
|
||||
|
@ -90,16 +97,18 @@ class ChangeRecord(Track):
|
|||
|
||||
@adapter(ILoopsObject, IObjectModifiedEvent)
|
||||
def recordModification(obj, event):
|
||||
ChangeManager(obj).recordModification()
|
||||
ChangeManager(obj).recordModification(event=event)
|
||||
|
||||
@adapter(ILoopsObject, IObjectAddedEvent)
|
||||
def recordAdding(obj, event):
|
||||
ChangeManager(obj).recordModification('add')
|
||||
ChangeManager(obj).recordModification('add', event=event)
|
||||
|
||||
@adapter(ILoopsObject, IAssignmentEvent)
|
||||
def recordAssignment(obj, event):
|
||||
ChangeManager(obj).recordModification('assign', relation=event.relation)
|
||||
ChangeManager(obj).recordModification('assign',
|
||||
event=event, relation=event.relation)
|
||||
|
||||
@adapter(ILoopsObject, IDeassignmentEvent)
|
||||
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