summaryrefslogtreecommitdiffstats
path: root/module/web/pyload
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-09-13 19:31:10 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-09-13 19:31:10 +0200
commite7ea8a420d01c927c17cf2db692cb0355aa87b95 (patch)
treefffd2c397b2fc300ca8086785d0898442e325531 /module/web/pyload
parentcouldn't connect to host fix (diff)
downloadpyload-e7ea8a420d01c927c17cf2db692cb0355aa87b95.tar.xz
new package ui for webif
Diffstat (limited to 'module/web/pyload')
-rw-r--r--module/web/pyload/urls.py1
-rw-r--r--module/web/pyload/views.py54
2 files changed, 10 insertions, 45 deletions
diff --git a/module/web/pyload/urls.py b/module/web/pyload/urls.py
index 66ea68e39..c4c2f6ef2 100644
--- a/module/web/pyload/urls.py
+++ b/module/web/pyload/urls.py
@@ -15,6 +15,7 @@ urlpatterns = patterns('pyload',
(r'^settings/$', 'views.config',{}, 'config'),
(r'^logs/$', 'views.logs',{}, 'logs'),
(r'^logs/(?P<item>\d+)$', 'views.logs',{}, 'logs'),
+ (r'^package_ui.js$', 'views.package_ui', {}, 'package_ui'),
(r'^$', 'views.home',{}, 'home'),
)
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index dd367f7f3..e1f4e2fdd 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -86,31 +86,10 @@ def home(request):
@permission('pyload.can_see_dl')
@check_server
def queue(request):
- queue = settings.PYLOAD.get_queue()
- for package in queue.itervalues():
- for pyfile in package["links"].itervalues():
- if pyfile["status"] == 0:
- pyfile["icon"] = "status_finished.png"
- elif pyfile["status"] in (2,3):
- pyfile["icon"] = "status_queue.png"
- elif pyfile["status"] in (9,1):
- pyfile["icon"] = "status_offline.png"
- elif pyfile["status"] == 5:
- pyfile["icon"] = "status_waiting.png"
- elif pyfile["status"] == 8:
- pyfile["icon"] = "status_failed.png"
- elif pyfile["status"] in (11,13):
- pyfile["icon"] = "status_proc.png"
- else:
- pyfile["icon"] = "status_downloading.png"
-
+ queue = settings.PYLOAD.get_queue_info()
+
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': data}, [status_proc]))
@@ -262,31 +241,10 @@ def logs(request, item=-1):
@permission('pyload.can_add_dl')
@check_server
def collector(request):
- queue = settings.PYLOAD.get_collector()
- for package in queue.itervalues():
- for pyfile in package["links"].itervalues():
- if pyfile["status"] == 0:
- pyfile["icon"] = "status_finished.png"
- elif pyfile["status"] in (2,3):
- pyfile["icon"] = "status_queue.png"
- elif pyfile["status"] in (9,1):
- pyfile["icon"] = "status_offline.png"
- elif pyfile["status"] == 5:
- pyfile["icon"] = "status_waiting.png"
- elif pyfile["status"] == 8:
- pyfile["icon"] = "status_failed.png"
- elif pyfile["status"] in (11,13):
- pyfile["icon"] = "status_proc.png"
- else:
- pyfile["icon"] = "status_downloading.png"
+ queue = settings.PYLOAD.get_collector_info()
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, 'collector.html'), RequestContext(request, {'content': data}, [status_proc]))
@@ -371,3 +329,9 @@ def config(request):
accs = settings.PYLOAD.get_accounts()
return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {'Plugin':plugin, 'General':conf, 'Accounts': accs}, 'errors': messages}, [status_proc]))
+
+@login_required
+@permission('pyload.can_change_status')
+@check_server
+def package_ui(request):
+ return render_to_response(join(settings.TEMPLATE, 'package_ui.js'), RequestContext(request, {}, )) \ No newline at end of file