summaryrefslogtreecommitdiffstats
path: root/application/modules/fbgui/views/scripts/index/start.phtml
blob: f63b8bd1634ab7f899a022a2cf88aad768f5678d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

<script type="text/javascript">
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]];
}

if (!Number.toFixed) {
	Number.prototype.toFixed=function(n){
		return Math.round(this*Math.pow(10, n)) / Math.pow(10, n);
	}
}

function updateProgress(p, s, u){
	$("#progressbar").progressbar({ value: ((actFile-1)*50+(p/2))});
	
	if (p >= 0 && p <= 100){
		$(".progressbar:last").progressbar({ value: p });
		$(".downloadelement .status:last").html("Downloading... "+p+"% - "+(s.toFixed(2))+" "+u);
	}else{
		$(".progressbar:last").progressbar({ value: 0 });
	}
}
var fileCount = 2;
var actFile = 0;

function downloadInfo(filename, filesize){
	actFile = actFile+1;
    $(".downloadelement .status").html("Complete");
    $(".progressbar:last").progressbar({ value: 100});
    $("#downloadinfo").append("<div class='downloadelement'>"+
									"<div class='label'>"+
										"<div><b>File: </b>"+filename+"</div>"+
										"<div><b>Filesize:</b> "+bytesToSize(filesize)+"</div>"+
									"</div>"+									
    								'<div class="progressbar" style="height: 10px;"></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> 


<div id="div4"> 
  <div class="bar1"></div> 
  <div class="bar2"></div> 
  <div class="bar3"></div> 
  <div class="bar4"></div> 
  <div class="bar5"></div> 
  <div class="bar6"></div> 
  <div class="bar7"></div> 
  <div class="bar8"></div> 
</div>
<h1>Downloading System Files</h1>
<div class='headling'>Overall:</div>
<div id="progressbar" style="height: 30px;"></div>

<div class='headling'>Files:</div>
<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();
}

</script>