Author:   Lars Michelsen <[email protected]>
Date:     Fri Oct 28 12:15:23 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Fri Oct 28 12:15:23 2011 +0200

Fixed several IE7 javascript errors

  * Bugfix: Fixed object link follow after moving object in edit mode when 
using IE<8
  * Bugfix: Fixed javascript several onload javascript errors when using IE<8

---

 ChangeLog                                          |    4 +++
 share/frontend/nagvis-js/js/NagVisObject.js        |   21 +++++++++++++++----
 .../frontend/nagvis-js/js/NagVisStatefulObject.js  |   12 +++++++++-
 3 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 56c29e6..f51c88e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@ Core
   * Bugfix: Fixed problem with some PHP 5.1.2 installations while reading the
     map configuration files
 
+Frontend
+  * Bugfix: Fixed object link follow after moving object in edit mode when 
using IE<8
+  * Bugfix: Fixed javascript several onload javascript errors when using IE<8
+
 Automap
   * Improved coord parsing code to make it graphviz-2.6-22.2 compatible
   * Bugfix: Fixed automap alias on overview page and in lists
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 2233590..a207cfc 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -855,10 +855,15 @@ var NagVisObject = Base.extend({
     },
 
     addControl: function (obj) {
-        // Add to DOM
-        
document.getElementById(this.conf.object_id+'-controls').appendChild(obj);
-        // Add to controls list
-        this.objControls.push(obj);
+        var o = document.getElementById(this.conf.object_id+'-controls');
+        if(o) {
+            // Add to DOM
+            o.appendChild(obj);
+            o = null;
+
+            // Add to controls list
+            this.objControls.push(obj);
+        }
     },
 
     parseLineControls: function () {
@@ -1255,7 +1260,13 @@ var NagVisObject = Base.extend({
 
                 // Link (Left mouse action)
                 if(o.parentNode.tagName == 'A')
-                    o.parentNode.onclick = function() {return false};
+                    o.parentNode.onclick = function(event) {
+                        var event = !event ? window.event : event;
+                        if(event.stopPropagation)
+                            event.stopPropagation();
+                        event.cancelBubble = true;
+                        return false;
+                    };
            }
             o = null;
        }
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js 
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index a284773..804bf07 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -974,11 +974,19 @@ var NagVisStatefulObject = NagVisObject.extend({
     },
 
     getObjWidth: function () {
-        return parseInt(document.getElementById(this.conf.object_id + 
'-icondiv').clientWidth);
+        var o = document.getElementById(this.conf.object_id + '-icondiv');
+        if(o && o.clientWidth)
+            return parseInt(o.clientWidth);
+        else
+            return 0;
     },
 
     getObjHeight: function () {
-        return parseInt(document.getElementById(this.conf.object_id + 
'-icondiv').clientHeight);
+        var o = document.getElementById(this.conf.object_id + '-icondiv');
+        if(o && o.clientHeight)
+            return parseInt(o.clientHeight);
+        else
+            return 0;
     },
 
     parseIconControls: function () {


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to