web/views/basecomponents.py
branchstable
changeset 3840 2eff4348b1e4
parent 3818 9522e51d8644
child 3844 c2625c512085
equal deleted inserted replaced
3839:84c9aab84d8c 3840:2eff4348b1e4
   202         else:
   202         else:
   203             html.insert(0, u'<span class="selected">%s</span>' % _('Any'))
   203             html.insert(0, u'<span class="selected">%s</span>' % _('Any'))
   204         self.w(u'&#160;|&#160;'.join(html))
   204         self.w(u'&#160;|&#160;'.join(html))
   205         self.w(u'</div>')
   205         self.w(u'</div>')
   206 
   206 
   207 class PdfViewComponent(component.Component):
   207 
   208     id = 'pdfview'
   208 class PdfViewComponent(component.EntityVComponent):
   209     __select__ = yes()
   209     id = 'view_page_as_pdf'
   210 
   210     context = 'ctxtoolbar'
   211     context = 'header'
   211 
   212     property_defs = {
   212     def cell_call(self, row, col, view):
   213         _('visible'):  dict(type='Boolean', default=True,
   213         entity = self.entity(row, col)
   214                             help=_('display the pdf icon or not')),
   214         url = entity.absolute_url(vid=view.id, __template='pdf-main-template')
   215     }
   215         iconurl = self.req.build_url('data/pdf_icon.gif')
   216 
   216         label = self.req._('Download page as pdf')
   217     def call(self, vid):
   217         self.w(u'<a href="%s" title="%s" class="toolbarButton"><img src="%s" alt="%s"/></a>' %
   218         entity = self.entity(0,0)
   218                (xml_escape(url), label, iconurl, label))
   219         url = entity.absolute_url(vid=vid, __template='pdf-main-template')
       
   220         self.w(u'<a href="%s" class="otherView"><img src="data/pdf_icon.gif" alt="%s"/></a>' %
       
   221                (xml_escape(url), self.req._('download page as pdf')))
       
   222 
   219 
   223 
   220 
   224 
   221 
   225 def registration_callback(vreg):
   222 def registration_callback(vreg):
   226     vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))
   223     vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))