Author:   Lars Michelsen <[email protected]>
Date:     Wed Jul 24 16:51:36 2013 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Jul 24 16:51:36 2013 +0200

FIX: Fixed shape image displaying when using external URLS

---

 ChangeLog                                  |    1 +
 share/frontend/nagvis-js/js/NagVisShape.js |   21 +++++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f024a77..70a6033 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ Frontend:
   * Weathermap lines now deal with bit/byte values provided by Check_MKs
     interface checks
   * FIX: Fixed "TypeError: oLabel is null" on at least geomaps
+  * FIX: Fixed shape image displaying when using external URLS
 
 Automap:
   * Labels have now a white background to improve the text readability
diff --git a/share/frontend/nagvis-js/js/NagVisShape.js 
b/share/frontend/nagvis-js/js/NagVisShape.js
index da7a637..51afde4 100644
--- a/share/frontend/nagvis-js/js/NagVisShape.js
+++ b/share/frontend/nagvis-js/js/NagVisShape.js
@@ -84,18 +84,23 @@ var NagVisShape = NagVisStatelessObject.extend({
         var oIcon = document.createElement('img');
         oIcon.setAttribute('id', this.conf.object_id+'-icon');
 
-        // Extract external URLs
-        if(this.conf.icon.match(/^\[(.*)\]$/))
-            this.conf.icon = this.conf.icon.replace(/^\[(.*)\]$/, '$1');
-
-        addZoomHandler(oIcon);
+        // Construct the real url to fetch for this shape
+        var img_url = null;
+        if(this.conf.icon.match(/^\[(.*)\]$/)) {
+            img_url = this.conf.icon.replace(/^\[(.*)\]$/, '$1');
+        } else {
+            img_url = oGeneralProperties.path_shapes + this.conf.icon;
+        }
 
-        if(this.conf.icon.indexOf('?') !== -1) {
-            oIcon.src = oGeneralProperties.path_shapes + this.conf.icon + 
'&_t=' + iNow;
+        if(img_url.indexOf('?') !== -1) {
+            img_url += '&_t=' + iNow;
         } else {
-            oIcon.src = oGeneralProperties.path_shapes + this.conf.icon + 
'?_t=' + iNow;
+            img_url += '?_t=' + iNow;
         }
 
+        addZoomHandler(oIcon);
+
+        oIcon.src = img_url;
         oIcon.alt = this.conf.type;
 
         if(this.conf.url && this.conf.url !== '') {


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to