summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-12-03 18:10:48 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-12-03 18:10:48 +0100
commita649d73a1bd2a9b45eb35d535d40e2454238417c (patch)
treee73aa757d7b55fcdd3f6badd0c36d97195133b7d /module/web
parentBetter Update System (diff)
downloadpyload-a649d73a1bd2a9b45eb35d535d40e2454238417c.tar.xz
little webinterface fixes
Diffstat (limited to 'module/web')
-rw-r--r--module/web/WebServer.py13
-rw-r--r--module/web/static/default/status.js4
-rw-r--r--module/web/templates/default.tpl6
3 files changed, 17 insertions, 6 deletions
diff --git a/module/web/WebServer.py b/module/web/WebServer.py
index 29b0aafe8..3486bf7cb 100644
--- a/module/web/WebServer.py
+++ b/module/web/WebServer.py
@@ -184,7 +184,7 @@ def queue():
username = request.COOKIES.get('user')
- return template('default', page='queue', links=core.get_links(), user=username, status=core_methods.status_server())
+ return template('default', page='queue', links=core_methods.get_queue(), user=username, status=core_methods.status_server())
@route('/downloads')
def downloads():
@@ -252,6 +252,17 @@ def get_status():
json = '{ "status": "%s", "speed": "%s", "queue": "%s" }' % (status, str(int(data['speed'])), str(data['queue']))
return json
+@route('json/addpackage', method='POST')
+def add_package():
+ response.header['Cache-Control'] = 'no-cache, must-revalidate'
+ response.content_type = 'application/json'
+
+ if not check_auth(request):
+ abort(404, "No Access")
+
+ links = request.POST['links'].split('\n')
+ name = request.POST['name']
+ core_methods.add_package(name, links)
@route('/json/addlinks', method='POST')
def add_links():
diff --git a/module/web/static/default/status.js b/module/web/static/default/status.js
index 31a4e0032..3923e80ca 100644
--- a/module/web/static/default/status.js
+++ b/module/web/static/default/status.js
@@ -39,11 +39,11 @@ window.addEvent('domready', function(){
new Request({
method: 'post',
- url: '/json/addlinks',
+ url: '/json/addpackage',
onSuccess: function(){
document.id('linkarea').value = ""
}
- }).send('links='+document.id('linkarea').value)
+ }).send('links='+document.id('linkarea').value+"&name="+document.id('pname').value)
})
diff --git a/module/web/templates/default.tpl b/module/web/templates/default.tpl
index 13be260b6..3f5e8d8e8 100644
--- a/module/web/templates/default.tpl
+++ b/module/web/templates/default.tpl
@@ -11,7 +11,7 @@
%include header title=header, use_js=js, use_css=['default.css','window.css'], redirect=red
-%include window id="addlinks", width=400, caption="Add links", body="<textarea rows=10 style='width: 345px;' id='linkarea'></textarea>", button="Add"
+%include window id="addlinks", width=400, caption="Add links", body="<input id='pname' type='text' style='width: 345px;' value='Package'/><textarea rows=10 style='width: 345px;' id='linkarea'></textarea>", button="Add"
<a class="anchor" name="top" id="top"></a>
@@ -199,9 +199,9 @@ this.morph({'color': '#000'});
<ul>
-%for id in links['order']:
+%for package in links:
-<li>{{links[id].url}}</li>
+<li>{{package.name}}</li>
%end