From 3602b868d455a1e95e098f1bcb801a1c643afc6e Mon Sep 17 00:00:00 2001 From: NOYB Date: Wed, 13 Jan 2016 01:30:47 -0800 Subject: Gateways Widget Refactor init-ajax Move table content creation into a function so initial table load can be done normally without resize flicker. Subsequent content updates remain via ajax. --- .../local/www/widgets/widgets/gateways.widget.php | 213 +++++++++++---------- 1 file changed, 109 insertions(+), 104 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php index b11162b..399a85e 100644 --- a/src/usr/local/www/widgets/widgets/gateways.widget.php +++ b/src/usr/local/www/widgets/widgets/gateways.widget.php @@ -64,29 +64,118 @@ require_once("pfsense-utils.inc"); require_once("functions.inc"); require_once("/usr/local/www/widgets/include/gateways.inc"); -$a_gateways = return_gateways_array(); -$gateways_status = array(); -$gateways_status = return_gateways_status(true); +// Compose the table contents and pass it back to the ajax caller +if ($_REQUEST && $_REQUEST['ajax']) { + compose_table_body_contents(); + exit; +} -if (isset($config["widgets"]["gateways_widget"]["display_type"])) { - $display_type = $config["widgets"]["gateways_widget"]["display_type"]; -} else { - $display_type = "gw_ip"; +if ($_POST) { + if (!is_array($config["widgets"]["gateways_widget"])) { + $config["widgets"]["gateways_widget"] = array(); + } + if (isset($_POST["display_type"])) { + $config["widgets"]["gateways_widget"]["display_type"] = $_POST["display_type"]; + } + write_config("Updated gateways widget settings via dashboard."); + header("Location: /"); + exit(0); } +?> -// Compose the table contents and pass it back to the ajax caller -if ($_REQUEST && $_REQUEST['ajax']) { - global $a_gateways, $gateways_status; + + + + + + + + + + + + +
RTT
+ + + + + - - - -