1 # -*- coding: utf-8 -*- |
1 # -*- coding: utf-8 -*- |
2 """default templates for CubicWeb web client |
2 """default templates for CubicWeb web client |
3 |
3 |
4 :organization: Logilab |
4 :organization: Logilab |
5 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :copyright: 2001-2009 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 |
9 |
|
10 |
10 from logilab.mtconverter import html_escape |
11 from logilab.mtconverter import html_escape |
11 |
12 |
12 from cubicweb import NoSelectableObject, ObjectNotFound |
13 from cubicweb import NoSelectableObject, ObjectNotFound |
13 from cubicweb.common.view import Template, MainTemplate, NOINDEX, NOFOLLOW |
14 from cubicweb.common.view import Template, MainTemplate, NOINDEX, NOFOLLOW |
14 from cubicweb.common.utils import make_uid |
15 from cubicweb.common.utils import make_uid |
|
16 from cubicweb.common.utils import UStringIO |
15 |
17 |
16 from cubicweb.web.views.baseviews import vid_from_rset |
18 from cubicweb.web.views.baseviews import vid_from_rset |
17 |
19 |
18 # main templates ############################################################## |
20 # main templates ############################################################## |
19 |
21 |
161 # display entity type restriction component |
163 # display entity type restriction component |
162 etypefilter = self.vreg.select_component('etypenavigation', |
164 etypefilter = self.vreg.select_component('etypenavigation', |
163 self.req, self.rset) |
165 self.req, self.rset) |
164 if etypefilter and etypefilter.propval('visible'): |
166 if etypefilter and etypefilter.propval('visible'): |
165 etypefilter.dispatch(w=self.w) |
167 etypefilter.dispatch(w=self.w) |
166 self.pagination(self.req, self.rset, self.w, not (view and view.need_navigation)) |
168 self.nav_html = UStringIO() |
|
169 self.pagination(self.req, self.rset, self.nav_html.write, |
|
170 not (view and view.need_navigation)) |
|
171 self.w(_(self.nav_html.getvalue())) |
167 self.w(u'<div id="contentmain">\n') |
172 self.w(u'<div id="contentmain">\n') |
168 |
173 |
169 def template_html_header(self, content_type, page_title, additional_headers=()): |
174 def template_html_header(self, content_type, page_title, additional_headers=()): |
170 w = self.whead |
175 w = self.whead |
171 lang = self.req.lang |
176 lang = self.req.lang |
197 if vtitle: |
202 if vtitle: |
198 w(u'<h1 class="vtitle">%s</h1>\n' % html_escape(vtitle)) |
203 w(u'<h1 class="vtitle">%s</h1>\n' % html_escape(vtitle)) |
199 |
204 |
200 def template_footer(self, view=None): |
205 def template_footer(self, view=None): |
201 self.w(u'</div>\n') # close id=contentmain |
206 self.w(u'</div>\n') # close id=contentmain |
|
207 self.w(_(self.nav_html.getvalue())) |
202 self.w(u'</div>\n') # closes id=pageContent |
208 self.w(u'</div>\n') # closes id=pageContent |
203 self.content_footer(view) |
209 self.content_footer(view) |
204 self.w(u'</td>\n') |
210 self.w(u'</td>\n') |
205 self.nav_column(view, 'right') |
211 self.nav_column(view, 'right') |
206 self.w(u'</tr></table></div>\n') |
212 self.w(u'</tr></table></div>\n') |
417 from cubicweb.web.views.wdoc import ChangeLogView |
423 from cubicweb.web.views.wdoc import ChangeLogView |
418 self.w(u'<a href="%s">%s</a> | ' % (req.build_url('changelog'), |
424 self.w(u'<a href="%s">%s</a> | ' % (req.build_url('changelog'), |
419 req._(ChangeLogView.title).lower())) |
425 req._(ChangeLogView.title).lower())) |
420 self.w(u'<a href="%s">%s</a> | ' % (req.build_url('doc/about'), |
426 self.w(u'<a href="%s">%s</a> | ' % (req.build_url('doc/about'), |
421 req._('about this site'))) |
427 req._('about this site'))) |
422 self.w(u'© 2001-2008 <a href="http://www.logilab.fr">Logilab S.A.</a>') |
428 self.w(u'© 2001-2009 <a href="http://www.logilab.fr">Logilab S.A.</a>') |
423 self.w(u'</div>') |
429 self.w(u'</div>') |
424 |
430 |
425 |
431 |
426 class HTMLContentHeader(Template): |
432 class HTMLContentHeader(Template): |
427 """default html page content header: |
433 """default html page content header: |