From 6866dfb176c9dc306879659c6df54dfd9f2bfa31 Mon Sep 17 00:00:00 2001 From: Jay McEntire Date: Tue, 16 Feb 2016 17:14:58 -0700 Subject: [PATCH 1/3] Initial adds for map group functionality. --- html/includes/print-map.inc.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/html/includes/print-map.inc.php b/html/includes/print-map.inc.php index 515fc68f46..8470e7a32c 100644 --- a/html/includes/print-map.inc.php +++ b/html/includes/print-map.inc.php @@ -39,6 +39,18 @@ $tmp_link_ids = array(); $ports = array(); $devices = array(); +$where = ""; +if (is_numeric($vars['group'])) { + $group_pattern = dbFetchCell('SELECT `pattern` FROM `device_groups` WHERE id = '.$vars['group']); + $group_pattern = rtrim($group_pattern, '&&'); + $group_pattern = rtrim($group_pattern, '||'); + + $device_id_sql = GenGroupSQL($group_pattern); + if ($device_id_sql) { + $where .= " AND D1.device_id IN ($device_id_sql) OR D2.device_id IN ($device_id_sql)"; + } +} + if (in_array('mac',$config['network_map_items'])) { $ports = dbFetchRows("SELECT `D1`.`device_id` AS `local_device_id`, @@ -74,6 +86,7 @@ if (in_array('mac',$config['network_map_items'])) { `P1`.`port_id` IS NOT NULL AND `P2`.`port_id` IS NOT NULL AND `D1`.`device_id` != `D2`.`device_id` + $where $sql GROUP BY `P1`.`port_id`,`P2`.`port_id` ", $sql_array); @@ -115,6 +128,7 @@ if (in_array('xdp', $config['network_map_items'])) { `remote_device_id` != 0 AND `local_device_id` IS NOT NULL AND `remote_device_id` IS NOT NULL + $where $sql GROUP BY `P1`.`port_id`,`P2`.`port_id` ", $sql_array); From a77c9d234cdc7166b203cf75c7782e2ec5f78ef7 Mon Sep 17 00:00:00 2001 From: Jay McEntire Date: Thu, 3 Mar 2016 16:43:13 -0700 Subject: [PATCH 2/3] Menu UI for map groups. --- html/includes/print-map.inc.php | 7 ++++-- html/includes/print-menubar.php | 39 ++++++++++++++++++++++----------- html/index.php | 2 +- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/html/includes/print-map.inc.php b/html/includes/print-map.inc.php index 8470e7a32c..9c28a0b34a 100644 --- a/html/includes/print-map.inc.php +++ b/html/includes/print-map.inc.php @@ -41,9 +41,11 @@ $devices = array(); $where = ""; if (is_numeric($vars['group'])) { - $group_pattern = dbFetchCell('SELECT `pattern` FROM `device_groups` WHERE id = '.$vars['group']); - $group_pattern = rtrim($group_pattern, '&&'); + $group = dbFetchRows('SELECT `pattern`, `name`, `description` FROM `device_groups` WHERE id = '.$vars['group']); + $group_pattern = rtrim($group['pattern'], '&&'); $group_pattern = rtrim($group_pattern, '||'); + $group_name = $group['name']; + $group_description = $group['group_descriptio']; $device_id_sql = GenGroupSQL($group_pattern); if ($device_id_sql) { @@ -246,4 +248,5 @@ else { } +if (is_numeric($vars['group'])) { $pagetitle[] = "Map"; diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 4c22ad08ba..0f4268be11 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -48,14 +48,14 @@ else {