show target and source info on work items that have been moved or delegated

This commit is contained in:
Helmut Merz 2011-06-15 18:50:57 +02:00
parent e74d21bb7a
commit fea68978f3
4 changed files with 43 additions and 6 deletions

View file

@ -134,6 +134,7 @@
</div>
</metal:block>
<metal:assignments define-macro="assignments"
tal:condition="view/showAssignments">
<tr>

View file

@ -24,11 +24,8 @@ $Id$
"""
from zope import interface, component
from zope.app import zapi
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
#from zope.formlib.namedtemplate import NamedTemplate
from zope.i18nmessageid import MessageFactory
from cybertools.browser.action import actions
from cybertools.typology.interfaces import IType

View file

@ -31,7 +31,7 @@ from zope.cachedescriptors.property import Lazy
from zope.event import notify
from zope.lifecycleevent import ObjectModifiedEvent
from zope.traversing.browser import absoluteURL
from zope.traversing.api import getName
from zope.traversing.api import getName, getParent
from cybertools.ajax import innerHtml
from cybertools.browser.action import actions
@ -116,6 +116,18 @@ class WorkItemDetails(TrackDetails):
if value is not None:
return weekDays[value.weekday()].title()
@Lazy
def sourceWorkItem(self):
sourceId = self.track.data.get('source')
if sourceId:
return getParent(self.track)[sourceId]
@Lazy
def targetWorkItem(self):
targetId = self.track.data.get('target')
if targetId:
return getParent(self.track)[targetId]
def actions(self):
info = DialogAction(self.view,
description=_(u'Information about this work item.'),

View file

@ -166,7 +166,8 @@
<metal:info define-macro="workitem_info"
tal:define="item nocall:view/track">
<table class="object_info" width="400">
<table class="object_info" width="400"
tal:define="state item/track/getStateObject">
<tr>
<td colspan="2"><h2 i18n:translate="">Work Item Information</h2><br /></td>
</tr>
@ -201,7 +202,7 @@
<td valign="top"><span i18n:translate="">Comment</span>:</td>
<td tal:content="item/track/comment"></td>
</tr>
<tr tal:define="state item/track/getStateObject">
<tr>
<td><span i18n:translate="">State</span>:</td>
<td i18n:translate=""
tal:content="state/title"></td>
@ -212,6 +213,32 @@
(<span tal:content="python:
item.getUserForUserName(item.track.creator)['title']" />)</td>
</tr>
<tr tal:condition="python:state.name == 'delegated'">
<td><span i18n:translate="">Delegated to</span>:</td>
<td><a tal:define="party python:view.getObjectForUid(item.targetWorkItem.party)"
tal:attributes="href python:view.getUrlForTarget(party)"
tal:content="party/title" /></td>
</tr>
<tr tal:condition="python:state.name == 'moved'">
<td><span i18n:translate="">Moved To</span>:</td>
<td><a tal:define="task python:view.getObjectForUid(item.targetWorkItem.taskId)"
tal:attributes="href python:view.getUrlForTarget(task)"
tal:content="task/title" /></td>
</tr>
<tr tal:define="source item/sourceWorkItem;
isDelegated python:source and source.state == 'delegated'"
tal:condition="source">
<td>
<span tal:condition="isDelegated"
i18n:translate="">Delegated by</span>
<span tal:condition="not:isDelegated"
i18n:translate="">Moved From</span>:
</td>
<td><a tal:define="objId python:isDelegated and source.party or source.taskId;
obj python:view.getObjectForUid(objId)"
tal:attributes="href python:view.getUrlForTarget(obj)"
tal:content="obj/title" /></td>
</tr>
<tr>
<td colspan="2"><br />
<input type="button" value="Close" onclick="closeDialog()"