29 """ |
29 """ |
30 id = 'edit_box' |
30 id = 'edit_box' |
31 title = _('actions') |
31 title = _('actions') |
32 order = 2 |
32 order = 2 |
33 |
33 |
34 def call(self, **kwargs): |
34 def call(self, view=None, **kwargs): |
35 _ = self.req._ |
35 _ = self.req._ |
36 title = _(self.title) |
36 title = _(self.title) |
37 if self.rset: |
37 if self.rset: |
38 etypes = self.rset.column_types(0) |
38 etypes = self.rset.column_types(0) |
39 if len(etypes) == 1: |
39 if len(etypes) == 1: |
40 plural = self.rset.rowcount > 1 and 'plural' or '' |
40 plural = self.rset.rowcount > 1 and 'plural' or '' |
41 etypelabel = display_name(self.req, iter(etypes).next(), plural) |
41 etypelabel = display_name(self.req, iter(etypes).next(), plural) |
42 title = u'%s - %s' % (title, etypelabel.lower()) |
42 title = u'%s - %s' % (title, etypelabel.lower()) |
43 box = BoxWidget(title, self.id, _class="greyBoxFrame") |
43 box = BoxWidget(title, self.id, _class="greyBoxFrame") |
44 # build list of actions |
44 # build list of actions |
45 actions = self.vreg.possible_actions(self.req, self.rset) |
45 actions = self.vreg.possible_actions(self.req, self.rset, view=view) |
46 add_menu = BoxMenu(_('add')) # 'addrelated' category |
46 add_menu = BoxMenu(_('add')) # 'addrelated' category |
47 other_menu = BoxMenu(_('more actions')) # 'moreactions' category |
47 other_menu = BoxMenu(_('more actions')) # 'moreactions' category |
48 searchstate = self.req.search_state[0] |
48 searchstate = self.req.search_state[0] |
49 for category, menu in (('mainactions', box), |
49 for category, menu in (('mainactions', box), |
50 ('addrelated', add_menu), |
50 ('addrelated', add_menu), |