Module: nagvis Branch: master Commit: caffd6c1d06e43c007f2da83f16292e5d14c580e URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=caffd6c1d06e43c007f2da83f16292e5d14c580e
Author: LaMi <[email protected]> Date: Fri Dec 4 22:57:26 2009 +0100 #13 Added options for hover and context menus too. The url options are avialable on maps and automaps: enableHeader=1/0 enableHover=1/0 enableContext=1/0 Also added missing search option to the automap for search on page loading. --- .../nagvis-js/classes/FrontendModAutoMap.php | 3 ++ .../nagvis-js/classes/NagVisAutoMapView.php | 29 ++++++++++++++++++++ share/frontend/nagvis-js/classes/NagVisMapView.php | 10 +++++++ share/frontend/nagvis-js/js/NagVisObject.js | 22 +++++++++++++++ .../userfiles/templates/pages/default.automap.html | 1 + 5 files changed, 65 insertions(+), 0 deletions(-) diff --git a/share/frontend/nagvis-js/classes/FrontendModAutoMap.php b/share/frontend/nagvis-js/classes/FrontendModAutoMap.php index 2cddd73..3164635 100644 --- a/share/frontend/nagvis-js/classes/FrontendModAutoMap.php +++ b/share/frontend/nagvis-js/classes/FrontendModAutoMap.php @@ -11,6 +11,7 @@ class FrontendModAutoMap extends FrontendModule { // Parse the view specific options $aOpts = Array('show' => MATCH_MAP_NAME, + 'search' => MATCH_STRING_NO_SPACE_EMPTY, 'backend' => MATCH_STRING_NO_SPACE_EMPTY, 'root' => MATCH_STRING_NO_SPACE_EMPTY, 'maxLayers' => MATCH_INTEGER_EMPTY, @@ -30,11 +31,13 @@ class FrontendModAutoMap extends FrontendModule { $this->name = $aVals['show']; $this->rotation = $aVals['rotation']; + $this->viewOpts['search'] = $aVals['search']; $this->viewOpts['enableHeader'] = $aVals['enableHeader']; $this->viewOpts['enableContext'] = $aVals['enableContext']; $this->viewOpts['enableHover'] = $aVals['enableHover']; unset($aVals['show']); + unset($aVals['search']); unset($aVals['rotation']); unset($aVals['enableHeader']); unset($aVals['enableContext']); diff --git a/share/frontend/nagvis-js/classes/NagVisAutoMapView.php b/share/frontend/nagvis-js/classes/NagVisAutoMapView.php index dd54e5b..eb4bc72 100644 --- a/share/frontend/nagvis-js/classes/NagVisAutoMapView.php +++ b/share/frontend/nagvis-js/classes/NagVisAutoMapView.php @@ -96,6 +96,7 @@ class NagVisAutoMapView { 'generalProperties' => $this->CORE->getMainCfg()->parseGeneralProperties(), 'workerProperties' => $this->CORE->getMainCfg()->parseWorkerProperties(), 'rotationProperties' => json_encode($this->aRotation), + 'viewProperties' => $this->parseViewProperties(), 'mapName' => $this->name, 'automap' => $this->content, 'automapParams' => json_encode($this->aParams) @@ -104,5 +105,33 @@ class NagVisAutoMapView { // Build page based on the template file and the data array return $TMPLSYS->get($TMPL->getTmplFile('automap'), $aData); } + + /** + * Parses the view specific properties. In most cases this will be user + * defined values which maybe given by url or session + * + * @return String JSON array + * @author Lars Michelsen <[email protected]> + */ + private function parseViewProperties() { + $arr = Array(); + + // View specific search set + if($this->aViewOpts['enableHover'] !== false) { + $arr['search'] = $this->aViewOpts['search']; + } + + // View specific hover modifier set + if($this->aViewOpts['enableHover'] !== false) { + $arr['enableHover'] = $this->aViewOpts['enableHover']; + } + + // View specific context modifier set + if($this->aViewOpts['enableContext'] !== false) { + $arr['enableContext'] = $this->aViewOpts['enableContext']; + } + + return json_encode($arr); + } } ?> diff --git a/share/frontend/nagvis-js/classes/NagVisMapView.php b/share/frontend/nagvis-js/classes/NagVisMapView.php index 6853ab3..c8f5be5 100644 --- a/share/frontend/nagvis-js/classes/NagVisMapView.php +++ b/share/frontend/nagvis-js/classes/NagVisMapView.php @@ -111,6 +111,16 @@ class NagVisMapView { $arr['search'] = $this->search; + // View specific hover modifier set + if($this->aViewOpts['enableHover'] !== false) { + $arr['enableHover'] = $this->aViewOpts['enableHover']; + } + + // View specific context modifier set + if($this->aViewOpts['enableContext'] !== false) { + $arr['enableContext'] = $this->aViewOpts['enableContext']; + } + return json_encode($arr); } } diff --git a/share/frontend/nagvis-js/js/NagVisObject.js b/share/frontend/nagvis-js/js/NagVisObject.js index 5ff7c32..1f83314 100644 --- a/share/frontend/nagvis-js/js/NagVisObject.js +++ b/share/frontend/nagvis-js/js/NagVisObject.js @@ -45,6 +45,28 @@ var NagVisObject = Base.extend({ if(this.conf.object_id == null) { this.conf.object_id = getRandomLowerCaseLetter() + getRandom(1, 99999); } + + // Load view specific config modifiers (Normaly triggered by url params) + this.loadViewOpts(); + }, + + /** + * PUBLIC loadViewOpts + * + * Loads view specific options. Basically this options are triggered by url params + * + * @author Lars Michelsen <[email protected]> + */ + loadViewOpts: function() { + // View specific hover modifier set. Will override the map configured option + if(oViewProperties && oViewProperties.enableHover && oViewProperties.enableHover != '') { + this.conf.hover_menu = '0'; + } + + // View specific hover modifier set. Will override the map configured option + if(oViewProperties && oViewProperties.enableHover && oViewProperties.enableHover != '') { + this.conf.context_menu = '0'; + } }, /** diff --git a/share/userfiles/templates/pages/default.automap.html b/share/userfiles/templates/pages/default.automap.html index 4727b79..4f9dcec 100644 --- a/share/userfiles/templates/pages/default.automap.html +++ b/share/userfiles/templates/pages/default.automap.html @@ -7,6 +7,7 @@ oGeneralProperties = {$generalProperties}; oWorkerProperties = {$workerProperties}; oRotationProperties = {$rotationProperties}; +oViewProperties = {$viewProperties}; oAutomapParams = {$automapParams}; // Kick of the worker ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
