Project

General

Profile

Download (3.27 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2

    
3
/* $Id$ */
4

    
5
include("guiconfig.inc");
6

    
7
if($config['theme'] <> "")
8
	$g['theme'] = $config['theme'];
9
else
10
	$g['theme'] = "pfsense";
11

    
12
$url = 'progress.php?UPLOAD_IDENTIFIER='.  $_GET["UPLOAD_IDENTIFIER"] .'&e=1';
13

    
14
function nice_value($x) {
15
   if ($x < 100)  $x;
16
   if ($x < 10000)  return sprintf("%.2fKB", $x/1000);
17
   if ($x < 900000) return sprintf("%dKB", $x/1000);
18
   return sprintf("%.2fMB", $x/1000/1000);
19
}
20

    
21
$X = upload_progress_meter_get_info( $_GET["UPLOAD_IDENTIFIER"] );
22
if (!$X) {
23

    
24
   if ( array_key_exists( "e", $_GET ) ) {
25
      echo "<HTML><BODY onLoad='window.close();'>" . gettext("Invalid Meter ID") . "! {$_GET["UPLOAD_IDENTIFIER"]}";
26
      echo ('</BODY></HTML>');
27
   }else{
28
      echo ('<HTML><meta HTTP-EQUIV="Refresh" CONTENT="1; url='. $url .'"><BODY></BODY></HTML>');
29
   }
30

    
31
} else {
32

    
33
   $meter = sprintf("%.2f", $X['bytes_uploaded'] / $X['bytes_total'] * 100);
34

    
35
   $sp = $X['speed_last'];
36
   if ($sp < 10000) $speed  = sprintf("%.2f", $sp / 1000);
37
   else $speed  = sprintf("%d", $sp / 1000);
38

    
39
   $eta = sprintf("%02d:%02d", $X['est_sec'] / 60, $X['est_sec'] % 60 );
40

    
41
   $upl   = nice_value($X['bytes_uploaded']);
42
   $total = nice_value($X['bytes_total']);
43

    
44
   if ($X['bytes_total'] > 1 && $X['bytes_uploaded'] >= $X['bytes_total'] && $X['est_sec'] == 0) {
45
      echo ('<HTML><BODY onLoad="window.close()"> ' . gettext("UPLOAD completed") . '!</BODY></HTML>');
46
   } else {
47

    
48
?>
49

    
50
<HTML>
51
<HEAD>
52

    
53
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=<?=$url?>">
54

    
55
<TITLE><?=gettext("Uploading Files"); ?>... <?=gettext("Please wait"); ?> ...</TITLE>
56

    
57
<style type='text/css'> td {font-size: 10pt }</style>
58

    
59
</HEAD>
60
<BODY BGCOLOR="#FFFFFF">
61

    
62
<table height="100%" width="100%" cellPadding="4" cellSpacing="4" style="border:1px solid #990000;">
63
<tr><td>
64

    
65
   <font face="arial"><b><center><?=gettext("Uploading files");?>...</b></center>
66

    
67
   <br>
68

    
69
   <table width="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
70
	<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" align="top"></td>
71
	<td>
72
		<table WIDTH="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
73
			<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif"><?php echo("<img src='./themes/".$g['theme']."/images/misc/bar_blue.gif' height='15' WIDTH='$meter%'>");?></td>
74
		</table>
75

    
76
	</td>
77
	<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" align="top"></td>
78
   </table>
79

    
80
   <br>
81

    
82
   <TABLE WIDTH="100%">
83
   <tr>
84
   <td align="right"><font face="arial"><b><?=gettext("Time Remaining");?>:</td><td><font face="arial"><?=$eta?></td>
85
   <td align="right"><font face="arial"><b><?=gettext("Speed:");?></td><td><font face="arial"><font face="arial"><?=$speed?><?=gettext("KB/sec");?></td>
86
   </tr>
87

    
88
   <tr>
89
   <td align="right"><font face="arial"><b><?=gettext("Uploaded");?>:</td><td><font face="arial"><?=$upl?></td>
90
   <td align="right"><font face="arial"><b><?=gettext("File Size");?>:</td><td><font face="arial"><?=$total?></td>
91
   </tr>
92

    
93
   <tr>
94
   <td align="right"><font face="arial"><b><?=gettext("Completed");?>:</td><td><font face="arial"><?=$meter?>%</td>
95
   <td align="right"><font face="arial"><b></td><td><font face="arial"></td>
96
   </tr>
97

    
98
</td></tr>
99
</table>
100

    
101
</BODY>
102
</HTML>
103

    
104

    
105

    
(123-123/222)