diff --git a/deluge/ui/webui/pages.py b/deluge/ui/webui/pages.py
index 9360c5e81..0e142e0e1 100644
--- a/deluge/ui/webui/pages.py
+++ b/deluge/ui/webui/pages.py
@@ -72,6 +72,7 @@ menu_manager.register_admin_page("logout", _("Logout"), "/logout")
menu_manager.register_detail_tab("details", _("Details"), "tab_meta")
menu_manager.register_detail_tab("files", _("Files"), "tab_files")
menu_manager.register_detail_tab("options", _("Options"), "tab_options")
+menu_manager.register_detail_tab("trackers", _("Trackers"), "tab_trackers")
menu_manager.register_toolbar_item("add", _("Add"), "list-add.png" , TB.generic,
"GET","/torrent/add/", True)
@@ -132,7 +133,8 @@ urls = [
#default-pages
"/", "home",
"", "home",
- "/robots.txt","robots"
+ "/robots.txt","robots",
+ "/template_style.css","template_style"
]
#/routing
@@ -464,6 +466,12 @@ class robots:
web.header("Content-Type", "text/plain")
print "User-agent: *\nDisallow:/\n"
+class template_style:
+ def GET(self):
+ web.header("Content-Type", "text/css")
+ style = Storage()
+ print render.template_style(style)
+
#/pages
#for plugins..
diff --git a/deluge/ui/webui/render.py b/deluge/ui/webui/render.py
index 2bb8087e1..837326538 100644
--- a/deluge/ui/webui/render.py
+++ b/deluge/ui/webui/render.py
@@ -34,13 +34,13 @@ from webserver_common import ws,REVNO,VERSION
from utils import *
#/relative
from deluge import common
-from lib.webpy022 import changequery as self_url, template
+from lib.webpy022 import changequery as self_url, template, Storage
import os
class subclassed_render(object):
"""
- try to use the html template in configured dir.
- not available : use template in /deluge/
+ adds limited subclassing for templates.
+ see: meta.cfg in the template-directory.
"""
def __init__(self):
self.apply_cfg()
@@ -51,13 +51,15 @@ class subclassed_render(object):
self.plugin_renderers = []
self.template_cache = {}
- #future: better/more subclassing.
- self.renderers.append(template.render(
- os.path.join(ws.webui_path, 'templates/%s/' % ws.config.get('template')),
- cache=False))
+ #load template-meta-data
+ cfg_template = ws.config.get('template')
+ template_path = os.path.join(ws.webui_path, 'templates/%s/' % cfg_template)
+ self.meta = Storage(eval(open(os.path.join(template_path,'meta.cfg')).read()))
- self.renderers.append(template.render(
- os.path.join(ws.webui_path, 'templates/deluge/'),cache=False))
+ #load renerders
+ for template_name in [cfg_template] + list(reversed(self.meta.inherits)):
+ self.renderers.append(template.render(
+ os.path.join(ws.webui_path, 'templates/%s/' % template_name),cache=False))
@logcall
def register_template_path(self, path):
diff --git a/deluge/ui/webui/templates/advanced/static/deluge.js b/deluge/ui/webui/static/deluge.js
similarity index 100%
rename from deluge/ui/webui/templates/advanced/static/deluge.js
rename to deluge/ui/webui/static/deluge.js
diff --git a/deluge/ui/webui/templates/advanced/header.html b/deluge/ui/webui/templates/advanced/header.html
index 3d8f4cda3..eba913d7f 100644
--- a/deluge/ui/webui/templates/advanced/header.html
+++ b/deluge/ui/webui/templates/advanced/header.html
@@ -1,11 +1,11 @@
-$def with (title)
+$def with (title, active_tab=None)
Deluge:$title
-
+
diff --git a/deluge/ui/webui/templates/advanced/index.html b/deluge/ui/webui/templates/advanced/index.html
index bde035128..e42c81519 100644
--- a/deluge/ui/webui/templates/advanced/index.html
+++ b/deluge/ui/webui/templates/advanced/index.html
@@ -1,112 +1,16 @@
$def with (torrent_list, organize_filters)
$:render.header(_('Torrent list'))
-
-
-
-
-
-
-
-$altrow(True)
-$#4-space indentation is mandatory for for-loops in templetor!
-$for torrent in torrent_list:
-
-
-
-
- $torrent.queue
-
- $(crop(torrent.name, 40))
- $fsize(torrent.total_size)
-
-
-
- $torrent.message $int(torrent.progress) %
-
-
-
- $if organize_filters:
- $torrent.tracker_name
-
- $if torrent.total_seeds != -1:
- $torrent.num_seeds ($torrent.total_seeds)
- $else:
- 0
-
-
- $if torrent.total_peers != -1:
- $torrent.num_peers ($torrent.total_peers)
- $else:
- 0
-
- $if (torrent.download_rate):
- $fspeed(torrent.download_rate)
- $else:
-
-
-
- $if (torrent.upload_rate):
- $fspeed(torrent.upload_rate)
- $else:
-
-
- $ftime(torrent.eta)
- $("%.3f" % torrent.distributed_copies)
- $("%.3f" % torrent.ratio)
-
-
-
+ $:render.part_organize(organize_filters)
+$:render.part_torrent_list(torrent_list, organize_filters)
+$:render.part_auto_refresh()
$:part_stats()
diff --git a/deluge/ui/webui/templates/advanced/meta.cfg b/deluge/ui/webui/templates/advanced/meta.cfg
new file mode 100644
index 000000000..0ceae245a
--- /dev/null
+++ b/deluge/ui/webui/templates/advanced/meta.cfg
@@ -0,0 +1,10 @@
+{
+ 'authors':['Martijn Voncken
'],
+ 'inherits':['deluge'],
+ 'comment':"""
+ The default template.
+ Uses advanced css/javascript.
+ You need a newer standards compliant browser.
+ """
+}
+
diff --git a/deluge/ui/webui/templates/advanced/part_auto_refresh.html b/deluge/ui/webui/templates/advanced/part_auto_refresh.html
new file mode 100644
index 000000000..2c2b7153a
--- /dev/null
+++ b/deluge/ui/webui/templates/advanced/part_auto_refresh.html
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/deluge/ui/webui/templates/advanced/part_stats.html b/deluge/ui/webui/templates/advanced/part_stats.html
index fca2e0bad..0a38f0789 100644
--- a/deluge/ui/webui/templates/advanced/part_stats.html
+++ b/deluge/ui/webui/templates/advanced/part_stats.html
@@ -1,23 +1,6 @@
$def with (stats)
-
-
@@ -36,10 +19,3 @@ $else:
-
-
-
-
-
diff --git a/deluge/ui/webui/templates/advanced/part_toolbar.html b/deluge/ui/webui/templates/advanced/part_toolbar.html
new file mode 100644
index 000000000..0399b2c39
--- /dev/null
+++ b/deluge/ui/webui/templates/advanced/part_toolbar.html
@@ -0,0 +1,6 @@
+$for id, title, image, flag, method, url, important in toolbar_items:
+ $if important:
+
diff --git a/deluge/ui/webui/templates/advanced/part_torrent_list.html b/deluge/ui/webui/templates/advanced/part_torrent_list.html
new file mode 100644
index 000000000..bd27abb48
--- /dev/null
+++ b/deluge/ui/webui/templates/advanced/part_torrent_list.html
@@ -0,0 +1,90 @@
+$def with (torrent_list, organize_filters)
+
+
+
+
+
+
+
+$altrow(True)
+$#4-space indentation is mandatory for for-loops in templetor!
+$for torrent in torrent_list:
+
+
+
+
+ $torrent.queue
+
+ $(crop(torrent.name, 40))
+ $fsize(torrent.total_size)
+
+
+
+ $torrent.message $int(torrent.progress) %
+
+
+
+ $if organize_filters:
+ $torrent.tracker_name
+
+ $if torrent.total_seeds != -1:
+ $torrent.num_seeds ($torrent.total_seeds)
+ $else:
+ 0
+
+
+ $if torrent.total_peers != -1:
+ $torrent.num_peers ($torrent.total_peers)
+ $else:
+ 0
+
+ $if (torrent.download_rate):
+ $fspeed(torrent.download_rate)
+ $else:
+
+
+
+ $if (torrent.upload_rate):
+ $fspeed(torrent.upload_rate)
+ $else:
+
+
+ $ftime(torrent.eta)
+ $("%.3f" % torrent.distributed_copies)
+ $("%.3f" % torrent.ratio)
+
+
+
diff --git a/deluge/ui/webui/templates/advanced/static/advanced.css b/deluge/ui/webui/templates/advanced/static/advanced.css
index 4861d7f8f..f94c64068 100644
--- a/deluge/ui/webui/templates/advanced/static/advanced.css
+++ b/deluge/ui/webui/templates/advanced/static/advanced.css
@@ -71,7 +71,7 @@ div.error {
}
-tr.torrent_table:hover {
+#torrent_table tr:hover {
background-color:#68a;
}
diff --git a/deluge/ui/webui/templates/deluge/about.html b/deluge/ui/webui/templates/deluge/about.html
index f0d1c2b1e..9e82db43f 100644
--- a/deluge/ui/webui/templates/deluge/about.html
+++ b/deluge/ui/webui/templates/deluge/about.html
@@ -1,8 +1,15 @@
-$:render.header(_('About'))
+$:render.header(_('About'), 'about')
$:render.admin_toolbar('about')
Version
$version
+
+
Template
+Name: $get_config('template')
+Authors: $render.meta.authors
+Inherits: $render.meta.inherits
+Comment: $render.meta.comment
+
Links
Deluge
@@ -34,6 +41,13 @@ $:render.admin_toolbar('about')
+
+Console UI
+
+
+
*and all other authors/helpers/contributors I forgot to mention
diff --git a/deluge/ui/webui/templates/deluge/config.html b/deluge/ui/webui/templates/deluge/config.html
index 249f2f61a..4a4b00e44 100644
--- a/deluge/ui/webui/templates/deluge/config.html
+++ b/deluge/ui/webui/templates/deluge/config.html
@@ -1,6 +1,6 @@
$def with (groups, pages, form, selected, message, error)
-$:render.header(_("Config"))
+$:render.header(_("Config"), 'config')
$:render.admin_toolbar('config')
diff --git a/deluge/ui/webui/templates/deluge/connect.html b/deluge/ui/webui/templates/deluge/connect.html
index 9ae35785e..9524f3354 100644
--- a/deluge/ui/webui/templates/deluge/connect.html
+++ b/deluge/ui/webui/templates/deluge/connect.html
@@ -1,6 +1,6 @@
$def with (connect_list, connected)
-$:render.header(_("Connect to Daemon"))
+$:render.header(_("Connect to Daemon"), 'connect')
$:render.admin_toolbar('connect')
diff --git a/deluge/ui/webui/templates/deluge/header.html b/deluge/ui/webui/templates/deluge/header.html
index 42cc62eed..3b0b7e8a5 100644
--- a/deluge/ui/webui/templates/deluge/header.html
+++ b/deluge/ui/webui/templates/deluge/header.html
@@ -1,4 +1,4 @@
-$def with (title)
+$def with (title, active_tab="NONE")
Deluge:$title
diff --git a/deluge/ui/webui/templates/deluge/index.html b/deluge/ui/webui/templates/deluge/index.html
index 1d512e98b..462b5a504 100644
--- a/deluge/ui/webui/templates/deluge/index.html
+++ b/deluge/ui/webui/templates/deluge/index.html
@@ -1,5 +1,9 @@
-$def with (torrent_list, organize_filter)
-$:render.header(_('Torrent list'))
+$def with (torrent_list, organize_filters)
+$:render.header(_('Torrent list'), 'home')
+
+
+$if organize_filters:
+ $:render.part_organize(organize_filters)
diff --git a/deluge/ui/webui/templates/deluge/meta.cfg b/deluge/ui/webui/templates/deluge/meta.cfg
new file mode 100644
index 000000000..2965a1b5e
--- /dev/null
+++ b/deluge/ui/webui/templates/deluge/meta.cfg
@@ -0,0 +1,10 @@
+{
+ 'authors':['Martijn Voncken '],
+ 'inherits':[],
+ 'comment':"""Fail-safe template.
+ Most other templetes inherit from this template.
+ Should work on ANY browser.
+ thanks to "somedude" for some help/enhancements in header/footer/css.
+ """
+}
+
diff --git a/deluge/ui/webui/templates/advanced/part_categories.html b/deluge/ui/webui/templates/deluge/part_organize.html
similarity index 100%
rename from deluge/ui/webui/templates/advanced/part_categories.html
rename to deluge/ui/webui/templates/deluge/part_organize.html
diff --git a/deluge/ui/webui/templates/deluge/tab_trackers.html b/deluge/ui/webui/templates/deluge/tab_trackers.html
new file mode 100644
index 000000000..c0c680f3a
--- /dev/null
+++ b/deluge/ui/webui/templates/deluge/tab_trackers.html
@@ -0,0 +1,16 @@
+$def with (torrent)
+
+
+$altrow(True)
+
+ #
+ $_("Tracker")
+$for tracker in torrent.trackers:
+
+
+ $tracker['tier']
+
+ $crop(tracker['url'], 60)
+
+
+
diff --git a/deluge/ui/webui/templates/deluge/torrent_info.html b/deluge/ui/webui/templates/deluge/torrent_info.html
index 0dfa9722f..763a1a7e4 100644
--- a/deluge/ui/webui/templates/deluge/torrent_info.html
+++ b/deluge/ui/webui/templates/deluge/torrent_info.html
@@ -34,9 +34,4 @@ function toggle_dump(){
-
-
-
-$:part_stats()
-
$:render.footer()
diff --git a/deluge/ui/webui/templates/white/admin_toolbar.html b/deluge/ui/webui/templates/white/admin_toolbar.html
new file mode 100644
index 000000000..0762da65a
--- /dev/null
+++ b/deluge/ui/webui/templates/white/admin_toolbar.html
@@ -0,0 +1,3 @@
+$def with (active_tab)
+
+
diff --git a/deluge/ui/webui/templates/white/header.html b/deluge/ui/webui/templates/white/header.html
new file mode 100644
index 000000000..281fa0093
--- /dev/null
+++ b/deluge/ui/webui/templates/white/header.html
@@ -0,0 +1,46 @@
+$def with (title, active_tab="NONE")
+
+
+
+
+ Deluge:$_('Torrent list')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Home
+
+
+$for id, title, url in admin_pages:
+
$title
+
+
+
+ $#:render.part_auto_refresh()
+
+
+
+
+ $:part_stats()
+
+
+
diff --git a/deluge/ui/webui/templates/white/index.html b/deluge/ui/webui/templates/white/index.html
new file mode 100644
index 000000000..d9649e11b
--- /dev/null
+++ b/deluge/ui/webui/templates/white/index.html
@@ -0,0 +1,80 @@
+$def with (torrent_list, organize_filters)
+
+
+ Deluge:$_('Torrent list')
+
+
+
+
+
+
+
+
+
+
+
+
+
Home
+ $for id, title, url in admin_pages:
+
$title
+
+
+ $#:render.part_auto_refresh()
+
+
+
+
+ $:part_stats()
+
+
+
+
+
+
+
+$if organize_filters:
+ $:render.part_organize(organize_filters)
+
+
+
+
+ $:render.part_toolbar()
+
+
+ $:render.part_torrent_list(torrent_list, organize_filters)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+$:render.footer()
+
+
diff --git a/deluge/ui/webui/templates/white/login.html b/deluge/ui/webui/templates/white/login.html
new file mode 100644
index 000000000..2808a1a4f
--- /dev/null
+++ b/deluge/ui/webui/templates/white/login.html
@@ -0,0 +1,34 @@
+$def with (error)
+
+
+
+ Deluge:$_('Login')
+
+
+
+
+
+
+
+
+
+
+$if error > 0:
+
$_("Password is invalid,try again")
+
+
+
+$:render.footer()
diff --git a/deluge/ui/webui/templates/white/meta.cfg b/deluge/ui/webui/templates/white/meta.cfg
new file mode 100644
index 000000000..3bd3a320f
--- /dev/null
+++ b/deluge/ui/webui/templates/white/meta.cfg
@@ -0,0 +1,11 @@
+{
+ 'authors':['Martijn Voncken
'],
+ 'inherits':['deluge','advanced'],
+ 'comment':"""
+ A more conventional template.
+ css written from scratch
+ templated-css with variables.
+ Inspried by (but not copied from) gmail.
+ """
+}
+
diff --git a/deluge/ui/webui/templates/white/template_style.css b/deluge/ui/webui/templates/white/template_style.css
new file mode 100644
index 000000000..3f2d8ca12
--- /dev/null
+++ b/deluge/ui/webui/templates/white/template_style.css
@@ -0,0 +1,115 @@
+$def with (style)
+/*
+preprocessed style.
+avoid copy and paste of colours.
+*/
+
+
+/*global:*/
+body, th, td,tr ,hr, div,table , div{
+ font-family: Bitstream Vera Sans, verdana, arial, sans-serif;
+ font-size:12px;
+ padding:0px;
+ margin:0px;
+ border-style: hidden;
+ border-spacing:0px;
+}
+
+a { color: #0000AA;}
+a:visited { color: #0000AA;}
+
+th {font-weight:normal}
+
+form {
+ display:inline;
+}
+
+img{
+ border:0;
+}
+
+/*controls:*/
+a.tab_button_active {
+ color: #0000AA;
+ text-decoration:none;
+ font-weight:bold;
+ color:#000;
+}
+
+div.deluge_button{
+ display:inline;
+}
+
+
+/*page from top to bottom:*/
+
+
+/*top part :*/
+#admin_toolbar {
+ text-align:right;
+ float;
+}
+
+#home_top {
+ text-align:left;
+ float;
+}
+
+/*toolbar*/
+#toolbar {
+ background-color:#E0ECFF;
+}
+
+#torrent_list_block{
+ border-style:solid;
+ border-width:12px;
+ border-color:#C3D9FF;
+ -moz-border-radius:8px;
+ /*float: right;*/
+}
+
+/*torrent table*/
+XX#torrent_table td {
+ border-bottom-style:solid;
+ border-bottom-width:1px;
+ border-bottom-color:#000000;
+}
+
+#torrent_table th {
+ background-color:#C3D9FF;
+}
+
+tr.altrow1 {
+ background-color:#F0F0F0;
+}
+
+
+tr.torrent_table_selected {
+ background-color:#FFFFCC;
+}
+
+div.progress_bar{
+ background-color:#E0ECFF;
+ /*color:blue;*/
+ /*-moz-border-radius:5px;*/ /*ff only setting*/
+ }
+
+
+/*info panel:*/
+#info_panel_div {
+ border-style:solid;
+ border-width:12px;
+ border-color:#B5EDBC;
+ -moz-border-radius:8px;
+ /*float: right;*/
+}
+
+#organize_block {
+ border-style:solid;
+ border-width:12px;
+ border-color:#B5EDBC;
+ -moz-border-radius:8px;
+ float: left;
+}
+
+/*config:*/
diff --git a/deluge/ui/webui/templates/white/torrent_info_inner.html b/deluge/ui/webui/templates/white/torrent_info_inner.html
new file mode 100644
index 000000000..a7ba9cc30
--- /dev/null
+++ b/deluge/ui/webui/templates/white/torrent_info_inner.html
@@ -0,0 +1,19 @@
+$def with (torrent, active_tab)
+
+
+
+ Deluge:$torrent.name
+
+
+
+
+$for id, title, tab in detail_tabs:
+
+ $:render.part_tab_button(id, title, active_tab)
+
+$for id, title, tab in detail_tabs:
+ $if active_tab == id:
+ $:render[tab](torrent)
+
+
+