purging organize pt1

This commit is contained in:
Martijn Voncken 2008-07-05 15:38:07 +00:00
parent 14d6dd55bc
commit 14b5aabfa6
8 changed files with 39 additions and 118 deletions

View File

@ -1,3 +1,8 @@
After labels:
*templates : remove advanced , rename deluge to classic , result ->classic template:no-javascript ; white -> static enhanced with js ; ajax-template -> damoxc.
*white temnplate: add deluge icon.
*fix all comments from IRC-nonicknamename2.
0.6 :
*plugin-config + (re)enable webui plugins.
*Fix IE7 for advanced/white template.

View File

@ -183,12 +183,17 @@ class PluginApi(component.Component):
import web
from render import render
import page_decorators as deco
import utils
import lib.newforms_plus as forms
self.render = render
self.web = web
self.deco = deco
self.forms = forms
self.page_manager = component.get("PageManager")
self.config_page_manager = component.get("ConfigPageManager")
self.menu_manager = component.get("MenuManager")
self.utils = utils
def register():
__plugin_manager = PluginManager()

View File

@ -88,7 +88,7 @@ class index:
@deco.deluge_page
@deco.auto_refreshed
def GET(self, name):
vars = web.input(sort=None, order=None, state=None , tracker=None, keyword=None)
vars = web.input(sort=None, order=None, filter_cat=None ,filter_value=None , tracker=None)
#cookies are a delicious delecacy.
if not vars.sort: #no arguments, default to coockies.
@ -98,16 +98,21 @@ class index:
setcookie(key,getattr(vars,key))
#organize-filters
organize_filters = {}
if 'Organize' in proxy.get_enabled_plugins():
label_filters = {}
if 'label' in proxy.get_enabled_plugins():
filter_dict = {}
if vars.filter_cat and vars.filter_value and vars.filter_value <> "All":
filter_dict = {vars.filter_cat:vars.filter_value}
"""
TODO...
for filter_name in ["state","tracker","keyword"]:
value = getattr(vars, filter_name)
if value and value <> "All" and value <> "None":
filter_dict[filter_name] = value
log.debug(filter_dict)
torrent_ids = proxy.organize_get_session_state(filter_dict)
organize_filters = Storage(proxy.organize_all_filter_items())
"""
torrent_ids = proxy.label_get_filtered_ids(filter_dict)
label_filters = proxy.label_filter_items()
else:
torrent_ids = proxy.get_session_state()
@ -124,7 +129,7 @@ class index:
if vars.order == 'up':
torrent_list = list(reversed(torrent_list))
return render.index(torrent_list, organize_filters)
return render.index(torrent_list, label_filters)
route('/index',index)
#simple proxy's to deluge.ui.client

View File

@ -1,4 +1,4 @@
$def with (torrent_list, organize_filters)
$def with (torrent_list, label_filters)
<script language="javascript">
/*for select_all shortcut/button*/
@ -24,11 +24,12 @@ document.onkeydown = torrent_table.keydown;
$:(sort_head('total_size', _('Size')))
$:(sort_head('progress', _('Progress')))
$if organize_filters:
$if label_filters:
<!--HACK:
abusing organize_filters to check if the Orgnize plugin is enabled
abusing label_filters to check if the Orgnize plugin is enabled
-->
$:(sort_head('tracker_name', _('Tracker')))
$:(sort_head('label', _('Label')))
$:(sort_head('tracker_host', _('Tracker')))
$:(sort_head('num_seeds', _('Seeders')))
$:(sort_head('num_peers', _('Peers')))
@ -68,8 +69,9 @@ $for torrent in torrent_list:
</div>
</div>
</td>
$if organize_filters:
<td>$torrent.tracker_name</td>
$if label_filters:
<td>$torrent.label</td>
<td>$torrent.tracker_host</td>
<td>
$if torrent.total_seeds != -1:
$torrent.num_seeds ($torrent.total_seeds)

