prepare stateful (workflow) stuff for concepts

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2907 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-09-26 17:30:34 +00:00
parent 4a09b21e5f
commit 9af3d9ab29
6 changed files with 43 additions and 7 deletions

View file

@ -176,6 +176,14 @@ class ConceptRelationView(BaseView):
def order(self): def order(self):
return self.relation.order return self.relation.order
def getActions(self, category='object', page=None, target=None):
t = IType(self.context)
actInfo = t.optionsDict.get('action.' + category, '')
actNames = [n.strip() for n in actInfo.split(',')]
if actNames:
return actions.get(category, actNames, view=self, page=page, target=target)
return []
class ConceptView(BaseView): class ConceptView(BaseView):

View file

@ -12,13 +12,16 @@
<metal:title define-macro="concepttitle"> <metal:title define-macro="concepttitle">
<tal:actions condition="view/showObjectActions">
<div metal:use-macro="views/node_macros/object_actions" />
</tal:actions>
<h1 tal:attributes="ondblclick item/openEditWindow"> <h1 tal:attributes="ondblclick item/openEditWindow">
<a name="top" <a name="top"
tal:content="item/title">Title</a> tal:content="item/title">Title</a>
</h1> </h1>
<p tal:define="description description|item/description" <p tal:define="description description|item/description"
tal:condition="description"> tal:condition="description">
<i tal:content="description">Description</i></p> <i tal:content="description">Description</i></p>
</metal:title> </metal:title>
@ -80,6 +83,8 @@
<th i18n:translate="">Type</th> <th i18n:translate="">Type</th>
<th i18n:translate="">Modification Date</th> <th i18n:translate="">Modification Date</th>
<th i18n:translate="">Author(s)</th> <th i18n:translate="">Author(s)</th>
<th i18n:translate=""
tal:condition="view/showObjectActions">Info</th>
</tr> </tr>
<tal:items repeat="related children"> <tal:items repeat="related children">
<tal:item define="class python: repeat['related'].odd() and 'even' or 'odd'; <tal:item define="class python: repeat['related'].odd() and 'even' or 'odd';
@ -96,6 +101,12 @@
i18n:translate="">Type</span></td> i18n:translate="">Type</span></td>
<td><span tal:replace="related/modified">Type</span></td> <td><span tal:replace="related/modified">Type</span></td>
<td><span tal:replace="related/creators">Type</span></td> <td><span tal:replace="related/creators">Type</span></td>
<td style="white-space: nowrap"
tal:define="target nocall:related;
style nothing"
tal:condition="view/showObjectActions">
<div metal:use-macro="views/node_macros/object_actions" />
</td>
</tr> </tr>
</tal:item> </tal:item>
</tal:items> </tal:items>

View file

@ -329,6 +329,7 @@ class NodeView(BaseView):
def targetDefaultView(self): def targetDefaultView(self):
target = self.virtualTargetObject target = self.virtualTargetObject
if target is not None: if target is not None:
# zope.app.publisher.browser
name = zapi.getDefaultViewName(target, self.request) name = zapi.getDefaultViewName(target, self.request)
return self.targetView(name) return self.targetView(name)
return u'' return u''
@ -396,7 +397,8 @@ class NodeView(BaseView):
target = self.virtualTarget target = self.virtualTarget
if target is not None: if target is not None:
actions.extend(target.getActions(category, page=self, target=target)) actions.extend(target.getActions(category, page=self, target=target))
actions.extend(self.view.getAdditionalActions(category, self, target)) if target != self.virtualTarget: # self view must be used directly for target
actions.extend(self.view.getAdditionalActions(category, self, target))
return actions return actions
def getPortletActions(self, target=None): def getPortletActions(self, target=None):

View file

@ -109,5 +109,3 @@
</a> </a>
</div> </div>
</metal:actions> </metal:actions>

View file

@ -31,7 +31,7 @@ from cybertools.meta.interfaces import IOptions
from cybertools.stateful.base import Stateful as BaseStateful from cybertools.stateful.base import Stateful as BaseStateful
from cybertools.stateful.base import StatefulAdapter, IndexInfo from cybertools.stateful.base import StatefulAdapter, IndexInfo
from cybertools.stateful.interfaces import IStatesDefinition, ITransitionEvent from cybertools.stateful.interfaces import IStatesDefinition, ITransitionEvent
from loops.interfaces import ILoopsObject, IResource from loops.interfaces import ILoopsObject, IConcept, IResource
from loops import util from loops import util
@ -59,6 +59,16 @@ class SimplePublishable(StatefulLoopsObject):
statesDefinition = 'simple_publishing' statesDefinition = 'simple_publishing'
class StatefulConceptIndexInfo(IndexInfo):
adapts(IConcept)
@property
def availableStatesDefinitions(self):
options = IOptions(self.context.getLoopsRoot())
return options('organize.stateful.concept', ())
class StatefulResourceIndexInfo(IndexInfo): class StatefulResourceIndexInfo(IndexInfo):
adapts(IResource) adapts(IResource)

View file

@ -12,6 +12,13 @@
<allow interface="cybertools.stateful.interfaces.IStatefulIndexInfo" /> <allow interface="cybertools.stateful.interfaces.IStatefulIndexInfo" />
</zope:class> </zope:class>
<zope:adapter
factory="loops.organize.stateful.base.StatefulConceptIndexInfo"
trusted="True" />
<zope:class class="loops.organize.stateful.base.StatefulConceptIndexInfo">
<allow interface="cybertools.stateful.interfaces.IStatefulIndexInfo" />
</zope:class>
<!-- stateful definitions and corresponding adapters --> <!-- stateful definitions and corresponding adapters -->
<zope:utility <zope:utility