Convert pagekite introduction page to templates

This commit is contained in:
Sunil Mohan Adapa 2014-05-05 00:31:02 +05:30
parent a54672ae01
commit 8e8ac77661
4 changed files with 56 additions and 41 deletions

View File

@ -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 = _("""
<p>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: </p>
menu = {'title': _('PageKite'),
'items': [{'url': '/router/setup/pagekite/configure',
'text': _('Configure PageKite')}]}
sidebar_right = util.render_template(template='menu_block', menu=menu)
<ul>
<li>{box_name} is behind a restricted firewall.</li>
<li>{box_name} is connected to a (wireless) router which you don't
control.</li>
<li>Your ISP does not provide you an external IP address and instead
provides Internet connection through NAT.</li>
<li>Your ISP does not provide you a static IP address and your IP
address changes evertime you connect to Internet.</li>
<li>Your ISP limits incoming connections.</li>
</ul>
<p>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.</p>
<p><a class='btn btn-primary btn-lg'
href="{server_dir}/router/setup/pagekite/configure">Configure
PageKite</a></p>
""").format(box_name=cfg.box_name, server_dir=cfg.server_dir)
sidebar_right = _('''
<strong>PageKite</strong>
<p><a href="{server_dir}/router/setup/pagekite/configure">Configure
PageKite</a> </p>''').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

View File

@ -0,0 +1,38 @@
{% extends "login_nav.html" %}
{% block main_block %}
<p>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: </p>
<ul>
<li>{{ cfg.box_name }} is behind a restricted firewall.</li>
<li>{{ cfg.box_name }} is connected to a (wireless) router which you
don't control.</li>
<li>Your ISP does not provide you an external IP address and instead
provides Internet connection through NAT.</li>
<li>Your ISP does not provide you a static IP address and your IP
address changes evertime you connect to Internet.</li>
<li>Your ISP limits incoming connections.</li>
</ul>
<p>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.</p>
<p>
<a class='btn btn-primary btn-lg'
href="{{ basehref }}/router/setup/pagekite/configure">Configure
PageKite</a>
</p>
{% endblock %}

View File

@ -0,0 +1,8 @@
<ul class='nav nav-list'>
<li class='nav-header'>{{ menu.title }}</li>
{% for item in menu.items %}
<li>
<a href="{{ basehref }}{{ item.url }}">{{ item.text }}</a>
</li>
{% endfor %}
</ul>

View File

@ -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'] = """ <script type="text/javascript">