summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-01-20 19:41:43 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-01-20 19:41:43 +0100
commit07f280a220ab5bc5c3fb510ea00aecedfcec7564 (patch)
tree0a902013984fa8aee01ce162e437ee2dfd988e84 /module/web
parentwebinterface - status icons (diff)
downloadpyload-07f280a220ab5bc5c3fb510ea00aecedfcec7564.tar.xz
queue page fully functional, some fixes
Diffstat (limited to 'module/web')
-rw-r--r--module/web/ajax/urls.py6
-rw-r--r--module/web/ajax/views.py44
-rw-r--r--module/web/media/default/css/default.css15
-rw-r--r--module/web/media/default/img/progress-bar-back.gifbin10819 -> 0 bytes
-rw-r--r--module/web/media/default/img/progress-bar.gifbin10819 -> 0 bytes
-rw-r--r--module/web/media/default/img/progressbar.gifbin120 -> 0 bytes
-rw-r--r--module/web/media/default/img/progressbg_black.gifbin1626 -> 0 bytes
-rw-r--r--module/web/media/default/img/progressbg_green.gifbin1308 -> 0 bytes
-rw-r--r--module/web/media/default/img/progressbg_orange.gifbin1308 -> 0 bytes
-rw-r--r--module/web/media/default/img/progressbg_red.gifbin1308 -> 0 bytes
-rw-r--r--module/web/media/default/img/progressbg_yellow.gifbin1308 -> 0 bytes
-rw-r--r--module/web/pyload/views.py4
-rw-r--r--module/web/templates/default/base.html8
-rw-r--r--module/web/templates/default/home.html4
-rw-r--r--module/web/templates/default/queue.html106
-rw-r--r--module/web/templates/default/window.html2
16 files changed, 164 insertions, 25 deletions
diff --git a/module/web/ajax/urls.py b/module/web/ajax/urls.py
index 7d63ef5a6..d50e7121e 100644
--- a/module/web/ajax/urls.py
+++ b/module/web/ajax/urls.py
@@ -12,7 +12,7 @@ urlpatterns = patterns('ajax',
# Uncomment the next line to enable the admin:
(r'^add_package$', 'views.add_package'),
- (r'^remove_link/(\d+)$', 'views.remove_link'),
+ (r'^abort_link/(\d+)$', 'views.abort_link'),
(r'^status$', 'views.status'),
(r'^links$', 'views.links'), #currently active links
(r'^queue$', 'views.queue'),
@@ -22,4 +22,8 @@ urlpatterns = patterns('ajax',
(r'^packages$', 'views.packages'),
(r'^package/(\d+)$', 'views.package'),
(r'^link/(\d+)$', 'views.link'),
+ (r'^remove_package/(\d+)$', 'views.remove_package'),
+ (r'^restart_package/(\d+)$', 'views.restart_package'),
+ (r'^remove_link/(\d+)$', 'views.remove_link'),
+ (r'^restart_link/(\d+)$', 'views.restart_link'),
) \ No newline at end of file
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py
index 4f136cef9..4d9762ab4 100644
--- a/module/web/ajax/views.py
+++ b/module/web/ajax/views.py
@@ -39,16 +39,15 @@ def add_package(request):
name = request.POST['add_name']
- if name == None or name == "":
- return HttpResponseServerError()
-
links = request.POST['add_links'].replace(" ","\n").split("\n")
try:
f = request.FILES['add_file']
- print f
+
+ if name == None or name == "":
+ name = f.name
+
fpath = join(settings.DL_ROOT, f.name)
- print fpath
destination = open(fpath, 'wb')
for chunk in f.chunks():
destination.write(chunk)
@@ -57,6 +56,9 @@ def add_package(request):
except:
pass
+ if name == None or name == "":
+ return HttpResponseServerError()
+
links = filter(lambda x: x != "", links)
settings.PYLOAD.add_package(name, links)
@@ -160,3 +162,35 @@ def link(request, id):
except:
return HttpResponseServerError()
+
+@permission('pyload.can_add_dl')
+def remove_package(request, id):
+ try:
+ settings.PYLOAD.del_packages([int(id)])
+ return JsonResponse("sucess")
+ except:
+ return HttpResponseServerError()
+
+@permission('pyload.can_add_dl')
+def restart_package(request, id):
+ try:
+ settings.PYLOAD.restart_package(int(id))
+ return JsonResponse("sucess")
+ except:
+ return HttpResponseServerError()
+
+@permission('pyload.can_add_dl')
+def restart_link(request, id):
+ try:
+ settings.PYLOAD.restart_file(int(id))
+ return JsonResponse("sucess")
+ except:
+ return HttpResponseServerError()
+
+@permission('pyload.can_add_dl')
+def abort_link(request, id):
+ try:
+ settings.PYLOAD.stop_download("link", int(id))
+ return JsonResponse("sucess")
+ except:
+ return HttpResponseServerError() \ No newline at end of file
diff --git a/module/web/media/default/css/default.css b/module/web/media/default/css/default.css
index d7756e314..3c4762012 100644
--- a/module/web/media/default/css/default.css
+++ b/module/web/media/default/css/default.css
@@ -1466,7 +1466,7 @@ div.codearea pre span.Preprc {
padding-right: 8px;
}
.package {
- margin-bottom: 20px;
+ margin-bottom: 10px;
}
.packagename {
background: url(/media/default/img/folder.png) no-repeat;
@@ -1495,3 +1495,16 @@ div.codearea pre span.Preprc {
height: 5px;
}
+
+.queue {
+ border: none
+}
+
+.queue tr td {
+ border: none
+}
+
+.header, .header th{
+ text-align: left;
+ font-weight: normal;
+} \ No newline at end of file
diff --git a/module/web/media/default/img/progress-bar-back.gif b/module/web/media/default/img/progress-bar-back.gif
deleted file mode 100644
index 0c8f68211..000000000
--- a/module/web/media/default/img/progress-bar-back.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progress-bar.gif b/module/web/media/default/img/progress-bar.gif
deleted file mode 100644
index 746f77175..000000000
--- a/module/web/media/default/img/progress-bar.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progressbar.gif b/module/web/media/default/img/progressbar.gif
deleted file mode 100644
index abe588c15..000000000
--- a/module/web/media/default/img/progressbar.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progressbg_black.gif b/module/web/media/default/img/progressbg_black.gif
deleted file mode 100644
index 74fd1f9b3..000000000
--- a/module/web/media/default/img/progressbg_black.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progressbg_green.gif b/module/web/media/default/img/progressbg_green.gif
deleted file mode 100644
index f3f3bf681..000000000
--- a/module/web/media/default/img/progressbg_green.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progressbg_orange.gif b/module/web/media/default/img/progressbg_orange.gif
deleted file mode 100644
index 808cac7cf..000000000
--- a/module/web/media/default/img/progressbg_orange.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progressbg_red.gif b/module/web/media/default/img/progressbg_red.gif
deleted file mode 100644
index 54dfa135f..000000000
--- a/module/web/media/default/img/progressbg_red.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/media/default/img/progressbg_yellow.gif b/module/web/media/default/img/progressbg_yellow.gif
deleted file mode 100644
index fdb0dfc98..000000000
--- a/module/web/media/default/img/progressbg_yellow.gif
+++ /dev/null
Binary files differ
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 994075001..d72dca56c 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -111,7 +111,7 @@ def downloads(request):
return render_to_response(join(settings.TEMPLATE, 'downloads.html'), RequestContext(request, {'files': data}, [status_proc]))
@login_required
-@permission('pyload.user.can_download')
+@permission('pyload.can_download')
@check_server
def download(request, path):
path = path.split("/")
@@ -143,7 +143,7 @@ def download(request, path):
return HttpResponseNotFound("File not Found.")
@login_required
-@permission('pyload.user.can_see_logs')
+@permission('pyload.can_see_logs')
@check_server
def logs(request, page=0):
diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html
index 692a951bc..2a2490088 100644
--- a/module/web/templates/default/base.html
+++ b/module/web/templates/default/base.html
@@ -36,7 +36,7 @@ document.addEvent("domready", function(){
});
var jsonStatus = new Request.JSON({
- url: "json/status",
+ url: "/json/status",
onSuccess: LoadJsonToContent,
secure: false,
async: true,
@@ -46,17 +46,17 @@ document.addEvent("domready", function(){
})
$('action_play').addEvent('click', function(){
- new Request({method: 'get', url: 'json/unpause'}).send();
+ new Request({method: 'get', url: '/json/unpause'}).send();
});
$('action_cancel').addEvent('click', function(){
- new Request({method: 'get', url: 'json/cancel'}).send();
+ new Request({method: 'get', url: '/json/cancel'}).send();
});
$('action_stop').addEvent('click', function(){
- new Request({method: 'get', url: 'json/pause'}).send();
+ new Request({method: 'get', url: '/json/pause'}).send();
});
jsonStatus.startTimer();
diff --git a/module/web/templates/default/home.html b/module/web/templates/default/home.html
index 4d499f6fe..ab2135800 100644
--- a/module/web/templates/default/home.html
+++ b/module/web/templates/default/home.html
@@ -168,7 +168,7 @@ var LinkEntry = new Class({
this.fadeBar = new Fx.Tween(this.elements.pgbTr);
this.elements.remove.addEvent('click', function(){
- new Request({method: 'get', url: 'json/remove_link/'+this.id}).send();
+ new Request({method: 'get', url: '/json/abort_link/'+this.id}).send();
}.bind(this));
},
@@ -222,7 +222,7 @@ Active Downloads
</td>
</tr>
<tr id="link_{{ link.id }}_pgb_tr">
- <td span="5">
+ <td colspan="5">
<div id="link_{{ link.id }}_pgb" class="progressBar" style="background-color: green; height:4px; width: {{ link.percent }}%;">&nbsp;</div>
</td>
</tr>
diff --git a/module/web/templates/default/queue.html b/module/web/templates/default/queue.html
index 7c78ac45b..aa21390a0 100644
--- a/module/web/templates/default/queue.html
+++ b/module/web/templates/default/queue.html
@@ -1,5 +1,76 @@
{% extends 'default/base.html' %}
+{% block head %}
+<script type="text/javascript">
+
+document.addEvent("domready", function(){
+ $$('.package').each(function(item){
+ id = item.get('id').match(/[0-9]+/)
+
+ imgs = item.getElements('img');
+ imgs[0].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/remove_package/'+this,
+ onSuccess: function(){
+ $('package_'+this).nix()
+ }.bind(this)
+ }).send();
+ e.stop();
+ }.bind(id));
+
+ imgs[1].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/restart_package/'+this,
+ onSuccess: function(){
+ $('package_'+this).nix()
+ }.bind(this)
+ }).send();
+ e.stop();
+ }.bind(id));
+
+
+ item.getElement('.packagename').addEvent('click', function(){
+
+ child = item.getElement('.children')
+ if (child.getStyle('display') == "block"){
+ child.dissolve();
+ }else{
+ child.reveal();
+ }
+ }.bind(item));
+
+
+ item.getElements('.child').each(function(child){
+ id = child.get('id').match(/[0-9]+/)
+ imgs = child.getElements('.child_secrow img')
+ imgs[0].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/remove_link/'+this,
+ onSuccess: function(){
+ $('file_'+this).nix()
+ }.bind(this)
+ }).send();
+ }.bind(id));
+
+ imgs[1].addEvent('click', function(e){
+ new Request({
+ method: 'get',
+ url: '/json/restart_link/'+this,
+ onSuccess: function(){
+ $('file_'+this).nix()
+ }.bind(this)
+ }).send();
+ }.bind(id));
+ });
+
+ })
+});
+</script>
+{% endblock %}
+
{% block title %}Queue - {{block.super}} {% endblock %}
{% block menu %}
@@ -11,17 +82,34 @@
{% block content %}
{% for package in content %}
-<div class="package"><div class="packagename" onclick="javascript: PackegeShower();">{{ package.package_name }}&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" /></a>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" /></a></div>
- <div class="children">
+<div id="package_{{package.id}}" class="package">
+ <div class="packagename" style="cursor: pointer;">
+ {{ package.package_name }}
+ &nbsp;&nbsp;
+ <img width="12px" height="12px" src="{{ MEDIA_URL }}img/delete.png" />
+ &nbsp;&nbsp;
+ <img style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
+ </div>
+ <div id="children_{{package.id}}" style="display: none;" class="children">
{% for child in package.children %}
- <div class="child"><span class="child_status">hierkommteinicondasaufdenstatusabgestimmtist</span>{{ child.filename }}<br />
- <div class="child_secrow"><span class="child_status">Downloaded</span>&nbsp;&nbsp;<span class="child_status">100 MB</span>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" /></a>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" /></a></div></div>
- <div class="child"><span class="child_status">hierkommteinicondasaufdenstatusabgestimmtist</span>{{ child.filename }}<br />
- <div class="child_secrow"><span class="child_status">Downloaded</span>&nbsp;&nbsp;<span class="child_status">100 MB</span>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" /></a>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" /></a></div></div>
- <div class="child"><span class="child_status">hierkommteinicondasaufdenstatusabgestimmtist</span>{{ child.filename }}<br />
- <div class="child_secrow"><span class="child_status">Downloaded</span>&nbsp;&nbsp;<span class="child_status">100 MB</span>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" /></a>&nbsp;&nbsp;<a href=""><img width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" /></a></div></div>
+ <div class="child" id="file_{{child.id}}">
+ <span class="child_status">
+ <img src="/media/default/img/status_{{child.status_type}}.png" style="width: 12px; height:12px;"/>
+ </span>
+ <span style="font-size: 15px">{{ child.filename }}</span><br />
+ <div class="child_secrow">
+ <span class="child_status">{{ child.status_type }}</span>{{child.status_error}}&nbsp;
+ <span class="child_status">{{ child.size }} KB</span>
+ <span class="child_status">{{ child.plugin }}</span>
+ <span class="child_status">Folder: {{child.folder}}</span>
+ &nbsp;&nbsp;
+ <img style="cursor: pointer;" width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" />
+ &nbsp;&nbsp;
+ <img style="cursor: pointer;margin-left: -4px" width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
+ </div>
+ </div>
{% endfor %}
- </div>
+ </div>
</div>
{% endfor %}
<!--table >
diff --git a/module/web/templates/default/window.html b/module/web/templates/default/window.html
index 5f2dc594a..7e5c249e6 100644
--- a/module/web/templates/default/window.html
+++ b/module/web/templates/default/window.html
@@ -4,7 +4,7 @@
<!--<div style="width: 900px; text-align: right;"><b onclick="AddBox();">[Close]</b></div>-->
<div id="add_box" class="myform">
-<form id="add_form" action="json/add_package" method="POST" enctype="multipart/form-data">
+<form id="add_form" action="/json/add_package" method="POST" enctype="multipart/form-data">
<h1>Add Package</h1>
<p>Paste your links or upload a container.</p>
<label>Name