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 # 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
@ -103,3 +103,7 @@ class TrackView(object):
@Lazy @Lazy
def timeStamp(self): def timeStamp(self):
return timeStamp2ISO(self.metadata['timeStamp']) 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> <td tal:content="view/run"></td></tr>
<tr> <tr>
<td>User:</td> <td>User:</td>
<td><a tal:omit-tag="not:view/userUrl" <td><a tal:define="userUrl view/userUrl|nothing"
tal:attributes="href view/userUrl" tal:omit-tag="not:userUrl"
tal:attributes="href userUrl"
tal:content="view/userTitle" /></td></tr> tal:content="view/userTitle" /></td></tr>
<tr> <tr>
<td>Timestamp:</td> <td>Timestamp:</td>
<td tal:content="view/timeStamp"></td></tr> <td tal:content="view/timeStamp"></td></tr>
<tr tal:repeat="key view/additionalMetadataFields"> <tr tal:repeat="key view/additionalMetadataFields">
<td><span tal:replace="key" />:</td> <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> </table>
<h2>Data</h2> <h2>Data</h2>
<div tal:content="context/data" /> <div tal:content="context/data" />

View file

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