Attachment 'PDFIcon1_0_4.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - PDFIcon macro display a PDF icon which generate a PDF document
4
5 This macro is display a picture which is a link to ?action=CreatePdfDocument to create
6 a PDF document at once. The idear is to show a PDF ready page.
7
8 @copyright: 2006 Raphael Bossek <raphael.bossek@solutions4linux.de>
9 @license: GNU GPL, see COPYING for details.
10
11 2006-11-16 RaphaelBossek
12 * Release v1.0.4
13 * Fixed URL for sub-pages.
14
15 2006-11-14 RaphaelBossek
16 * Release v1.0.3
17 * Moin 1.6 support added.
18
19 2006-09-12 RaphaelBossek
20 * Release v1.0.2
21 * Use the same workding for link description as the action macro. The same translation
22 for both can be used.
23
24 2006-09-06 RaphaelBossek
25 * Release v1.0.1
26 * Update to new action name, CreatePdfDocument
27
28 2006-08-31 RaphaelBossek
29 * Initial release v1.0.0
30 """
31
32 from MoinMoin import wikiutil
33
34 def execute (macro, args):
35 if not getattr (macro.request.cfg, 'pdficon_imageurl', None):
36 macro.request.cfg.pdficon_imageurl = u'/icons/pdf.png'
37
38 if macro.request.form.get(u'action', [u''])[0] != 'print':
39 query_string = u'action=CreatePdfDocument&generate=1'
40 if macro.request.query_string:
41 url = macro.request.url.replace(macro.request.query_string, query_string)
42 else:
43 url = macro.request.url + u'?' + query_string
44 url = macro.request.getQualifiedURL(url.replace(macro.request.http_host, u''))
45 return u'<div style="float:right;"><a href="%s"><img src="%s" style="margin:.3em 0;" title="%s" border="0" /></a></div>\n' % (url, macro.request.cfg.pdficon_imageurl, macro.request.getText(u'Create Pdf Document'),)
46 return u''
47
48 # vim:ts=4:sw=4
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.