summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorVinicius Coque <vinicius.coque@bluepex.com>2011-01-28 17:32:17 -0200
committerVinicius Coque <vinicius.coque@bluepex.com>2011-01-28 17:32:17 -0200
commit9d3d8d005ec74d6108aa423c7ad09e0b58951127 (patch)
treef765cfb57d7d75ac2af8fa6b975ea953b557bdfc /etc/inc/pfsense-utils.inc
parentb638ef519a8e1ad3e843c55e091fc2649e834797 (diff)
parent1596d9c17349f47ef06defa5c44333db0158a110 (diff)
downloadpfsense-9d3d8d005ec74d6108aa423c7ad09e0b58951127.zip
pfsense-9d3d8d005ec74d6108aa423c7ad09e0b58951127.tar.gz
Merge branch 'master' into inc
Conflicts: etc/inc/captiveportal.inc etc/inc/config.console.inc etc/inc/config.lib.inc etc/inc/easyrule.inc etc/inc/filter.inc etc/inc/ipsec.inc etc/inc/pkg-utils.inc etc/inc/shaper.inc etc/inc/system.inc etc/inc/voucher.inc
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r--etc/inc/pfsense-utils.inc28
1 files changed, 24 insertions, 4 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index c5890d1..b6755c8 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1458,17 +1458,35 @@ function read_header($ch, $string) {
function read_body($ch, $string) {
global $fout, $file_size, $downloaded, $sendto, $static_status, $static_output, $lastseen;
+ global $pkg_interface;
$length = strlen($string);
$downloaded += intval($length);
- $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
- $downloadProgress = 100 - $downloadProgress;
+ if($file_size > 0) {
+ $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0);
+ $downloadProgress = 100 - $downloadProgress;
+ } else
+ $downloadProgress = 0;
if($lastseen <> $downloadProgress and $downloadProgress < 101) {
if($sendto == "status") {
+ if($pkg_interface == "console") {
+ if(substr($downloadProgress,2,1) == "0" || count($downloadProgress) < 2) {
+ $tostatus = $static_status . $downloadProgress . "%";
+ update_status($tostatus);
+ }
+ } else {
$tostatus = $static_status . $downloadProgress . "%";
- update_status($tostatus);
+ update_status($tostatus);
+ }
} else {
+ if($pkg_interface == "console") {
+ if(substr($downloadProgress,2,1) == "0" || count($downloadProgress) < 2) {
+ $tooutput = $static_output . $downloadProgress . "%";
+ update_output_window($tooutput);
+ }
+ } else {
$tooutput = $static_output . $downloadProgress . "%";
update_output_window($tooutput);
+ }
}
update_progress_bar($downloadProgress);
$lastseen = $downloadProgress;
@@ -1486,7 +1504,9 @@ function update_output_window($text) {
global $pkg_interface;
$log = ereg_replace("\n", "\\n", $text);
if($pkg_interface != "console") {
- echo "\n<script language=\"JavaScript\">this.document.forms[0].output.value = \"" . $log . "\";</script>";
+ echo "\n<script language=\"JavaScript\">\nthis.document.forms[0].output.value = \"" . $log . "\";\n";
+ echo "this.document.forms[0].output.scrollTop = this.document.forms[0].output.scrollHeight;\n";
+ echo "</script>";
}
/* ensure that contents are written out */
ob_flush();
OpenPOWER on IntegriCloud