summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-11-03 12:11:17 -0500
committerStephen Beaver <sbeaver@netgate.com>2015-11-03 12:11:41 -0500
commitfad87798bb0beb552b0c7dfab0405c947f2f3035 (patch)
tree34ffe1da711bab2a6c4a60f28520200add922482 /src
parente1c34c699b5ef5c41435b031817cd5ee2d13cf6c (diff)
downloadpfsense-fad87798bb0beb552b0c7dfab0405c947f2f3035.zip
pfsense-fad87798bb0beb552b0c7dfab0405c947f2f3035.tar.gz
Completed #5369
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/widgets/javascript/thermal_sensors.js302
-rw-r--r--src/usr/local/www/widgets/widgets/thermal_sensors.widget.php150
2 files changed, 208 insertions, 244 deletions
diff --git a/src/usr/local/www/widgets/javascript/thermal_sensors.js b/src/usr/local/www/widgets/javascript/thermal_sensors.js
index 7415b01..75e143b 100644
--- a/src/usr/local/www/widgets/javascript/thermal_sensors.js
+++ b/src/usr/local/www/widgets/javascript/thermal_sensors.js
@@ -1,36 +1,59 @@
/*
$Id: thermal_sensors.js
- Description:
- Javascript functions to get and show thermal sensors data in thermal_sensors.widget.php.
- NOTE: depends on proper config in System >> Advanced >> Miscellaneous tab >> Thermal Sensors section.
- File location:
- \usr\local\www\widgets\javascript\
- Used by:
- \usr\local\www\widgets\widgets\thermal_sensors.widget.php
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
*/
-
-
+/* ====================================================================
+ * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution. (http://www.pfsense.org/).
+ *
+ * 4. The names "pfSense" and "pfSense Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * coreteam@pfsense.org.
+ *
+ * 5. Products derived from this software may not be called "pfSense"
+ * nor may "pfSense" appear in their names without prior written
+ * permission of the Electric Sheep Fencing, LLC.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ *
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution (http://www.pfsense.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ */
+
+warningTemp = 9999;
+criticalTemp = 100;
//should be called from "thermal_sensors.widget.php"
function showThermalSensorsData() {
@@ -63,7 +86,11 @@ function buildThermalSensorsData(thermalSensorsData) {
if (thermal_sensors_widget_showRawOutput) {
buildThermalSensorsDataRaw(thermalSensorsData);
} else {
- buildThermalSensorsDataGraph(thermalSensorsData);
+ if(warningTemp == 9999) {
+ buildThermalSensorsDataGraph(thermalSensorsData);
+ }
+
+ updateThermalSensorsDataGraph(thermalSensorsData);
}
}
@@ -95,22 +122,6 @@ function loadThermalSensorsContainer (thermalSensorsContent) {
function buildThermalSensorsDataGraph(thermalSensorsData) {
- //local constants
- var normalColor = "LimeGreen";
- var normalColorShadowTop = "Lime";
- var normalColorShadowBottom = "Green";
-
- var warningColor = "Orange";
- var warningColorShadowBottom = "Chocolate";
-
- var criticalColor = "Red";
- var criticalColorShadowBottom = "DarkRed";
-
- //local variables
- var barBgColor = normalColor; //green/normal as default
- var barBgColorShadowTop = normalColorShadowTop; //green/normal as default
- var barBgColorShadowBottom = normalColorShadowBottom; //green/normal as default
-
var thermalSensorsArray = new Array();
if (thermalSensorsData && thermalSensorsData != "") {
@@ -118,7 +129,6 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
}
var thermalSensorsHTMLContent = "";
- var itemsToPulsate = new Array();
//generate graph for each temperature sensor and append to thermalSensorsHTMLContent string
for (var i = 0; i < thermalSensorsArray.length; i++) {
@@ -127,72 +137,13 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
var sensorName = sensorDataArray[0].trim();
var thermalSensorValue = getThermalSensorValue(sensorDataArray[1]);
- var pulsateTimes = 0;
- var pulsateDuration = 0;
-
- var warningTempThresholdPosition = 0;
- var criticalTempThresholdPosition = 0;
-
- //NOTE: the following variables are declared/set in "thermal_sensors.widget.php":
- // thermal_sensors_widget_coreWarningTempThreshold, thermal_sensors_widget_coreCriticalTempThreshold,
- // thermal_sensors_widget_zoneWarningTempThreshold, thermal_sensors_widget_zoneCriticalTempThreshold
- // thermal_sensors_widget_pulsateWarning, thermal_sensors_widget_pulsateCritical
-
- //set graph color and pulsate parameters
+ //set thresholds
if (sensorName.indexOf("cpu") > -1) { //check CPU Threshold config settings
-
- warningTempThresholdPosition = thermal_sensors_widget_coreWarningTempThreshold;
- criticalTempThresholdPosition = thermal_sensors_widget_coreCriticalTempThreshold;
-
- if (thermalSensorValue < thermal_sensors_widget_coreWarningTempThreshold) {
- barBgColor = normalColor;
- barBgColorShadowTop = normalColorShadowTop;
- barBgColorShadowBottom = normalColorShadowBottom;
- pulsateTimes = 0;
- pulsateDuration = 0;
- } else if (thermalSensorValue >= thermal_sensors_widget_coreWarningTempThreshold && thermalSensorValue < thermal_sensors_widget_coreCriticalTempThreshold) {
- barBgColor = warningColor;
- barBgColorShadowTop = warningColor;
- barBgColorShadowBottom = warningColorShadowBottom;
- pulsateTimes = thermal_sensors_widget_pulsateWarning ? 4 : 0;
- pulsateDuration = thermal_sensors_widget_pulsateWarning ? 900 : 0;
- } else { // thermalSensorValue > thermal_sensors_widget_coreCriticalTempThreshold
- barBgColor = criticalColor;
- barBgColorShadowTop = criticalColor;
- barBgColorShadowBottom = criticalColorShadowBottom;
- pulsateTimes = thermal_sensors_widget_pulsateCritical ? 7 : 0;
- pulsateDuration = thermal_sensors_widget_pulsateCritical ? 900 : 0;
- }
+ warningTemp = thermal_sensors_widget_coreWarningTempThreshold;
+ criticalTemp = thermal_sensors_widget_coreCriticalTempThreshold;
} else { //assuming sensor is for a zone, check Zone Threshold config settings
-
- warningTempThresholdPosition = thermal_sensors_widget_zoneWarningTempThreshold;
- criticalTempThresholdPosition = thermal_sensors_widget_zoneCriticalTempThreshold;
-
- if (thermalSensorValue < thermal_sensors_widget_zoneWarningTempThreshold) {
-
- barBgColor = normalColor;
- barBgColorShadowTop = normalColorShadowTop;
- barBgColorShadowBottom = normalColorShadowBottom;
- pulsateTimes = 0;
- pulsateDuration = 0;
-
- } else if (thermalSensorValue >= thermal_sensors_widget_zoneWarningTempThreshold &&
- thermalSensorValue < thermal_sensors_widget_zoneCriticalTempThreshold) {
-
- barBgColor = warningColor;
- barBgColorShadowTop = warningColor;
- barBgColorShadowBottom = warningColorShadowBottom;
- pulsateTimes = thermal_sensors_widget_pulsateWarning ? 4 : 0;
- pulsateDuration = thermal_sensors_widget_pulsateWarning ? 900 : 0;
-
- } else { // thermalSensorValue > thermal_sensors_widget_zoneCriticalTempThreshold
-
- barBgColor = criticalColor;
- barBgColorShadowTop = criticalColor;
- barBgColorShadowBottom = criticalColorShadowBottom;
- pulsateTimes = thermal_sensors_widget_pulsateCritical ? 7 : 0;
- pulsateDuration = thermal_sensors_widget_pulsateCritical ? 900 : 0;
- }
+ warningTemp = thermal_sensors_widget_zoneWarningTempThreshold;
+ criticalTemp = thermal_sensors_widget_zoneCriticalTempThreshold;
}
//NOTE: variable thermal_sensors_widget_showFullSensorName is declared/set in "thermal_sensors.widget.php"
@@ -201,78 +152,55 @@ function buildThermalSensorsDataGraph(thermalSensorsData) {
}
//build temperature item/row for a sensor
- //NOTE: additional styles are set in 'thermal_sensors.widget.php'
- var thermalSensorRow = "<div class='thermalSensorRow' id='thermalSensorRow" + i + "' >" +
- //sensor name and temperature value
- " <div class='thermalSensorTextShell'><div class='thermalSensorText' id='thermalSensorText" + i + "'>" + sensorName + ": </div><div class='thermalSensorValue' id='thermalSensorValue" + i + "'>" + thermalSensorValue + " &deg;C</div></div>" +
- //temperature bar
- " <div class='thermalSensorBarShell' id='thermalSensorBarShell" + i + "' >" +
- " <div class='thermalSensorBar' id='thermalSensorBar" + i + "' style='background-color: " + barBgColor + "; border-top-color: " + barBgColorShadowTop + "; border-bottom-color: " + barBgColorShadowBottom + "; width:" + thermalSensorValue + "%;' ></div>" +
- //threshold targets (warning and critical)
- " <div class='thermalSensorWarnThresh' id='thermalSensorWarnThresh" + i + "' style='left:" + warningTempThresholdPosition + "%;' ></div>" +
- " <div class='thermalSensorCritThresh' id='thermalSensorCritThresh" + i + "' style='left:" + criticalTempThresholdPosition + "%;' ></div>" +
- //temperature scale (max 100 C)
- " <div class='thermal_sensors_widget_scale000'></div>" +
- " <div class='thermal_sensors_widget_scale010'></div>" +
- " <div class='thermal_sensors_widget_scale020'></div>" +
- " <div class='thermal_sensors_widget_scale030'></div>" +
- " <div class='thermal_sensors_widget_scale040'></div>" +
- " <div class='thermal_sensors_widget_scale050'></div>" +
- " <div class='thermal_sensors_widget_scale060'></div>" +
- " <div class='thermal_sensors_widget_scale070'></div>" +
- " <div class='thermal_sensors_widget_scale080'></div>" +
- " <div class='thermal_sensors_widget_scale090'></div>" +
- " <div class='thermal_sensors_widget_scale100'></div>" +
- " <div class='thermal_sensors_widget_mark100'>100&deg;</div>" +
- " </div>" +
- "</div>";
-
- //collect parameters for warning/critical items we need to pulsate
- if (pulsateTimes > 0) {
- var params = i + "|" + barBgColor + "|" + pulsateTimes + "|" + pulsateDuration;
- itemsToPulsate.push(params);
- }
- //append HTML item
+ var thermalSensorRow = '<div class="progress">' +
+ '<div id="temperaturebarL' + i + '" class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="1" style="width: 1%"></div>' +
+ '<div id="temperaturebarM' + i + '" class="progress-bar progress-bar-warning progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" style="width: 0%"></div>' +
+ '<div id="temperaturebarH' + i + '" class="progress-bar progress-bar-danger progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" style="width: 0%"></div>' +
+ '</div>' +
+ '<span><b>' + sensorName + ': </b></span>' + '<span id="temperaturemsg' + i + '">' + thermalSensorValue + ' °C</span>';
+
+
thermalSensorsHTMLContent = thermalSensorsHTMLContent + thermalSensorRow;
+
}
//load generated graph into thermalSensorsContainer (DIV defined in "thermal_sensors.widget.php")
loadThermalSensorsContainer(thermalSensorsHTMLContent);
- if (itemsToPulsate.length > 0) {
- //pulsate/flash warning/critical items we collected
- pulsateThermalSensorsItems(itemsToPulsate);
- }
+
}
-function pulsateThermalSensorsItems(itemsToPulsate) {
-
- //pulsate/flash warning/critical items we collected
- for (var i = 0; i < itemsToPulsate.length; i++) {
-
- var pulsateParams = itemsToPulsate[i].split("|");
- var rowNum = parseInt(pulsateParams[0]);
- //var textColor = pulsateParams[1];
- var pulsateTimes = parseInt(pulsateParams[2]);
- var pulsateDuration = parseInt(pulsateParams[3]);
-
- //pulsate temp Value
- var divThermalSensorValue = jQuery("#thermalSensorValue" + rowNum); //get temp value by id
- divThermalSensorValue.effect("pulsate", {
- times: pulsateTimes,
- easing: 'linear' //'easeInExpo'
- }, pulsateDuration);
- ////set Temp Value color
- //divThermalSensorValue.css({ color: textColor });
-
- //pulsate temp Bar
- var divThermalSensorBar = jQuery("#thermalSensorBar" + rowNum); //get temp bar by id
- divThermalSensorBar.effect("pulsate", {
- times: pulsateTimes,
- easing: 'linear' //'easeInExpo'
- }, pulsateDuration);
+function updateThermalSensorsDataGraph(thermalSensorsData) {
+ var thermalSensorsArray = new Array();
+
+ if (thermalSensorsData && thermalSensorsData != "") {
+ thermalSensorsArray = thermalSensorsData.split("|");
+ }
+
+ //generate graph for each temperature sensor and append to thermalSensorsHTMLContent string
+ for (var i = 0; i < thermalSensorsArray.length; i++) {
+
+ var sensorDataArray = thermalSensorsArray[i].split(":");
+ var sensorName = sensorDataArray[0].trim();
+ var thermalSensorValue = getThermalSensorValue(sensorDataArray[1]);
+
+
+ //set thresholds
+ if (sensorName.indexOf("cpu") > -1) { //check CPU Threshold config settings
+ warningTemp = thermal_sensors_widget_coreWarningTempThreshold;
+ criticalTemp = thermal_sensors_widget_coreCriticalTempThreshold;
+ } else { //assuming sensor is for a zone, check Zone Threshold config settings
+ warningTemp = thermal_sensors_widget_zoneWarningTempThreshold;
+ criticalTemp = thermal_sensors_widget_zoneCriticalTempThreshold;
+ }
+ //NOTE: variable thermal_sensors_widget_showFullSensorName is declared/set in "thermal_sensors.widget.php"
+ if (!thermal_sensors_widget_showFullSensorName) {
+ sensorName = getSensorFriendlyName(sensorName);
+ }
+
+ setTempProgress(i, thermalSensorValue);
}
}
@@ -294,3 +222,29 @@ function getSensorFriendlyName(sensorFullName) {
function getThermalSensorValue(stringValue) {
return (+parseFloat(stringValue) || 0).toFixed(1);
}
+
+// Update the progress indicator
+// transition = true allows the bar to move at default speed, false = instantaneous
+function setTempProgress(bar, percent) {
+ var barTempL, barTempM, barTempH;
+
+ if(percent <= warningTemp) {
+ barTempL = percent;
+ barTempM = 0;
+ barTempH = 0;
+ } else if(percent <= criticalTemp) {
+ barTempL = WarningTemp;
+ barTempM = percent - warningTemp;
+ barTempH = 0;
+ } else {
+ barTempL = warningTemp;
+ barTempM = criticalTemp - warningTemp;
+ barTempH = percent - criticalTemp;
+ }
+
+ $('#' + 'temperaturebarL' + bar).css('width', barTempL + '%').attr('aria-valuenow', barTempL);
+ $('#' + 'temperaturebarM' + bar).css('width', barTempM + '%').attr('aria-valuenow', barTempM);
+ $('#' + 'temperaturebarH' + bar).css('width', barTempH + '%').attr('aria-valuenow', barTempH);
+
+ $('#' + 'temperaturemsg' + bar).html(percent + ' °C');
+} \ No newline at end of file
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 875ccb2..78d0983 100644
--- a/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
+++ b/src/usr/local/www/widgets/widgets/thermal_sensors.widget.php
@@ -1,37 +1,56 @@
<?php
/*
$Id: thermal_sensors.widget.php
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
-
- Description: Thermal Sensors Widget.
- NOTE: depends on proper config in System >> Advanced >> Miscellaneous tab >> Thermal Sensors section.
-
- File location:
- \usr\local\www\widgets\widgets\
- Depends on:
- \usr\local\www\widgets\javascript\thermal_sensors.js
- \usr\local\www\widgets\include\thermal_sensors.inc
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+*/
+/* ====================================================================
+ * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution. (http://www.pfsense.org/).
+ *
+ * 4. The names "pfSense" and "pfSense Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * coreteam@pfsense.org.
+ *
+ * 5. Products derived from this software may not be called "pfSense"
+ * nor may "pfSense" appear in their names without prior written
+ * permission of the Electric Sheep Fencing, LLC.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ *
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution (http://www.pfsense.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
*/
require_once("guiconfig.inc");
@@ -87,8 +106,8 @@ function saveThresholdSettings(&$configArray, &$postArray, $warningValueKey, $cr
}
if (($warningValue >= MIN_THRESHOLD_VALUE && $warningValue <= MAX_THRESHOLD_VALUE) &&
- ($criticalValue >= MIN_THRESHOLD_VALUE && $criticalValue <= MAX_THRESHOLD_VALUE) &&
- ($warningValue < $criticalValue)) {
+ ($criticalValue >= MIN_THRESHOLD_VALUE && $criticalValue <= MAX_THRESHOLD_VALUE) &&
+ ($warningValue < $criticalValue)) {
//all validated ok, save to config array
$configArray[WIDGETS_CONFIG_SECTION_KEY][THERMAL_SENSORS_WIDGET_SUBSECTION_KEY][$warningValueKey] = $warningValue;
$configArray[WIDGETS_CONFIG_SECTION_KEY][THERMAL_SENSORS_WIDGET_SUBSECTION_KEY][$criticalValueKey] = $criticalValue;
@@ -159,14 +178,19 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
//start showing temp data
//NOTE: the refresh interval will be reset to a proper value in showThermalSensorsData() (thermal_sensors.js).
- jQuery(document).ready(function() {
+ events.push(function(){
showThermalSensorsData();
});
//]]>
</script>
-
+<div style="padding: 5px">
+ <div id="thermalSensorsContainer" class="listr">
+ (Updating...)<br /><br />
+ </div>
+</div>
<input type="hidden" id="thermal_sensors-config" name="thermal_sensors-config" value="" />
-<div id="thermal_sensors-settings" class="widgetconfigdiv" style="display:none;">
+</div>
+<div id="thermal_sensors-settings" class="widgetconfigdiv panel-footer collapse" >
<form action="/widgets/widgets/thermal_sensors.widget.php" method="post" id="iform_thermal_sensors_settings" name="iform_thermal_sensors_settings">
<table>
<tr>
@@ -183,16 +207,16 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</td>
<td>
<input type="text" maxlength="3" size="3" class="formfld unknown"
- name="thermal_sensors_widget_zone_warning_threshold"
- id="thermal_sensors_widget_zone_warning_threshold"
- value="<?= $thermal_sensors_widget_zoneWarningTempThreshold; ?>" />
+ name="thermal_sensors_widget_zone_warning_threshold"
+ id="thermal_sensors_widget_zone_warning_threshold"
+ value="<?= $thermal_sensors_widget_zoneWarningTempThreshold; ?>" />
</td>
<td align="right">
<label for="thermal_sensors_widget_show_raw_output">Show raw output (no graph): </label>
<input type="checkbox"
- id="thermal_sensors_widget_show_raw_output"
- name="thermal_sensors_widget_show_raw_output"
- value="<?= $thermal_sensors_widget_showRawOutput; ?>" <?= ($thermal_sensors_widget_showRawOutput) ? " checked='checked'" : ""; ?> />
+ id="thermal_sensors_widget_show_raw_output"
+ name="thermal_sensors_widget_show_raw_output"
+ value="<?= $thermal_sensors_widget_showRawOutput; ?>" <?= ($thermal_sensors_widget_showRawOutput) ? " checked='checked'" : ""; ?> />
</td>
</tr>
<tr>
@@ -201,16 +225,16 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</td>
<td>
<input type="text" maxlength="3" size="3" class="formfld unknown"
- name="thermal_sensors_widget_zone_critical_threshold"
- id="thermal_sensors_widget_zone_critical_threshold"
- value="<?= $thermal_sensors_widget_zoneCriticalTempThreshold; ?>" />
+ name="thermal_sensors_widget_zone_critical_threshold"
+ id="thermal_sensors_widget_zone_critical_threshold"
+ value="<?= $thermal_sensors_widget_zoneCriticalTempThreshold; ?>" />
</td>
<td align="right">
<label for="thermal_sensors_widget_show_full_sensor_name">Show full sensor name: </label>
<input type="checkbox"
- id="thermal_sensors_widget_show_full_sensor_name"
- name="thermal_sensors_widget_show_full_sensor_name"
- value="<?= $thermal_sensors_widget_showFullSensorName; ?>" <?= ($thermal_sensors_widget_showFullSensorName) ? " checked='checked'" : ""; ?> />
+ id="thermal_sensors_widget_show_full_sensor_name"
+ name="thermal_sensors_widget_show_full_sensor_name"
+ value="<?= $thermal_sensors_widget_showFullSensorName; ?>" <?= ($thermal_sensors_widget_showFullSensorName) ? " checked='checked'" : ""; ?> />
</td>
</tr>
<tr>
@@ -219,16 +243,12 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</td>
<td>
<input type="text" maxlength="3" size="3" class="formfld unknown"
- name="thermal_sensors_widget_core_warning_threshold"
- id="thermal_sensors_widget_core_warning_threshold"
- value="<?= $thermal_sensors_widget_coreWarningTempThreshold ?>" />
+ name="thermal_sensors_widget_core_warning_threshold"
+ id="thermal_sensors_widget_core_warning_threshold"
+ value="<?= $thermal_sensors_widget_coreWarningTempThreshold ?>" />
</td>
<td align="right">
- <label for="thermal_sensors_widget_pulsate_warning">Pulsate Warning: </label>
- <input type="checkbox"
- id="thermal_sensors_widget_pulsate_warning"
- name="thermal_sensors_widget_pulsate_warning"
- value="<?= $thermal_sensors_widget_pulsateWarning; ?>" <?= ($thermal_sensors_widget_pulsateWarning) ? " checked='checked'" : ""; ?> />
+
</td>
</tr>
<tr>
@@ -237,16 +257,12 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</td>
<td>
<input type="text" maxlength="3" size="3" class="formfld unknown"
- name="thermal_sensors_widget_core_critical_threshold"
- id="thermal_sensors_widget_core_critical_threshold"
- value="<?= $thermal_sensors_widget_coreCriticalTempThreshold ?>" />
+ name="thermal_sensors_widget_core_critical_threshold"
+ id="thermal_sensors_widget_core_critical_threshold"
+ value="<?= $thermal_sensors_widget_coreCriticalTempThreshold ?>" />
</td>
<td align="right">
- <label for="thermal_sensors_widget_pulsate_critical">Pulsate Critical: </label>
- <input type="checkbox"
- id="thermal_sensors_widget_pulsate_critical"
- name="thermal_sensors_widget_pulsate_critical"
- value="<?= $thermal_sensors_widget_pulsateCritical; ?>" <?= ($thermal_sensors_widget_pulsateCritical) ? " checked='checked'" : ""; ?> />
+
</td>
</tr>
<tr>
@@ -264,12 +280,6 @@ function getBoolValueFromConfig(&$configArray, $valueKey, $defaultValue) {
</form>
</div>
-<div style="padding: 5px">
- <div id="thermalSensorsContainer" class="listr">
- (Updating...)<br /><br />
- </div>
-</div>
-
<!-- needed to display the widget settings menu -->
<script type="text/javascript">
//<![CDATA[
OpenPOWER on IntegriCloud