diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-08-19 17:13:35 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-08-19 17:13:35 +0200 |
commit | 0c8dc650e52323f741bdaf50a864f1ebd819e6c6 (patch) | |
tree | 204b85ba411fde2b8da79493c75002253f3ee628 /module/web | |
parent | some webinterface functions (diff) | |
download | pyload-0c8dc650e52323f741bdaf50a864f1ebd819e6c6.tar.xz |
webinterface statusbar
Diffstat (limited to 'module/web')
20 files changed, 152 insertions, 30 deletions
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 Binary files differnew file mode 100644 index 000000000..6659e230e --- /dev/null +++ b/module/web/static/default/Button-Add-grey.png diff --git a/module/web/static/default/Button-Add.png b/module/web/static/default/Button-Add.png Binary files differnew file mode 100644 index 000000000..602da4131 --- /dev/null +++ b/module/web/static/default/Button-Add.png diff --git a/module/web/static/default/Button-Pause-grey.png b/module/web/static/default/Button-Pause-grey.png Binary files differnew file mode 100644 index 000000000..d1017e974 --- /dev/null +++ b/module/web/static/default/Button-Pause-grey.png diff --git a/module/web/static/default/Button-Pause.png b/module/web/static/default/Button-Pause.png Binary files differnew file mode 100644 index 000000000..68f3ffc3a --- /dev/null +++ b/module/web/static/default/Button-Pause.png diff --git a/module/web/static/default/Button-Play-grey.png b/module/web/static/default/Button-Play-grey.png Binary files differnew file mode 100644 index 000000000..9f44c2289 --- /dev/null +++ b/module/web/static/default/Button-Play-grey.png diff --git a/module/web/static/default/Button-Play.png b/module/web/static/default/Button-Play.png Binary files differnew file mode 100644 index 000000000..1ce1ed913 --- /dev/null +++ b/module/web/static/default/Button-Play.png 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 Binary files differnew file mode 100644 index 000000000..7680490ea --- /dev/null +++ b/module/web/static/window/big_button.gif diff --git a/module/web/static/window/big_button_over.gif b/module/web/static/window/big_button_over.gif Binary files differnew file mode 100644 index 000000000..2e3ee10d2 --- /dev/null +++ b/module/web/static/window/big_button_over.gif diff --git a/module/web/static/window/body.png b/module/web/static/window/body.png Binary files differnew file mode 100644 index 000000000..7ff1043e0 --- /dev/null +++ b/module/web/static/window/body.png diff --git a/module/web/static/window/closebtn.gif b/module/web/static/window/closebtn.gif Binary files differnew file mode 100644 index 000000000..3e27e6030 --- /dev/null +++ b/module/web/static/window/closebtn.gif diff --git a/module/web/static/window/drag_corner.gif b/module/web/static/window/drag_corner.gif Binary files differnew file mode 100644 index 000000000..befb1adf1 --- /dev/null +++ b/module/web/static/window/drag_corner.gif diff --git a/module/web/static/window/full.png b/module/web/static/window/full.png Binary files differnew file mode 100644 index 000000000..fea52af76 --- /dev/null +++ b/module/web/static/window/full.png 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="<textarea rows=10 style='width: 345px;'></textarea>", button="Add" <a class="anchor" name="top" id="top"></a> @@ -62,10 +69,40 @@ <div id="content" lang="en" dir="ltr"> -<h1><a name="pyload_download_manager_for_1_click_hoster" id="pyload_download_manager_for_1_click_hoster">pyLoad — Webinterface</a></h1> +<h1><a name="pyload_download_manager_for_1_click_hoster" id="pyload_download_manager_for_1_click_hoster">pyLoad — Webinterface</a> +</h1> + + +%if page != "loggedin" and page != "login": + +<div id="statusbar"> + <div style="float: left;padding: 8px;"> +Status: running +</div> + <div style="float: left;padding: 8px"> +Speed: 500 kb/s +</div> + +<div style="padding-top:2px"> + +<div style="background-image:url(static/default/Button-Play.png);width:32px;height:32px;float:left"></div> +<div class= "statusbutton" style="background-image:url(static/default/Button-Play-grey.png); visibility: visible; opacity: 0.01"></div> +<div style="background-image:url(static/default/Button-Pause.png);width:32px;height:32px;float:left"></div> +<div class= "statusbutton" style="background-image:url(static/default/Button-Pause-grey.png); visibility: visible; opacity: 0.01"></div> +<div style="background-image:url(static/default/Button-Add.png);width:32px;height:32px;float:left"></div> +<div class= "statusbutton" style="background-image:url(static/default/Button-Add-grey.png); visibility: visible; opacity: 0.01"></div> + + +</div> + +</div> + +%end + + <br> -<div class="level1"> +<div class="level1" style="clear:both"> %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 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +%if redirect: +<meta http-equiv="refresh" content="3; url=/"> +%end + <title>{{title}}</title> </head> 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 @@ +<div id="{{id}}" class="StickyWinInstance SWclearfix" style="overflow: visible;visibility: visible;display: none; position: absolute; z-index: 10000; opacity: 1; left: 0px; top: 0px;"> +<div class="DefaultStickyWin" style="width: {{width}}px;"> + +<div class="top"> +<div class="top_ul"></div> +<div class="top_ur"><h1 class="caption dragHandle">{{caption}}</h1> +</div></div> + +<div class="middle"> +<div class="body">{{body}} +</div></div> + +<div class="closeBody"> +<div class="closeButtons"> +<a class="closeSticky button">{{button}}</a><a class="closeSticky button">Close</a> +</div> +</div> + +<div class="bottom"> +<div class="bottom_ll"> +</div> + +<div class="bottom_lr"></div> +</div> +<div class="closeButton closeSticky"></div> + +</div> +</div>
\ No newline at end of file |