web/views/basetemplates.py
changeset 592 aae01d81c713
parent 432 8a7f619fce96
child 596 5ecf67090c2f
equal deleted inserted replaced
591:9eeb3d0a4463 592:aae01d81c713
     4 :organization: Logilab
     4 :organization: Logilab
     5 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     5 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 """
     7 """
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
       
     9 
       
    10 from StringIO import StringIO
     9 
    11 
    10 from logilab.mtconverter import html_escape
    12 from logilab.mtconverter import html_escape
    11 
    13 
    12 from cubicweb import NoSelectableObject, ObjectNotFound
    14 from cubicweb import NoSelectableObject, ObjectNotFound
    13 from cubicweb.common.view import Template, MainTemplate,  NOINDEX, NOFOLLOW
    15 from cubicweb.common.view import Template, MainTemplate,  NOINDEX, NOFOLLOW
   112         return view, rset
   114         return view, rset
   113     
   115     
   114     def call(self):
   116     def call(self):
   115         view, rset = self._select_view_and_rset()
   117         view, rset = self._select_view_and_rset()
   116         req = self.req
   118         req = self.req
       
   119         self.nav_html = StringIO()
   117         # update breadcrumps **before** validating cache, unless the view
   120         # update breadcrumps **before** validating cache, unless the view
   118         # specifies explicitly it should not be added to breadcrumb or the
   121         # specifies explicitly it should not be added to breadcrumb or the
   119         # view is a binary view
   122         # view is a binary view
   120         if view.add_to_breadcrumbs and not view.binary:
   123         if view.add_to_breadcrumbs and not view.binary:
   121             req.update_breadcrumbs()
   124             req.update_breadcrumbs()
   160         # display entity type restriction component
   163         # display entity type restriction component
   161         etypefilter = self.vreg.select_component('etypenavigation',
   164         etypefilter = self.vreg.select_component('etypenavigation',
   162                                                  self.req, self.rset)
   165                                                  self.req, self.rset)
   163         if etypefilter and etypefilter.propval('visible'):
   166         if etypefilter and etypefilter.propval('visible'):
   164             etypefilter.dispatch(w=self.w)
   167             etypefilter.dispatch(w=self.w)
   165         self.pagination(self.req, self.rset, self.w, not (view and view.need_navigation))
   168         self.pagination(self.req, self.rset, self.nav_html.write,
       
   169                         not (view and view.need_navigation))
       
   170         self.w(_(self.nav_html.getvalue()))
   166         self.w(u'<div id="contentmain">\n')
   171         self.w(u'<div id="contentmain">\n')
   167     
   172     
   168     def template_html_header(self, content_type, page_title, additional_headers=()):
   173     def template_html_header(self, content_type, page_title, additional_headers=()):
   169         w = self.whead
   174         w = self.whead
   170         lang = self.req.lang
   175         lang = self.req.lang
   196         if vtitle:
   201         if vtitle:
   197             w(u'<h1 class="vtitle">%s</h1>\n' % html_escape(vtitle))
   202             w(u'<h1 class="vtitle">%s</h1>\n' % html_escape(vtitle))
   198             
   203             
   199     def template_footer(self, view=None):
   204     def template_footer(self, view=None):
   200         self.w(u'</div>\n') # close id=contentmain
   205         self.w(u'</div>\n') # close id=contentmain
       
   206         self.w(_(self.nav_html.getvalue()))
   201         self.w(u'</div>\n') # closes id=pageContent
   207         self.w(u'</div>\n') # closes id=pageContent
   202         self.content_footer(view)
   208         self.content_footer(view)
   203         self.w(u'</td>\n')
   209         self.w(u'</td>\n')
   204         self.nav_column(view, 'right')
   210         self.nav_column(view, 'right')
   205         self.w(u'</tr></table></div>\n')
   211         self.w(u'</tr></table></div>\n')