--- a/web/views/boxes.py Wed Sep 23 19:26:38 2009 +0200
+++ b/web/views/boxes.py Wed Sep 23 19:40:19 2009 +0200
@@ -40,19 +40,19 @@
order = 2
def call(self, view=None, **kwargs):
- _ = self.req._
+ _ = self._cw._
title = _(self.title)
- if self.rset:
- etypes = self.rset.column_types(0)
+ if self.cw_rset:
+ etypes = self.cw_rset.column_types(0)
if len(etypes) == 1:
- plural = self.rset.rowcount > 1 and 'plural' or ''
- etypelabel = display_name(self.req, iter(etypes).next(), plural)
+ plural = self.cw_rset.rowcount > 1 and 'plural' or ''
+ etypelabel = display_name(self._cw, iter(etypes).next(), plural)
title = u'%s - %s' % (title, etypelabel.lower())
- box = BoxWidget(title, self.id, _class="greyBoxFrame")
+ box = BoxWidget(title, self.__regid__, _class="greyBoxFrame")
self._menus_in_order = []
self._menus_by_id = {}
# build list of actions
- actions = self.vreg['actions'].possible_actions(self.req, self.rset,
+ actions = self._cw.vreg['actions'].possible_actions(self._cw, self.cw_rset,
view=view)
other_menu = self._get_menu('moreactions', _('more actions'))
for category, defaultmenu in (('mainactions', box),
@@ -85,7 +85,7 @@
return self._menus_by_id[id]
except KeyError:
if title is None:
- title = self.req._(id)
+ title = self._cw._(id)
self._menus_by_id[id] = menu = BoxMenu(title)
menu.label_prefix = label_prefix
self._menus_in_order.append(menu)
@@ -122,7 +122,7 @@
</form>"""
def call(self, view=None, **kwargs):
- req = self.req
+ req = self._cw
if req.form.pop('__fromsearchbox', None):
rql = req.form.get('rql', '')
else:
@@ -130,7 +130,7 @@
form = self.formdef % (req.build_url('view'), req.next_tabindex(),
xml_escape(rql), req.next_tabindex())
title = u"""<span onclick="javascript: toggleVisibility('rqlinput')">%s</span>""" % req._(self.title)
- box = BoxWidget(title, self.id, _class="searchBoxFrame", islist=False, escape=False)
+ box = BoxWidget(title, self.__regid__, _class="searchBoxFrame", islist=False, escape=False)
box.append(BoxHtml(form))
box.render(self.w)
@@ -147,9 +147,9 @@
order = 10
def call(self, **kwargs):
- box = BoxWidget(self.req._(self.title), self.id)
- views = [v for v in self.vreg['views'].possible_views(self.req,
- rset=self.rset)
+ box = BoxWidget(self._cw._(self.title), self.__regid__)
+ views = [v for v in self._cw.vreg['views'].possible_views(self._cw,
+ rset=self.cw_rset)
if v.category != 'startupview']
for category, views in self.sort_actions(views):
menu = BoxMenu(category)
@@ -168,8 +168,8 @@
order = 70
def call(self, **kwargs):
- box = BoxWidget(self.req._(self.title), self.id)
- for view in self.vreg['views'].possible_views(self.req, None):
+ box = BoxWidget(self._cw._(self.title), self.__regid__)
+ for view in self._cw.vreg['views'].possible_views(self._cw, None):
if view.category == 'startupview':
box.append(self.box_action(view))
@@ -189,19 +189,19 @@
self.w(u'<div class="sideBoxTitle"><span>%s</span></div>' % title)
self.w(u'<div class="%s"><div class="sideBoxBody">' % boxclass)
# if not too much entities, show them all in a list
- maxrelated = self.req.property_value('navigation.related-limit')
- if self.rset.rowcount <= maxrelated:
- if len(self.rset) == 1:
- self.wview('incontext', self.rset, row=0)
- elif 1 < len(self.rset) < 5:
- self.wview('csv', self.rset)
+ maxrelated = self._cw.property_value('navigation.related-limit')
+ if self.cw_rset.rowcount <= maxrelated:
+ if len(self.cw_rset) == 1:
+ self.wview('incontext', self.cw_rset, row=0)
+ elif 1 < len(self.cw_rset) < 5:
+ self.wview('csv', self.cw_rset)
else:
- self.wview('simplelist', self.rset)
+ self.wview('simplelist', self.cw_rset)
# else show links to display related entities
else:
- self.rset.limit(maxrelated)
- rql = self.rset.printable_rql(encoded=False)
- self.wview('simplelist', self.rset)
- self.w(u'[<a href="%s">%s</a>]' % (self.build_url(rql=rql),
- self.req._('see them all')))
+ self.cw_rset.limit(maxrelated)
+ rql = self.cw_rset.printable_rql(encoded=False)
+ self.wview('simplelist', self.cw_rset)
+ self.w(u'[<a href="%s">%s</a>]' % (self._cw.build_url(rql=rql),
+ self._cw._('see them all')))
self.w(u'</div>\n</div>\n')