web/views/basecomponents.py
branch3.5
changeset 2937 36b11249014e
parent 2650 18aec79ec3a3
child 2968 0e3460341023
child 3002 a9d7eaa07475
equal deleted inserted replaced
2936:f35b64718d02 2937:36b11249014e
     1 """Bases HTML components:
     1 """Bases HTML components:
     2 
     2 
     3 * the rql input form
     3 * the rql input form
     4 * the logged user link
     4 * the logged user link
       
     5 * pdf view link
     5 
     6 
     6 :organization: Logilab
     7 :organization: Logilab
     7 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     8 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     8 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     9 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     9 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
    10 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
   212         else:
   213         else:
   213             html.insert(0, u'<span class="selected">%s</span>' % _('Any'))
   214             html.insert(0, u'<span class="selected">%s</span>' % _('Any'))
   214         self.w(u'&nbsp;|&nbsp;'.join(html))
   215         self.w(u'&nbsp;|&nbsp;'.join(html))
   215         self.w(u'</div>')
   216         self.w(u'</div>')
   216 
   217 
       
   218 class PdfViewComponent(component.Component):
       
   219     id = 'pdfview'
       
   220     __select__ = yes()
       
   221 
       
   222     context = 'header'
       
   223     property_defs = {
       
   224         _('visible'):  dict(type='Boolean', default=True,
       
   225                             help=_('display the pdf icon or not')),
       
   226     }
       
   227 
       
   228     def call(self, vid):
       
   229         self.req.add_css('cubes.confman.css')
       
   230         entity = self.entity(0,0)
       
   231         self.w(u'<a href="%s" class="otherView"><img src="data/pdf_icon.gif"/></a>' %
       
   232                (xml_escape(entity.absolute_url() + '?vid=%s&__template=pdf-main-template' % vid)))
       
   233 
       
   234 
   217 
   235 
   218 def registration_callback(vreg):
   236 def registration_callback(vreg):
   219     vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))
   237     vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))
   220     if 'see_also' in vreg.schema:
   238     if 'see_also' in vreg.schema:
   221         vreg.register(SeeAlsoVComponent)
   239         vreg.register(SeeAlsoVComponent)