web/action.py
branch3.5
changeset 3219 be8cfc00ae04
parent 2698 a6ef9bec755e
child 3220 11b6016e3970
equal deleted inserted replaced
3218:2a4bbe3fa4f3 3219:be8cfc00ae04
    32                                      'useractions', 'siteactions', 'hidden'),
    32                                      'useractions', 'siteactions', 'hidden'),
    33                          help=_('context where this component should be displayed')),
    33                          help=_('context where this component should be displayed')),
    34     }
    34     }
    35     site_wide = True # don't want user to configuration actions eproperties
    35     site_wide = True # don't want user to configuration actions eproperties
    36     category = 'moreactions'
    36     category = 'moreactions'
       
    37     # actions in category 'moreactions' can specify a sub-menu in which they should be filed
       
    38     submenu = None
       
    39 
       
    40     def fill_menu(self, box, menu):
       
    41         """add action(s) to the given submenu of the given box"""
       
    42         menu.append(box.box_action(self))
    37 
    43 
    38     def url(self):
    44     def url(self):
    39         """return the url associated with this action"""
    45         """return the url associated with this action"""
    40         raise NotImplementedError
    46         raise NotImplementedError
    41 
    47 
    73     __select__ = (match_search_state('normal') & one_line_rset()
    79     __select__ = (match_search_state('normal') & one_line_rset()
    74                   & partial_relation_possible(action='add')
    80                   & partial_relation_possible(action='add')
    75                   & partial_may_add_relation())
    81                   & partial_may_add_relation())
    76     registered = accepts_compat(Action.registered)
    82     registered = accepts_compat(Action.registered)
    77 
    83 
    78     category = 'addrelated'
    84     submenu = 'addrelated'
    79 
    85 
    80     def url(self):
    86     def url(self):
    81         current_entity = self.rset.get_entity(self.row or 0, self.col or 0)
    87         current_entity = self.rset.get_entity(self.row or 0, self.col or 0)
    82         linkto = '%s:%s:%s' % (self.rtype, current_entity.eid, target(self))
    88         linkto = '%s:%s:%s' % (self.rtype, current_entity.eid, target(self))
    83         return self.build_url(vid='creation', etype=self.etype,
    89         return self.build_url(vid='creation', etype=self.etype,