webui tweaks rev 160

This commit is contained in:
Marcos Pinto 2007-11-26 16:06:55 +00:00
parent 1698c57f58
commit 4dad638a41
8 changed files with 82 additions and 30 deletions

View File

@ -177,16 +177,29 @@ class torrent_add:
@check_session @check_session
def POST(self, name): def POST(self, name):
vars = web.input(url = None, torrent = {}) """
allows:
*posting of url
*posting file-upload
*posting of data as string(for greasemonkey-private)
"""
if vars.url and vars.torrent.filename: vars = web.input(url = None, torrent = {},
torrent_name=None, torrent_data = None)
torrent_name = vars.torrent_name
torrent_data = vars.torrent_data
if vars.torrent.filename:
torrent_name = vars.torrent.filename
torrent_data = vars.torrent.file.read()
if vars.url and torrent_name:
error_page(_("Choose an url or a torrent, not both.")) error_page(_("Choose an url or a torrent, not both."))
if vars.url: if vars.url:
ws.proxy.add_torrent_url(vars.url) ws.proxy.add_torrent_url(vars.url)
do_redirect() do_redirect()
elif vars.torrent.filename: elif torrent_name:
data = vars.torrent.file.read() data_b64 = base64.b64encode(torrent_data)
data_b64 = base64.b64encode(data)
#b64 because of strange bug-reports related to binary data #b64 because of strange bug-reports related to binary data
ws.proxy.add_torrent_filecontent(vars.torrent.filename, data_b64) ws.proxy.add_torrent_filecontent(vars.torrent.filename, data_b64)
do_redirect() do_redirect()

View File

@ -1 +1 @@
155 160

View File

@ -4,40 +4,40 @@ $:render.header(_('Torrent list'))
<div class="panel" id="toolbar"> <div class="panel" id="toolbar">
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_get("/torrent/add/")' onclick='toolbar_get("/torrent/add/",0)'
title='$_("Add")'><img class='toolbar_btn' title='$_("Add")'><img class='toolbar_btn'
src='/static/images/tango/list-add.png'></a> src='/static/images/tango/list-add.png'></a>
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_get("/torrent/delete/")'><img class='toolbar_btn' onclick='toolbar_get("/torrent/delete/",2)'><img class='toolbar_btn'
src='/static/images/tango/list-remove.png' src='/static/images/tango/list-remove.png'
title='$_("Remove")'></a> title='$_("Remove")'></a>
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_post("/torrent/stop/")' onclick='toolbar_post("/torrent/stop/",2)'
title='$_("Pause")'><img class='toolbar_btn' title='$_("Pause")'><img class='toolbar_btn'
src='/static/images/tango/pause.png' src='/static/images/tango/pause.png'
></a> ></a>
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_post("/torrent/start/")' onclick='toolbar_post("/torrent/start/",2)'
title='$_("Start")'><img class='toolbar_btn' title='$_("Start")'><img class='toolbar_btn'
src='/static/images/tango/start.png'></a> src='/static/images/tango/start.png'></a>
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_post("/torrent/queue/up/")' onclick='toolbar_post("/torrent/queue/up/",2)'
title='$_("Up")'><img class='toolbar_btn' title='$_("Up")'><img class='toolbar_btn'
src='/static/images/tango/queue-up.png'></a> src='/static/images/tango/queue-up.png'></a>
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_post("/torrent/queue/down/")' onclick='toolbar_post("/torrent/queue/down/",2)'
title='$_("Down")'><img class='toolbar_btn' title='$_("Down")'><img class='toolbar_btn'
src='/static/images/tango/queue-down.png'></a> src='/static/images/tango/queue-down.png'></a>
<a class='toolbar_btn' href="#" <a class='toolbar_btn' href="#"
onclick='toolbar_get("/torrent/info/")' onclick='toolbar_get("/torrent/info/",1)'
title='$_("Details")'><img class='toolbar_btn' title='$_("Details")'><img class='toolbar_btn'
src='/static/images/tango/details.png'></a> src='/static/images/tango/details.png'></a>
@ -67,6 +67,7 @@ $#end
$:(sort_head('name', _('Name'))) $:(sort_head('name', _('Name')))
$:(sort_head('total_size', _('Size'))) $:(sort_head('total_size', _('Size')))
$:(sort_head('progress', _('Progress'))) $:(sort_head('progress', _('Progress')))
$:(sort_head('category', _('Tracker')))
$:(sort_head('num_seeds', _('Seeders'))) $:(sort_head('num_seeds', _('Seeders')))
$:(sort_head('num_peers', _('Peers'))) $:(sort_head('num_peers', _('Peers')))
$:(sort_head('download_rate', _('Download'))) $:(sort_head('download_rate', _('Download')))
@ -99,6 +100,7 @@ $for torrent in torrent_list:
</div> </div>
</div> </div>
</td> </td>
<td>$torrent.category</td>
<td>$torrent.num_seeds ($torrent.total_seeds)</td> <td>$torrent.num_seeds ($torrent.total_seeds)</td>
<td>$torrent.num_peers ($torrent.total_peers)</td> <td>$torrent.num_peers ($torrent.total_peers)</td>
<td> <td>

