diff options
author | Simon | 2011-04-15 15:20:52 +0200 |
---|---|---|
committer | Simon | 2011-04-15 15:20:52 +0200 |
commit | cb7a7f0ae376fd46e926959390c80e13d8c04e35 (patch) | |
tree | e95643d07c00fa45f6020649070694b16ea782d2 /application/modules/fbgui | |
parent | Ticket #210 - Button nach Selektion in Focus gesetzt (diff) | |
download | pbs2-cb7a7f0ae376fd46e926959390c80e13d8c04e35.tar.gz pbs2-cb7a7f0ae376fd46e926959390c80e13d8c04e35.tar.xz pbs2-cb7a7f0ae376fd46e926959390c80e13d8c04e35.zip |
Downloadstatus der Dateien in der FBGui
Diffstat (limited to 'application/modules/fbgui')
-rw-r--r-- | application/modules/fbgui/views/scripts/index/start.phtml | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/application/modules/fbgui/views/scripts/index/start.phtml b/application/modules/fbgui/views/scripts/index/start.phtml index e946530..e6a7936 100644 --- a/application/modules/fbgui/views/scripts/index/start.phtml +++ b/application/modules/fbgui/views/scripts/index/start.phtml @@ -68,6 +68,20 @@ from {-webkit-transform:scale(0.5) rotate(0deg);} to {-webkit-transform:scale(0.5) rotate(360deg);} } */ +#downloadinfo .downloadelement{ + clear:both; + padding-top:10px; + padding-bottom:10px; +} +#downloadinfo .downloadelement .label{ + float:left; + padding:5px; + width:200px; +} +#downloadinfo .downloadelement .status{ + margin-left:205px; + padding:5px; +} </style> <script type="text/javascript"> @@ -86,15 +100,40 @@ } window.setTimeout(rotate, 100); +function bytesToSize(bytes) { + var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; + if (bytes == 0) return 'n/a'; + var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); + return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[[i]]; +} function updateProgress(p, s, u){ - if (p >= 0 && p <= 100) - $("#progressbar").progressbar({ value: p }); - else - $("#progressbar").progressbar({ value: 0 }); + if (p >= 0 && p <= 100){ + $(".progressbar:last").progressbar({ value: p }); + $(".downloadelement .status:last").html("Downloading...<br>"+p+"% - "+s+" "+u); + }else{ + $(".progressbar:last").progressbar({ value: 0 }); + } +} +function downloadInfo(filename, filesize){ + $(".downloadelement .status").html("Complete"); + $(".progressbar:last").progressbar({ value: 100}); + $("#downloadinfo").append("<div class='downloadelement'>"+ + '<div class="progressbar" style="height: 15px;"></div>'+ + "<div class='label'>"+ + "<div><b>File: </b>"+filename+"</div>"+ + "<div><b>Filesize:</b> "+bytesToSize(filesize)+"</div>"+ + "</div>"+ + "<div class='status'>Downloading...</div>"+ + "</div>"); + $(".progressbar:last").progressbar({ value: 0 }); } +function allComplete(){ + $(".downloadelement .status").html("Complete"); + $(".progressbar").progressbar({ value: 100}); +} + $(document).ready(function() { - $("#progressbar").progressbar({ value: 0 }); }); </script> @@ -110,14 +149,19 @@ function updateProgress(p, s, u){ <div class="bar8"></div> </div> -<div id="progressbar" style="height: 15px;"></div> <h1>Downloading</h1> +<div id='downloadinfo'> + +</div> + <script type="text/javascript"> fbgui.setCallbackOnFinished('foo();'); fbgui.startDownload('http://<?php echo $this->host; ?>/resource/getkernel/alpha/<?php echo $this->alphasessionID; ?>/file/kernel'); fbgui.startDownload('http://<?php echo $this->host; ?>/resource/getinitramfs/alpha/<?php echo $this->alphasessionID; ?>/file/initramfs'); fbgui.startDownload('http://<?php echo $this->host; ?>/resource/getkcl/alpha/<?php echo $this->alphasessionID; ?>/file/kcl'); function foo(){ + allComplete(); fbgui.quit(); + } </script> |