Attachment 'PDFIcon1_0_5.py'

Download

   1 # -*- coding: utf-8 -*-
   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     2007-08-15
  12     * Release v1.0.5
  13     * Support for DOCBOOK (do not create any HTML content)
  14 
  15     2006-11-16  RaphaelBossek
  16     * Release v1.0.4
  17     * Fixed URL for sub-pages.
  18 
  19     2006-11-14  RaphaelBossek
  20     * Release v1.0.3
  21     * Moin 1.6 support added.
  22 
  23     2006-09-12  RaphaelBossek
  24     * Release v1.0.2
  25     * Use the same workding for link description as the action macro. The same translation
  26       for both can be used.
  27 
  28     2006-09-06  RaphaelBossek
  29     * Release v1.0.1
  30     * Update to new action name, CreatePdfDocument
  31 
  32     2006-08-31  RaphaelBossek
  33     * Initial release v1.0.0
  34 """
  35 
  36 from MoinMoin import wikiutil
  37 
  38 def execute(macro, args):
  39 	if not getattr(macro.request.cfg, u'pdficon_imageurl', None):
  40 		macro.request.cfg.pdficon_imageurl = u'/icons/pdf.png'
  41 
  42 	if macro.request.form.get(u'action', [u''])[0] != u'print':
  43 		query_string = u'action=CreatePdfDocument&generate=1'
  44 		if macro.request.query_string:
  45 			url = macro.request.url.replace(macro.request.query_string, query_string)
  46 		else:
  47 			url = macro.request.url + u'?' + query_string
  48 		url = macro.request.getQualifiedURL(url.replace(macro.request.http_host, u''))
  49 		return macro.formatter.rawHTML(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'),))
  50 	return u''

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.
  • [get | view] (2006-08-31 21:07:49, 0.9 KB) [[attachment:PDFIcon1_0_0.py]]
  • [get | view] (2006-09-10 21:45:56, 1.0 KB) [[attachment:PDFIcon1_0_1.py]]
  • [get | view] (2006-09-18 05:00:35, 1.2 KB) [[attachment:PDFIcon1_0_2.py]]
  • [get | view] (2006-11-14 21:56:50, 1.4 KB) [[attachment:PDFIcon1_0_3.py]]
  • [get | view] (2006-11-16 22:34:49, 1.6 KB) [[attachment:PDFIcon1_0_4.py]]
  • [get | view] (2007-08-20 09:10:48, 1.7 KB) [[attachment:PDFIcon1_0_5.py]]
  • [get | view] (2010-01-31 14:10:42, 4.9 KB) [[attachment:PDFIcon1_1_0.py]]
  • [get | view] (2008-01-28 20:36:00, 1.7 KB) [[attachment:pdf_48x48.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.