From 8e8ac77661ab96508c7e38276ead3df8f584626b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 5 May 2014 00:31:02 +0530 Subject: [PATCH] Convert pagekite introduction page to templates --- modules/installed/router/pagekite.py | 50 ++++--------------- .../templates/pagekite_introduction.html | 38 ++++++++++++++ templates/menu_block.html | 8 +++ util.py | 1 + 4 files changed, 56 insertions(+), 41 deletions(-) create mode 100644 modules/installed/router/templates/pagekite_introduction.html create mode 100644 templates/menu_block.html diff --git a/modules/installed/router/pagekite.py b/modules/installed/router/pagekite.py index 10d86dbb7..cc87fac2a 100644 --- a/modules/installed/router/pagekite.py +++ b/modules/installed/router/pagekite.py @@ -44,53 +44,21 @@ class PageKite(PagePlugin): _("Public Visibility (PageKite)"), "icon-flag", "/router/setup/pagekite", 50) + @staticmethod @cherrypy.expose @require() - def index(self, **kwargs): + def index(**kwargs): """Serve introcution page""" del kwargs # Unused - main = _(""" -

PageKite is a system for exposing {box_name} services when you -don't have a direct connection to the Internet. You only need this -service if your {box_name} services are unreachable from the rest of -the Internet. This includes the following situations:

+ menu = {'title': _('PageKite'), + 'items': [{'url': '/router/setup/pagekite/configure', + 'text': _('Configure PageKite')}]} + sidebar_right = util.render_template(template='menu_block', menu=menu) - - -

PageKite works around NAT, firewalls and IP-address limitations by -using a combination of tunnels and reverse proxies. Currently, -exposing web server and SSH server are supported. An intermediary -server with direct Internet access is required. Currently, only -pagekite.net server is supported and you will need an account -there. In future, it might be possible to use your buddy's {box_name} -for this.

- -

Configure -PageKite

-""").format(box_name=cfg.box_name, server_dir=cfg.server_dir) - - sidebar_right = _(''' -PageKite -

Configure -PageKite

''').format(server_dir=cfg.server_dir) - - return util.render_template(title=_("Public Visibility (PageKite)"), - main=main, sidebar_right=sidebar_right) + return util.render_template(template='pagekite_introduction', + title=_("Public Visibility (PageKite)"), + sidebar_right=sidebar_right) class configure(FormPlugin, PagePlugin): # pylint: disable-msg=C0103 diff --git a/modules/installed/router/templates/pagekite_introduction.html b/modules/installed/router/templates/pagekite_introduction.html new file mode 100644 index 000000000..bb0fcf3e6 --- /dev/null +++ b/modules/installed/router/templates/pagekite_introduction.html @@ -0,0 +1,38 @@ +{% extends "login_nav.html" %} + +{% block main_block %} +

PageKite is a system for exposing {{ cfg.box_name }} services when +you don't have a direct connection to the Internet. You only need this +service if your {{ cfg.box_name }} services are unreachable from the +rest of the Internet. This includes the following situations:

+ + + +

PageKite works around NAT, firewalls and IP-address limitations by +using a combination of tunnels and reverse proxies. Currently, +exposing web server and SSH server are supported. An intermediary +server with direct Internet access is required. Currently, only +pagekite.net server is supported and you will need an account +there. In future, it might be possible to use your buddy's +{{ cfg.box_name }} for this.

+ +

+ Configure + PageKite +

+ +{% endblock %} diff --git a/templates/menu_block.html b/templates/menu_block.html new file mode 100644 index 000000000..05c9c0a5e --- /dev/null +++ b/templates/menu_block.html @@ -0,0 +1,8 @@ + diff --git a/util.py b/util.py index 20a5cba92..d90bc4000 100644 --- a/util.py +++ b/util.py @@ -81,6 +81,7 @@ def render_template(template='login_nav', **kwargs): kwargs['sub_menu_js'] = submenu kwargs['current_url'] = cherrypy.url() kwargs['username'] = cherrypy.session.get(cfg.session_key) + kwargs['cfg'] = cfg if not kwargs['nav'] and submenu: kwargs['nav'] = """