diff options
author | Steve Beaver <sbeaver@netgate.com> | 2017-08-08 15:51:06 -0400 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2017-08-08 15:51:06 -0400 |
commit | 53547a05e07294ef32f2db90e456e009058e1ef5 (patch) | |
tree | 6461725dc96680490415771543094666ef50c0d9 /src | |
parent | d7c2f4fe6cf9d38a397e17d1f6789e5f692fbac3 (diff) | |
download | pfsense-53547a05e07294ef32f2db90e456e009058e1ef5.zip pfsense-53547a05e07294ef32f2db90e456e009058e1ef5.tar.gz |
Add ipsec widget to new centralized refresh system
Diffstat (limited to 'src')
4 files changed, 28 insertions, 30 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index c8ea9ce..e14f2a3 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -569,7 +569,7 @@ function set_widget_checkbox_events(checkbox_panel_ref, all_none_button_id) { // --------------------- EXPERIMENTAL centralized widget refresh system ------------------------------ // These need to live outsie of the events.push() function to enable the widgets to see them -var ajaxspecs = new Array(); // Array to hold each widget refresh specification (object) +var ajaxspecs = new Array(); // Array to hold widget refresh specifications (objects ) var ajaxidx = 0; var ajaxmutex = false; @@ -658,7 +658,7 @@ events.push(function() { } // Loop through each AJAX widget refresh object, make the AJAX call and pass the - //results back to the widget's callback function + // results back to the widget's callback function function executewidget() { if (ajaxspecs.length > 0) { if (!ajaxmutex) { diff --git a/src/usr/local/www/widgets/widgets/interfaces.widget.php b/src/usr/local/www/widgets/widgets/interfaces.widget.php index 60d1240..fdec201 100644 --- a/src/usr/local/www/widgets/widgets/interfaces.widget.php +++ b/src/usr/local/www/widgets/widgets/interfaces.widget.php @@ -221,9 +221,8 @@ if ($_REQUEST['widgetkey']) { // POST data to send via AJAX var postdata = '{"widgetkey":"<?=$widgetkey?>"}'; - // Create aN object defining widget refresh AJAX call + // Create an object defining the widget refresh AJAX call var interfacesObject = new Object(); - interfacesObject.name = "Interfaces"; interfacesObject.url = "/widgets/widgets/interfaces.widget.php"; interfacesObject.callback = interfaces_callback; diff --git a/src/usr/local/www/widgets/widgets/ipsec.widget.php b/src/usr/local/www/widgets/widgets/ipsec.widget.php index ff577b7..e1d86a5 100644 --- a/src/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/src/usr/local/www/widgets/widgets/ipsec.widget.php @@ -291,32 +291,31 @@ function changeTabDIV(selectedDiv) { } } -function get_ipsec_stats_<?=$widgetkey_nodash?>() { - var ajaxRequest; - - ajaxRequest = $.ajax({ - url: "/widgets/widgets/ipsec.widget.php", - type: "post", - data: { - ajax: "ajax", - tab: curtab - } - }); - - // Deal with the results of the above ajax call - ajaxRequest.done(function (response, textStatus, jqXHR) { - - $('tbody', '#<?=$widgetkey_nodash?>-' + curtab).html(response); - - // and do it again - setTimeout(get_ipsec_stats_<?=$widgetkey_nodash?>, "<?=$widgetperiod?>"); - }); -} - events.push(function(){ - // Start polling for updates some small random number of seconds from now (so that all the widgets don't - // hit the server at exactly the same time) - setTimeout(get_ipsec_stats_<?=$widgetkey_nodash?>, Math.floor((Math.random() * 10000) + 1000)); + // --------------------- EXPERIMENTAL centralized widget refresh system ------------------------------ + + // Callback function called by refresh system when data is retrieved + function ipsec_callback(s) { + $('tbody', '#<?=$widgetkey_nodash?>-' + curtab).html(s); + } + + // POST data to send via AJAX + var postdata = { + ajax: "ajax", + tab : curtab + }; + + // Create an object defining the widget refresh AJAX call + var ipsecObject = new Object(); + ipsecObject.name = "IPsec"; + ipsecObject.url = "/widgets/widgets/ipsec.widget.php"; + ipsecObject.callback = ipsec_callback; + ipsecObject.parms = postdata; + + // Register the AJAX object + register_ajax(ipsecObject); + + // --------------------------------------------------------------------------------------------------- }); //]]> </script> diff --git a/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php b/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php index 8e50668..4a045a1 100644 --- a/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php +++ b/src/usr/local/www/widgets/widgets/netgate_services_and_support.widget.php @@ -1,6 +1,6 @@ <?php /* - * support.widget.php + * netgate_serives_and_support.widget.php * * part of pfSense (https://www.pfsense.org) * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate) |