web/views/boxes.py
changeset 3377 dd9d292b6a6d
parent 3219 be8cfc00ae04
child 3451 6b46d73823f5
equal deleted inserted replaced
3376:f5c69485381f 3377:dd9d292b6a6d
    31 class EditBox(BoxTemplate): # XXX rename to ActionsBox
    31 class EditBox(BoxTemplate): # XXX rename to ActionsBox
    32     """
    32     """
    33     box with all actions impacting the entity displayed: edit, copy, delete
    33     box with all actions impacting the entity displayed: edit, copy, delete
    34     change state, add related entities
    34     change state, add related entities
    35     """
    35     """
    36     id = 'edit_box'
    36     __regid__ = 'edit_box'
    37     __select__ = BoxTemplate.__select__ & non_final_entity()
    37     __select__ = BoxTemplate.__select__ & non_final_entity()
    38 
    38 
    39     title = _('actions')
    39     title = _('actions')
    40     order = 2
    40     order = 2
    41 
    41 
   104             box.append(RawBoxItem(xml_escape(submenu.label)))
   104             box.append(RawBoxItem(xml_escape(submenu.label)))
   105 
   105 
   106 
   106 
   107 class SearchBox(BoxTemplate):
   107 class SearchBox(BoxTemplate):
   108     """display a box with a simple search form"""
   108     """display a box with a simple search form"""
   109     id = 'search_box'
   109     __regid__ = 'search_box'
   110 
   110 
   111     visible = True # enabled by default
   111     visible = True # enabled by default
   112     title = _('search')
   112     title = _('search')
   113     order = 0
   113     order = 0
   114     formdef = u"""<form action="%s">
   114     formdef = u"""<form action="%s">
   137 
   137 
   138 # boxes disabled by default ###################################################
   138 # boxes disabled by default ###################################################
   139 
   139 
   140 class PossibleViewsBox(BoxTemplate):
   140 class PossibleViewsBox(BoxTemplate):
   141     """display a box containing links to all possible views"""
   141     """display a box containing links to all possible views"""
   142     id = 'possible_views_box'
   142     __regid__ = 'possible_views_box'
   143     __select__ = BoxTemplate.__select__ & match_user_groups('users', 'managers')
   143     __select__ = BoxTemplate.__select__ & match_user_groups('users', 'managers')
   144 
   144 
   145     visible = False
   145     visible = False
   146     title = _('possible views')
   146     title = _('possible views')
   147     order = 10
   147     order = 10
   160             box.render(self.w)
   160             box.render(self.w)
   161 
   161 
   162 
   162 
   163 class StartupViewsBox(BoxTemplate):
   163 class StartupViewsBox(BoxTemplate):
   164     """display a box containing links to all startup views"""
   164     """display a box containing links to all startup views"""
   165     id = 'startup_views_box'
   165     __regid__ = 'startup_views_box'
   166     visible = False # disabled by default
   166     visible = False # disabled by default
   167     title = _('startup views')
   167     title = _('startup views')
   168     order = 70
   168     order = 70
   169 
   169 
   170     def call(self, **kwargs):
   170     def call(self, **kwargs):
   179 
   179 
   180 # helper classes ##############################################################
   180 # helper classes ##############################################################
   181 
   181 
   182 class SideBoxView(EntityView):
   182 class SideBoxView(EntityView):
   183     """helper view class to display some entities in a sidebox"""
   183     """helper view class to display some entities in a sidebox"""
   184     id = 'sidebox'
   184     __regid__ = 'sidebox'
   185 
   185 
   186     def call(self, boxclass='sideBox', title=u''):
   186     def call(self, boxclass='sideBox', title=u''):
   187         """display a list of entities by calling their <item_vid> view"""
   187         """display a list of entities by calling their <item_vid> view"""
   188         if title:
   188         if title:
   189             self.w(u'<div class="sideBoxTitle"><span>%s</span></div>' % title)
   189             self.w(u'<div class="sideBoxTitle"><span>%s</span></div>' % title)