web/views/basecomponents.py
branchstable
changeset 3840 2eff4348b1e4
parent 3818 9522e51d8644
child 3844 c2625c512085
--- a/web/views/basecomponents.py	Fri Nov 13 11:14:48 2009 +0100
+++ b/web/views/basecomponents.py	Fri Nov 13 11:16:24 2009 +0100
@@ -204,21 +204,18 @@
         self.w(u' | '.join(html))
         self.w(u'</div>')
 
-class PdfViewComponent(component.Component):
-    id = 'pdfview'
-    __select__ = yes()
+
+class PdfViewComponent(component.EntityVComponent):
+    id = 'view_page_as_pdf'
+    context = 'ctxtoolbar'
 
-    context = 'header'
-    property_defs = {
-        _('visible'):  dict(type='Boolean', default=True,
-                            help=_('display the pdf icon or not')),
-    }
-
-    def call(self, vid):
-        entity = self.entity(0,0)
-        url = entity.absolute_url(vid=vid, __template='pdf-main-template')
-        self.w(u'<a href="%s" class="otherView"><img src="data/pdf_icon.gif" alt="%s"/></a>' %
-               (xml_escape(url), self.req._('download page as pdf')))
+    def cell_call(self, row, col, view):
+        entity = self.entity(row, col)
+        url = entity.absolute_url(vid=view.id, __template='pdf-main-template')
+        iconurl = self.req.build_url('data/pdf_icon.gif')
+        label = self.req._('Download page as pdf')
+        self.w(u'<a href="%s" title="%s" class="toolbarButton"><img src="%s" alt="%s"/></a>' %
+               (xml_escape(url), label, iconurl, label))