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">
|
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,10 @@ 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)))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,8 @@
|
||||||
<div>
|
<div>
|
||||||
<span i18n:translate="">State</span>:
|
<span i18n:translate="">State</span>:
|
||||||
<span i18n:translate=""
|
<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="">Transition</span>:
|
||||||
<span i18n:translate=""
|
<span i18n:translate=""
|
||||||
tal:content="view/transition/title" />
|
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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Recording changes to loops objects.
|
Recording changes to loops objects.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.app.container.interfaces import IObjectAddedEvent, IObjectRemovedEvent
|
from zope.app.container.interfaces import IObjectAddedEvent, IObjectRemovedEvent
|
||||||
|
@ -53,6 +51,9 @@ class ChangeManager(BaseRecordManager):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def valid(self):
|
def valid(self):
|
||||||
|
req = util.getRequest()
|
||||||
|
if req and req.form.get('organize.suppress_tracking'):
|
||||||
|
return False
|
||||||
return (not (self.context is None or
|
return (not (self.context is None or
|
||||||
self.storage is None or
|
self.storage is None or
|
||||||
self.personId is None)
|
self.personId is None)
|
||||||
|
@ -70,6 +71,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 +97,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