mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Generify sensor display on overview page, make links go directly to zoomed graph unless you click on the header in which case you go to that sensor health overview page
git-svn-id: http://www.observium.org/svn/observer/trunk@1749 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -216,6 +216,12 @@ A:visited { color: #0000cc; }
|
||||
A:hover { color: #990099; }
|
||||
A:active { color: #00000; }
|
||||
|
||||
A.sectionhead { text-decoration: none; color: #555; }
|
||||
A.sectionhead:link { text-decoration: none; color: #555; }
|
||||
A.sectionhead:visited { text-decoration: none; color: #555; }
|
||||
A.sectionhead:hover { text-decoration: none; color: #555; }
|
||||
A.sectionhead:active { text-decoration: none; color: #555; }
|
||||
|
||||
A.red:visited, a.red, .red {color: #CC0000;}
|
||||
A.grey:visited, A.grey, .gray {color: #36393D;}
|
||||
A.black:visited, A.black, .black {color: #000000;}
|
||||
|
||||
@@ -90,12 +90,12 @@ include("overview/mempools.inc.php");
|
||||
#include("overview/cmp.inc.php");
|
||||
#include("overview/hrStorage.inc.php");
|
||||
include("overview/storage.inc.php");
|
||||
include("overview/temperatures.inc.php");
|
||||
include("overview/humidity.inc.php");
|
||||
include("overview/fanspeeds.inc.php");
|
||||
include("overview/voltages.inc.php");
|
||||
include("overview/frequencies.inc.php");
|
||||
include("overview/current.inc.php");
|
||||
include("overview/sensors/temperatures.inc.php");
|
||||
include("overview/sensors/humidity.inc.php");
|
||||
include("overview/sensors/fanspeeds.inc.php");
|
||||
include("overview/sensors/voltages.inc.php");
|
||||
include("overview/sensors/frequencies.inc.php");
|
||||
include("overview/sensors/current.inc.php");
|
||||
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/16/report.png'> Recent Events</p>");
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_current";
|
||||
|
||||
if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$rows = round($total / 2,0);
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/current.png'> Current</p>");
|
||||
$i = '1';
|
||||
$currents = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
echo("<table width=100% valign=top>");
|
||||
while($current = mysql_fetch_array($currents)) {
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$current_day = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$current_week = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$current_month = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$current_year = "graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$current_minigraph = "<img src='graph.php?id=" . $current['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
$current_link = "<a href='device/".$device['device_id']."/health/current/' onmouseover=\"return ";
|
||||
$current_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$current['sensor_descr'];
|
||||
$current_link .= "</div><div style=\'width: 750px\'><img src=\'$current_day\'><img src=\'$current_week\'><img src=\'$current_month\'><img src=\'$current_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$current_link_c = $current_link . "<span " . ($current['sensor_current'] < $current['sensor_limit_low'] || $current['sensor_current'] > $current['sensor_limit'] ? "style='color: red'" : '') . '>' . $current['sensor_current'] . "A</span></a>";
|
||||
$current_link_b = $current_link . $current_minigraph . "</a>";
|
||||
$current_link_a = $current_link . $current['sensor_descr'] . "</a>";
|
||||
|
||||
$current['sensor_descr'] = truncate($current['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$current_link_a</strong></td><td width=80 align=right class=tablehead>$current_link_b<td width=80 align=right class=tablehead>$current_link_c</td></tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_fanspeed";
|
||||
|
||||
if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$rows = round($total / 2,0);
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/fanspeeds.png'> Fanspeeds</p>");
|
||||
$i = '1';
|
||||
$fans = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "'");
|
||||
echo("<table width=100% valign=top>");
|
||||
while($fan = mysql_fetch_array($fans)) {
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$fan_day = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$fan_week = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$fan_month = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$fan_year = "graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$fan_minigraph = "<img src='graph.php?id=" . $fan['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
$fan_link = "<a href='device/".$device['device_id']."/health/fanspeeds/' onmouseover=\"return ";
|
||||
$fan_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$fan['sensor_descr'];
|
||||
$fan_link .= "</div><div style=\'width: 750px\'><img src=\'$fan_day\'><img src=\'$fan_week\'><img src=\'$fan_month\'><img src=\'$fan_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$fan_link_b = $fan_link . $fan_minigraph . "</a>";
|
||||
$fan_link_c = $fan_link . "<span style='" . ($fan['sensor_current'] <= $fan['sensor_limit'] ? "color: red" : '') . "'>" . $fan['sensor_current'] . "rpm</span></a>";
|
||||
$fan_link_a = $fan_link . $fan['sensor_descr'] . "</a>";
|
||||
|
||||
$fan['sensor_descr'] = truncate($fan['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$fan_link_a</strong></td><td width=80 align=right class=tablehead>$fan_link_b<td width=80 align=right class=tablehead>$fan_link_c</td></tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_frequency";
|
||||
|
||||
if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE sensor_class='freq' AND device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$rows = round($total / 2,0);
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/frequencies.png'> Frequencies</p>");
|
||||
$i = '1';
|
||||
$temps = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
echo('<table width="100%" valign="top">');
|
||||
while($temp = mysql_fetch_array($temps)) {
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$temp_perc = $temp['sensor_current'] / $temp['sensor_limit'] * 100;
|
||||
$temp_colour = percent_colour($temp_perc);
|
||||
$temp_day = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$temp_week = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$temp_month = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$temp_year = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$temp_minigraph = "<img src='graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
$temp_link = "<a href='device/".$device['device_id']."/health/frequencies/' onmouseover=\"return ";
|
||||
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['sensor_descr'];
|
||||
$temp_link .= "</div><div style=\'width: 750px\'><img src=\'$temp_day\'><img src=\'$temp_week\'><img src=\'$temp_month\'><img src=\'$temp_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$temp_link_c = $temp_link . "<span style='color: $temp_colour'>" . round($temp['sensor_current'],0) . "Hz</span></a>";
|
||||
$temp_link_b = $temp_link . $temp_minigraph . "</a>";
|
||||
$temp_link_a = $temp_link . $temp['sensor_descr'] . "</a>";
|
||||
|
||||
$temp['sensor_descr'] = truncate($temp['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$temp_link_a</strong></td><td width=80 align=right class=tablehead>$temp_link_b<td width=80 align=right class=tablehead>$temp_link_c</td></tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
40
html/pages/device/overview/generic/sensor.inc.php
Normal file
40
html/pages/device/overview/generic/sensor.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$results = mysql_query("SELECT * FROM sensors WHERE sensor_class='" . $sensor_class . "' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
|
||||
if(mysql_num_rows($results))
|
||||
{
|
||||
$rows = round(mysql_num_rows($results) / 2,0);
|
||||
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
|
||||
echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/'.$device['device_id'].'/health/' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</p>');
|
||||
$i = '1';
|
||||
echo('<table width="100%" valign="top">');
|
||||
while($sensor = mysql_fetch_array($results))
|
||||
{
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$sensor_year = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$sensor_minigraph = "<img src='graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
$sensor_link = "<a href='graphs/".$sensor['sensor_id']."/" . $graph_type . "/' onmouseover=\"return ";
|
||||
$sensor_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$sensor['sensor_descr'];
|
||||
$sensor_link .= "</div><div style=\'width: 750px\'><img src=\'$sensor_day\'><img src=\'$sensor_week\'><img src=\'$sensor_month\'><img src=\'$sensor_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$sensor_link_c = $sensor_link . "<span " . ($sensor['sensor_current'] < $sensor['sensor_limit_low'] || $sensor['sensor_current'] > $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . "</span></a>";
|
||||
$sensor_link_b = $sensor_link . $sensor_minigraph . "</a>";
|
||||
$sensor_link_a = $sensor_link . $sensor['sensor_descr'] . "</a>";
|
||||
|
||||
$sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$sensor_link_a</strong></td><td width=80 align=right class=tablehead>$sensor_link_b<td width=80 align=right class=tablehead>$sensor_link_c</td></tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_humidity";
|
||||
|
||||
if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE sensor_class='humidity' AND device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$rows = round($total / 2,0);
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/humidity.png'> Humidity</p>");
|
||||
$i = '1';
|
||||
$humiditys = mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
echo('<table width="100%" valign="top">');
|
||||
echo('<tr><td width="50%">');
|
||||
echo('<table width="100%" cellspacing="0" cellpadding="2">');
|
||||
while($humidity = mysql_fetch_array($humiditys)) {
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$humidity_perc = $humidity['sensor_current'] / $humidity['sensor_limit'] * 100;
|
||||
$humidity_colour = percent_colour($humidity_perc);
|
||||
$humidity_day = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$humidity_week = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$humidity_month = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$humidity_year = "graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$humidity_minigraph = "<img src='graph.php?id=" . $humidity['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
$humidity_link = "<a href='device/".$device['device_id']."/health/humidity/' onmouseover=\"return ";
|
||||
$humidity_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$humidity['sensor_descr'];
|
||||
$humidity_link .= "</div><div style=\'width: 750px\'><img src=\'$humidity_day\'><img src=\'$humidity_week\'><img src=\'$humidity_month\'><img src=\'$humidity_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$humidity_link_c = $humidity_link . "<span style='color: $humidity_colour'>" . round($humidity['sensor_current'],0) . "%</span></a>";
|
||||
$humidity_link_b = $humidity_link . $humidity_minigraph . "</a>";
|
||||
$humidity_link_a = $humidity_link . $humidity['sensor_descr'] . "</a>";
|
||||
|
||||
$humidity['sensor_descr'] = truncate($humidity['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$humidity_link_a</strong></td><td width=80 align=right class=tablehead>$humidity_link_b<td width=80 align=right class=tablehead>$humidity_link_c</td></tr>");
|
||||
# if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</td></tr>");
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
10
html/pages/device/overview/sensors/current.inc.php
Normal file
10
html/pages/device/overview/sensors/current.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_current";
|
||||
$sensor_class = "current";
|
||||
$sensor_unit = "A";
|
||||
$sensor_type = "Current";
|
||||
|
||||
include('pages/device/overview/generic/sensor.inc.php');
|
||||
|
||||
?>
|
||||
10
html/pages/device/overview/sensors/fanspeeds.inc.php
Normal file
10
html/pages/device/overview/sensors/fanspeeds.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_fanspeed";
|
||||
$sensor_class = "fanspeed";
|
||||
$sensor_unit = "rpm";
|
||||
$sensor_type = "Fanspeeds";
|
||||
|
||||
include('pages/device/overview/generic/sensor.inc.php');
|
||||
|
||||
?>
|
||||
10
html/pages/device/overview/sensors/frequencies.inc.php
Normal file
10
html/pages/device/overview/sensors/frequencies.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_frequency";
|
||||
$sensor_class = "freq";
|
||||
$sensor_unit = "Hz";
|
||||
$sensor_type = "Frequencies";
|
||||
|
||||
include('pages/device/overview/generic/sensor.inc.php');
|
||||
|
||||
?>
|
||||
10
html/pages/device/overview/sensors/humidity.inc.php
Normal file
10
html/pages/device/overview/sensors/humidity.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_humidity";
|
||||
$sensor_class = "humidity";
|
||||
$sensor_unit = "%";
|
||||
$sensor_type = "Humidity";
|
||||
|
||||
include('pages/device/overview/generic/sensor.inc.php');
|
||||
|
||||
?>
|
||||
10
html/pages/device/overview/sensors/temperatures.inc.php
Normal file
10
html/pages/device/overview/sensors/temperatures.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_temperature";
|
||||
$sensor_class = "temperature";
|
||||
$sensor_unit = "°C";
|
||||
$sensor_type = "Temperatures";
|
||||
|
||||
include('pages/device/overview/generic/sensor.inc.php');
|
||||
|
||||
?>
|
||||
10
html/pages/device/overview/sensors/voltages.inc.php
Normal file
10
html/pages/device/overview/sensors/voltages.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_voltage";
|
||||
$sensor_class = "voltage";
|
||||
$sensor_unit = "V";
|
||||
$sensor_type = "Voltages";
|
||||
|
||||
include('pages/device/overview/generic/sensor.inc.php');
|
||||
|
||||
?>
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_temperature";
|
||||
|
||||
if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$rows = round($total / 2,0);
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/temperatures.png'> Temperatures</p>");
|
||||
$i = '1';
|
||||
$temps = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
echo('<table width="100%" valign="top">');
|
||||
while($temp = mysql_fetch_array($temps)) {
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$temp_perc = $temp['sensor_current'] / $temp['sensor_limit'] * 100;
|
||||
$temp_colour = percent_colour($temp_perc);
|
||||
$temp_day = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$temp_week = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$temp_month = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$temp_year = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$temp_minigraph = "<img src='graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
$temp_minigraph_b = "<img src='graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
|
||||
$temp_link = "<a href='device/".$device['device_id']."/health/temperatures/' onmouseover=\"return ";
|
||||
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['sensor_descr'];
|
||||
$temp_link .= "</div><div style=\'width: 750px\'><img src=\'$temp_day\'><img src=\'$temp_week\'><img src=\'$temp_month\'><img src=\'$temp_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$temp_link_c = $temp_link . "<span style='color: $temp_colour'>" . round($temp['sensor_current'],0) . "°C</span></a>";
|
||||
$temp_link_b = $temp_link . $temp_minigraph . " " . $temp_minigraph_b . "</a>";
|
||||
$temp_link_a = $temp_link . $temp['sensor_descr'] . "</a>";
|
||||
|
||||
$temp['sensor_descr'] = truncate($temp['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$temp_link_a</strong></td><td width=170 align=right class=tablehead>$temp_link_b<td width=80 align=right class=tablehead>$temp_link_c</td></tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
$graph_type = "sensor_voltage";
|
||||
|
||||
if($total = mysql_result(mysql_query("SELECT count(sensor_id) from sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "'"),0)) {
|
||||
$rows = round($total / 2,0);
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/voltages.png'> Voltages</p>");
|
||||
$i = '1';
|
||||
$volts = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
|
||||
echo("<table width=100% valign=top>");
|
||||
while($volt = mysql_fetch_array($volts)) {
|
||||
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$graph_colour = str_replace("#", "", $row_colour);
|
||||
|
||||
$volt_day = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100";
|
||||
$volt_week = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100";
|
||||
$volt_month = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100";
|
||||
$volt_year = "graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100";
|
||||
$volt_minigraph = "<img src='graph.php?id=" . $volt['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
|
||||
|
||||
$volt_link = "<a href='device/".$device['device_id']."/health/voltages/' onmouseover=\"return ";
|
||||
$volt_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$volt['sensor_descr'];
|
||||
$volt_link .= "</div><div style=\'width: 750px\'><img src=\'$volt_day\'><img src=\'$volt_week\'><img src=\'$volt_month\'><img src=\'$volt_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||
|
||||
$volt_link_c = $volt_link . "<span " . ($volt['sensor_current'] < $volt['sensor_limit_low'] || $volt['sensor_current'] > $volt['sensor_limit'] ? "style='color: red'" : '') . '>' . $volt['sensor_current'] . "V</span></a>";
|
||||
$volt_link_b = $volt_link . $volt_minigraph . "</a>";
|
||||
$volt_link_a = $volt_link . $volt['sensor_descr'] . "</a>";
|
||||
|
||||
$volt['sensor_descr'] = truncate($volt['sensor_descr'], 25, '');
|
||||
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$volt_link_a</strong></td><td width=80 align=right class=tablehead>$volt_link_b<td width=80 align=right class=tablehead>$volt_link_c</td></tr>");
|
||||
$i++;
|
||||
}
|
||||
echo("</table>");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user