web/views/idownloadable.py
branchstable
changeset 3846 1a7d10864628
parent 3789 fb22b55f80f8
child 3890 d7a270f50f54
child 4212 ab6573088b4a
equal deleted inserted replaced
3845:596044fb7bc5 3846:1a7d10864628
    23     mt = entity.download_content_type()
    23     mt = entity.download_content_type()
    24     if not (mt and mt.startswith('image/')):
    24     if not (mt and mt.startswith('image/')):
    25         return 0
    25         return 0
    26     return 1
    26     return 1
    27 
    27 
    28 def download_box(w, entity, title=None, label=None):
    28 def download_box(w, entity, title=None, label=None, footer=u''):
    29     req = entity.req
    29     req = entity.req
    30     w(u'<div class="sideBox">')
    30     w(u'<div class="sideBox">')
    31     if title is None:
    31     if title is None:
    32         title = req._('download')
    32         title = req._('download')
    33     w(u'<div class="sideBoxTitle downloadBoxTitle"><span>%s</span></div>'
    33     w(u'<div class="sideBoxTitle downloadBoxTitle"><span>%s</span></div>'
    35     w(u'<div class="sideBox downloadBox"><div class="sideBoxBody">')
    35     w(u'<div class="sideBox downloadBox"><div class="sideBoxBody">')
    36     w(u'<a href="%s"><img src="%s" alt="%s"/> %s</a>'
    36     w(u'<a href="%s"><img src="%s" alt="%s"/> %s</a>'
    37       % (xml_escape(entity.download_url()),
    37       % (xml_escape(entity.download_url()),
    38          req.external_resource('DOWNLOAD_ICON'),
    38          req.external_resource('DOWNLOAD_ICON'),
    39          _('download icon'), xml_escape(label or entity.dc_title())))
    39          _('download icon'), xml_escape(label or entity.dc_title())))
    40     w(u'</div>')
    40     w(u'%s</div>' % footer)
    41     w(u'</div>\n</div>\n')
    41     w(u'</div></div>\n')
    42 
    42 
    43 
    43 
    44 class DownloadBox(EntityBoxTemplate):
    44 class DownloadBox(EntityBoxTemplate):
    45     id = 'download_box'
    45     id = 'download_box'
    46     # no download box for images
    46     # no download box for images