diff --git a/html/ajax_mapview.php b/html/ajax_mapview.php index 66c4cd34d4..d60c562d7e 100644 --- a/html/ajax_mapview.php +++ b/html/ajax_mapview.php @@ -1,7 +1,17 @@ $_SESSION['map_view']); + header('Content-type: text/plain'); + echo json_encode($map_view); +} + +//availability-map device group view +if (isset($_REQUEST['group_view'])) { + $_SESSION['group_view'] = $_REQUEST['group_view']; + $group_view = array('group_view' => $_SESSION['group_view']); + header('Content-type: text/plain'); + echo json_encode($group_view); } -header('Content-type: text/plain'); -echo $_SESSION['mapView']; diff --git a/html/css/styles.css b/html/css/styles.css index b00bf3feef..1b2f7f7d9b 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -480,18 +480,15 @@ a.list-device-disabled, a.list-device-disabled:visited { border-radius: 2pt 2pt 2pt 2pt; } -.status-boxes { -} - .boxes { - vertical-align: center; + vertical-align: middle; } .box { width: 500px; height: 300px; padding: 0px; - vertical-align: center; + vertical-align: middle; } .top10 { @@ -1084,10 +1081,10 @@ a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover { /* Gradient background */ background:#EEF7F7; -# background: -moz-linear-gradient(top, #FFF, #DEEFEF); -# background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FBFBFB), to(#DEEFEF)); -# background: -ms-linear-gradient(top, #FBFBFB, #DEEFEF); -# background: -webkit-linear-gradient(top, #FBFBFB, #DEEFEF); +/* background: -moz-linear-gradient(top, #FFF, #DEEFEF); + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FBFBFB), to(#DEEFEF)); + background: -ms-linear-gradient(top, #FBFBFB, #DEEFEF); + background: -webkit-linear-gradient(top, #FBFBFB, #DEEFEF); */ /* Rounded Corners */ -moz-border-radius: 0px 4px 4px 4px; @@ -1417,7 +1414,7 @@ a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover { } .tabBox .tabcontent { - margin-top -2px; + margin-top: -2px; min-height: 600px; clear: left; position: relative; @@ -1682,7 +1679,7 @@ tr.search:nth-child(odd) { .gridster .gs-w { background: #ffffff; box-shadow: inset 0 0 2px #000; - color: 000000 + color: #000000; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; @@ -1836,7 +1833,7 @@ label { } .redCluster { - background-color: rgba(255,0,0); + background-color: rgba(255,0,0, 0); background-color: rgba(255,0,0,0.7); text-align: center; width: 25px !important; @@ -1846,7 +1843,7 @@ label { } .greenCluster { - background-color: rgba(0,255,0); + background-color: rgba(0,255,0, 0); background-color: rgba(110, 204, 57, 0.6); text-align: center; width: 25px !important; @@ -1875,7 +1872,7 @@ label { .device-availability, .service-availability { color:#000000; float:left; - width:166px; + width:125px; height:64px; margin:10px; padding:8px; diff --git a/html/includes/common/availability-map.inc.php b/html/includes/common/availability-map.inc.php index d2a5e6b50e..e23961dafe 100644 --- a/html/includes/common/availability-map.inc.php +++ b/html/includes/common/availability-map.inc.php @@ -70,8 +70,8 @@ if (defined('SHOW_SETTINGS')) { $sql = dbFetchRow('SELECT `settings` FROM `users_widgets` WHERE `user_id` = ? AND `widget_id` = ?', array($_SESSION["user_id"], '1')); $widget_mode = json_decode($sql['settings']); - if (isset($_SESSION["mapView"])) { - $mode = $_SESSION["mapView"]; + if (isset($_SESSION["map_view"])) { + $mode = $_SESSION["map_view"]; } else { $mode = $widget_mode->{'mode'}; } @@ -93,7 +93,16 @@ if (defined('SHOW_SETTINGS')) { if ($mode == 0 || $mode == 2) { // Only show devices if mode is 0 or 2 (Only Devices or both) + $device_group = 'SELECT `D`.`device_id` FROM `device_group_device` AS `D` WHERE `device_group_id` = ?'; + $param = array($_SESSION['group_view']); + $devices = dbFetchRows($device_group, $param); + foreach ($devices as $in_dev) { + $in_devices[] = $in_dev['device_id']; + } + $in_devices = implode(',', $in_devices); + $sql = 'SELECT `D`.`hostname`, `D`.`sysName`, `D`.`device_id`, `D`.`status`, `D`.`uptime`, `D`.`os`, `D`.`icon` FROM `devices` AS `D`'; + if (is_normal_user() === true) { $sql .= ' , `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = ? AND'; $param = array( @@ -102,7 +111,13 @@ if (defined('SHOW_SETTINGS')) { } else { $sql .= ' WHERE'; } - $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' ORDER BY `".$deviceOrderBy."`"; + + if ($config['webui']['availability_map_use_device_groups'] != 0) { + $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' AND `D`.`device_id` IN (".$in_devices.") ORDER BY `".$deviceOrderBy."`"; + } else { + $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' ORDER BY `".$deviceOrderBy."`"; + } + $temp_output = array(); foreach (dbFetchRows($sql, $param) as $device) { @@ -220,6 +235,32 @@ if (defined('SHOW_SETTINGS')) { '