From 0c8dc650e52323f741bdaf50a864f1ebd819e6c6 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 19 Aug 2009 17:13:35 +0200 Subject: webinterface statusbar --- module/web/WebServer.py | 17 ++++---- module/web/static/default.css | 3 +- module/web/static/default/Button-Add-grey.png | Bin 0 -> 2112 bytes module/web/static/default/Button-Add.png | Bin 0 -> 2110 bytes module/web/static/default/Button-Pause-grey.png | Bin 0 -> 1932 bytes module/web/static/default/Button-Pause.png | Bin 0 -> 2146 bytes module/web/static/default/Button-Play-grey.png | Bin 0 -> 1938 bytes module/web/static/default/Button-Play.png | Bin 0 -> 2023 bytes module/web/static/default/home.js | 19 +-------- module/web/static/default/status.js | 51 ++++++++++++++++++++++++ module/web/static/window.css | 17 ++++++++ module/web/static/window/big_button.gif | Bin 0 -> 1905 bytes module/web/static/window/big_button_over.gif | Bin 0 -> 728 bytes module/web/static/window/body.png | Bin 0 -> 402 bytes module/web/static/window/closebtn.gif | Bin 0 -> 254 bytes module/web/static/window/drag_corner.gif | Bin 0 -> 76 bytes module/web/static/window/full.png | Bin 0 -> 3543 bytes module/web/templates/default.tpl | 43 ++++++++++++++++++-- module/web/templates/header.tpl | 4 ++ module/web/templates/window.tpl | 28 +++++++++++++ 20 files changed, 152 insertions(+), 30 deletions(-) create mode 100644 module/web/static/default/Button-Add-grey.png create mode 100644 module/web/static/default/Button-Add.png create mode 100644 module/web/static/default/Button-Pause-grey.png create mode 100644 module/web/static/default/Button-Pause.png create mode 100644 module/web/static/default/Button-Play-grey.png create mode 100644 module/web/static/default/Button-Play.png create mode 100644 module/web/static/default/status.js create mode 100644 module/web/static/window.css create mode 100644 module/web/static/window/big_button.gif create mode 100644 module/web/static/window/big_button_over.gif create mode 100644 module/web/static/window/body.png create mode 100644 module/web/static/window/closebtn.gif create mode 100644 module/web/static/window/drag_corner.gif create mode 100644 module/web/static/window/full.png create mode 100644 module/web/templates/window.tpl (limited to 'module') diff --git a/module/web/WebServer.py b/module/web/WebServer.py index fe103e83d..5885ab2de 100644 --- a/module/web/WebServer.py +++ b/module/web/WebServer.py @@ -65,7 +65,7 @@ def do_login(): response.COOKIES['user'] = username response.COOKIES['id'] = id - return template('default', page='loggedin', links=core.get_downloads(), user=username) + return template('default', page='loggedin', user=username) else: return template('default', page='login') @@ -97,12 +97,11 @@ def home(): dls = core.get_downloads() for dl in dls: - dl['eta'] = core.format_time(dl['eta']) - dl['wait_until'] = core.format_time(dl['wait_until'] - time.time()) - print dl['eta'] + dl['eta'] = str(core.format_time(dl['eta'])) + dl['wait_until'] = str(core.format_time(dl['wait_until'] - time.time())) - return template('default', page='home', links=dls, user=username) + return template('default', page='home', links=dls, user=username, status=core.server_status()) @route('/queue') def queue(): @@ -112,7 +111,7 @@ def queue(): username = request.COOKIES.get('user') - return template('default', page='queue', links=core.get_downloads(), user=username) + return template('default', page='queue', links=core.get_downloads(), user=username, status=core.server_status()) @route('/downloads') def downloads(): @@ -122,7 +121,7 @@ def downloads(): username = request.COOKIES.get('user') - return template('default', page='downloads', links=core.get_downloads(), user=username) + return template('default', page='downloads', links=core.get_downloads(), user=username, status=core.server_status()) @route('/logs') @@ -133,7 +132,7 @@ def logs(): username = request.COOKIES.get('user') - return template('default', page='logs', links=core.get_downloads(), user=username) + return template('default', page='logs', links=core.get_downloads(), user=username, status=core.server_status()) @route('/json/links') def get_links(): @@ -152,7 +151,7 @@ def get_links(): for dl in downloads: json += '{' json += '"id": "%s", "name": "%s", "speed": "%s", "eta": "%s", "kbleft": "%s", "size": "%s", "percent": "%s", "wait": "%s", "status": "%s"'\ - % (dl['id'], dl['name'], dl['speed'], core.format_time(dl['eta']), dl['kbleft'], dl['size'], dl['percent'], str(core.format_time(dl['wait_until'] - time.time())), dl['status']) + % (str(dl['id']), str(dl['name']), str(dl['speed']), str(core.format_time(dl['eta'])), dl['kbleft'], dl['size'], dl['percent'], str(core.format_time(dl['wait_until'] - time.time())), dl['status']) json += "}," diff --git a/module/web/static/default.css b/module/web/static/default.css index 37a84517a..9757b4f49 100644 --- a/module/web/static/default.css +++ b/module/web/static/default.css @@ -182,4 +182,5 @@ a.admin{background:transparent url(/static/default/user-actions-admin.png) 0px 1 .box{ background:url(/static/default/progress-bar-back.gif) right center no-repeat; width:200px; height:20px; float:left; } .perc{ background:url(/static/default/progress-bar.gif) right center no-repeat; height:20px; } -.boxtext{ font-family:tahoma, arial, sans-serif; font-size:11px; color:#000; float:none; padding:3px 0 0 10px; } \ No newline at end of file +.boxtext{ font-family:tahoma, arial, sans-serif; font-size:11px; color:#000; float:none; padding:3px 0 0 10px; } +.statusbutton{width:32px;height:32px;float:left;margin-left:-32px;margin-right:5px;opacity:0;cursor:pointer} \ No newline at end of file diff --git a/module/web/static/default/Button-Add-grey.png b/module/web/static/default/Button-Add-grey.png new file mode 100644 index 000000000..6659e230e Binary files /dev/null and b/module/web/static/default/Button-Add-grey.png differ diff --git a/module/web/static/default/Button-Add.png b/module/web/static/default/Button-Add.png new file mode 100644 index 000000000..602da4131 Binary files /dev/null and b/module/web/static/default/Button-Add.png differ diff --git a/module/web/static/default/Button-Pause-grey.png b/module/web/static/default/Button-Pause-grey.png new file mode 100644 index 000000000..d1017e974 Binary files /dev/null and b/module/web/static/default/Button-Pause-grey.png differ diff --git a/module/web/static/default/Button-Pause.png b/module/web/static/default/Button-Pause.png new file mode 100644 index 000000000..68f3ffc3a Binary files /dev/null and b/module/web/static/default/Button-Pause.png differ diff --git a/module/web/static/default/Button-Play-grey.png b/module/web/static/default/Button-Play-grey.png new file mode 100644 index 000000000..9f44c2289 Binary files /dev/null and b/module/web/static/default/Button-Play-grey.png differ diff --git a/module/web/static/default/Button-Play.png b/module/web/static/default/Button-Play.png new file mode 100644 index 000000000..1ce1ed913 Binary files /dev/null and b/module/web/static/default/Button-Play.png differ diff --git a/module/web/static/default/home.js b/module/web/static/default/home.js index 7db6d4efc..9f8902458 100644 --- a/module/web/static/default/home.js +++ b/module/web/static/default/home.js @@ -61,32 +61,17 @@ req = new Request.JSON({ method: 'get', url: '/json/links', initialDelay: 0, - delay: 1000, + delay: 2000, limit: 20000 }); function renderTable(data){ -data.downloads.forEach() +//data.downloads.each() } - -/* hover! */ -Element.implement({ - 'hover': function(fn1,fn2) { - return this.addEvents({ - 'mouseenter': function(e) { - fn1.attempt(e,this); - }, - 'mouseleave': function(e) { - fn2.attempt(e,this); - } - }) - } -}); - window.addEvent('domready', function(){ /* diff --git a/module/web/static/default/status.js b/module/web/static/default/status.js new file mode 100644 index 000000000..c211fc669 --- /dev/null +++ b/module/web/static/default/status.js @@ -0,0 +1,51 @@ +/* hover! */ +Element.implement({ + 'hover': function(fn1,fn2) { + return this.addEvents({ + 'mouseenter': function(e) { + fn1.attempt(e,this); + }, + 'mouseleave': function(e) { + fn2.attempt(e,this); + } + }) + } +}); + + +window.addEvent('domready', function(){ + +$$('.statusbutton').each(function(item){ + + item.hover(function(e){ + this.tween('opacity',1) + },function(e){ + this.tween('opacity',0.01) + } +) +}) + +fx_reveal = new Fx.Reveal($('addlinks')); +//fx_reveal.dissolve() + + +$$('#addlinks .closeSticky').each(function(el){ + +el.addEvent('click',function(e){ + +fx_reveal.dissolve(); + +}); + +}); + +$$('.statusbutton')[2].addEvent('click',function(e){ + +$('addlinks').setStyle('top', e.page.y + 5) +$('addlinks').setStyle('left', e.page.x + 5) + +fx_reveal.reveal() + +}); + +}); \ No newline at end of file diff --git a/module/web/static/window.css b/module/web/static/window.css new file mode 100644 index 000000000..aaccae082 --- /dev/null +++ b/module/web/static/window.css @@ -0,0 +1,17 @@ +.SWclearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;} +.SWclearfix {display: inline-table;} +* html .SWclearfix {height: 1%;} +.SWclearfix {display: block;} + +div.DefaultStickyWin div.body{font-family:verdana; font-size:11px; line-height: 13px;} +div.DefaultStickyWin div.top_ul{background:url(/static/window/full.png) top left no-repeat; height:30px; width:15px; float:left} +div.DefaultStickyWin div.top_ur{position:relative; left:0px !important; left:-4px; background:url(/static/window/full.png) top right !important; height:30px; margin:0px 0px 0px 15px !important; margin-right:-4px; padding:0px} +div.DefaultStickyWin h1.caption{clear: none !important; margin:0px !important; overflow: hidden; padding:0 !important; font-weight:bold; color:#555; font-size:14px !important; position:relative; top:8px !important; left:5px !important; float: left; height: 22px !important;} +div.DefaultStickyWin div.middle, div.DefaultStickyWin div.closeBody {background:url(/static/window/body.png) top left repeat-y; margin:0px 20px 0px 0px !important; margin-bottom: -3px; position: relative; top: 0px !important; top: -3px;} +div.DefaultStickyWin div.body{background:url(/static/window/body.png) top right repeat-y; padding:8px 30px 8px 0px !important; margin-left:5px !important; position:relative; right:-20px !important;} +div.DefaultStickyWin div.bottom{clear:both}div.DefaultStickyWin div.bottom_ll{background:url(/static/window/full.png) bottom left no-repeat; width:15px; height:15px; float:left} +div.DefaultStickyWin div.bottom_lr{background:url(/static/window/full.png) bottom right; position:relative; left:0px !important; left:-4px; margin:0px 0px 0px 15px !important; margin-right:-4px; height:15px} +div.DefaultStickyWin div.closeButtons{text-align: center; background:url(/static/window/body.png) top right repeat-y; padding: 0px 30px 8px 0px; margin-left:5px; position:relative; right:-20px} +div.DefaultStickyWin a.button:hover{background:url(/static/window/big_button_over.gif) repeat-x}div.DefaultStickyWin a.button {background:url(/static/window/big_button.gif) repeat-x; margin: 2px 8px 2px 8px; padding: 2px 12px; cursor:pointer; border: 1px solid #999 !important; text-decoration:none; color: #000 !important;} +div.DefaultStickyWin div.closeButton{width:13px; height:13px; background:url(/static/window/closebtn.gif) no-repeat; position: absolute; right: 0px; margin:10px 15px 0px 0px !important; cursor:pointer;top:0px} +div.DefaultStickyWin div.dragHandle { width: 11px; height: 25px; position: relative; top: 5px; left: -3px; cursor: move; background: url(/static/window/drag_corner.gif); float: left;} \ No newline at end of file diff --git a/module/web/static/window/big_button.gif b/module/web/static/window/big_button.gif new file mode 100644 index 000000000..7680490ea Binary files /dev/null and b/module/web/static/window/big_button.gif differ diff --git a/module/web/static/window/big_button_over.gif b/module/web/static/window/big_button_over.gif new file mode 100644 index 000000000..2e3ee10d2 Binary files /dev/null and b/module/web/static/window/big_button_over.gif differ diff --git a/module/web/static/window/body.png b/module/web/static/window/body.png new file mode 100644 index 000000000..7ff1043e0 Binary files /dev/null and b/module/web/static/window/body.png differ diff --git a/module/web/static/window/closebtn.gif b/module/web/static/window/closebtn.gif new file mode 100644 index 000000000..3e27e6030 Binary files /dev/null and b/module/web/static/window/closebtn.gif differ diff --git a/module/web/static/window/drag_corner.gif b/module/web/static/window/drag_corner.gif new file mode 100644 index 000000000..befb1adf1 Binary files /dev/null and b/module/web/static/window/drag_corner.gif differ diff --git a/module/web/static/window/full.png b/module/web/static/window/full.png new file mode 100644 index 000000000..fea52af76 Binary files /dev/null and b/module/web/static/window/full.png differ diff --git a/module/web/templates/default.tpl b/module/web/templates/default.tpl index c9c4da272..fe617bfe6 100644 --- a/module/web/templates/default.tpl +++ b/module/web/templates/default.tpl @@ -3,8 +3,15 @@ %if page== "home": js.append('default/home.js') %end +%if page== "loggedin": red=True +%else: red=False +%end +%if page != "loggedin" and page != "login": js.append('default/status.js') +%end + +%include header title=header, use_js=js, use_css=['default.css','window.css'], redirect=red -%include header title=header, use_js=js, use_css= ['default.css'] +%include window id="addlinks", width=400, caption="Add links", body="", button="Add" @@ -62,10 +69,40 @@
-

pyLoad — Webinterface

+

pyLoad — Webinterface +

+ + +%if page != "loggedin" and page != "login": + +
+
+Status: running +
+
+Speed: 500 kb/s   +
+ +
+ +
+
+
+
+
+
+ + +
+ +
+ +%end + +
-
+
%if page == "login": diff --git a/module/web/templates/header.tpl b/module/web/templates/header.tpl index 27ab7e2bc..22c252e3c 100644 --- a/module/web/templates/header.tpl +++ b/module/web/templates/header.tpl @@ -14,6 +14,10 @@ +%if redirect: + +%end + {{title}} diff --git a/module/web/templates/window.tpl b/module/web/templates/window.tpl new file mode 100644 index 000000000..fce3cb86f --- /dev/null +++ b/module/web/templates/window.tpl @@ -0,0 +1,28 @@ + \ No newline at end of file -- cgit v1.2.3