web/views/basecomponents.py
branch3.5
changeset 2937 36b11249014e
parent 2650 18aec79ec3a3
child 2968 0e3460341023
child 3002 a9d7eaa07475
--- a/web/views/basecomponents.py	Thu Aug 20 17:52:21 2009 +0200
+++ b/web/views/basecomponents.py	Thu Aug 20 18:30:18 2009 +0200
@@ -2,6 +2,7 @@
 
 * the rql input form
 * the logged user link
+* pdf view link
 
 :organization: Logilab
 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
@@ -214,6 +215,23 @@
         self.w(u' | '.join(html))
         self.w(u'</div>')
 
+class PdfViewComponent(component.Component):
+    id = 'pdfview'
+    __select__ = yes()
+
+    context = 'header'
+    property_defs = {
+        _('visible'):  dict(type='Boolean', default=True,
+                            help=_('display the pdf icon or not')),
+    }
+
+    def call(self, vid):
+        self.req.add_css('cubes.confman.css')
+        entity = self.entity(0,0)
+        self.w(u'<a href="%s" class="otherView"><img src="data/pdf_icon.gif"/></a>' %
+               (xml_escape(entity.absolute_url() + '?vid=%s&__template=pdf-main-template' % vid)))
+
+
 
 def registration_callback(vreg):
     vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))