From eb87668d07f1f5eea095ffa206bd010fe521c46d Mon Sep 17 00:00:00 2001 From: Rosiak Date: Fri, 17 Jul 2015 00:36:29 +0200 Subject: [PATCH 1/3] Availability-map - Availability-map - Maps submenu - Remove old network-map menu entry --- html/includes/print-menubar.php | 9 ++++--- html/pages/availability-map.inc.php | 40 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 html/pages/availability-map.inc.php diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 1a4748908..e71716769 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -67,11 +67,14 @@ if ($_SESSION['userlevel'] >= '10') { } ?> + + - Network Map'); -} ?>
  • Eventlog
  • Syslog'); diff --git a/html/pages/availability-map.inc.php b/html/pages/availability-map.inc.php new file mode 100644 index 000000000..dc63bf16b --- /dev/null +++ b/html/pages/availability-map.inc.php @@ -0,0 +1,40 @@ + +* This program is free software: you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation, either version 3 of the License, or (at your +* option) any later version. Please see LICENSE.txt at the top level of +* the source code distribution for details. +*/ + +if ($_SESSION['userlevel'] >= '10') { + $sql = "SELECT `hostname`,`device_id`,`status`,`uptime` FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' ORDER BY `hostname`"; + $sqlcount = "SELECT COUNT(*) FROM `devices` WHERE `ignore` = '0' AND `disabled` = '0' ORDER BY `hostname`"; + $rows = dbFetchCell($sqlcount); + echo "

    All Devices(" . $rows . ")

    "; +} +else { + $sql = "SELECT D.`hostname`,D.`device_id`,D.`status`,D.`uptime` FROM `devices` AS D, `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = '" . $_SESSION['user_id'] . "' AND D.`ignore` = '0' AND D.`disabled` = '0' ORDER BY D.`hostname`"; + $sqlcount = "SELECT COUNT(*) FROM `devices` AS D, `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = '" . $_SESSION['user_id'] . "' AND D.`ignore` = '0' AND D.`disabled` = '0' ORDER BY D.`hostname`"; + $rows = dbFetchCell($sqlcount); + echo "

    All Devices(" . $rows . ")

    "; +} + +foreach(dbFetchRows($sql) as $device) { + if ($device['status'] == '1') { + $btn_type = 'btn-success'; + if ($device['uptime'] < $config['uptime_warning']) { + $btn_type = 'btn-warning'; + } + } + else { + $btn_type = 'btn-danger'; + } + + echo ""; +} + +echo "
    "; From 8d09a66f80691213109e9d427ccdb6a087ed01d1 Mon Sep 17 00:00:00 2001 From: Rosiak Date: Fri, 17 Jul 2015 11:17:22 +0200 Subject: [PATCH 2/3] Minor corrections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Made some changes according to f0o’s recommendation --- html/includes/print-menubar.php | 3 +-- html/pages/availability-map.inc.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index e71716769..59ce75d45 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -72,6 +72,7 @@ if ($_SESSION['userlevel'] >= '10') { Maps @@ -147,8 +148,6 @@ if ($_SESSION['userlevel'] >= '10') { } ?> - -
  • Network Map Network Map
  • diff --git a/html/pages/availability-map.inc.php b/html/pages/availability-map.inc.php index dc63bf16b..fa7bc5a52 100644 --- a/html/pages/availability-map.inc.php +++ b/html/pages/availability-map.inc.php @@ -33,8 +33,8 @@ foreach(dbFetchRows($sql) as $device) { else { $btn_type = 'btn-danger'; } + echo " 'device', 'device' => $device['device_id'])). "' role='button' class='btn " . $btn_type . " btn-xs' title='" . $device['hostname'] . "' style='min-height:25px; min-width:25px; border-radius:0px;'>"; - echo ""; } -echo "
    "; +echo ""; \ No newline at end of file From ef23f47b6dd174e2341a1d8f766996e74999547f Mon Sep 17 00:00:00 2001 From: Rosiak Date: Fri, 17 Jul 2015 13:05:25 +0200 Subject: [PATCH 3/3] Change submenu entry name - Device -> Network --- html/includes/print-menubar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 59ce75d45..62e6d97d6 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -72,7 +72,7 @@ if ($_SESSION['userlevel'] >= '10') { Maps