Module: nagvis
Branch: master
Commit: 2188ac0fc62c124baa930eaad0f8af81cfac922f
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=2188ac0fc62c124baa930eaad0f8af81cfac922f

Author: LaMi <[email protected]>
Date:   Fri Dec  4 22:14:16 2009 +0100

#149 Automaps can be added to rotations using an @ sign before the automap name

---

 docs/en_US/nagvis_config_format_description.html   |    3 ++-
 etc/nagvis.ini.php-sample                          |    3 +++
 .../nagvis-js/classes/FrontendModAutoMap.php       |   11 +++++++----
 .../frontend/nagvis-js/classes/FrontendModMap.php  |    1 -
 share/server/core/classes/CoreRotation.php         |    3 +++
 share/server/core/classes/GlobalMainCfg.php        |    9 ++++++++-
 6 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/docs/en_US/nagvis_config_format_description.html 
b/docs/en_US/nagvis_config_format_description.html
index a10ba54..f1477f9 100644
--- a/docs/en_US/nagvis_config_format_description.html
+++ b/docs/en_US/nagvis_config_format_description.html
@@ -368,7 +368,8 @@ interval=15</pre>
                <td> maps </td><td> </td>
                <td> 
                        <p>Comma separated list of maps to rotate in this pool. 
You can also add external URLs surrounded by [ and ] (e.g. 
maps="demo1,[http://localhost/test.php]";. The URL has to be reachable and 
accessable by the server which NagVis is running on.</p>
-                       <font color="#ff0000">New in 1.4:</font> You can add 
labels in the following format &lt;label&gt;:&lt;map&gt; and 
&lt;label&gt;:&lt;[url]&gt;. The labels are displayed in the rotation list.
+                       <p><font color="#ff0000">New in 1.4:</font> You can add 
labels in the following format &lt;label&gt;:&lt;map&gt; and 
&lt;label&gt;:&lt;[url]&gt;. The labels are displayed in the rotation list.</p>
+                       <p><font color="#ff0000">New in 1.5:</font> It is also 
possible to add automaps to rotations. Simply add an @ sign before the automap 
name to add an automap to the rotation.</p>
                </td>
                </tr>
                </table>
diff --git a/etc/nagvis.ini.php-sample b/etc/nagvis.ini.php-sample
index 90bf290..3e08762 100644
--- a/etc/nagvis.ini.php-sample
+++ b/etc/nagvis.ini.php-sample
@@ -303,6 +303,9 @@ backendtype="merlinmy"
 [rotation_demo]
 ; These steps are rotated. The "Demo2:" is a label which is being displayed in
 ; the index pages rotation list.
+; You may also add external URLs as steps. Simply put the url surrounded by []
+; instead of the map name. It is also possible to add automaps to rotations,
+; add an @ sign before the automap name to add an automap to the rotation.
 maps="demo,Demo2:demo2"
 ; rotation interval (seconds)
 interval=15
diff --git a/share/frontend/nagvis-js/classes/FrontendModAutoMap.php 
b/share/frontend/nagvis-js/classes/FrontendModAutoMap.php
index 2228eb4..1657b65 100644
--- a/share/frontend/nagvis-js/classes/FrontendModAutoMap.php
+++ b/share/frontend/nagvis-js/classes/FrontendModAutoMap.php
@@ -95,10 +95,13 @@ class FrontendModAutoMap extends FrontendModule {
                $this->VIEW->setAutomapParams($this->opts);
                
                // Maybe it is needed to handle the requested rotation
-               if($this->rotation != '') { 
-                       $ROTATION = new FrontendRotation($this->CORE, 
$this->rotation);
-                       $ROTATION->setStep('automap', $this->name);
-                       
$this->VIEW->setRotation($ROTATION->getRotationProperties());
+               if($this->rotation != '') {
+                       // Only allow the rotation if the user is permitted to 
use it
+                       if($this->AUTHORISATION->isPermitted('Rotation', 
'view', $this->rotation)) {
+                               $ROTATION = new FrontendRotation($this->CORE, 
$this->rotation);
+                               $ROTATION->setStep('automap', $this->name);
+                               
$this->VIEW->setRotation($ROTATION->getRotationProperties());
+                       }
                }
                
     //FIXME: Maintenance mode not supported atm
diff --git a/share/frontend/nagvis-js/classes/FrontendModMap.php 
b/share/frontend/nagvis-js/classes/FrontendModMap.php
index aaa3106..541c204 100644
--- a/share/frontend/nagvis-js/classes/FrontendModMap.php
+++ b/share/frontend/nagvis-js/classes/FrontendModMap.php
@@ -81,7 +81,6 @@ class FrontendModMap extends FrontendModule {
                // Maybe it is needed to handle the requested rotation
                if($this->rotation != '') {
                        // Only allow the rotation if the user is permitted to 
use it
-                       // FIXME: Errorhandling?
                        if($this->AUTHORISATION->isPermitted('Rotation', 
'view', $this->rotation)) {
                                $ROTATION = new FrontendRotation($this->CORE, 
$this->rotation);
                                $ROTATION->setStep('map', $this->name);
diff --git a/share/server/core/classes/CoreRotation.php 
b/share/server/core/classes/CoreRotation.php
index f37af40..f8ffbb2 100644
--- a/share/server/core/classes/CoreRotation.php
+++ b/share/server/core/classes/CoreRotation.php
@@ -64,6 +64,7 @@ class CoreRotation {
                  (
                        [label] => demo
                        [map] => demo
+                       [automap] => 
                        [url] => 
                        [target] => 
                        )
@@ -168,6 +169,8 @@ class CoreRotation {
                foreach($this->arrSteps AS $intId => $arrStep) {
                        if(isset($arrStep['url']) && $arrStep['url'] != '') {
                                $this->arrSteps[$intId]['target'] = 
$htmlBase.'/frontend/nagvis-js/index.php?mod=Url&act=view&show='.$arrStep['url'].'&rotation='.$this->sPoolName;
+                       } elseif(isset($arrStep['automap']) && 
$arrStep['automap'] != '') {
+                               $this->arrSteps[$intId]['target'] = 
$htmlBase.'/frontend/nagvis-js/index.php?mod=AutoMap&act=view&show='.$arrStep['automap'].'&rotation='.$this->sPoolName;
                        } else {
                                $this->arrSteps[$intId]['target'] = 
$htmlBase.'/frontend/nagvis-js/index.php?mod=Map&act=view&show='.$arrStep['map'].'&rotation='.$this->sPoolName;
                        }
diff --git a/share/server/core/classes/GlobalMainCfg.php 
b/share/server/core/classes/GlobalMainCfg.php
index ad4de50..1f63202 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -972,6 +972,7 @@ class GlobalMainCfg {
                                                        
if(preg_match("/^([^\[.]+:)?(\[(.+)\]|(.+))$/", $element, $arrRet)) {
                                                                $label = '';
                                                                $map = '';
+                                                               $automap = '';
                                                                
                                                                // When no 
label is set, set map or url as label
                                                                if($arrRet[1] 
!= '') {
@@ -993,8 +994,14 @@ class GlobalMainCfg {
                                                                $label = 
trim($label);
                                                                $map = 
trim($map);
                                                                
+                                                               // Check if the 
map is an automap
+                                                               if(substr($map, 
0, 1) === '@') {
+                                                                       
$automap = substr($map, 1);
+                                                                       $map = 
'';
+                                                               }
+                                                               
                                                                // Save the 
extracted information to an array
-                                                               $val[$id] = 
Array('label' => $label, 'map' => $map, 'url' => $arrRet[3], 'target' => '');
+                                                               $val[$id] = 
Array('label' => $label, 'map' => $map, 'automap' => $automap, 'url' => 
$arrRet[3], 'target' => '');
                                                        }
                                                }
                                        }


------------------------------------------------------------------------------
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

Reply via email to