View File

@ -1,5 +1,5 @@
$def with (filter_tabs, category_tabs) $def with (filter_tabs, category_tabs)
<form method="GET" id="category_form" style="display:inline;position:relative;top:-5px;padding-left:50px;> <form method="GET" id="category_form">
<input type="hidden" name="sort" value="$get('sort')"> <input type="hidden" name="sort" value="$get('sort')">
<input type="hidden" name="order" value="$get('order')"> <input type="hidden" name="order" value="$get('order')">
<select name='filter' id='filter' <select name='filter' id='filter'
@ -23,6 +23,11 @@ $for tab in category_tabs:
</option> </option>
</select> </select>
<input type="image" id='toolbar_refresh'
src='/static/images/tango/view-refresh.png'
title='$_('Refresh')'
>
</form> </form>

View File

@ -163,7 +163,7 @@ body.inner {
padding-bottom:5px; padding-bottom:5px;
margin-bottom: 15px; margin-bottom: 15px;
padding-left:32px; padding-left:32px;
height:16px; height:20px;
} }
#toolbar select{ #toolbar select{
@ -183,6 +183,7 @@ a.toolbar_btn {
padding-top:7px; padding-top:7px;
padding-right:3px; padding-right:3px;
text-decoration: none; text-decoration: none;
margin-bottom:3px;
} }
a.toolbar_btn:hover { a.toolbar_btn:hover {
background-color:#68a; background-color:#68a;
@ -190,6 +191,32 @@ a.toolbar_btn:hover {
text-decoration: none; text-decoration: none;
} }
#toolbar_refresh {
margin:0;
border:0;
background-color:none;
padding-left:2px;
padding-top:2px;
padding-right:2px;
text-decoration: none;
background-color: #37506f;
position:relative;
top:5px;
}
#toolbar_refresh:hover {
background-color:#68a;
-moz-border-radius:5px;
text-decoration: none;
}
#category_form{
display:inline;
position:relative;
top:-3px;
padding-left:20px;
}
form { /*all forms!*/ form { /*all forms!*/
margin:0; margin:0;
padding:0; padding:0;

View File

@ -97,19 +97,24 @@ function on_click_do_nothing(e, id){
on_click_action = on_click_do_nothing; on_click_action = on_click_do_nothing;
/*toobar buttons, */ /*toobar buttons, */
function toolbar_post(url) { function toolbar_post(url, selected) {
/*this feels hacky, but it's the only way i know of*/ if ((!selected) || (state.selected_rows.length > 0)) {
var ids = state.selected_rows.join(','); var ids = state.selected_rows.join(',');
var form = $('toolbar_form'); var form = $('toolbar_form');
form.action = url +ids; form.action = url +ids;
form.submit(); form.submit();
}
return false; return false;
} }
function toolbar_get(url) { function toolbar_get(url , selected) {
/*this feels hacky, but it's the only way i know of*/ if (!selected) {
window.location.href = url
}
else if (state.selected_rows.length > 0) {
var ids = state.selected_rows.join(','); var ids = state.selected_rows.join(',');
window.location.href = url +ids; window.location.href = url +ids;
}
return false; return false;
} }

View File

@ -68,10 +68,10 @@ $fspeed(torrent.download_rate)</td></td></tr>
<td class="info_value">$torrent.num_files</td></tr> <td class="info_value">$torrent.num_files</td></tr>
<tr><td class="info_label">$_('Tracker'):</td> <tr><td class="info_label">$_('Tracker'):</td>
<td class="info_value">$(crop(torrent.tracker, 30))</td></tr> <td class="info_value" title="$torrent.tracker">$(crop(torrent.tracker, 30))</td></tr>
<tr><td class="info_label">$_('Tracker Status'):</td> <tr><td class="info_label">$_('Tracker Status'):</td>
<td class="info_value">$torrent.tracker_status </td></tr> <td class="info_value" title="$torrent.tracker_status">$(crop(torrent.tracker_status, 30)) </td></tr>
<tr><td class="info_label">$_('Next Announce'):</td> <tr><td class="info_label">$_('Next Announce'):</td>
<td class="info_value">$torrent.next_announce </td></tr> <td class="info_value">$torrent.next_announce </td></tr>

View File

@ -1,5 +1,5 @@
revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk
date: 2007-11-06 15:10:08 +0200 date: 2007-11-26 15:10:08 +0200
build-date: 2007-11-06 15:34:50 +0200 build-date: 2007-11-26 15:34:50 +0200
revno: 155 revno: 160
branch-nick: WebUi branch-nick: WebUi