{{ port }}:
- {% if port in internal_enabled_services and port in external_enabled_services %}
- Permitted
- {% elif port in internal_enabled_services %}
- Permitted (internal only)
- {% elif port in external_enabled_services %}
- Permitted (external only)
- {% else %}
- Blocked
- {% endif %}
-
+
+
{{ port }}
+
+ {% if port in internal_enabled_services and port in external_enabled_services %}
+ Permitted
+ {% elif port in internal_enabled_services %}
+ Permitted (internal only)
+ {% elif port in external_enabled_services %}
+ Permitted (external only)
+ {% else %}
+ Blocked
+ {% endif %}
+
+
{% endfor %}
-
-
- {% endfor %}
-
+ {% endfor %}
+
+
+
+
The operation of the firewall is automatic. When you enable a
service it is automatically permitted in the firewall and you disable
diff --git a/themes/default/css/plinth.css b/themes/default/css/plinth.css
index ce817d11f..c983d7042 100644
--- a/themes/default/css/plinth.css
+++ b/themes/default/css/plinth.css
@@ -47,3 +47,11 @@ body {
margin-right: 8px;
padding-right: 5px;
}
+
+.table-autowidth {
+ width: auto;
+}
+
+.table td.cell-indented {
+ padding-left: 3em;
+}
From d2a6e2332d95c15ee65b69ea227b89b3bedf0f11 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa
Date: Mon, 12 May 2014 23:31:07 +0530
Subject: [PATCH 6/9] Fix minor styling issue in router setup page
---
.../router/templates/router_setup.html | 39 +++++++++++--------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/modules/installed/router/templates/router_setup.html b/modules/installed/router/templates/router_setup.html
index 34fd9c0ae..c484c5585 100644
--- a/modules/installed/router/templates/router_setup.html
+++ b/modules/installed/router/templates/router_setup.html
@@ -63,31 +63,36 @@
{% block sidebar_right_block %}
-
Introduction
+
-
Your {{ cfg.box_name }} is a replacement for your wireless
- router. By default, it should do everything your usual router
- does. With the addition of some extra modules, its abilities can
- rival those of high-end routers costing hundreds of dollars.
+
Introduction
- {% if cfg.users.expert %}
+
Your {{ cfg.box_name }} is a replacement for your wireless
+ router. By default, it should do everything your usual router
+ does. With the addition of some extra modules, its abilities
+ can rival those of high-end routers costing hundreds of
+ dollars.
-
WAN Connection Type
+ {% if cfg.users.expert %}
-
DHCP
+
WAN Connection Type
-
DHCP allows your router to automatically connect with the
- upstream network. If you are unsure what option to choose,
- stick with DHCP. It is usually correct.
+
DHCP
-
Static IP
+
DHCP allows your router to automatically connect with the
+ upstream network. If you are unsure what option to choose,
+ stick with DHCP. It is usually correct.
-
If you want to setup your connection manually, you can enter
- static IP information. This option is for those who know what
- they're doing. As such, it is only available in expert
- mode.
+
Static IP
- {% endif %}
+
If you want to setup your connection manually, you can enter
+ static IP information. This option is for those who know what
+ they're doing. As such, it is only available in expert
+ mode.
+
+ {% endif %}
+
+
{% endblock %}
From 218fc37e8fb293ee403a11870200fea058cbbd0d Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa
Date: Mon, 12 May 2014 23:51:41 +0530
Subject: [PATCH 7/9] Remove erroneous onload javascript
If a page needs to run javascript on load, it is easy to do so by attaching
onload handlers or by using corresponing jQuery utilities. There is no need
to mess with templating.
---
templates/base.html | 7 +------
util.py | 4 ++--
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/templates/base.html b/templates/base.html
index f8abfc20a..55552c0da 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -51,13 +51,8 @@
{{ main_menu_js|safe }}
{{ sub_menu_js|safe }}
-
-
+
diff --git a/util.py b/util.py
index d90bc4000..4ca819a8d 100644
--- a/util.py
+++ b/util.py
@@ -63,8 +63,8 @@ class Message():
def render_template(template='login_nav', **kwargs):
- for key in ['sidebar_left', 'sidebar_right', 'main', 'js', 'onload', 'nav',
- 'css', 'title', 'basehref']:
+ for key in ['sidebar_left', 'sidebar_right', 'main', 'js', 'nav', 'css',
+ 'title', 'basehref']:
if not key in kwargs:
kwargs[key] = ''
From 994199f09619cf7a24435389a0d927c874258363 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa
Date: Tue, 13 May 2014 01:00:38 +0530
Subject: [PATCH 8/9] Cleanup menu generation using templates
---
LICENSES | 1 -
menu.py | 39 ++++-------------------
templates/base.html | 11 +++----
templates/login_nav.html | 15 +++++++--
templates/menu.html | 36 +++++++++++++++++++++
themes/default/js/menu.js | 67 ---------------------------------------
util.py | 16 ++--------
7 files changed, 61 insertions(+), 124 deletions(-)
create mode 100644 templates/menu.html
delete mode 100644 themes/default/js/menu.js
diff --git a/LICENSES b/LICENSES
index e4a1d8a0e..f967fb292 100644
--- a/LICENSES
+++ b/LICENSES
@@ -108,7 +108,6 @@ specified and linked otherwise.
- themes/default/img/glyphicons-halflings.png :: -
- themes/default/img/glyphicons-halflings-white.png :: -
- themes/default/js/functions.js :: -
-- themes/default/js/menu.js :: -
- themes/default/js/plinth.js :: -
- themes/default/js/plugins.js :: [[file:themes/default/js/plugins.js::/%20paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/][CC0]]
- themes/default/js/libs/jquery.min.js :: Symlink to external target: [[file:themes/default/js/libs/jquery.min.js::*%20Dual%20licensed%20under%20the%20MIT%20or%20GPL%20Version%202%20licenses.][MIT/GPL2]]
diff --git a/menu.py b/menu.py
index 93860dcdb..84b26c19d 100644
--- a/menu.py
+++ b/menu.py
@@ -1,19 +1,16 @@
from urlparse import urlparse
-try:
- import simplejson as json
-except ImportError:
- import json
import cherrypy
import cfg
+
class Menu():
"""One menu item."""
def __init__(self, label="", icon="", url="#", order=50):
"""label is the text that is displayed on the menu.
- icon is the icon to be displayed next to the label.
- Choose from the Glyphicon set:
- http://twitter.github.com/bootstrap/base-css.html#icons
+ icon is the icon to be displayed next to the label.
+ Choose from the Glyphicon set:
+ http://twitter.github.com/bootstrap/base-css.html#icons
url is the url location that will be activated when the menu
item is selected.
@@ -35,11 +32,13 @@ class Menu():
def sort_items(self):
"""Sort the items in self.items by order."""
self.items = sorted(self.items, key=lambda x: x.order, reverse=False)
+
def add_item(self, label, icon, url, order=50, basehref=True):
"""This method creates a menu item with the parameters, adds
that menu item to this menu, and returns the item.
- If BASEHREF is true and url start with a slash, prepend the cfg.server_dir to it"""
+ If BASEHREF is true and url start with a slash, prepend the
+ cfg.server_dir to it"""
if basehref and url.startswith("/"):
url = cfg.server_dir + url
@@ -62,27 +61,3 @@ class Menu():
for item in self.items:
if path.startswith(item.url):
return item
-
- def serializable(self, render_subs=False):
- """Return the items in self.items as a serializable object we can pass to json.
- Note: this doesn't serialize all the data in this object."""
-
- so = []
- for item in self.items:
- i = { 'label':item.label, 'icon':item.icon, 'url':item.url}
- if item.active_p():
- i['active']=True
- if item.items and render_subs:
- i['subs'] = item.serializable()
- so.append(i)
- return so
- def encode(self, name="", render_subs=False):
- """return a string containing a javascript data structure
- assigned to the menu name
-
- if render_subs is True, we render submenus too"""
-
- return ('')
diff --git a/templates/base.html b/templates/base.html
index 55552c0da..9f381dd8b 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -47,10 +47,7 @@
{{ css|safe }}
-
- {{ main_menu_js|safe }}
- {{ sub_menu_js|safe }}
@@ -72,13 +69,13 @@
- {% if nav or sidebar_right or sidebar_left %}
+ {% if submenu or sidebar_right or sidebar_left %}
- {% if nav %}
+ {% if submenu %}
- {{ nav|safe }}
+ {% include "menu.html" with menu=submenu %}
{% else %}
diff --git a/templates/menu.html b/templates/menu.html
new file mode 100644
index 000000000..83374c40d
--- /dev/null
+++ b/templates/menu.html
@@ -0,0 +1,36 @@
+{% comment %}
+#
+# This file is part of Plinth.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+{% endcomment %}
+
+
+
Menu
+ {% for item in menu.items %}
+
+
+
+
+ {{ item.label }}
+
+ {% if item.items %}
+ {% include "menu.html" with menu=item %}
+ {% endif %}
+