Author:   Lars Michelsen <[email protected]>
Date:     Wed Nov 20 18:50:29 2013 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Nov 20 18:50:29 2013 +0100

FIX: maps now to be shown in list are again hidden in lists

---

 .../nagvis-js/classes/NagVisHeaderMenu.php         |    2 +-
 .../nagvis-js/classes/NagVisOverviewView.php       |    2 +-
 share/server/core/classes/CoreModOverview.php      |    2 +-
 share/server/core/classes/GlobalCore.php           |   18 ++++++++++++++++++
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php 
b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
index ac5b269..150bc0b 100644
--- a/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
+++ b/share/frontend/nagvis-js/classes/NagVisHeaderMenu.php
@@ -281,7 +281,7 @@ class NagVisHeaderMenu {
             $this->aMacros['filter_group'] = isset($_GET['filter_group']) ? 
htmlspecialchars($_GET['filter_group']) : $default;
         }
 
-        $this->aMacros['mapNames'] = 
json_encode(array_keys($CORE->getPermittedMaps()));
+        $this->aMacros['mapNames'] = 
json_encode(array_keys($CORE->getListMaps()));
     }
 
     private function sortHostgroups($a, $b) {
diff --git a/share/frontend/nagvis-js/classes/NagVisOverviewView.php 
b/share/frontend/nagvis-js/classes/NagVisOverviewView.php
index 2772744..0d49e15 100644
--- a/share/frontend/nagvis-js/classes/NagVisOverviewView.php
+++ b/share/frontend/nagvis-js/classes/NagVisOverviewView.php
@@ -42,7 +42,7 @@ class NagVisOverviewView {
         $TMPLSYS = $TMPL->getTmplSys();
         $USERCFG = new CoreUserCfg();
 
-        $maps      = cfg('index', 'showmaps') == 1 ? 
array_keys($CORE->getPermittedMaps()) : array();
+        $maps      = cfg('index', 'showmaps') == 1 ? 
array_keys($CORE->getListMaps()) : array();
         $rotations = cfg('index', 'showrotations') == 1 ? 
array_keys($CORE->getPermittedRotationPools()) : array();
 
         $aData = Array(
diff --git a/share/server/core/classes/CoreModOverview.php 
b/share/server/core/classes/CoreModOverview.php
index ae6248d..361d905 100644
--- a/share/server/core/classes/CoreModOverview.php
+++ b/share/server/core/classes/CoreModOverview.php
@@ -156,7 +156,7 @@ class CoreModOverview extends CoreModule {
         if($type == 'list')
             $mapList = $objects;
         else
-            $mapList = $CORE->getPermittedMaps();
+            $mapList = $CORE->getListMaps();
 
         $aMaps = Array();
         $aObjs = Array();
diff --git a/share/server/core/classes/GlobalCore.php 
b/share/server/core/classes/GlobalCore.php
index 71d7377..53b4fca 100644
--- a/share/server/core/classes/GlobalCore.php
+++ b/share/server/core/classes/GlobalCore.php
@@ -439,6 +439,24 @@ class GlobalCore {
         return $list;
     }
 
+    public function getListMaps() {
+        $list = array();
+        $maps = $this->getPermittedMaps();
+        foreach ($maps AS $mapName) {
+            $MAPCFG = new GlobalMapCfg($mapName);
+            $MAPCFG->checkMapConfigExists(true);
+            try {
+                $MAPCFG->readMapConfig(ONLY_GLOBAL);
+            } catch(MapCfgInvalid $e) {
+                continue;
+            }
+            
+            if($MAPCFG->getValue(0, 'show_in_lists') == 1)
+                $list[$mapName] = $mapName;
+        }
+        return $list;
+    }
+
     /**
      * Reads all map images in map path
      *


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to