summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-08-23 20:00:49 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-08-23 20:00:49 -0400
commit84677257549c3e574440893aab19d05611d9afc1 (patch)
treedddb813b47e7cc552575f5ee50136b272d1dafd7 /etc
parentb31da21e9ebfb1f1c78ad4e8d8418d23db43a817 (diff)
downloadpfsense-84677257549c3e574440893aab19d05611d9afc1.zip
pfsense-84677257549c3e574440893aab19d05611d9afc1.tar.gz
Move functions to pfsense-utils.inc since they can be called from either console or gui side
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pfsense-utils.inc44
1 files changed, 44 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 4ed8e50..bd279a7 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1736,4 +1736,48 @@ function read_body($ch, $string) {
return $length;
}
+/*
+ * update_output_window: update bottom textarea dynamically.
+ */
+function update_output_window($text) {
+ global $pkg_interface;
+ $log = ereg_replace("\n", "\\n", $text);
+ if($pkg_interface == "console") {
+ /* too chatty */
+ } else {
+ echo "\n<script language=\"JavaScript\">this.document.forms[0].output.value = \"" . $log . "\";</script>";
+ }
+ /* ensure that contents are written out */
+ ob_flush();
+}
+
+/*
+ * update_output_window: update top textarea dynamically.
+ */
+function update_status($status) {
+ global $pkg_interface;
+ if($pkg_interface == "console") {
+ echo $status . "\n";
+ } else {
+ echo "\n<script type=\"text/javascript\">this.document.forms[0].status.value=\"" . $status . "\";</script>";
+ }
+ /* ensure that contents are written out */
+ ob_flush();
+}
+
+/*
+ * update_progress_bar($percent): updates the javascript driven progress bar.
+ */
+function update_progress_bar($percent) {
+ global $pkg_interface;
+ if($percent > 100) $percent = 1;
+ if($pkg_interface <> "console") {
+ echo "\n<script type=\"text/javascript\" language=\"javascript\">";
+ echo "\ndocument.progressbar.style.width='" . $percent . "%';";
+ echo "\n</script>";
+ } else {
+ echo " {$percent}%";
+ }
+}
+
?> \ No newline at end of file
OpenPOWER on IntegriCloud