From f71eac502ff397e0f8cf631d4d73e3c63aeeee2f Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Thu, 2 Dec 2010 16:45:32 +0000 Subject: [PATCH] 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 --- html/css/styles.css | 6 +++ html/pages/device/overview.inc.php | 12 ++--- html/pages/device/overview/current.inc.php | 40 ---------------- html/pages/device/overview/fanspeeds.inc.php | 40 ---------------- .../pages/device/overview/frequencies.inc.php | 42 ----------------- .../device/overview/generic/sensor.inc.php | 40 ++++++++++++++++ html/pages/device/overview/humidity.inc.php | 47 ------------------- .../device/overview/sensors/current.inc.php | 10 ++++ .../device/overview/sensors/fanspeeds.inc.php | 10 ++++ .../overview/sensors/frequencies.inc.php | 10 ++++ .../device/overview/sensors/humidity.inc.php | 10 ++++ .../overview/sensors/temperatures.inc.php | 10 ++++ .../device/overview/sensors/voltages.inc.php | 10 ++++ .../device/overview/temperatures.inc.php | 44 ----------------- html/pages/device/overview/voltages.inc.php | 40 ---------------- 15 files changed, 112 insertions(+), 259 deletions(-) delete mode 100644 html/pages/device/overview/current.inc.php delete mode 100644 html/pages/device/overview/fanspeeds.inc.php delete mode 100644 html/pages/device/overview/frequencies.inc.php create mode 100644 html/pages/device/overview/generic/sensor.inc.php delete mode 100644 html/pages/device/overview/humidity.inc.php create mode 100644 html/pages/device/overview/sensors/current.inc.php create mode 100644 html/pages/device/overview/sensors/fanspeeds.inc.php create mode 100644 html/pages/device/overview/sensors/frequencies.inc.php create mode 100644 html/pages/device/overview/sensors/humidity.inc.php create mode 100644 html/pages/device/overview/sensors/temperatures.inc.php create mode 100644 html/pages/device/overview/sensors/voltages.inc.php delete mode 100644 html/pages/device/overview/temperatures.inc.php delete mode 100644 html/pages/device/overview/voltages.inc.php diff --git a/html/css/styles.css b/html/css/styles.css index c7d3a4391..b06e8a756 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -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;} diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index d84d41684..614ab80d8 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -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("
"); echo("

Recent Events

"); diff --git a/html/pages/device/overview/current.inc.php b/html/pages/device/overview/current.inc.php deleted file mode 100644 index a49376c3e..000000000 --- a/html/pages/device/overview/current.inc.php +++ /dev/null @@ -1,40 +0,0 @@ -"); - echo("

Current

"); - $i = '1'; - $currents = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); - echo(""); - 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 = ""; - - $current_link = ""; - - $current_link_c = $current_link . " $current['sensor_limit'] ? "style='color: red'" : '') . '>' . $current['sensor_current'] . "A"; - $current_link_b = $current_link . $current_minigraph . ""; - $current_link_a = $current_link . $current['sensor_descr'] . ""; - - $current['sensor_descr'] = truncate($current['sensor_descr'], 25, ''); - echo(""); - $i++; - } - echo("
$current_link_a$current_link_b$current_link_c
"); - echo("
"); -} - - -?> diff --git a/html/pages/device/overview/fanspeeds.inc.php b/html/pages/device/overview/fanspeeds.inc.php deleted file mode 100644 index 761a4a4f4..000000000 --- a/html/pages/device/overview/fanspeeds.inc.php +++ /dev/null @@ -1,40 +0,0 @@ -"); - echo("

Fanspeeds

"); - $i = '1'; - $fans = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '" . $device['device_id'] . "'"); - echo(""); - 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 = ""; - - $fan_link = ""; - - $fan_link_b = $fan_link . $fan_minigraph . ""; - $fan_link_c = $fan_link . "" . $fan['sensor_current'] . "rpm"; - $fan_link_a = $fan_link . $fan['sensor_descr'] . ""; - - $fan['sensor_descr'] = truncate($fan['sensor_descr'], 25, ''); - echo(""); - $i++; - } - echo("
$fan_link_a$fan_link_b$fan_link_c
"); - echo(""); -} - - -?> diff --git a/html/pages/device/overview/frequencies.inc.php b/html/pages/device/overview/frequencies.inc.php deleted file mode 100644 index eec1c2677..000000000 --- a/html/pages/device/overview/frequencies.inc.php +++ /dev/null @@ -1,42 +0,0 @@ -"); - echo("

Frequencies

"); - $i = '1'; - $temps = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); - echo(''); - 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 = ""; - - $temp_link = ""; - - $temp_link_c = $temp_link . "" . round($temp['sensor_current'],0) . "Hz"; - $temp_link_b = $temp_link . $temp_minigraph . ""; - $temp_link_a = $temp_link . $temp['sensor_descr'] . ""; - - $temp['sensor_descr'] = truncate($temp['sensor_descr'], 25, ''); - echo(""); - $i++; - } - echo("
$temp_link_a$temp_link_b$temp_link_c
"); - echo(""); -} - - -?> diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php new file mode 100644 index 000000000..aa91c7bb4 --- /dev/null +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -0,0 +1,40 @@ +'); + echo('

' . $sensor_type . '

'); + $i = '1'; + echo(''); + 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 = ""; + + $sensor_link = ""; + + $sensor_link_c = $sensor_link . " $sensor['sensor_limit'] ? "style='color: red'" : '') . '>' . $sensor['sensor_current'] . $sensor_unit . ""; + $sensor_link_b = $sensor_link . $sensor_minigraph . ""; + $sensor_link_a = $sensor_link . $sensor['sensor_descr'] . ""; + + $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 25, ''); + echo(""); + $i++; + } + echo("
$sensor_link_a$sensor_link_b$sensor_link_c
"); + echo(""); +} + +?> diff --git a/html/pages/device/overview/humidity.inc.php b/html/pages/device/overview/humidity.inc.php deleted file mode 100644 index 25a7664ec..000000000 --- a/html/pages/device/overview/humidity.inc.php +++ /dev/null @@ -1,47 +0,0 @@ -"); - echo("

Humidity

"); - $i = '1'; - $humiditys = mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); - echo(''); - echo('"); - echo("
'); - echo(''); - 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 = ""; - - $humidity_link = ""; - - $humidity_link_c = $humidity_link . "" . round($humidity['sensor_current'],0) . "%"; - $humidity_link_b = $humidity_link . $humidity_minigraph . ""; - $humidity_link_a = $humidity_link . $humidity['sensor_descr'] . ""; - - $humidity['sensor_descr'] = truncate($humidity['sensor_descr'], 25, ''); - echo(""); -# if($i == $rows) { echo("
$humidity_link_a$humidity_link_b$humidity_link_c
"); } - $i++; - } - echo("
"); - echo("
"); - echo(""); -} - - -?> diff --git a/html/pages/device/overview/sensors/current.inc.php b/html/pages/device/overview/sensors/current.inc.php new file mode 100644 index 000000000..26cb5e70a --- /dev/null +++ b/html/pages/device/overview/sensors/current.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/overview/sensors/fanspeeds.inc.php b/html/pages/device/overview/sensors/fanspeeds.inc.php new file mode 100644 index 000000000..92ec22140 --- /dev/null +++ b/html/pages/device/overview/sensors/fanspeeds.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/overview/sensors/frequencies.inc.php b/html/pages/device/overview/sensors/frequencies.inc.php new file mode 100644 index 000000000..eb81092ad --- /dev/null +++ b/html/pages/device/overview/sensors/frequencies.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/overview/sensors/humidity.inc.php b/html/pages/device/overview/sensors/humidity.inc.php new file mode 100644 index 000000000..b5f0e14e9 --- /dev/null +++ b/html/pages/device/overview/sensors/humidity.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/overview/sensors/temperatures.inc.php b/html/pages/device/overview/sensors/temperatures.inc.php new file mode 100644 index 000000000..a40e34a9a --- /dev/null +++ b/html/pages/device/overview/sensors/temperatures.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/overview/sensors/voltages.inc.php b/html/pages/device/overview/sensors/voltages.inc.php new file mode 100644 index 000000000..21e279596 --- /dev/null +++ b/html/pages/device/overview/sensors/voltages.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/pages/device/overview/temperatures.inc.php b/html/pages/device/overview/temperatures.inc.php deleted file mode 100644 index a9f30b2bd..000000000 --- a/html/pages/device/overview/temperatures.inc.php +++ /dev/null @@ -1,44 +0,0 @@ -"); - echo("

Temperatures

"); - $i = '1'; - $temps = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); - echo(''); - 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 = ""; - $temp_minigraph_b = ""; - - - $temp_link = ""; - - $temp_link_c = $temp_link . "" . round($temp['sensor_current'],0) . "°C"; - $temp_link_b = $temp_link . $temp_minigraph . " " . $temp_minigraph_b . ""; - $temp_link_a = $temp_link . $temp['sensor_descr'] . ""; - - $temp['sensor_descr'] = truncate($temp['sensor_descr'], 25, ''); - echo(""); - $i++; - } - echo("
$temp_link_a$temp_link_b$temp_link_c
"); - echo(""); -} - - -?> diff --git a/html/pages/device/overview/voltages.inc.php b/html/pages/device/overview/voltages.inc.php deleted file mode 100644 index 780156e11..000000000 --- a/html/pages/device/overview/voltages.inc.php +++ /dev/null @@ -1,40 +0,0 @@ -"); - echo("

Voltages

"); - $i = '1'; - $volts = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); - echo(""); - 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 = ""; - - $volt_link = ""; - - $volt_link_c = $volt_link . " $volt['sensor_limit'] ? "style='color: red'" : '') . '>' . $volt['sensor_current'] . "V"; - $volt_link_b = $volt_link . $volt_minigraph . ""; - $volt_link_a = $volt_link . $volt['sensor_descr'] . ""; - - $volt['sensor_descr'] = truncate($volt['sensor_descr'], 25, ''); - echo(""); - $i++; - } - echo("
$volt_link_a$volt_link_b$volt_link_c
"); - echo(""); -} - - -?>