# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - PDFIcon macro display a PDF icon which generate a PDF document

    This macro is display a picture which is a link to ?action=PDF to create
    a PDF document at once. The idear is to show a PDF ready page.

    @copyright: 2006  Raphael Bossek <raphael.bossek@solutions4linux.de>
    @license: GNU GPL, see COPYING for details.

    2006-08-31  Raphael Bossek
    * Initial release 1.0.0
"""

def execute (macro, args):
	if not getattr (macro.request.cfg, 'pdficon_imageurl', None):
		macro.request.cfg.pdficon_imageurl = u'/icons/pdf.png'

	if macro.form.get(u'action', [u''])[0] != 'print':
		return u'<div style="float:right;"><a href="?action=PDF&generate=1"><img src="%s" style="margin:.3em 0;" title="%s" border="0" /></a></div>\n' % (macro.request.cfg.pdficon_imageurl, macro.request.getText(u'Create PDF document'),)
	return u''

# vim:ts=4:sw=4
