make viewing of tracks more flexible: show links to metadata targets if appropriate

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3760 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-03-08 16:23:05 +00:00
parent 439ddf7c3d
commit ec60869bf9
3 changed files with 16 additions and 7 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2010 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
@ -103,3 +103,7 @@ class TrackView(object):
@Lazy
def timeStamp(self):
return timeStamp2ISO(self.metadata['timeStamp'])
def getMetadataTarget(self, key):
value = self.metadata.get(key)
return dict(title=value, url=None, obj=value)

View file

@ -16,15 +16,19 @@
<td tal:content="view/run"></td></tr>
<tr>
<td>User:</td>
<td><a tal:omit-tag="not:view/userUrl"
tal:attributes="href view/userUrl"
<td><a tal:define="userUrl view/userUrl|nothing"
tal:omit-tag="not:userUrl"
tal:attributes="href userUrl"
tal:content="view/userTitle" /></td></tr>
<tr>
<td>Timestamp:</td>
<td tal:content="view/timeStamp"></td></tr>
<tr tal:repeat="key view/additionalMetadataFields">
<td><span tal:replace="key" />:</td>
<td tal:content="view/metadata/?key"></td></tr>
<td><a tal:define="target python: view.getMetadataTarget(key)"
tal:omit-tag="not:target/url"
tal:attributes="href target/url"
tal:content="python: target['title'] or '???'" /></td></tr>
</table>
<h2>Data</h2>
<div tal:content="context/data" />

View file

@ -52,9 +52,10 @@
tal:attributes="href item/taskUrl"
tal:content="item/taskTitle"></a></td>
<td tal:content="item/run"></td>
<td><a tal:omit-tag="not:item/userUrl"
tal:attributes="href item/userUrl"
tal:content="item/userTitle"></a></td>
<td><a tal:define="userUrl view/userUrl|nothing"
tal:omit-tag="not:userUrl"
tal:attributes="href userUrl"
tal:content="item/userTitle|string:???"></a></td>
<td tal:content="item/timeStamp"></td>
</tr>
</tal:list>