From: Simo Sorce Date: Sun, 19 Oct 2014 20:02:22 +0000 (-0400) Subject: Add SVG Image to the Home administration page X-Git-Tag: v0.3.0~32 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=commitdiff_plain;h=7a88f6bc436a95536b5af896f2f4997c859571f9;hp=f3575089742ba85ed420f6f9becd2cde4135097f 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 --- 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 + +