Module: nagvis Branch: master Commit: 2c7c282f4092889278bcd21cc0c12938c76e7a81 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=2c7c282f4092889278bcd21cc0c12938c76e7a81
Author: Lars Michelsen <[email protected]> Date: Fri May 7 22:28:34 2010 +0200 Fixed the map option fetching on overview page --- share/server/core/classes/CoreModGeneral.php | 40 ++----------------------- share/server/core/classes/GlobalIndexPage.php | 9 ++--- share/server/core/defines/global.php | 2 +- 3 files changed, 8 insertions(+), 43 deletions(-) diff --git a/share/server/core/classes/CoreModGeneral.php b/share/server/core/classes/CoreModGeneral.php index e819695..e7aa8e8 100644 --- a/share/server/core/classes/CoreModGeneral.php +++ b/share/server/core/classes/CoreModGeneral.php @@ -160,10 +160,6 @@ class CoreModGeneral extends CoreModule { $numObjects = count($arrType); $aObjs = Array(); for($i = 0; $i < $numObjects; $i++) { - // Get the object configuration - $objConf = $this->getObjConf($arrType[$i], $arrName1[$i], $arrName2[$i]); - $objConf['object_id'] = $arrObjId[$i]; - switch($arrType[$i]) { case 'map': // Skip unpermitted maps @@ -211,12 +207,11 @@ class CoreModGeneral extends CoreModule { break; } - // Apply default configuration to object - $OBJ->setConfiguration($objConf); + $arr = $MAPCFG->getDefinitions('global'); + $OBJ->setConfiguration($arr[0]); - if($arrType[$i] != 'automap') { + if($arrType[$i] != 'automap') $OBJ->queueState(GET_STATE, GET_SINGLE_MEMBER_STATES); - } $aObjs[] = $OBJ; } @@ -245,34 +240,5 @@ class CoreModGeneral extends CoreModule { return json_encode($arrReturn); } - - private function getObjConf($objType, $objName1, $objName2) { - $objConf = Array(); - - // Get the object configuration from main configuration defaults by - // creating a temporary map object - $objConf['type'] = $objType; - - if($objType == 'service') { - $objConf['host_name'] = $objName1; - $objConf['service_description'] = $objName2; - } else { - $objConf[$objType.'_name'] = $objName1; - } - - $TMPMAPCFG = new NagVisMapCfg($this->CORE); - $TMPMAPCFG->gatherTypeDefaults(!ONLY_GLOBAL); - - // merge with "global" settings - foreach($TMPMAPCFG->getTypeDefaults('global') AS $key => $default) { - if($key != 'type') { - $objConf[$key] = $default; - } - } - - unset($TMPMAPCFG); - - return $objConf; - } } ?> diff --git a/share/server/core/classes/GlobalIndexPage.php b/share/server/core/classes/GlobalIndexPage.php index 60df865..c1c3131 100644 --- a/share/server/core/classes/GlobalIndexPage.php +++ b/share/server/core/classes/GlobalIndexPage.php @@ -81,10 +81,8 @@ class GlobalIndexPage { $MAP = new NagVisAutoMap($this->CORE, $MAPCFG, $this->BACKEND, Array('automap' => $mapName, 'preview' => 1), !IS_VIEW); // Apply default configuration to object - $objConf = Array(); - foreach($MAPCFG->getValidTypeKeys('map') AS $key) { - $objConf[$key] = $MAPCFG->getValue('global', 0, $key); - } + $arr = $MAPCFG->getDefinitions('global'); + $objConf = $arr[0]; $objConf['type'] = 'map'; $objConf['map_name'] = $MAPCFG->getName(); $objConf['object_id'] = $object_id; @@ -188,7 +186,8 @@ class GlobalIndexPage { $MAP = new NagVisMap($this->CORE, $MAPCFG, $this->BACKEND, GET_STATE, !IS_VIEW); // Apply default configuration to object - $objConf = $MAPCFG->getTypeDefaults('global'); + $arr = $MAPCFG->getDefinitions('global'); + $objConf = $arr[0]; $objConf['type'] = 'map'; $objConf['map_name'] = $MAPCFG->getName(); $objConf['object_id'] = $object_id; diff --git a/share/server/core/defines/global.php b/share/server/core/defines/global.php index ebf2dac..6ff152c 100644 --- a/share/server/core/defines/global.php +++ b/share/server/core/defines/global.php @@ -41,7 +41,7 @@ set_include_path( // Enable/Disable profiling of NagVis using xhprof. To make use of this the // xhprof php module needs to be loaded and the xhprof_lib directory needs // to be available in /var/www. -define('PROFILE', false); +define('PROFILE', true); // enable/disable the debug mode define('DEBUG', false); ------------------------------------------------------------------------------ _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