View File

@ -1,44 +1,2 @@
$def with (filters)
<form method="GET" id="category_form">
<input type="hidden" name="sort" value="$get('sort')">
<input type="hidden" name="order" value="$get('order')">
<select name='state' id='state'
onchange="document.getElementById('category_form').submit()"
title="$_('Filter on state')">
$for state, num in filters.state:
<option value="$state"
$if state == get('state'):
selected
>
$_(state) ($num)
</option>
</select>
<select name='tracker' id='tracker'
onchange="document.getElementById('category_form').submit()"
title="$_('Filter on tracker')"
style="width:150px"
>
<option value="">$_('Trackers')</option>
$for tracker, num in filters.tracker:
<option value="$tracker"
$if tracker == get('tracker'):
selected
>
$tracker ($num)
</option>
</select>
<input type="text" name="keyword" value="$get('keyword')" style="width:150px"
title="$_('Filter on a keyword')"
/>
<input type="image" id='toolbar_refresh' name="refresh_organize"
src='$base/static/images/tango/view-refresh.png'
title='$_('Refresh')'
>
</form>
<!-- todo:remove-->

View File

@ -1,10 +1,11 @@
$def with (torrent_list, organize_filters)
$def with (torrent_list, label_filters)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
$:render.header(_("Deluge : Torrent List"), 'home')
$if organize_filters:
$:render.part_organize(organize_filters)
$if label_filters:
<!--the part_label_filters.html is served from the label plugin template directory -->
$:render.part_label_filters(label_filters)
<table id="torrent_list_block" width="80%">
@ -13,7 +14,7 @@ $if organize_filters:
$:render.part_toolbar()
</div>
</td></tr><tr><td>
$:render.part_torrent_list(torrent_list, organize_filters)
$:render.part_torrent_list(torrent_list, label_filters)
</td></tr><tr><td height=100%>

View File

@ -1,58 +1,2 @@
$def with (filters)
<form method="GET" id="category_form">
<input type="hidden" name="sort" value="$get('sort')">
<input type="hidden" name="order" value="$get('order')">
<div id="organize_block">
<div id="organize_state">
<div class="title">$_('Keyword')</div>
<input type="text" name="keyword" id="keyword" value="$get('keyword')" style="width:100px;padding:0px"
title="$_('Filter on a keyword')"
/>
$if get('keyword'):
<img src="$base/static/images/tango/edit-clear.png" alt="$_('Clear')"
onclick="el('keyword').value='';el('category_form').submit();"
>
<!--1st button widget is default , i dont want that here, using an image instead :(-->
<br /><br />
<div class="title">$_('State')</div>
<ul>
$for state, num in filters.state:
$if (num > 0) or (state == get('state')):
<li
$if not get('state'):
$if state == "All":
class="selected"
$if state == get('state'):
class="selected"
>
<img src="$base/pixmaps/$state.lower() ">
<a href="$self_url(state=state)">$_(state) ($num)</a>
</li>
$else:
<!--ignore states with no count $state -->
</ul>
<div class="title">$_('Trackers')</div>
<ul>
<li
$if not get('tracker'):
class="selected"
>
<a href="$self_url(tracker='')" title="$_('All')">$_("All")</a>
</li>
$for tracker, num in filters.tracker:
<li
$if tracker == get('tracker'):
class="selected"
>
<a href="$self_url(tracker=tracker)" title="$tracker ($num)">$crop(tracker, 20) ($num)</a>
</li>
</ul>
</div>
</form>
</div>
<!-- todo:remove-->

View File

@ -54,7 +54,8 @@ TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length',
'max_upload_slots', 'max_download_speed', 'prioritize_first_last',
'private','max_upload_speed','queue','peers',
#builtin plugins:
'tracker_name' #organize-plugin
'tracker_name', #organize-plugin
'tracker_host', 'label' #label-plugin
]
CONFIG_DEFAULTS = {