Author:   Lars Michelsen <[email protected]>
Date:     Thu Jul 12 13:37:07 2012 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Thu Jul 12 13:37:07 2012 +0200

Bugfix: Fixed zoom function problem in Chrome

---

 ChangeLog                                          |    1 +
 .../frontend/nagvis-js/js/NagVisStatefulObject.js  |   18 +++++++++---------
 share/frontend/nagvis-js/js/NagVisTextbox.js       |    7 ++++---
 share/frontend/nagvis-js/js/lines.js               |   12 ++++--------
 share/frontend/nagvis-js/js/nagvis.js              |    5 +++--
 5 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cbda355..96159ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@ Frontend
   * Bugfix: Fixed some IE css warning message
   * Bugfix: Fixed icons not being displayed in IE (version 9 in this case)
   * Bugfix: Fixed rendering errors in IE (below version 9)
+  * Bugfix: Fixed zoom function problem in Chrome
 
 Installer
   * Moved javascript compress code to make it available in omd_install script
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js 
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index c598f38..8a428ec 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -221,9 +221,7 @@ var NagVisStatefulObject = NagVisObject.extend({
 
         // Parse label when configured
         if(this.conf.label_show && this.conf.label_show == '1') {
-            var oLabel = this.parseLabel();
-            oContainerDiv.appendChild(oLabel);
-            oLabel = null;
+            this.parseLabel(oContainerDiv);
         }
 
         // Append child to map and save reference in parsedObject
@@ -881,13 +879,15 @@ var NagVisStatefulObject = NagVisObject.extend({
      * @return String          HTML code of the label
      * @author Lars Michelsen <[email protected]>
      */
-    parseLabel: function () {
+    parseLabel: function (oContainer) {
         var coords = this.getLabelPos();
-        return drawNagVisTextbox(this.conf.object_id + '-label', 
'object_label',
-                                 this.conf.label_background, 
this.conf.label_border,
-                                 coords[0], coords[1], this.conf.z,
-                                 this.conf.label_width, '', 
this.replaceLabelTextDynamicMacros(),
-                                 this.conf.label_style);
+        drawNagVisTextbox(
+            oContainer, this.conf.object_id + '-label', 'object_label',
+            this.conf.label_background, this.conf.label_border,
+            coords[0], coords[1], this.conf.z,
+            this.conf.label_width, '', this.replaceLabelTextDynamicMacros(),
+            this.conf.label_style
+        );
     },
 
     unlockLabel: function () {
diff --git a/share/frontend/nagvis-js/js/NagVisTextbox.js 
b/share/frontend/nagvis-js/js/NagVisTextbox.js
index 7a2f985..548b28c 100644
--- a/share/frontend/nagvis-js/js/NagVisTextbox.js
+++ b/share/frontend/nagvis-js/js/NagVisTextbox.js
@@ -48,7 +48,7 @@ var NagVisTextbox = NagVisStatelessObject.extend({
         // Create container div
         oContainerDiv = document.createElement('div');
         oContainerDiv.setAttribute('id', this.conf.object_id);
-        oContainerDiv.appendChild(this.parseTextbox());
+        this.parseTextbox(oContainerDiv);
 
         // When this is an update, remove the object first
         this.remove();
@@ -81,8 +81,9 @@ var NagVisTextbox = NagVisStatelessObject.extend({
      * @return String  String with HTML Code
      * @author Lars Michelsen <[email protected]>
      */
-    parseTextbox: function () {
-        return drawNagVisTextbox(
+    parseTextbox: function (oContainer) {
+        drawNagVisTextbox(
+            oContainer,
             this.conf.object_id+'-label', 'box',
             this.conf.background_color, this.conf.border_color,
             this.parseCoord(this.conf.x, 'x'), this.parseCoord(this.conf.y, 
'y'), this.conf.z, this.conf.w,
diff --git a/share/frontend/nagvis-js/js/lines.js 
b/share/frontend/nagvis-js/js/lines.js
index 007ca9a..25391c8 100644
--- a/share/frontend/nagvis-js/js/lines.js
+++ b/share/frontend/nagvis-js/js/lines.js
@@ -151,16 +151,12 @@ function drawLabel(objectId, num, lineType, lx, ly, z, 
perfdataA, perfdataB, yOf
 
     if(lineType == '13') {
         if(oLinkContainer)
-            oLinkContainer.appendChild(drawNagVisTextbox(objectId+'-link'+num, 
'box', '#ffffff', '#000000', (lx-labelShift), parseInt(ly - labelHeight / 2), 
z, 'auto', 'auto', '<b>' + perfdataA + '</b>'));
+            drawNagVisTextbox(oLinkContainer, objectId+'-link'+num, 'box', 
'#ffffff', '#000000', (lx-labelShift), parseInt(ly - labelHeight / 2), z, 
'auto', 'auto', '<b>' + perfdataA + '</b>');
+
     } else if(lineType == '14') {
-        var label = drawNagVisTextbox(objectId+'-link'+num, 'box', '#ffffff', 
'#000000', (lx-labelShift), parseInt(ly - labelHeight - yOffset), z, 'auto', 
'auto', '<b>' + perfdataA + '</b>');
-        if(oLinkContainer)
-            oLinkContainer.appendChild(label);
+        drawNagVisTextbox(oLinkContainer, objectId+'-link'+num, 'box', 
'#ffffff', '#000000', (lx-labelShift), parseInt(ly - labelHeight - yOffset), z, 
'auto', 'auto', '<b>' + perfdataA + '</b>');
         labelShift = getLabelShift(perfdataB);
-        label = drawNagVisTextbox(objectId+'-link'+(num+1), 'box', '#ffffff', 
'#000000', (lx-labelShift), parseInt(ly + yOffset), z, 'auto', 'auto', '<b>' + 
perfdataB + '</b>');
-        if(oLinkContainer)
-            oLinkContainer.appendChild(label);
-        label = null;
+        drawNagVisTextbox(oLinkContainer, objectId+'-link'+(num+1), 'box', 
'#ffffff', '#000000', (lx-labelShift), parseInt(ly + yOffset), z, 'auto', 
'auto', '<b>' + perfdataB + '</b>');
     }
 
     oLinkContainer = null;
diff --git a/share/frontend/nagvis-js/js/nagvis.js 
b/share/frontend/nagvis-js/js/nagvis.js
index 0105020..35a82a7 100644
--- a/share/frontend/nagvis-js/js/nagvis.js
+++ b/share/frontend/nagvis-js/js/nagvis.js
@@ -967,7 +967,7 @@ function hideStatusMessage() {
  * @return  Object  Returns the div object of the textbox
  * @author  Lars Michelsen <[email protected]>
  */
-function drawNagVisTextbox(id, className, bgColor, borderColor, x, y, z, w, h, 
text, customStyle) {
+function drawNagVisTextbox(oContainer, id, className, bgColor, borderColor, x, 
y, z, w, h, text, customStyle) {
     var initRendering = false;
     var oLabelDiv = document.getElementById(id);
     if(!oLabelDiv) {
@@ -1046,6 +1046,7 @@ function drawNagVisTextbox(id, className, bgColor, 
borderColor, x, y, z, w, h, t
     oLabelSpan.innerHTML = text;
 
     oLabelDiv.appendChild(oLabelSpan);
+    oContainer.appendChild(oLabelDiv);
 
     // Take zoom factor into account
     if(initRendering) {
@@ -1065,7 +1066,7 @@ function drawNagVisTextbox(id, className, bgColor, 
borderColor, x, y, z, w, h, t
     }
 
     oLabelSpan = null;
-    return oLabelDiv;
+    oLabelDiv = null;
 }
 
 /**


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to