changeset 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 83db1c30d391
children 87c2948f5373
files MoinMoin/action/AttachFile.py MoinMoin/formatter/text_html.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
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
--- a/MoinMoin/formatter/text_html.py	Mon Aug 20 00:25:29 2007 +0200
+++ b/MoinMoin/formatter/text_html.py	Mon Aug 20 01:18:22 2007 +0200
@@ -614,7 +614,7 @@
             #self.request.log("attachment_link: url %s pagename %s filename %s" % (url, pagename, filename))
             fname = wikiutil.taintfilename(filename)
             if AttachFile.exists(self.request, pagename, fname):
-                target = AttachFile.getAttachUrl(pagename, fname, self.request)
+                target = AttachFile.getAttachUrl(pagename, fname, self.request, do='view')
                 title = "attachment:%s" % url
                 css = 'attachment'
             else: