Author:   Lars Michelsen <[email protected]>
Date:     Sat Sep 24 22:24:30 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sat Sep 24 22:24:30 2011 +0200

Updating the editing grid when resizing the browser window

---

 ChangeLog                               |    1 +
 share/frontend/nagvis-js/js/edit.js     |   35 +++++++++++++++++++-----------
 share/frontend/nagvis-js/js/frontend.js |   22 +++++++++---------
 3 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4dd44c2..5b7147c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@ Frontend
   * Recoded the add/modify dialog to add/edit map objects
   * Merged frontendEventlog.css into template css file
   * Reduced HTTP requests during initial page loading
+  * Updating the editing grid when resizing the browser window
 
 Automap
   * Bugfix: Made the problem automap work again
diff --git a/share/frontend/nagvis-js/js/edit.js 
b/share/frontend/nagvis-js/js/edit.js
index 7fde1d3..6658acb 100644
--- a/share/frontend/nagvis-js/js/edit.js
+++ b/share/frontend/nagvis-js/js/edit.js
@@ -746,6 +746,27 @@ function gridParse() {
         gridStep = null;
         grid = null;
     }
+
+    addEvent(window, "resize", gridRedraw);
+}
+
+function gridRemove() {
+    var oMap = document.getElementById('map');
+    if(oMap) {
+        var oGrid = document.getElementById('grid')
+        if(oGrid) {
+            oMap.removeChild(oGrid);
+            oGrid = null;
+        }
+        oMap = null;
+    }
+
+    removeEvent(window, "resize", gridRedraw);
+}
+
+function gridRedraw() {
+    gridRemove();
+    gridParse();
 }
 
 /**
@@ -758,21 +779,9 @@ function gridToggle() {
     // Toggle the grid state
     if(oViewProperties.grid_show === 1) {
         oViewProperties.grid_show = 0;
-
-        // Remove from view
-        var oMap = document.getElementById('map');
-        if(oMap) {
-            var oGrid = document.getElementById('grid')
-            if(oGrid) {
-            oMap.removeChild(oGrid);
-            oGrid = null;
-            }
-            oMap = null;
-        }
+        gridRemove();
     } else {
         oViewProperties.grid_show = 1;
-
-        // Add to view
         gridParse();
     }
 
diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 484f7ac..e84f1b1 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -851,17 +851,17 @@ function getMapObjByDomObjId(id) {
 function updateNumUnlocked(num) {
     iNumUnlocked += num;
     if(iNumUnlocked == 0) {
-    var o = document.getElementById('editIndicator');
-    if(o) {
-        o.style.display = 'none';
-        o = null;
-    }
+        var o = document.getElementById('editIndicator');
+        if(o) {
+            o.style.display = 'none';
+            o = null;
+        }
     } else {
-    var o = document.getElementById('editIndicator');
-    if(o) {
-        o.style.display = '';
-        o = null;
-    }
+        var o = document.getElementById('editIndicator');
+        if(o) {
+            o.style.display = '';
+            o = null;
+        }
     }
 }
 
@@ -875,7 +875,7 @@ function removeMapObject(objectId) {
     obj.detachChilds();
     obj.remove();
     if(!obj.bIsLocked)
-    updateNumUnlocked(-1);
+        updateNumUnlocked(-1);
     obj = null;
     saveObjectRemove(objectId);
 }


------------------------------------------------------------------------------
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