web/views/basecomponents.py
changeset 3890 d7a270f50f54
parent 3659 993997b4b41d
parent 3848 adc706f312a2
child 4004 c52619c738a5
--- a/web/views/basecomponents.py	Sun Nov 08 21:53:18 2009 +0100
+++ b/web/views/basecomponents.py	Fri Nov 20 19:35:54 2009 +0100
@@ -215,23 +215,30 @@
         self.w(u' | '.join(html))
         self.w(u'</div>')
 
-class PdfViewComponent(component.Component):
+
+class PdfViewComponent(component.EntityVComponent):
     __regid__ = 'pdfview'
     __select__ = yes()
 
-    context = 'header'
-    cw_property_defs = {
-        _('visible'):  dict(type='Boolean', default=True,
-                            help=_('display the pdf icon or not')),
-    }
+    context = 'ctxtoolbar'
 
-    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._cw._('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))
 
 
+class MetaDataComponent(component.EntityVComponent):
+    id = 'metadata'
+    context = 'navbottom'
+    order = 1
+
+    def cell_call(self, row, col, view=None):
+        self.wview('metadata', self.rset, row=row, col=col)
+
 
 def registration_callback(vreg):
     vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))