Author:   Lars Michelsen <[email protected]>
Date:     Fri Sep 23 10:41:32 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Fri Sep 23 10:41:32 2011 +0200

Preventing javascript errors when using shapes on maps

---

 share/frontend/nagvis-js/js/NagVisObject.js |    8 +++++---
 share/frontend/nagvis-js/js/frontend.js     |    1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 8382bb9..64d73a5 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -291,7 +291,7 @@ var NagVisObject = Base.extend({
             return;
 
         var objId = this.conf.object_id;
-        var sTemplateCode;
+        var sTemplateCode = '';
         var iHoverDelay = this.conf.hover_delay;
 
         // Parse the configured URL or get the hover menu
@@ -306,7 +306,8 @@ var NagVisObject = Base.extend({
                 this.getHoverTemplateCode();
 
             // Replace dynamic (state dependent) macros
-            sTemplateCode = replaceHoverTemplateDynamicMacros(this);
+            if(isset(this.conf.hover_template))
+                sTemplateCode = replaceHoverTemplateDynamicMacros(this);
         }
 
         var doc = document;
@@ -395,7 +396,8 @@ var NagVisObject = Base.extend({
     getHoverTemplateCode: function() {
         // Asign the template code and replace only the static macros
         // These are typicaly configured static configued values from nagios
-        this.hover_template_code = replaceHoverTemplateStaticMacros(this, 
oHoverTemplates[this.conf.hover_template]);
+        if(isset(this.conf.hover_template))
+            this.hover_template_code = replaceHoverTemplateStaticMacros(this, 
oHoverTemplates[this.conf.hover_template]);
     },
 
     /**
diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 3fd118e..484f7ac 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -452,6 +452,7 @@ function getHoverTemplates() {
         // c) templates are already fetched
         if(isset(oMapObjects[i].conf.hover_menu) && 
oMapObjects[i].conf.hover_menu == '1'
            && (!oMapObjects[i].conf.hover_url || oMapObjects[i].conf.hover_url 
=== '')
+           && isset(oMapObjects[i].conf.hover_template)
            && (!isset(oHoverTemplates[oMapObjects[i].conf.hover_template]) || 
oHoverTemplates[oMapObjects[i].conf.hover_template] === ''))
             oHoverTemplates[oMapObjects[i].conf.hover_template] = '';
     }


------------------------------------------------------------------------------
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-d2dcopy2
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to