1 # Copyright (C) 2014 Ipsilon project Contributors, for license see COPYING
3 from ipsilon.admin.common import AdminPlugins
6 FACILITY = 'login stack'
9 class LoginStackPlugins(AdminPlugins):
11 def __init__(self, name, site, parent, facility, **kwargs):
12 super(LoginStackPlugins, self).__init__(name, site, parent,
16 def root_with_msg(self, message=None, message_type=None, changed=None):
17 return self.parent.root_with_msg(message, message_type, changed)
20 class LoginStack(AdminPlugins):
21 def __init__(self, site, parent):
24 super(LoginStack, self).__init__('loginstack', site, parent, FACILITY)
25 self.title = 'Login Stack'
26 self.template = 'admin/loginstack.html'
28 def add_subtree(self, name, page):
29 self.__dict__[name] = page
30 self.children.append(page)
32 def del_subtree(self, name):
33 self.children.remove(self.__dict__[name])
34 del self.__dict__[name]
36 def root_with_msg(self, message=None, message_type=None, changed=None):
37 # Force the url to be that of the Login Stack
38 kwargs = {'title': self.title,
39 'menu': self._master.menu,
41 'message_type': message_type,
44 for child in self.children:
45 # pylint: disable=protected-access
46 plugins = child._site[child.facility]
51 targs = {'title': child.title,
52 'available': plugins.available,
53 'enabled': plugins.enabled,
57 targs['order_name'] = '%s_order_form' % child.name
58 targs['order_action'] = child.order.url
60 kwargs['sections'].append(targs)
62 return self._template(self.template, **kwargs)