From 7a88f6bc436a95536b5af896f2f4997c859571f9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 19 Oct 2014 16:02:22 -0400 Subject: [PATCH 1/1] Add SVG Image to the Home administration page This SVG image contain HREF links that are template in jinja to link images/text i the SVG to the menu pages. Clicking on elements of the SVG thus redirects to the relevant menu item. Signed-off-by: Simo Sorce Reviewed-by: Patrick Uiterwijk --- ipsilon/admin/common.py | 22 +- templates/admin/index.html | 6 + templates/admin/ipsilon-scheme.svg | 897 +++++++++++++++++++++++++++++ 3 files changed, 924 insertions(+), 1 deletion(-) create mode 100644 templates/admin/ipsilon-scheme.svg diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py index 4d69bcd..b68e53e 100755 --- a/ipsilon/admin/common.py +++ b/ipsilon/admin/common.py @@ -276,12 +276,15 @@ class Admin(AdminPage): def __init__(self, site, mount): super(Admin, self).__init__(site) + self.title = 'Home' + self.mount = mount self.url = '%s/%s' % (self.basepath, mount) - self.menu = [] + self.menu = [self] def root(self, *args, **kwargs): return self._template('admin/index.html', title='Configuration', + baseurl=self.url, menu=self.menu) def add_subtree(self, name, page): @@ -291,3 +294,20 @@ class Admin(AdminPage): def del_subtree(self, name): self.menu.remove(self.__dict__[name]) del self.__dict__[name] + + def get_menu_urls(self): + urls = dict() + for item in self.menu: + name = getattr(item, 'name', None) + if name: + urls['%s_url' % name] = cherrypy.url('/%s/%s' % (self.mount, + name)) + return urls + + @admin_protect + def scheme(self): + cherrypy.response.headers.update({'Content-Type': 'image/svg+xml'}) + urls = self.get_menu_urls() + # pylint: disable=star-args + return self._template('admin/ipsilon-scheme.svg', **urls) + scheme.public_function = True diff --git a/templates/admin/index.html b/templates/admin/index.html index a0d17fe..7ab55e1 100644 --- a/templates/admin/index.html +++ b/templates/admin/index.html @@ -2,5 +2,11 @@ {% block main %} {% if user.is_admin %}

Select an item to configure

+
+ {##} + + + +
{% endif %} {% endblock %} diff --git a/templates/admin/ipsilon-scheme.svg b/templates/admin/ipsilon-scheme.svg new file mode 100644 index 0000000..6f7fec7 --- /dev/null +++ b/templates/admin/ipsilon-scheme.svg @@ -0,0 +1,897 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + Server Stack + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + People 2 + + + + + + + + + + + + + InfoPlugins + + Documents 2 + + + + + + + + + + + + + + + + + + + + Protected Small + + + + + + + LoginPlugins + + + + IdentityProviders + + Verified + + + + + + + + + + + + + + + + + Webpage + + + + + + + + + + + + Idm Server + User + Resource + + -- 2.20.1