summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/etc/pfSense.obsoletedfiles1
-rw-r--r--src/usr/local/www/widgets/javascript/thermal_sensors.js29
-rw-r--r--src/usr/local/www/widgets/widgets/thermal_sensors.widget.php46
3 files changed, 40 insertions, 36 deletions
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles
index 802c8ca..49ae203 100644
--- a/src/etc/pfSense.obsoletedfiles
+++ b/src/etc/pfSense.obsoletedfiles
@@ -1015,6 +1015,7 @@
/usr/local/www/vpn_pppoe_edit.php
/usr/local/www/vpn_pppoe_users.php
/usr/local/www/vpn_pppoe_users_edit.php
+/usr/local/www/widgets/include/thermal_sensors.inc
/usr/local/www/widgets/widgets/deactivated
/usr/local/www/widgets/widgets/support.widget.php
/usr/local/www/wizards/traffic_shaper_wizard.inc
diff --git a/src/usr/local/www/widgets/javascript/thermal_sensors.js b/src/usr/local/www/widgets/javascript/thermal_sensors.js
index 5791961..5193c9c 100644
--- a/src/usr/local/www/widgets/javascript/thermal_sensors.js
+++ b/src/usr/local/www/widgets/javascript/thermal_sensors.js
@@ -22,35 +22,6 @@ warningTemp = 9999;
criticalTemp = 100;
ajaxBusy = false;
-//should be called from "thermal_sensors.widget.php"
-function showThermalSensorsData(widgetKey, tsParams, firstTime) {
- if (!ajaxBusy) {
- ajaxBusy = true;
- //get data from thermal_sensors.widget.php
- url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1"
- //IE fix to disable cache when using http:// , just append timespan
- + new Date().getTime();
-
- $.ajax(url, {
- type: 'get',
- success: function(data) {
- var thermalSensorsData = data || "";
- buildThermalSensorsData(thermalSensorsData, widgetKey, tsParams, firstTime);
- firstTime = false;
- },
- error: function(jqXHR, status, error) {
- firstTime = true;
- warningTemp = 9999;
- buildThermalSensorsDataRaw('<span class="alert-danger">Temperature data could not be read.</span>', widgetKey);
- }
- });
-
- ajaxBusy = false;
- }
- //call itself in 11 seconds
- window.setTimeout(function(){showThermalSensorsData(widgetKey, tsParams, firstTime);}, 11000);
-}
-
function buildThermalSensorsData(thermalSensorsData, widgetKey, tsParams, firstTime) {
if (tsParams.showRawOutput) {
buildThermalSensorsDataRaw(thermalSensorsData, widgetKey);
diff --git a/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php b/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
index fbeabb3..2f77298 100644
--- a/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
+++ b/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
@@ -20,14 +20,19 @@
*/
require_once("guiconfig.inc");
-require_once("/usr/local/www/widgets/include/thermal_sensors.inc");
+
//=========================================================================
//called by showThermalSensorsData() (jQuery Ajax call) in thermal_sensors.js
-if (isset($_GET["getThermalSensorsData"])) {
- //get Thermal Sensors data and return
- echo getThermalSensorsData();
- return;
+if (isset($_REQUEST["getThermalSensorsData"])) {
+
+ $_gb = exec("/sbin/sysctl -a | grep temperature", $dfout);
+ $dfout_filtered = array_filter($dfout, function($v) {
+ return strpos($negsign, ' -') === false;
+ });
+
+ print(join("|", $dfout_filtered));
+ exit;
}
//=========================================================================
@@ -153,8 +158,35 @@ $thermal_sensors_widget_pulsateCritical = getBoolValueFromConfig($user_settings,
pulsateWarning:<?= $thermal_sensors_widget_pulsateWarning ? "true" : "false"; ?>,
pulsateCritical:<?= $thermal_sensors_widget_pulsateCritical ? "true" : "false"; ?>
};
- // showThermalSensorsData("<?=$widgetkey?>", true);
- setTimeout(function(){showThermalSensorsData("<?=$widgetkey?>", tsParams, true);}, Math.floor((Math.random() * 10000) + 1000));
+
+ // --------------------- Centralized widget refresh system ------------------------------
+
+ // Callback function called by refresh system when data is retrieved
+ function ts_callback(s) {
+ var thermalSensorsData = s || "";
+ buildThermalSensorsData(thermalSensorsData, "<?=$widgetkey?>", tsParams, true);
+ firstTime = false;
+ }
+
+ // POST data to send via AJAX
+ var postdata = {
+ ajax: "ajax",
+ getThermalSensorsData : "1"
+ };
+
+ // Create an object defining the widget refresh AJAX call
+ var tsObject = new Object();
+ tsObject.name = "Gateways";
+ tsObject.url = "/widgets/widgets/thermal_sensors.widget.php";
+ tsObject.callback = ts_callback;
+ tsObject.parms = postdata;
+ tsObject.freq = 1;
+
+ // Register the AJAX object
+ register_ajax(tsObject);
+
+ // ---------------------------------------------------------------------------------------------------
+
});
//]]>
</script>
OpenPOWER on IntegriCloud