--- a/web/views/idownloadable.py Tue Apr 28 10:11:08 2009 +0200
+++ b/web/views/idownloadable.py Tue Apr 28 11:22:31 2009 +0200
@@ -43,9 +43,10 @@
id = 'download_box'
# no download box for images
# XXX primary_view selector ?
- __select__ = (one_line_rset() & implements(IDownloadable) & match_context_prop() & ~score_entity(is_image))
+ __select__ = (one_line_rset() & implements(IDownloadable) &
+ match_context_prop() & ~score_entity(is_image))
order = 10
-
+
def cell_call(self, row, col, title=None, label=None, **kwargs):
entity = self.entity(row, col)
download_box(self.w, entity, title, label)
@@ -86,14 +87,14 @@
__select__ = implements(IDownloadable)
title = None # should not be listed in possible views
-
+
def cell_call(self, row, col, title=None, **kwargs):
entity = self.entity(row, col)
url = html_escape(entity.download_url())
self.w(u'<a href="%s">%s</a>' % (url, html_escape(title or entity.dc_title())))
-
+
class IDownloadablePrimaryView(baseviews.PrimaryView):
__select__ = implements(IDownloadable)
# XXX File/Image attributes but this is not specified in the IDownloadable interface
@@ -103,7 +104,7 @@
self.w(u'<h1>%s %s</h1>'
% (entity.dc_type().capitalize(),
html_escape(entity.dc_title())))
-
+
def render_entity_attributes(self, entity, siderelations):
super(IDownloadablePrimaryView, self).render_entity_attributes(entity, siderelations)
self.w(u'<div class="content">')
@@ -121,7 +122,7 @@
msg = self.req._("can't display data, unexpected error: %s") % ex
self.w('<div class="error">%s</div>' % msg)
self.w(u'</div>')
-
+
def is_side_related(self, rschema, eschema):
"""display all relations as side related"""
return True
@@ -143,16 +144,16 @@
class ImageView(baseviews.EntityView):
id = 'image'
__select__ = implements(IDownloadable) & score_entity(is_image)
-
+
title = _('image')
-
+
def call(self):
rset = self.rset
for i in xrange(len(rset)):
self.w(u'<div class="efile">')
self.wview(self.id, rset, row=i, col=0)
self.w(u'</div>')
-
+
def cell_call(self, row, col):
entity = self.entity(row, col)
#if entity.data_format.startswith('image/'):