Module: nagvis Branch: master Commit: 662751658ce5a9bc266a79518d3e7c53ff0c74d9 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=662751658ce5a9bc266a79518d3e7c53ff0c74d9
Author: Roman Kyrylych <[email protected]> Date: Mon Aug 17 13:02:37 2009 +0300 gmap: Extended the Settings class to include URL templates Signed-off-by: Roman Kyrylych <[email protected]> --- share/netmap/Settings.php | 41 ++++++++++++++++++++++++++++- uifx/src/modules/gmap/domain/Settings.as | 17 +++++++++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/share/netmap/Settings.php b/share/netmap/Settings.php index d7b2d5f..c4f2dc9 100644 --- a/share/netmap/Settings.php +++ b/share/netmap/Settings.php @@ -26,12 +26,24 @@ class Settings public $googleMapsKey; public $defaultLocationAction; public $openLinksInNewWindow; + public $hosturl; + public $hostgroupurl; + public $serviceurl; + public $servicegroupurl; + public $mapurl; - public function __construct($googleMapsKey = "", $defaultLocationAction = "", $openLinksInNewWindow = false) + public function __construct($googleMapsKey = '', $defaultLocationAction = '', + $openLinksInNewWindow = false, $hosturl = '', $hostgroupurl = '', + $serviceurl = '', $servicegroupurl = '', $mapurl = '') { $this->googleMapsKey = $googleMapsKey; $this->defaultLocationAction = $defaultLocationAction; $this->openLinksInNewWindow = $openLinksInNewWindow; + $this->hosturl = $hosturl; + $this->hostgroupurl = $hostgroupurl; + $this->serviceurl = $serviceurl; + $this->servicegroupurl = $servicegroupurl; + $this->mapurl = $mapurl; } /** @@ -39,12 +51,37 @@ class Settings */ public function load() { + require_once("../nagvis/includes/defines/global.php"); + require_once("../nagvis/includes/defines/matches.php"); + set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__)) + . PATH_SEPARATOR . '../nagvis/includes/classes/' + . PATH_SEPARATOR . '../nagvis/includes/classes/' + . PATH_SEPARATOR . '../nagvis/includes/classes/validator/' + . PATH_SEPARATOR . '../nagvis/includes/classes/frontend/'); + require_once("../nagvis/includes/functions/oldPhpVersionFixes.php"); + require_once("../nagvis/includes/functions/getuser.php"); + + $CORE = new GlobalCore(); + $CORE->MAINCFG->setRuntimeValue('user', getUser()); + + if (($hosturl = $CORE->MAINCFG->getValue('defaults', 'hosturl')) === false) + throw new Exception('Error in NagVis configuration'); + if (($hostgroupurl = $CORE->MAINCFG->getValue('defaults', 'hostgroupurl')) === false) + throw new Exception('Error in NagVis configuration'); + if (($serviceurl = $CORE->MAINCFG->getValue('defaults', 'serviceurl')) === false) + throw new Exception('Error in NagVis configuration'); + if (($servicegroupurl = $CORE->MAINCFG->getValue('defaults', 'servicegroupurl')) === false) + throw new Exception('Error in NagVis configuration'); + if (($mapurl = $CORE->MAINCFG->getValue('defaults', 'mapurl')) === false) + throw new Exception('Error in NagVis configuration'); + if (($xml = @simplexml_load_file('settings.xml')) === FALSE) throw new Exception('Could not read settings.xml'); return new Settings((string)$xml['googleMapsKey'], (string)$xml['defaultLocationAction'], - (boolean)$xml['openLinksInNewWindow']); + (boolean)$xml['openLinksInNewWindow'], + $hosturl, $hostgroupurl, $serviceurl, $servicegroupurl, $mapurl); } /** diff --git a/uifx/src/modules/gmap/domain/Settings.as b/uifx/src/modules/gmap/domain/Settings.as index af39e7a..b794b08 100644 --- a/uifx/src/modules/gmap/domain/Settings.as +++ b/uifx/src/modules/gmap/domain/Settings.as @@ -7,14 +7,29 @@ package modules.gmap.domain public var googleMapsKey : String; public var defaultLocationAction : String; public var openLinksInNewWindow : Boolean; + public var hosturl : String; + public var hostgroupurl : String; + public var serviceurl : String; + public var servicegroupurl : String; + public var mapurl : String; public function Settings(googleMapsKey : String = "", defaultLocationAction : String = "", - openLinksInNewWindow : Boolean = false) : void + openLinksInNewWindow : Boolean = false, + hosturl : String = "", + hostgroupurl : String = "", + serviceurl : String = "", + servicegroupurl : String = "", + mapurl : String = "") : void { this.googleMapsKey = googleMapsKey; this.defaultLocationAction = defaultLocationAction; this.openLinksInNewWindow = openLinksInNewWindow; + this.hosturl = hosturl; + this.hostgroupurl = hostgroupurl; + this.serviceurl = serviceurl; + this.servicegroupurl = servicegroupurl; + this.mapurl = mapurl; } } } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
