diff MoinMoin/action/AttachFile.py @ 2736:2ffae6c847fd

change the default link target for attachments to 'do=view', add a download link at top of the view page
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 20 Aug 2007 01:18:22 +0200
parents cdda42a9d8a8
children 87c2948f5373
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Mon Aug 20 00:25:29 2007 +0200
+++ b/MoinMoin/action/AttachFile.py	Mon Aug 20 01:18:22 2007 +0200
@@ -991,10 +991,14 @@
         return
 
     request.write('<h2>' + _("Attachment '%(filename)s'") % {'filename': filename} + '</h2>')
+    # show a download link above the content
+    label = _('Download')
+    url = getAttachUrl(pagename, filename, request, escaped=1, do='get')
+    timestamp = htdocs_access(request) and "?%s" % time.time() or ''
+    request.write('<a href="%s%s">%s<a><br><br>' % (url, timestamp, label))
 
     mt = wikiutil.MimeType(filename=filename)
     if mt.major == 'image':
-        timestamp = htdocs_access(request) and "?%s" % time.time() or ''
         request.write('<img src="%s%s" alt="%s">' % (
             getAttachUrl(pagename, filename, request, escaped=1), timestamp, wikiutil.escape(filename, 1)))
         return