sync webui rev 143
This commit is contained in:
parent
fde0c836aa
commit
d918302e3e
|
@ -45,13 +45,20 @@ Other contributors:
|
|||
"""
|
||||
|
||||
import deluge.common
|
||||
try:
|
||||
import deluge.pref
|
||||
from deluge.dialogs import show_popup_warning
|
||||
import webserver_common
|
||||
except ImportError:
|
||||
print 'WebUi:not imported as a plugin'
|
||||
|
||||
|
||||
|
||||
try:
|
||||
from dbus_interface import get_dbus_manager
|
||||
except:
|
||||
pass #for unit-test.
|
||||
import webserver_common
|
||||
|
||||
import time
|
||||
|
||||
import gtk
|
||||
|
@ -117,6 +124,9 @@ class plugin_WebUi(object):
|
|||
else:
|
||||
self.config.set("run_in_thread", False)
|
||||
|
||||
if self.config.get("use_https") == None:
|
||||
self.config.set("use_https", False)
|
||||
|
||||
self.dbus_manager = get_dbus_manager(deluge_core, deluge_interface,
|
||||
self.config, self.config_file)
|
||||
|
||||
|
@ -167,8 +177,6 @@ class plugin_WebUi(object):
|
|||
def __del__(self):
|
||||
self.kill_server()
|
||||
|
||||
|
||||
|
||||
class ConfigDialog(gtk.Dialog):
|
||||
"""
|
||||
sorry, can't get used to gui builders.
|
||||
|
@ -195,6 +203,12 @@ class ConfigDialog(gtk.Dialog):
|
|||
gtk.combo_box_new_text())
|
||||
self.cache_templates = self.add_widget(_('Cache Templates'),
|
||||
gtk.CheckButton())
|
||||
"""
|
||||
temporary disable for 0.5.7
|
||||
self.use_https = self.add_widget(_('Use https://'),
|
||||
gtk.CheckButton())
|
||||
"""
|
||||
|
||||
#self.share_downloads = self.add_widget(_('Share Download Directory'),
|
||||
# gtk.CheckButton())
|
||||
|
||||
|
@ -222,6 +236,7 @@ class ConfigDialog(gtk.Dialog):
|
|||
# bool(self.config.get("share_downloads")))
|
||||
|
||||
self.cache_templates.set_active(self.config.get("cache_templates"))
|
||||
"""0.5.7.. self.use_https.set_active(self.config.get("use_https"))"""
|
||||
|
||||
self.vbox.pack_start(self.vb, True, True, 0)
|
||||
self.vb.show_all()
|
||||
|
@ -257,6 +272,7 @@ class ConfigDialog(gtk.Dialog):
|
|||
self.config.set("template", self.template.get_active_text())
|
||||
self.config.set("button_style", self.button_style.get_active())
|
||||
self.config.set("cache_templates", self.cache_templates.get_active())
|
||||
#0.5.7.. self.config.set("use_https", self.use_https.get_active())
|
||||
#self.config.set("share_downloads", self.share_downloads.get_active())
|
||||
self.config.save(self.plugin.config_file)
|
||||
self.plugin.start_server() #restarts server
|
||||
|
|
|
@ -95,7 +95,8 @@ class DbusManager(dbus.service.Object):
|
|||
"total_size": state["total_size"],
|
||||
"num_pieces": state["num_pieces"],
|
||||
"state": state['state'],
|
||||
"paused": self.core.is_user_paused(torrent_id),
|
||||
"user_paused": self.core.is_user_paused(torrent_id),
|
||||
"paused":state['is_paused'],
|
||||
"progress": int(state["progress"] * 100),
|
||||
"next_announce": state["next_announce"],
|
||||
"total_payload_download":state["total_payload_download"],
|
||||
|
@ -153,16 +154,22 @@ class DbusManager(dbus.service.Object):
|
|||
self.core.update_tracker(torrent_id)
|
||||
|
||||
@dbus.service.method(dbus_interface=dbus_interface,
|
||||
in_signature="sbb", out_signature="")
|
||||
def remove_torrent(self, torrent_id, data_also, torrent_also):
|
||||
in_signature="asbb", out_signature="")
|
||||
def remove_torrent(self, torrent_ids, data_also, torrent_also):
|
||||
"""remove a torrent,and optionally data and torrent
|
||||
additions compared to 0.6 interface: (data_also, torrent_also)
|
||||
"""
|
||||
for torrent_id in torrent_ids:
|
||||
torrent_id = int(torrent_id)
|
||||
self.core.remove_torrent(torrent_id, bool(data_also)
|
||||
,bool( torrent_also))
|
||||
|
||||
#this should not be needed:
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
self.interface.torrent_model_remove(torrent_id)
|
||||
except:
|
||||
pass
|
||||
|
||||
@dbus.service.method(dbus_interface=dbus_interface,
|
||||
in_signature="s", out_signature="b")
|
||||
|
@ -174,7 +181,6 @@ class DbusManager(dbus.service.Object):
|
|||
@dbus.service.method(dbus_interface=dbus_interface,
|
||||
in_signature="s", out_signature="b")
|
||||
def queue_up(self, torrent_id):
|
||||
print 'UP!'
|
||||
self.core.queue_up(int(torrent_id))
|
||||
return True
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ urls = (
|
|||
"/login", "login",
|
||||
"/index", "index",
|
||||
"/torrent/info/(.*)", "torrent_info",
|
||||
"/torrent/pause", "torrent_pause",
|
||||
"/torrent/info_inner/(.*)", "torrent_info_inner",
|
||||
"/torrent/stop/(.*)", "torrent_stop",
|
||||
"/torrent/start/(.*)", "torrent_start",
|
||||
"/torrent/reannounce/(.*)", "torrent_reannounce",
|
||||
"/torrent/add", "torrent_add",
|
||||
"/torrent/delete/(.*)", "torrent_delete",
|
||||
|
@ -115,19 +117,38 @@ class index:
|
|||
class torrent_info:
|
||||
@deluge_page
|
||||
@auto_refreshed
|
||||
def GET(self, torrent_id):
|
||||
def GET(self, name):
|
||||
torrent_id = name.split(',')[0]
|
||||
return ws.render.torrent_info(get_torrent_status(torrent_id))
|
||||
|
||||
class torrent_pause:
|
||||
class torrent_info_inner:
|
||||
@deluge_page
|
||||
def GET(self, torrent_ids):
|
||||
torrent_ids = torrent_ids.split(',')
|
||||
info = get_torrent_status(torrent_ids[0])
|
||||
if len(torrent_ids) > 1:
|
||||
#todo : hmm, lots of manual stuff here :(
|
||||
pass
|
||||
|
||||
|
||||
return ws.render.torrent_info_inner(info)
|
||||
|
||||
class torrent_start:
|
||||
@check_session
|
||||
def POST(self, name):
|
||||
vars = web.input(stop = None, start = None, redir = None)
|
||||
if vars.stop:
|
||||
ws.proxy.pause_torrent([vars.stop])
|
||||
elif vars.start:
|
||||
ws.proxy.resume_torrent([vars.start])
|
||||
torrent_ids = name.split(',')
|
||||
ws.proxy.resume_torrent(torrent_ids)
|
||||
do_redirect()
|
||||
|
||||
class torrent_stop:
|
||||
@check_session
|
||||
def POST(self, name):
|
||||
torrent_ids = name.split(',')
|
||||
ws.proxy.pause_torrent(torrent_ids)
|
||||
do_redirect()
|
||||
|
||||
|
||||
|
||||
class torrent_reannounce:
|
||||
@check_session
|
||||
def POST(self, torrent_id):
|
||||
|
@ -175,26 +196,31 @@ class remote_torrent_add:
|
|||
|
||||
class torrent_delete:
|
||||
@deluge_page
|
||||
def GET(self, torrent_id):
|
||||
return ws.render.torrent_delete(get_torrent_status(torrent_id))
|
||||
def GET(self, name):
|
||||
torrent_ids = name.split(',')
|
||||
torrent_list = [get_torrent_status(id) for id in torrent_ids]
|
||||
return ws.render.torrent_delete(name, torrent_list)
|
||||
|
||||
@check_session
|
||||
def POST(self, torrent_id):
|
||||
def POST(self, name):
|
||||
torrent_ids = name.split(',')
|
||||
vars = web.input(data_also = None, torrent_also = None)
|
||||
data_also = bool(vars.data_also)
|
||||
torrent_also = bool(vars.torrent_also)
|
||||
ws.proxy.remove_torrent(torrent_id, data_also, torrent_also)
|
||||
ws.proxy.remove_torrent(torrent_ids, data_also, torrent_also)
|
||||
do_redirect()
|
||||
|
||||
class torrent_queue_up:
|
||||
@check_session
|
||||
def POST(self, torrent_id):
|
||||
def POST(self, name):
|
||||
for torrent_id in sorted(name.split(',')):
|
||||
ws.proxy.queue_up(torrent_id)
|
||||
do_redirect()
|
||||
|
||||
class torrent_queue_down:
|
||||
@check_session
|
||||
def POST(self, torrent_id):
|
||||
def POST(self, name):
|
||||
for torrent_id in reversed(sorted(name.split(','))):
|
||||
ws.proxy.queue_down(torrent_id)
|
||||
do_redirect()
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
127
|
||||
143
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 464 B |
Binary file not shown.
After Width: | Height: | Size: 683 B |
Binary file not shown.
After Width: | Height: | Size: 652 B |
Binary file not shown.
After Width: | Height: | Size: 660 B |
Binary file not shown.
After Width: | Height: | Size: 429 B |
|
@ -26,11 +26,16 @@ form.deluge_button {
|
|||
}
|
||||
button.deluge_button {
|
||||
background-color: #37506f;
|
||||
border:1px solid #23344b;
|
||||
border:1px solid #68a;
|
||||
|
||||
background: #99acc3;
|
||||
color: #000;
|
||||
vertical-align:middle;
|
||||
-moz-border-radius:7px;
|
||||
}
|
||||
button.deluge_button:hover {
|
||||
background-color:#68a;
|
||||
}
|
||||
|
||||
div.error {
|
||||
background-color:#FFFFFF;
|
||||
color:#AA0000;
|
||||
|
@ -42,4 +47,28 @@ div.error {
|
|||
|
||||
}
|
||||
|
||||
/*tr.torrent_table:hover {
|
||||
background-color:#68a;
|
||||
}*/
|
||||
|
||||
tr.torrent_table_selected {
|
||||
background-color:#900;
|
||||
}
|
||||
|
||||
th.torrent_table:hover {
|
||||
background-color:#68a;
|
||||
}
|
||||
|
||||
img.button {
|
||||
margin-bottom:0px;
|
||||
padding:0px;
|
||||
position:relative;
|
||||
top:2px;
|
||||
}
|
||||
|
||||
body.inner {
|
||||
background:none;
|
||||
}
|
||||
|
||||
|
||||
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
|
|
@ -0,0 +1,28 @@
|
|||
$def with (title)
|
||||
<html>
|
||||
<head>
|
||||
<title>Deluge:$title</title>
|
||||
<link rel="icon" href="/static/images/deluge_icon.gif" type="image/gif" />
|
||||
<link rel="shortcut icon" href="/static/images/deluge_icon.gif" type="image/gif" />
|
||||
<link rel="stylesheet" type="text/css" href="/template/static/advanced.css" />
|
||||
<script language="javascript" src="/template/static/deluge.js"></script>
|
||||
|
||||
<!--<link rel="stylesheet" type="text/css" href="/template/static/scrolling_table.css" />
|
||||
-->
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="page">
|
||||
|
||||
<a href='/home'>
|
||||
<div id="simple_logo">
|
||||
<div class="title">Deluge</div>
|
||||
<div class="info">$title</div>
|
||||
</div>
|
||||
</a>
|
||||
<div id="main_content">
|
||||
|
||||
<div id="main">
|
||||
<center>
|
|
@ -0,0 +1,105 @@
|
|||
$def with (torrent_list)
|
||||
$:render.header(_('Torrent list'))
|
||||
|
||||
|
||||
<a href='/torrent/add' >[Add]</a>
|
||||
<a href='#' onclick=' toolbar_post("/torrent/queue/up/")'>[Up]</a>
|
||||
<a href='#' onclick=' toolbar_post("/torrent/queue/down/")'>[Down]</a>
|
||||
<a href='#' onclick=' toolbar_get("/torrent/delete/")'>[Delete]</a>
|
||||
<a href='#' onclick=' toolbar_get("/torrent/info/")'>[Info]</a>
|
||||
<a href='#' onclick=' toolbar_post("/torrent/stop/")'>[Pause]</a>
|
||||
<a href='#' onclick=' toolbar_post("/torrent/start/")'>[Start]</a>
|
||||
|
||||
|
||||
<!--
|
||||
$if getcookie('auto_refresh') == '1':
|
||||
<a href='#' onclick=' toolbar_post("/refresh/off/")'>[Auto Refresh:disable]</a>
|
||||
<a href='#' onclick=' toolbar_get("/refresh/set/")'>[Auto Refresh:set]</a>
|
||||
$else:
|
||||
<a href='#' onclick=' toolbar_post("/refresh/on/")'>[Auto Refresh:enable]</a>
|
||||
$#end
|
||||
-->
|
||||
|
||||
|
||||
<form action="/torrent/pause" method="POST">
|
||||
|
||||
<div id="tableContainer" class="tableContainer">
|
||||
<table class="torrent_list" border=1>
|
||||
<thead class="fixedHeader">
|
||||
<tr>
|
||||
$:(sort_head('calc_state_str', 'S'))
|
||||
$:(sort_head('queue_pos', '#'))
|
||||
$:(sort_head('name', _('Name')))
|
||||
$:(sort_head('total_size', _('Size')))
|
||||
$:(sort_head('progress', _('Progress')))
|
||||
$:(sort_head('num_seeds', _('Seeders')))
|
||||
$:(sort_head('num_peers', _('Peers')))
|
||||
$:(sort_head('download_rate', _('Download')))
|
||||
$:(sort_head('upload_rate', _('Upload')))
|
||||
$:(sort_head('eta', _('Eta')))
|
||||
$:(sort_head('distributed_copies', _('Ava')))
|
||||
$:(sort_head('ratio', _('Ratio')))
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="scrollContent">
|
||||
$#4-space indentation is mandatory for for-loops in templetor!
|
||||
$for torrent in torrent_list:
|
||||
<tr class="torrent_table" onclick="on_click_row(event, '$torrent.id')" id="torrent_$torrent.id">
|
||||
<td><input type="image"
|
||||
src="/static/images/$(torrent.calc_state_str)16.png"
|
||||
name="$torrent.action" value="$torrent.id"
|
||||
onclick="state.row_js_continue = false;">
|
||||
</td>
|
||||
<td>$torrent.queue_pos</td>
|
||||
<td style="width:100px; overflow:hidden;white-space: nowrap">
|
||||
$(crop(torrent.name, 40))</td>
|
||||
<td>$fsize(torrent.total_size)</td>
|
||||
<td class="progress_bar">
|
||||
<div class="progress_bar_outer">
|
||||
<div class="progress_bar" style="width:$(torrent.progress)%">
|
||||
$torrent.message
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>$torrent.num_seeds ($torrent.total_seeds)</td>
|
||||
<td>$torrent.num_peers ($torrent.total_peers)</td>
|
||||
<td>$fspeed(torrent.download_rate)</td>
|
||||
<td>$fspeed(torrent.upload_rate)</td>
|
||||
<td>$torrent.eta</td>
|
||||
<td>$("%.3f" % torrent.distributed_copies)</td>
|
||||
<td>$("%.3f" % torrent.ratio)</td\>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
$:part_stats()
|
||||
|
||||
<div class="panel" id="info_panel_div">
|
||||
<iframe
|
||||
style="border-style:hidden;width:740px;height:200px;"
|
||||
id="torrent_info">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script language='javascript'>
|
||||
/*on_click_action = open_details;*/
|
||||
on_click_action = on_click_row_js;
|
||||
reselect_rows();
|
||||
var id = state.selected_rows[0];
|
||||
if (id) {
|
||||
open_inner_details(id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<form id='toolbar_form' method="POST" action="changed by javascript">
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
$:render.footer()
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
$def with (stats)
|
||||
|
||||
|
||||
<div class="panel" id='refresh_panel'>
|
||||
|
||||
$_('Auto refresh:')
|
||||
$if getcookie('auto_refresh') == '1':
|
||||
($getcookie('auto_refresh_secs')) $_('seconds')
|
||||
$:render.part_button('GET', '/refresh/set', _('Set'), 'tango/preferences-system.png')
|
||||
$:render.part_button('POST', '/refresh/off', _('Disable'), 'tango/process-stop.png')
|
||||
$else:
|
||||
$_('Off')
|
||||
$:render.part_button('POST', '/refresh/on', _('Enable'), 'tango/view-refresh.png')
|
||||
$#end
|
||||
</div>
|
||||
|
||||
<div class="panel" id='stats_panel'>
|
||||
<!--<a href='/config'>-->
|
||||
|
||||
$_('Connections') : $stats.num_connections ($stats.max_num_connections)
|
||||
|
||||
$_('Down Speed') : $stats.download_rate ($stats.max_download)
|
||||
|
||||
$_('Up Speed') : $stats.upload_rate ($stats.max_upload)
|
||||
|
||||
|
||||
<!--</a>-->
|
||||
|
||||
</div>
|
||||
|
||||
<div id='about'>
|
||||
<a href='/about'>$_('About')</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
$def with (method, func, title, image='')
|
||||
<div class="deluge_button">
|
||||
<form method="$method" action="$url" class="deluge_button">
|
||||
<input type="hidden" name="redir" value="$self_url()">
|
||||
$if (get_config('button_style') == 0):
|
||||
<button type="submit" class="deluge_button" alt="$title">
|
||||
$title
|
||||
$if image:
|
||||
<image src="/static/images/$image" class="button" alt="$title"/>
|
||||
</button>
|
||||
|
||||
$if (get_config('button_style') == 1):
|
||||
$if image:
|
||||
<input type="image" image src="/static/images/$image" class="img_button" alt="$title"/>
|
||||
$else:
|
||||
<button type="submit" class="deluge_button" alt="$title">
|
||||
$title
|
||||
</button>
|
||||
|
||||
$if (get_config('button_style') == 2):
|
||||
<button type="submit" class="deluge_button" alt="$title">
|
||||
$title
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<!--
|
||||
|
||||
pause
|
||||
start
|
||||
up
|
||||
down
|
||||
|
||||
|
||||
-->
|
|
@ -0,0 +1,136 @@
|
|||
/*
-----------------------------------------------------------
Theme Name: Simple
Theme URI: http://deluge-torrent.org
Description: Deluge Theme
Version: 1.0
-----------------------------------------------------------
*/
BODY {
background: #304663 url(../../static/images/simple_bg.jpg) repeat-x;
font-family: Bitstream Vera;
font-size: 10pt;
margin: 0;
|
||||
padding:0;
|
||||
border:0;
}
/* GENERIC STYLES */
a img {border: 0px}
hr {color: #627082; margin: 15px 0 15px 0;}
|
||||
td {font-family: Bitstream Vera;}
/* STRUCTURE */
#page {
min-width: 800px;
margin-left: auto;
margin-right: auto;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
font-family: Bitstream Vera;
}
#main_content {
background:url(../../static/images/simple_line.jpg) repeat-x;
|
||||
margin: 0;
|
||||
padding:0;
}
#simple_logo {
background:url(../../static/images/simple_logo.jpg) no-repeat;
}
#main {
|
||||
margin: 0;
|
||||
padding:0;
padding-top: 20px;
color: #fff;
}
#main form table {
border: #2a425c 1px solid;
}
#main form table tr {
border: 0px;
}
#main form table tr th {
background: #1f3044;
font-size: 16px;
border: 0px;
|
||||
white-space: nowrap;
}
#main form table tr td{
border: 0px;
color: #fff;
font-size: 12px;
white-space: nowrap;
}
#main form table tr th a {
color: #8fa6c3;
font-size: 16px;
white-space: nowrap;
}
#main form table tr th a, a:active, a:visited { color: #8fa6c3; text-decoration: none; }
#main form table tr th a:hover {color: #fff; text-decoration: underline;}
#main form table tr td a {
color: #fff;
font-size: 12px;
white-space: nowrap;
}
#main form table tr td a, a:active, a:visited { color: #fff; text-decoration: none;}
#main form table tr td a:hover {color: #fff; text-decoration: underline;}
#main a {
color: #fff;
font-size: 12px;
}
#main a, a:active, a:visited { color: #fff; text-decoration: none;}
#main a:hover {color: #fff; text-decoration: underline;}
.info {
text-align: right;
padding: 0 50px 0 0;
color: #8fa6c3;
font-size: 16px;
letter-spacing: 4px;
font-weight: bold;
}
.title {
color: #dce4ee;
font-size: 32px;
padding: 10px 50px 0 0;
text-align: right;
}
.title a, a:active, a:visited { color: #dce4ee; text-decoration: none;}
.title a:hover {color: #fff; text-decoration: underline;}
#button {
border:1px solid #23344b;
background: #99acc3;
color: #000;
|
||||
font-family: Bitstream Vera;
font-size:10px;
margin-top:5px;
}
INPUT{
border:1px solid #23344b;
background: #99acc3;
color: #000;
}
TEXTAREA{
border:1px solid #23344b;
background: #99acc3;
width:480px;
}
.footertext a { color: #c0c0c0; text-decoration:none;}
.footertext a:visited { color: #c0c0c0; text-decoration:none;}
.footertext a:active { color: #c0c0c0; text-decoration:none;}
.footertext a:hover {color: #fff; text-decoration: underline;}
.footertext {
text-align: center;
padding: 60px 0 0 0;
font-size: 8pt;
left: -100px;
font-family: Bitstream Vera;
color: #fff;
position: relative;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
div.progress_bar{
background-color:#4573a5;
/*color:blue;*/
-moz-border-radius:5px; /*ff only setting*/
}
|
||||
|
||||
div.progress_bar_outer { /*used in table-view*/
|
||||
width:150px;
|
||||
}
|
||||
td.progress_bar {
white-space: nowrap;
}
td.info_label {
font-weight: bold;
}
td {
font-size: 10pt;
color: #d1dae5;
white-space: nowrap;
}
tr {
font-size: 10pt;
color: #d1dae5;
}
|
||||
|
||||
div.panel {
|
||||
padding:10px;
|
||||
width:750px;
|
||||
background-color: #37506f;
|
||||
-moz-border-radius:10px; /*ff-only!*/
|
||||
margin-top:10px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
|
||||
/*New styles:*/
|
||||
|
||||
div.deluge_button {
|
||||
display:inline;
|
||||
}
|
||||
form.deluge_button {
|
||||
display:inline;
|
||||
}
|
||||
button.deluge_button {
|
||||
background-color: #37506f;
|
||||
border:1px solid #68a;
|
||||
|
||||
background: #99acc3;
|
||||
color: #000;
|
||||
vertical-align:middle;
|
||||
-moz-border-radius:7px;
|
||||
}
|
||||
button.deluge_button:hover {
|
||||
background-color:#68a;
|
||||
}
|
||||
div.error {
|
||||
background-color:#FFFFFF;
|
||||
color:#AA0000;
|
||||
font-weight:bold;
|
||||
-moz-border-radius:10px;
|
||||
width:200px;
|
||||
margin-bottom:20px;
|
||||
padding:10px;
|
||||
|
||||
}
|
||||
|
||||
tr.torrent_table:hover {
|
||||
background-color:#68a;
|
||||
}
|
||||
|
||||
tr.torrent_table_selected {
|
||||
background-color:#900;
|
||||
}
|
||||
|
||||
th.torrent_table:hover {
|
||||
background-color:#68a;
|
||||
}
|
||||
|
||||
img.button {
|
||||
margin-bottom:0px;
|
||||
padding:0px;
|
||||
position:relative;
|
||||
top:2px;
|
||||
}
|
||||
|
||||
body.inner {
|
||||
background:none;
|
||||
}
|
||||
|
||||
#stats_panel {
|
||||
-moz-border-radius:0px;
|
||||
width:100%;
|
||||
position:fixed;
|
||||
bottom:0px;
|
||||
left:0px;
|
||||
background-color:#304663;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
text-align:left;
|
||||
height:20px;
|
||||
}
|
||||
|
||||
#about {
|
||||
position:fixed;
|
||||
bottom:0px;
|
||||
right:10px;
|
||||
}
|
||||
|
||||
#info_panel_div2 {
|
||||
position:fixed;
|
||||
bottom:10px;
|
||||
right:0px;
|
||||
width:100%;
|
||||
background-color:#304663;
|
||||
}
|
||||
|
||||
#refresh_panel {
|
||||
-moz-border-radius:0px;
|
||||
width:100%;
|
||||
position:fixed;
|
||||
bottom:20px;
|
||||
left:0px;
|
||||
background-color:#304663;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
text-align:right;
|
||||
height:20px;
|
||||
}
|
||||
|
||||
#refresh_panel button {
|
||||
background-color:#304663;
|
||||
color:#FFFFFF;
|
||||
border:0;
|
||||
position:relative;
|
||||
top:0px;
|
||||
height:20px;
|
||||
}
|
||||
#refresh_panel button:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
all javascript is optional, everything should work web 1.0
|
||||
but javascript may/will enhance the experience.
|
||||
i'm not a full time web-dev so don't expect beautifull patterns.
|
||||
There's so much crap out there,i can't find good examples.
|
||||
so i'd rather start from scratch,
|
||||
Probably broken in an unexpected way , but worksforme.
|
||||
*/
|
||||
state = {
|
||||
'row_js_continue':true
|
||||
,'selected_rows': new Array()
|
||||
};
|
||||
|
||||
function $(el_id){
|
||||
return document.getElementById(el_id)
|
||||
}
|
||||
function get_row(id){
|
||||
return $('torrent_' + id);
|
||||
}
|
||||
|
||||
function on_click_row(e,id) {
|
||||
/*filter out web 1.0 events for detail-link and pause*/
|
||||
if (state.row_js_continue) {
|
||||
on_click_action(e,id);
|
||||
}
|
||||
state.row_js_continue = true;
|
||||
}
|
||||
|
||||
function on_click_row_js(e, id) {
|
||||
/*real onClick event*/
|
||||
if (!e.ctrlKey) {
|
||||
deselect_rows();
|
||||
}
|
||||
select_row(id);
|
||||
open_inner_details(id);
|
||||
}
|
||||
|
||||
function select_row(id){
|
||||
var row = get_row(id);
|
||||
if (row) {
|
||||
row.className = 'torrent_table_selected';
|
||||
state.selected_rows[state.selected_rows.length] = id;
|
||||
setCookie('selected_rows',state.selected_rows);
|
||||
}
|
||||
}
|
||||
function deselect_rows(){
|
||||
for (i in state.selected_rows) {
|
||||
deselect_row(state.selected_rows[i]);
|
||||
}
|
||||
state.selected_rows = new Array();
|
||||
}
|
||||
function deselect_row(id){
|
||||
var row = get_row(id);
|
||||
if (row) {
|
||||
row.className = 'torrent_table'
|
||||
/*TODO : remove from state.selected_rows*/
|
||||
}
|
||||
}
|
||||
function reselect_rows(){
|
||||
var selected_rows = getCookie('selected_rows').split(',');
|
||||
for (i in getCookie('selected_rows')) {
|
||||
select_row(selected_rows[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function open_details(e, id){
|
||||
alert(id);
|
||||
window.location.href = '/torrent/info/' + id;
|
||||
}
|
||||
|
||||
function open_inner_details(id){
|
||||
/*probably broken for IE, use FF!*/
|
||||
$('torrent_info').src = '/torrent/info_inner/' + id;
|
||||
}
|
||||
|
||||
function on_click_do_nothing(e, id){
|
||||
}
|
||||
|
||||
on_click_action = on_click_do_nothing;
|
||||
|
||||
/*toobar buttons, */
|
||||
function toolbar_post(url) {
|
||||
/*this feels hacky, but it's the only way i know of*/
|
||||
var ids = state.selected_rows.join(',');
|
||||
var form = $('toolbar_form');
|
||||
form.action = url +ids;
|
||||
form.submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
function toolbar_get(url) {
|
||||
/*this feels hacky, but it's the only way i know of*/
|
||||
var ids = state.selected_rows.join(',');
|
||||
window.location.href = url +ids;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*stuff copied from various places:*/
|
||||
/*http://www.w3schools.com/js/js_cookies.asp*/
|
||||
function setCookie(c_name,value,expiredays)
|
||||
{
|
||||
var exdate=new Date()
|
||||
exdate.setDate(exdate.getDate()+expiredays)
|
||||
document.cookie=c_name+ "=" +escape(value)+
|
||||
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
|
||||
}
|
||||
|
||||
function getCookie(c_name)
|
||||
{
|
||||
if (document.cookie.length>0)
|
||||
{
|
||||
c_start=document.cookie.indexOf(c_name + "=")
|
||||
if (c_start!=-1)
|
||||
{
|
||||
c_start=c_start + c_name.length+1
|
||||
c_end=document.cookie.indexOf(";",c_start)
|
||||
if (c_end==-1) c_end=document.cookie.length
|
||||
return unescape(document.cookie.substring(c_start,c_end))
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/*Taken from:
|
||||
http://www.imaputz.com/cssStuff/bigFourVersion.html
|
||||
*/
|
||||
|
||||
/* define height and width of scrollable area. Add 16px to width for scrollbar */
|
||||
div.tableContainer {
|
||||
clear: both;
|
||||
/*border: 1px solid #963;*/
|
||||
height: 285px;
|
||||
overflow: auto;
|
||||
width: 756px;
|
||||
}
|
||||
|
||||
/* Reset overflow value to hidden for all non-IE browsers. */
|
||||
html>body div.tableContainer {
|
||||
overflow: hidden;
|
||||
width: 756px
|
||||
}
|
||||
|
||||
/* define width of table. IE browsers only */
|
||||
div.tableContainer table {
|
||||
float: left;
|
||||
width: 740px;
|
||||
}
|
||||
|
||||
/* define width of table. Add 16px to width for scrollbar. */
|
||||
/* All other non-IE browsers. */
|
||||
html>body div.tableContainer table {
|
||||
width: 756px
|
||||
}
|
||||
|
||||
/* set table header to a fixed position. WinIE 6.x only */
|
||||
/* In WinIE 6.x, any element with a position property set to relative and is a child of */
|
||||
/* an element that has an overflow property set, the relative value translates into fixed. */
|
||||
/* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
|
||||
thead.fixedHeader tr {
|
||||
position: relative
|
||||
}
|
||||
|
||||
/* set THEAD element to have block level attributes. All other non-IE browsers */
|
||||
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
|
||||
html>body thead.fixedHeader tr {
|
||||
display: block
|
||||
}
|
||||
|
||||
/* define the table content to be scrollable */
|
||||
/* set TBODY element to have block level attributes. All other non-IE browsers */
|
||||
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
|
||||
/* induced side effect is that child TDs no longer accept width: auto */
|
||||
html>body tbody.scrollContent {
|
||||
display: block;
|
||||
height: 262px;
|
||||
overflow: auto;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
/* make TD elements pretty. Provide alternating classes for striping the table */
|
||||
/* http://www.alistapart.com/articles/zebratables/ */
|
||||
tbody.scrollContent td, tbody.scrollContent tr.normalRow td {
|
||||
/*background: #FFF;*/
|
||||
|
||||
border-bottom: none;
|
||||
border-left: none;
|
||||
/*border-right: 1px solid #CCC;
|
||||
border-top: 1px solid #DDD;*/
|
||||
padding: 2px 3px 3px 4px
|
||||
}
|
||||
|
||||
tbody.scrollContent tr.alternateRow td {
|
||||
/*background: #EEE;*/
|
||||
border-bottom: none;
|
||||
border-left: none;
|
||||
/*border-right: 1px solid #CCC;
|
||||
border-top: 1px solid #DDD;*/
|
||||
padding: 2px 3px 3px 4px
|
||||
}
|
||||
|
||||
/* define width of TH elements: 1st, 2nd, and 3rd respectively. */
|
||||
/* Add 16px to last TH for scrollbar padding. All other non-IE browsers. */
|
||||
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
|
||||
html>body thead.fixedHeader th {
|
||||
width: 200px
|
||||
}
|
||||
|
||||
html>body thead.fixedHeader th + th {
|
||||
width: 240px
|
||||
}
|
||||
|
||||
html>body thead.fixedHeader th + th + th {
|
||||
width: 316px
|
||||
}
|
||||
|
||||
/* define width of TD elements: 1st, 2nd, and 3rd respectively. */
|
||||
/* All other non-IE browsers. */
|
||||
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
|
||||
html>body tbody.scrollContent td {
|
||||
width: 200px
|
||||
}
|
||||
|
||||
html>body tbody.scrollContent td + td {
|
||||
width: 240px
|
||||
}
|
||||
|
||||
html>body tbody.scrollContent td + td + td {
|
||||
width: 300px
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
$def with (torrent)
|
||||
<!--for iframe in javascript mode.-->
|
||||
<html><head>
|
||||
<html>
|
||||
<head>
|
||||
<title>Deluge:$torrent.name</title>
|
||||
<link rel="icon" href="/static/images/deluge_icon.gif" type="image/gif" />
|
||||
<link rel="shortcut icon" href="/static/images/deluge_icon.gif" type="image/gif" />
|
||||
<link rel="stylesheet" type="text/css" href="/static/simple_site_style.css" />
|
||||
</head>
|
||||
<body class="inner">
|
||||
<!--[Tab :Details] [Tab : Files] [Tab : Peers]-->
|
||||
$:render.tab_meta(torrent)
|
||||
|
||||
$:render.footer()
|
|
@ -1,7 +1,6 @@
|
|||
$def with (torrent_list)
|
||||
$:render.header(_('Torrent list'))
|
||||
|
||||
<form action="/torrent/pause" method="POST">
|
||||
<table class="torrent_list" border=1>
|
||||
<tr>
|
||||
$:(sort_head('calc_state_str', 'S'))
|
||||
|
@ -19,14 +18,19 @@ $:render.header(_('Torrent list'))
|
|||
</tr>
|
||||
$#4-space indentation is mandatory for for-loops in templetor!
|
||||
$for torrent in torrent_list:
|
||||
<tr>
|
||||
<td><input type="image"
|
||||
<tr class="torrent_table" id="torrent_$torrent.id">
|
||||
<td>
|
||||
<form action="/torrent/$torrent.action/$torrent.id" method="POST">
|
||||
<input type="image"
|
||||
src="/static/images/$(torrent.calc_state_str)16.png"
|
||||
name="$torrent.action" value="$torrent.id">
|
||||
name="pauseresume" value="submit" />
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td>$torrent.queue_pos</td>
|
||||
<td style="width:100px; overflow:hidden;white-space: nowrap">
|
||||
<a href="/torrent/info/$torrent.id">$(crop(torrent.name, 40))</a></td>
|
||||
<a href="/torrent/info/$torrent.id" >
|
||||
$(crop(torrent.name, 40))</a></td>
|
||||
<td>$fsize(torrent.total_size)</td>
|
||||
<td class="progress_bar">
|
||||
<div class="progress_bar_outer">
|
||||
|
@ -45,7 +49,7 @@ $for torrent in torrent_list:
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<div class="panel">
|
||||
$:render.part_button('GET', '/torrent/add', _('Add torrent'), 'tango/list-add.png')
|
||||
|
|
|
@ -14,7 +14,7 @@ $else:
|
|||
$#end
|
||||
</div>
|
||||
|
||||
<div class="panel" id='refresh_panel'>
|
||||
<div class="panel" id='stats_panel'>
|
||||
<!--<a href='/config'>-->
|
||||
|
||||
$_('Connections') : $stats.num_connections ($stats.max_num_connections)
|
||||
|
@ -26,8 +26,9 @@ $#end
|
|||
|
||||
<!--</a>-->
|
||||
|
||||
|
||||
<span id=#about>
|
||||
(<a href='/about'>$_('About')</a>)
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
$def with (column_id, column_name, order, active_up, active_down)
|
||||
<th>
|
||||
<th class="torrent_table">
|
||||
<a href="/index?sort=$column_id&order=$order">
|
||||
$column_name\
|
||||
$if active_up:
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
$def with (torrent)
|
||||
<table width="100%"><tr>
|
||||
<td colspan=3 style="background-color:#999;-moz-border-radius:5px;">
|
||||
|
||||
<div class="progress_bar" style="width:$torrent.progress%;
|
||||
text-align:center;font-weight:bold;">
|
||||
|
||||
$torrent.progress %</div>
|
||||
</td>
|
||||
</tr><td width=30%%>
|
||||
<table>
|
||||
|
||||
<tr><td class="info_label">$_('Downloaded'):</td>
|
||||
<td class="info_value">$torrent.calc_total_downloaded</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Uploaded'):</td>
|
||||
<td class="info_value">$torrent.calc_total_uploaded</td>
|
||||
</tr>
|
||||
|
||||
<tr><td class="info_label">$_('Seeders'):</td>
|
||||
<td class="info_value">$torrent.num_seeds ($torrent.total_seeds )</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Share Ratio'):</td>
|
||||
<td class="info_value">$("%.3f" % torrent.ratio)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Pieces'):</td>
|
||||
<td class="info_value">$torrent.num_pieces x $fsize(torrent.piece_length) </td>
|
||||
</tr>
|
||||
|
||||
<tr><td class="info_label"> </td>
|
||||
<td class="info_value"> </td>
|
||||
|
||||
|
||||
</table>
|
||||
</td><td width=30%%>
|
||||
|
||||
<table>
|
||||
<tr><td class="info_label">$_('Speed'):</td><td class="info_value">
|
||||
$fspeed(torrent.download_rate)</td></td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Speed'):</td>
|
||||
<td class="info_value">$fspeed(torrent.upload_rate)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Peers'):</td>
|
||||
<td class="info_value">$torrent.num_peers ($torrent.total_peers )</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('ETA'):</td>
|
||||
<td class="info_value">$torrent.eta </td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Availability'):</td>
|
||||
<td class="info_value">$("%.3f" % torrent.distributed_copies)</td></td></tr>
|
||||
|
||||
<tr><td class="info_label"> </td>
|
||||
<td class="info_value"> </td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</td><td width=30%%>
|
||||
|
||||
<table>
|
||||
|
||||
<tr><td class="info_label">$_('Total Size'):</td>
|
||||
<td class="info_value">$fspeed(torrent.total_size)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('# Of Files'):</td>
|
||||
<td class="info_value">$torrent.num_files</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Tracker'):</td>
|
||||
<td class="info_value">$(crop(torrent.tracker, 30))</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Tracker Status'):</td>
|
||||
<td class="info_value">$torrent.tracker_status </td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Next Announce'):</td>
|
||||
<td class="info_value">$torrent.next_announce </td></tr>
|
||||
|
||||
|
||||
<tr><td class="info_label">$_('Queue Position'):</td>
|
||||
<td class="info_value">$torrent.queue_pos </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</table>
|
|
@ -1,10 +1,15 @@
|
|||
$def with (torrent)
|
||||
$:render.header(_("Remove %s ") % torrent.name)
|
||||
$def with (torrent_ids, torrent_list)
|
||||
$:render.header(_("Remove torrent"))
|
||||
<div class="panel">
|
||||
<form method="POST" action='/torrent/delete/$torrent.id'>
|
||||
<form method="POST" action='/torrent/delete/$torrent_ids'>
|
||||
<div id="del_torrent">
|
||||
|
||||
$(_("Remove %s?") % torrent.name)
|
||||
<h2>$_("Remove torrent")</h2>
|
||||
<ul>
|
||||
$for torrent in torrent_list:
|
||||
<li>$torrent.name</li>
|
||||
</ul>
|
||||
|
||||
<div class="form_row2">
|
||||
<span class="form_label2">
|
||||
<input type="checkbox" name="torrent_also" class="form_input" checked
|
||||
|
|
|
@ -1,88 +1,23 @@
|
|||
$def with (torrent)
|
||||
|
||||
$:(render.header(torrent.message + '/' + torrent.name))
|
||||
<div class="panel">
|
||||
<h3>$_('Details')</h3>
|
||||
<table width="100%"><tr>
|
||||
<td colspan=3 style="background-color:#999;-moz-border-radius:5px;">
|
||||
|
||||
<div class="progress_bar" style="width:$torrent.progress%;
|
||||
text-align:center;font-weight:bold;">
|
||||
$:render.tab_meta(torrent)
|
||||
|
||||
$torrent.progress %</div>
|
||||
</td>
|
||||
</tr><td width=30%%>
|
||||
<table>
|
||||
$if (torrent.action == 'start'):
|
||||
$:render.part_button('POST', '/torrent/start/' + str(torrent.id), _('Resume'), 'tango/start.png')
|
||||
$else:
|
||||
$:render.part_button('POST', '/torrent/stop/' + str(torrent.id), _('Pause'), 'tango/pause.png')
|
||||
|
||||
<tr><td class="info_label">$_('Downloaded'):</td>
|
||||
<td class="info_value">$torrent.calc_total_downloaded</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Uploaded'):</td>
|
||||
<td class="info_value">$torrent.calc_total_uploaded</td>
|
||||
</tr>
|
||||
|
||||
<tr><td class="info_label">$_('Seeders'):</td>
|
||||
<td class="info_value">$torrent.num_seeds ($torrent.total_seeds )</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Share Ratio'):</td>
|
||||
<td class="info_value">$("%.3f" % torrent.ratio)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Pieces'):</td>
|
||||
<td class="info_value">$torrent.num_pieces x $fsize(torrent.piece_length) </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td><td width=30%%>
|
||||
|
||||
<table>
|
||||
<tr><td class="info_label">$_('Speed'):</td><td class="info_value">
|
||||
$fspeed(torrent.download_rate)</td></td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Speed'):</td>
|
||||
<td class="info_value">$fspeed(torrent.upload_rate)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Peers'):</td>
|
||||
<td class="info_value">$torrent.num_peers ($torrent.total_peers )</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('ETA'):</td>
|
||||
<td class="info_value">$torrent.eta </td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Availability'):</td>
|
||||
<td class="info_value">$("%.3f" % torrent.distributed_copies)</td></td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td><td width=30%%>
|
||||
|
||||
<table>
|
||||
|
||||
<tr><td class="info_label">$_('Total Size'):</td>
|
||||
<td class="info_value">$fspeed(torrent.total_size)</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('# Of Files'):</td>
|
||||
<td class="info_value">$torrent.num_files</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Tracker'):</td>
|
||||
<td class="info_value">$(crop(torrent.tracker, 30))</td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Tracker Status'):</td>
|
||||
<td class="info_value">$torrent.tracker_status </td></tr>
|
||||
|
||||
<tr><td class="info_label">$_('Next Announce'):</td>
|
||||
<td class="info_value">$torrent.next_announce </td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
</table>
|
||||
<form action="/torrent/pause?redir=/torrent/info/$torrent.id" method="POST"
|
||||
class="deluge_button">
|
||||
|
||||
<input type="image" src="/static/images/$(torrent.calc_state_str)16.png"
|
||||
name="$torrent.action" value="$torrent.id">
|
||||
</form>
|
||||
|
||||
$:render.part_button('GET', '/torrent/delete/' + str(torrent.id), _('Remove'), 'tango/user-trash.png')
|
||||
$:render.part_button('POST', '/torrent/reannounce/' + str(torrent.id), _('Reannounce'), 'tango/view-refresh.png')
|
||||
|
||||
$:render.part_button('POST', '/torrent/queue/up/' + str(torrent.id), _('Queue Up'), 'tango/queue-up.png')
|
||||
$:render.part_button('POST', '/torrent/queue/down/' + str(torrent.id), _('Queue Down'), 'tango/queue-down.png')
|
||||
|
||||
<br>
|
||||
<!--
|
||||
[<a onclick="javascript:toggle_dump()">$_('Debug:Data Dump')</a>]
|
||||
|
@ -109,13 +44,6 @@ function toggle_dump(){
|
|||
|
||||
|
||||
|
||||
<div class='panel'>
|
||||
$_('Queue pos:') $torrent.queue_pos
|
||||
|
||||
$:render.part_button('POST', '/torrent/queue/up/' + str(torrent.id), _('Queue Up'), 'tango/up.png')
|
||||
|
||||
$:render.part_button('POST', '/torrent/queue/down/' + str(torrent.id), _('Queue Down'), 'tango/down.png')
|
||||
</div>
|
||||
|
||||
$:part_stats()
|
||||
|
||||
|
|
|
@ -3,28 +3,35 @@ Just copy and rename an existing template.
|
|||
-The settings panel will see all directory's in this folder ,and let you choose your new template.
|
||||
-Clicking Ok in the settings panel will restart the webserver and reload your template.
|
||||
|
||||
Limited "Subclassing":
|
||||
All templates are "subclassed" from the /deluge/ template.
|
||||
If a html file is not found in the template dir, the file from /deluge/ will be used.
|
||||
|
||||
|
||||
Notes:
|
||||
Please configure your editor to use 4-space indents instead of tabs.
|
||||
Or use scite and my config: http://mvoncken.sohosted.com/deluge/SciTEUser.properties.txt
|
||||
|
||||
template language: http://webpy.org/templetor
|
||||
|
||||
Exposed methods and variables (c&p from deluge_webserver):
|
||||
Exposed methods and variables (c&p from webserver_framework.py):
|
||||
template.Template.globals.update({
|
||||
'sort_head': template_sort_head,
|
||||
'part_stats':template_part_stats,
|
||||
'crop': template_crop,
|
||||
'_': _ , #gettext/translations
|
||||
'str': str, #because % in templetor is broken.
|
||||
'sorted': sorted,
|
||||
'get_config': proxy.get_webui_config,
|
||||
'self_url': web.changequery,
|
||||
'get_config': get_config,
|
||||
'self_url': self_url,
|
||||
'fspeed': common.fspeed,
|
||||
'fsize': common.fsize,
|
||||
'render': render, #for easy resuse of templates
|
||||
'button_style': (proxy.get_webui_config('button_style')),
|
||||
'rev': ('rev.' +
|
||||
open(os.path.join(os.path.dirname(__file__),'revno')).read()),
|
||||
'version': (
|
||||
open(os.path.join(os.path.dirname(__file__),'version')).read())
|
||||
'render': ws.render, #for easy resuse of templates
|
||||
'rev': 'rev.%s' % (REVNO, ),
|
||||
'version': VERSION,
|
||||
'getcookie':getcookie,
|
||||
'get': lambda (var): getattr(web.input(**{var:None}), var) # unreadable :-(
|
||||
})
|
||||
|
||||
I will update this file if there is interest in making templates.
|
||||
|
||||
|
|
|
@ -9,7 +9,11 @@ import cookielib, urllib2 , urllib
|
|||
import WebUi.webserver_common as ws
|
||||
import operator
|
||||
|
||||
|
||||
ws.init_05()
|
||||
print 'test-env=',ws.ENV
|
||||
|
||||
|
||||
|
||||
#CONFIG:
|
||||
BASE_URL = 'http://localhost:8112'
|
||||
|
@ -37,6 +41,7 @@ class TestWebUiBase(unittest.TestCase):
|
|||
|
||||
def open_url(self, page, post=None):
|
||||
url = BASE_URL + page
|
||||
|
||||
if post == 1:
|
||||
post = {'Force_a_post' : 'spam'}
|
||||
if post:
|
||||
|
@ -92,6 +97,10 @@ class TestWebUiBase(unittest.TestCase):
|
|||
else:
|
||||
pass
|
||||
|
||||
first_torrent_id = property(lambda self: ws.proxy.get_session_state()[0])
|
||||
first_torrent = property(lambda self: get_status(self.first_torrent_id))
|
||||
|
||||
|
||||
class TestNoAuth(TestWebUiBase):
|
||||
def test303(self):
|
||||
self.assert_303('/','/login')
|
||||
|
@ -217,8 +226,12 @@ class TestIntegration(TestWebUiBase):
|
|||
|
||||
else:
|
||||
#test correctness of existing-list
|
||||
#The setup makes 0.6 fail everything, added an else..
|
||||
for url in self.urls:
|
||||
if ws.ENV.startswith('0.5'):
|
||||
self.assert_500('/torrent/add',{'url':url,'torrent':None})
|
||||
else:
|
||||
self.assert_303('/torrent/add','/index',{'url':url,'torrent':None})
|
||||
|
||||
def testPauseResume(self):
|
||||
#pause all
|
||||
|
@ -237,12 +250,12 @@ class TestIntegration(TestWebUiBase):
|
|||
#pause again.
|
||||
self.assert_303('/pause_all','/index', post=1)
|
||||
|
||||
torrent_id = ws.proxy.get_session_state()[0]
|
||||
torrent_id = self.first_torrent_id
|
||||
#single resume.
|
||||
self.assert_303('/torrent/pause','/index', post={'start':torrent_id})
|
||||
self.assert_303('/torrent/start/%s' % torrent_id ,'/index', post=1)
|
||||
self.assertEqual(get_status(torrent_id)["paused"] ,False)
|
||||
#single pause
|
||||
self.assert_303('/torrent/pause','/index', post={'stop':torrent_id})
|
||||
self.assert_303('/torrent/stop/%s' % torrent_id,'/index', post=1)
|
||||
self.assertEqual(get_status(torrent_id)["paused"] , True)
|
||||
|
||||
def testQueue(self):
|
||||
|
@ -297,8 +310,6 @@ class TestIntegration(TestWebUiBase):
|
|||
#add torrrent-file
|
||||
#./test01.torrent
|
||||
|
||||
def testReannounce(self):
|
||||
pass
|
||||
|
||||
def test_do_redirect(self):
|
||||
self.assert_303('/home','/index')
|
||||
|
@ -314,17 +325,16 @@ class TestIntegration(TestWebUiBase):
|
|||
assert self.cookies['order'] == 'up'
|
||||
#redir after pause-POST? in /index.
|
||||
self.assert_exists('/index?sort=name&order=down')
|
||||
torrent_id = ws.proxy.get_session_state()[0]
|
||||
self.assert_303('/torrent/pause','/index?sort=name&order=down',
|
||||
post={'stop':torrent_id})
|
||||
torrent_id = self.first_torrent_id
|
||||
self.assert_303('/torrent/stop/%s' % torrent_id,
|
||||
'/index?sort=name&order=down', post=1)
|
||||
#redir in details 1
|
||||
self.assert_303('/torrent/pause?redir=/torrent/info/' + torrent_id
|
||||
,'/torrent/info/' + torrent_id, post = {'stop':torrent_id})
|
||||
self.assert_303('/torrent/stop/%s?redir=/torrent/info/%s' %(torrent_id,torrent_id)
|
||||
,'/torrent/info/' + torrent_id, post = 1)
|
||||
#redir in details 2
|
||||
self.assert_303('/torrent/pause'
|
||||
self.assert_303('/torrent/stop/%s' % torrent_id
|
||||
,'/torrent/info/' + torrent_id ,
|
||||
post={'stop':torrent_id,
|
||||
'redir': '/torrent/info/' + torrent_id})
|
||||
post={'redir': '/torrent/info/' + torrent_id})
|
||||
|
||||
def testRemote(self):
|
||||
pass
|
||||
|
@ -332,6 +342,26 @@ class TestIntegration(TestWebUiBase):
|
|||
def test_redir_after_login(self):
|
||||
pass
|
||||
|
||||
def testReannounce(self):
|
||||
torrent_id = self.first_torrent_id
|
||||
self.assert_303(
|
||||
'/torrent/reannounce/%(id)s?redir=/torrent/info/%(id)s'
|
||||
% {'id':torrent_id}
|
||||
,'/torrent/info/' + torrent_id, post = 1)
|
||||
|
||||
def testRecheck(self):
|
||||
#add test before writing code..
|
||||
#RELEASE-->disable
|
||||
"""
|
||||
torrent_id = self.first_torrent_id
|
||||
self.assert_303(
|
||||
'/torrent/recheck/%(id)s?redir=/torrent/info/%(id)s'
|
||||
% {'id':torrent_id}
|
||||
,'/torrent/info/' + torrent_id, post = 1)
|
||||
"""
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
if False:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk
|
||||
date: 2007-11-06 15:10:08 +0200
|
||||
build-date: 2007-11-06 15:34:50 +0200
|
||||
revno: 127
|
||||
date: 2007-11-21 15:10:08 +0200
|
||||
build-date: 2007-11-21 15:34:50 +0200
|
||||
revno: 143
|
||||
branch-nick: WebUi
|
||||
|
|
|
@ -44,6 +44,8 @@ from webpy022 import template
|
|||
random.seed()
|
||||
path = os.path.dirname(__file__)
|
||||
|
||||
ENV = 'UNKNOWN'
|
||||
|
||||
try:
|
||||
_('translate something')
|
||||
except:
|
||||
|
@ -90,6 +92,7 @@ def init_06():
|
|||
|
||||
init_process()
|
||||
globals()['proxy'] = proxy
|
||||
globals()['ENV'] = '0.6'
|
||||
|
||||
def init_05():
|
||||
import dbus
|
||||
|
@ -98,6 +101,7 @@ def init_05():
|
|||
proxy = bus.get_object("org.deluge_torrent.dbusplugin"
|
||||
, "/org/deluge_torrent/DelugeDbusPlugin")
|
||||
globals()['proxy'] = proxy
|
||||
globals()['ENV'] = '0.5_process'
|
||||
|
||||
def init_gtk_05():
|
||||
#appy possibly changed config-vars, only called in when runing inside gtk.
|
||||
|
@ -106,12 +110,16 @@ def init_gtk_05():
|
|||
globals()['config'] = deluge.pref.Preferences(config_file, False)
|
||||
globals()['render'] = subclassed_render(config.get('template'),
|
||||
config.get('cache_templates'))
|
||||
globals()['ENV'] = '0.5_gtk'
|
||||
|
||||
|
||||
|
||||
#hacks to determine environment, TODO: clean up.
|
||||
if 'env=0.5' in sys.argv:
|
||||
init_05()
|
||||
elif not hasattr(deluge, 'common'):
|
||||
elif 'env=0.6' in sys.argv:
|
||||
init_06()
|
||||
elif hasattr(deluge, 'ui'):
|
||||
init_06()
|
||||
elif not hasattr(deluge,'pref'):
|
||||
init_05()
|
||||
|
@ -128,7 +136,7 @@ TORRENT_KEYS = ['distributed_copies', 'download_payload_rate',
|
|||
'total_payload_download', 'total_payload_upload', 'total_peers',
|
||||
'total_seeds', 'total_size', 'total_upload', 'total_wanted',
|
||||
'tracker_status', 'upload_payload_rate', 'upload_rate',
|
||||
'uploaded_memory','tracker','state','queue_pos']
|
||||
'uploaded_memory','tracker','state','queue_pos','user_paused']
|
||||
|
||||
STATE_MESSAGES = (_("Queued"),
|
||||
_("Checking"),
|
||||
|
|
|
@ -224,8 +224,10 @@ def get_torrent_status(torrent_id):
|
|||
else:
|
||||
status.action = "stop"
|
||||
|
||||
if status.paused:
|
||||
if status.user_paused:
|
||||
status.message = _("Paused %s%%") % status.progress
|
||||
elif status.paused:
|
||||
status.message = _("Queued %s%%") % status.progress
|
||||
else:
|
||||
status.message = "%s %i%%" % (ws.STATE_MESSAGES[status.state]
|
||||
, status.progress)
|
||||
|
@ -293,6 +295,7 @@ template.Template.globals.update({
|
|||
'rev': 'rev.%s' % (REVNO, ),
|
||||
'version': VERSION,
|
||||
'getcookie':getcookie,
|
||||
'js_enabled': lambda : ws.config.get('use_javascript'),
|
||||
'get': lambda (var): getattr(web.input(**{var:None}), var) # unreadable :-(
|
||||
})
|
||||
#/template-defs
|
||||
|
@ -304,7 +307,12 @@ def create_webserver(urls, methods):
|
|||
|
||||
func = webapi.wsgifunc(webpyfunc(urls, methods, False))
|
||||
server_address=("0.0.0.0", int(ws.config.get('port')))
|
||||
|
||||
server = CherryPyWSGIServer(server_address, func, server_name="localhost")
|
||||
if ws.config.get('use_https'):
|
||||
server.ssl_certificate = ws.config.get('ssl_certificate')
|
||||
server.ssl_private_key = ws.config.get('ssl_private_key')
|
||||
|
||||
print "http://%s:%d/" % server_address
|
||||
return server
|
||||
|
||||
|
|
Loading…
Reference in New Issue