Module: nagvis
Branch: master
Commit: 02dd063bb8222275cef6c168f9a643d638635934
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=02dd063bb8222275cef6c168f9a643d638635934

Author: larsi- <[email protected]>
Date:   Sun Jun 28 21:50:28 2009 +0200

Next steps to complete the map/automap split

---

 share/nagvis/ajax_handler.php                      |   41 ++++++++++++++-----
 .../includes/classes/objects/NagVisMapObj.php      |    8 +++-
 2 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/share/nagvis/ajax_handler.php b/share/nagvis/ajax_handler.php
old mode 100644
new mode 100755
index 995dc07..e97c304
--- a/share/nagvis/ajax_handler.php
+++ b/share/nagvis/ajax_handler.php
@@ -56,11 +56,14 @@ switch($_GET['action']) {
        case 'getMapState':
                if(!isset($_GET['objName1']) || $_GET['objName1'] == '') {
                        echo 'Error: 
'.$CORE->LANG->getText('parameterObjName1NotSet');
-               } elseif($_GET['map'] == '__automap') {
-                       echo 'Error: 
'.$CORE->LANG->getText('automapNotSupportedHere');
                } else {
                        // Initialize map configuration
-                       $MAPCFG = new NagVisMapCfg($CORE, $_GET['map']);
+                       if($CORE->checkMapIsAutomap($_GET['map'])) {
+                               $MAPCFG = new NagVisAutomapCfg($CORE, 
$_GET['map']);
+                       } else {
+                               $MAPCFG = new NagVisMapCfg($CORE, $_GET['map']);
+                       }
+                       
                        $MAPCFG->readMapConfig();
                        
                        $MAP = new NagVisMap($CORE, $MAPCFG, $BACKEND);
@@ -181,7 +184,12 @@ switch($_GET['action']) {
                        $aMaps = $_GET['m'];
                        
                        foreach($aMaps AS $sMap) {
-                               $MAPCFG = new NagVisMapCfg($CORE, $sMap);
+                               if($CORE->checkMapIsAutomap($sMap)) {
+                                       $MAPCFG = new NagVisAutomapCfg($CORE, 
$sMap);
+                               } else {
+                                       $MAPCFG = new NagVisMapCfg($CORE, 
$sMap);
+                               }
+                               
                                $aReturn[$sMap] = 
$MAPCFG->getFileModificationTime();
                        }
                }
@@ -197,8 +205,13 @@ switch($_GET['action']) {
                if(!isset($_GET['objName1']) || $_GET['objName1'] == '') {
                        echo 'Error: 
'.$CORE->LANG->getText('parameterObjName1NotSet');
                } else {
-                       // Initialize map configuration
-                       $MAPCFG = new NagVisMapCfg($CORE, $_GET['objName1']);
+                       // Initialize map configuration based on map type
+                       if($CORE->checkMapIsAutomap($_GET['objName1'])) {
+                               $MAPCFG = new NagVisAutomapCfg($CORE, 
$_GET['objName1']);
+                       } else {
+                               $MAPCFG = new NagVisMapCfg($CORE, 
$_GET['objName1']);
+                       }
+                       
                        $MAPCFG->readMapConfig();
                        
                        $MAP = new NagVisMap($CORE, $MAPCFG, $BACKEND);
@@ -209,8 +222,13 @@ switch($_GET['action']) {
                if(!isset($_GET['objName1']) || $_GET['objName1'] == '') {
                        echo 'Error: 
'.$CORE->LANG->getText('parameterObjName1NotSet');
                } else {
-                       // Initialize map configuration
-                       $MAPCFG = new NagVisMapCfg($CORE, $_GET['objName1']);
+                       // Initialize map configuration based on map type
+                       if($CORE->checkMapIsAutomap($_GET['objName1'])) {
+                               $MAPCFG = new NagVisAutomapCfg($CORE, 
$_GET['objName1']);
+                       } else {
+                               $MAPCFG = new NagVisMapCfg($CORE, 
$_GET['objName1']);
+                       }
+                       
                        $MAPCFG->readMapConfig();
                        
                        $MAP = new NagVisMap($CORE, $MAPCFG, $BACKEND);
@@ -280,12 +298,13 @@ function getObjConf($objType, $objName1, $objName2, $map 
= null) {
         * configuration file is used.
         */
        
-       if(isset($map) && $map != '' && $map != '__automap') {
+       if(isset($map) && $map !== '' && !$CORE->checkMapIsAutomap($map)) {
                // Get the object configuration from map configuration (object 
and
                // defaults)
                
                // Initialize map configuration
                $MAPCFG = new NagVisMapCfg($CORE, $map);
+               
                // Read the map configuration file
                $MAPCFG->readMapConfig();
                
@@ -331,8 +350,8 @@ function getObjConf($objType, $objName1, $objName2, $map = 
null) {
                
                // Get settings from main configuration file by generating a 
temporary 
                // map or from the automap configuration
-               if($map == '__automap') {
-                       $TMPMAPCFG = new NagVisMapCfg($CORE, $map);
+               if($CORE->checkMapIsAutomap($map)) {
+                       $TMPMAPCFG = new NagVisAutomapCfg($CORE, $map);
                        
                        // Read the map configuration file
                        $TMPMAPCFG->readMapConfig();
diff --git a/share/nagvis/includes/classes/objects/NagVisMapObj.php 
b/share/nagvis/includes/classes/objects/NagVisMapObj.php
old mode 100644
new mode 100755
index ee77e7c..9fb4db5
--- a/share/nagvis/includes/classes/objects/NagVisMapObj.php
+++ b/share/nagvis/includes/classes/objects/NagVisMapObj.php
@@ -291,7 +291,13 @@ class NagVisMapObj extends NagVisStatefulObject {
                                                        $OBJ = new 
NagVisServicegroup($this->CORE, $this->BACKEND, $objConf['backend_id'], 
$objConf['servicegroup_name']);
                                                break;
                                                case 'map':
-                                                       $SUBMAPCFG = new 
NagVisMapCfg($this->CORE, $objConf['map_name']);
+                                                       // Initialize map 
configuration based on map type
+                                                       
if($this->CORE->checkMapIsAutomap($objConf['map_name'])) {
+                                                               $SUBMAPCFG = 
new NagVisAutomapCfg($this->CORE, $objConf['map_name']);
+                                                       } else {
+                                                               $SUBMAPCFG = 
new NagVisMapCfg($this->CORE, $objConf['map_name']);
+                                                       }
+                                                       
                                                        
if($SUBMAPCFG->checkMapConfigExists(0)) {
                                                                
$SUBMAPCFG->readMapConfig();
                                                        }


------------------------------------------------------------------------------
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to