diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-11 12:01:55 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-11 12:01:55 +0200 |
commit | 69eb9e649428b930448f496a7a39a9f12bb278bb (patch) | |
tree | 83fc72a5df42c3f384fa06ec19e1554ebf18183a | |
parent | package finished event (diff) | |
download | pyload-69eb9e649428b930448f496a7a39a9f12bb278bb.tar.xz |
correct order in webif
-rw-r--r-- | module/FileDatabase.py | 1 | ||||
-rw-r--r-- | module/web/ajax/views.py | 2 | ||||
-rw-r--r-- | module/web/pyload/views.py | 28 | ||||
-rw-r--r-- | module/web/templates/default/collector.html | 4 | ||||
-rw-r--r-- | module/web/templates/default/queue.html | 4 |
5 files changed, 31 insertions, 8 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index bbf02387e..a7d32b125 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -790,7 +790,6 @@ class FileDatabaseBackend(Thread): return [x[0] for x in self.c ] @queue - #---------------------------------------------------------------------- def getUnfinished(self, pid): """return list of ids with pyfiles in package not finished or processed""" diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index 0ad5e5156..82e478af3 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -232,7 +232,7 @@ def abort_link(request, id): @permission('pyload.can_add_dl') def push_to_queue(request, id): try: - settings.PYLOAD.push_package_2_queue(int(id)) + settings.PYLOAD.push_package_to_queue(int(id)) return JsonResponse("sucess") except: return HttpResponseServerError() diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 2d210b6d7..8cdef094b 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -10,6 +10,7 @@ from os.path import join from urllib import unquote from itertools import chain from datetime import datetime +from operator import itemgetter from django.conf import settings from django.contrib.auth.decorators import login_required @@ -19,6 +20,10 @@ from django.shortcuts import render_to_response from django.template import RequestContext from django.utils.translation import ugettext as _ + +def get_sort_key(item): + return item[1]["order"] + def check_server(function): def _dec(view_func): def _view(request, * args, ** kwargs): @@ -99,8 +104,18 @@ def queue(request): pyfile["icon"] = "status_proc.png" else: pyfile["icon"] = "status_downloading.png" + + + #@TODO: replace lambdas + data = zip(queue.keys(), queue.values()) + data.sort(key=get_sort_key) + + for id, value in data: + tmp = zip(value["links"].keys(), value["links"].values()) + tmp.sort(key=get_sort_key) + value["links"] = tmp - return render_to_response(join(settings.TEMPLATE, 'queue.html'), RequestContext(request, {'content': queue}, [status_proc])) + return render_to_response(join(settings.TEMPLATE, 'queue.html'), RequestContext(request, {'content': data}, [status_proc])) @login_required @@ -267,8 +282,17 @@ def collector(request): pyfile["icon"] = "status_proc.png" else: pyfile["icon"] = "status_downloading.png" + + #@TODO: replace lambdas + data = zip(queue.keys(), queue.values()) + data.sort(key=get_sort_key) - return render_to_response(join(settings.TEMPLATE, 'collector.html'), RequestContext(request, {'content': queue}, [status_proc])) + for id, value in data: + tmp = zip(value["links"].keys(), value["links"].values()) + tmp.sort(key=get_sort_key) + value["links"] = tmp + + return render_to_response(join(settings.TEMPLATE, 'collector.html'), RequestContext(request, {'content': data}, [status_proc])) @login_required diff --git a/module/web/templates/default/collector.html b/module/web/templates/default/collector.html index 266038af1..613fb824b 100644 --- a/module/web/templates/default/collector.html +++ b/module/web/templates/default/collector.html @@ -106,7 +106,7 @@ document.addEvent("domready", function(){ </li>{% endblock %}
{% block content %}
-{% for id,package in content.iteritems %}
+{% for id,package in content %}
<div id="package_{{id}}" class="package">
<div class="packagename" style="cursor: pointer;">
{{ package.name }}
@@ -118,7 +118,7 @@ document.addEvent("domready", function(){ <img title="{% trans "Push Package to Queue" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/package_go.png" />
</div>
<div id="children_{{id}}" style="display: none;" class="children">
- {% for lid, child in package.links.iteritems %}
+ {% for lid, child in package.links %}
<div class="child" id="file_{{lid}}">
<span class="child_status">
<img src="/media/default/img/{{child.icon}}" style="width: 12px; height:12px;"/>
diff --git a/module/web/templates/default/queue.html b/module/web/templates/default/queue.html index 2ca25e03d..0c6c021f5 100644 --- a/module/web/templates/default/queue.html +++ b/module/web/templates/default/queue.html @@ -96,7 +96,7 @@ document.addEvent("domready", function(){ </li>{% endblock %}
{% block content %}
-{% for id, package in content.iteritems %}
+{% for id, package in content %}
<div id="package_{{id}}" class="package">
<div class="packagename" style="cursor: pointer;">
{{ package.name }}
@@ -106,7 +106,7 @@ document.addEvent("domready", function(){ <img title="{% trans "Restart Package" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
</div>
<div id="children_{{id}}" style="display: none;" class="children">
- {% for lid, child in package.links.iteritems %}
+ {% for lid, child in package.links %}
<div class="child" id="file_{{lid}}">
<span class="child_status">
<img src="/media/default/img/{{child.icon}}" style="width: 12px; height:12px;"/>
|