Author:   Lars Michelsen <[email protected]>
Date:     Tue Jun 28 21:47:35 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Tue Jun 28 21:47:35 2011 +0200

Automap: New context menu action "make root"

Added new context menu action "make root" to automap nodes to change the
    root of the automap on-the-fly (Thanks to Oliver Graf)

---

 ChangeLog                                       |    6 +++++-
 share/frontend/nagvis-js/js/NagVisObject.js     |    8 +++++++-
 share/server/core/classes/NagVisContextMenu.php |    6 +++++-
 share/userfiles/templates/default.context.html  |    3 +++
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4d5af9..8992715 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,11 @@ Core
   * Bugfix: Fixed redirects after map add/rename/delete
   * Bugfix: NDO backend does correct type casting to integers for stats now 
(Thanks to Oliver Graf)
   * Bugfix: Fixed false CRITICAL states when using NDO Backend (Thanks to 
Oliver Graf)
-  * Bugfix: Automap: Fixed parent calculation in automap (Thanks to Oliver 
Graf)
+
+* Automap
+  * Added new context menu action "make root" to automap nodes to change the
+    root of the automap on-the-fly (Thanks to Oliver Graf)
+  * Bugfix: Fixed parent calculation in automap (Thanks to Oliver Graf)
 
 Frontend
   * Labels of objects can now be moved again; The edit mode is affected by the 
objects lock/unlock state
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 27c936d..0d18476 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -215,8 +215,14 @@ var NagVisObject = Base.extend({
         else
             oSectionMacros.host = 
'<!--\\sBEGIN\\shost\\s-->.+?<!--\\sEND\\shost\\s-->';
 
-        if(oPageProperties.view_type === 'automap')
+        if(oPageProperties.view_type === 'automap') {
             oSectionMacros.not_automap = 
'<!--\\sBEGIN\\snot_automap\\s-->.+?<!--\\sEND\\snot_automap\\s-->';
+           // Skip the root change link for the root host
+            if(this.conf.name === getUrlParam('root'))
+               oSectionMacros.automap_not_root = 
'<!--\\sBEGIN\\sautomap_not_root\\s-->.+?<!--\\sEND\\sautomap_not_root\\s-->';
+        } else {
+            oSectionMacros.automap = 
'<!--\\sBEGIN\\sautomap\\s-->.+?<!--\\sEND\\sautomap\\s-->';
+        }
         if(this.conf.view_type !== 'line')
             oSectionMacros.line = 
'<!--\\sBEGIN\\sline\\s-->.+?<!--\\sEND\\sline\\s-->';
         if(this.conf.view_type !== 'line' || (this.conf.line_type == 11 || 
this.conf.line_type == 12))
diff --git a/share/server/core/classes/NagVisContextMenu.php 
b/share/server/core/classes/NagVisContextMenu.php
index 72369b8..9bca4a1 100644
--- a/share/server/core/classes/NagVisContextMenu.php
+++ b/share/server/core/classes/NagVisContextMenu.php
@@ -135,6 +135,10 @@ class NagVisContextMenu {
         if(strpos($this->code,'[html_template_images]') !== FALSE) {
             $this->code = str_replace('[html_template_images]', 
$this->CORE->getMainCfg()->getPath('html', 'global', 'templateimages'), 
$this->code);
         }
+
+        if(strpos($this->code,'[lang_make_root]') !== FALSE) {
+            $this->code = str_replace('[lang_make_root]', 
$this->CORE->getLang()->getText('Make root'), $this->code);
+        }
     }
 
     /**
@@ -177,4 +181,4 @@ class NagVisContextMenu {
         return $this->CORE->getMainCfg()->getPath('html', 'global', 
'templates', $this->templateName.'.context.css');
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/share/userfiles/templates/default.context.html 
b/share/userfiles/templates/default.context.html
index cae642b..6078b08 100644
--- a/share/userfiles/templates/default.context.html
+++ b/share/userfiles/templates/default.context.html
@@ -1,4 +1,7 @@
 <ul>
+    <!-- BEGIN automap_not_root -->
+    <li><a 
href="index.php?mod=AutoMap&act=view&show=[map_name]&root=[name]">[lang_make_root]</a></li>
+    <!-- END automap_not_root -->
     <li><a href="#" onClick="refreshMapObject(event, '[obj_id]'); 
contextHide();return false">[lang_refresh_status]</a></li>
     <!-- BEGIN not_automap -->
     <li><a href="#" onClick="toggleMapObjectLock(event, '[obj_id]'); 
contextHide();return false">[lang_toggle_lock]</a></li>


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to