Author:   Lars Michelsen <[email protected]>
Date:     Sat Apr 16 13:04:17 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sat Apr 16 13:04:29 2011 +0200

The unlock/lock states of map objects are stored now in the user config

---

 ChangeLog                                   |    2 +
 TODO                                        |    7 +----
 share/frontend/nagvis-js/js/NagVisObject.js |   36 +++++++++++++++++++++++++-
 share/frontend/nagvis-js/js/edit.js         |   35 ++++++++++++++++++++++++++
 share/frontend/nagvis-js/js/frontend.js     |   27 --------------------
 5 files changed, 72 insertions(+), 35 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6f66716..3fa80b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,8 @@ Backend: Livestatus
     available
 
 Frontend
+  * Completely removed the WUI and merged the functionality into the regular 
frontend.
+    You can now "lock/unlock" all objects for editing using the "Edit Map" 
menu.
   * Added new sidebar for better navigation. It can be opened by clicking on
     the "Open" label in the header menu. The state of the sidebar and the
     single nodes is stored in user specific profile files
diff --git a/TODO b/TODO
index 6b0cf98..d3540db 100644
--- a/TODO
+++ b/TODO
@@ -32,10 +32,6 @@ Linien (Auch für neue Automap wichtig!):
    - Farbe (?)
  - Offset zum Ziel
 
-WUI: Bei Typ-Wechsel einer Linie in der WUI muss die Anzahl der Koordinaten
-variieren. Normale Linien haben zwei Koordinaten, Linien mit zwei Enden können
-drei Koordinaten haben.
-
 *** Add/Modify Redesign ***
 
 Aufrufe:
@@ -70,12 +66,11 @@ nach Möglichkeit nicht mit Hotkeys von FF/IE kollidieren.
 
   Bessere Fehlerbehandlung z.B. auf Übersichtsseite, wenn Antwort kein 
gültiges JS ist.
 
-
 Exception/Error log bauen:
   PHP Fehler loggen
        Eventuell sogar Javascript fehler loggen
 
-- Dokumentation:
+*** Dokumentation ***
   - Neue Editier-Möglichkeiten in der normalen GUI
   - Mittleren Teil der Linien festmachen oder positionieren
   - Relative Koordinaten
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index c270aa8..54317db 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -52,6 +52,23 @@ var NagVisObject = Base.extend({
                
                // Load view specific config modifiers (Normaly triggered by 
url params)
                this.loadViewOpts();
+
+               // Load lock options
+               this.loadLocked();
+       },
+
+
+       /**
+        * PRIVATE loadLocked
+        * Loads the lock state of an object from the user properties
+        */
+       loadLocked: function() {
+           if(!oUserProperties.hasOwnProperty('unlocked-' + 
oPageProperties.map_name))
+               return;
+
+           var unlocked = oUserProperties['unlocked-' + 
oPageProperties.map_name].split(',');
+           this.bIsLocked = unlocked.indexOf(this.conf.object_id) === -1 && 
unlocked.indexOf('*') === -1;
+           unlocked = null;
        },
        
        /**
@@ -369,10 +386,25 @@ var NagVisObject = Base.extend({
                else
                        this.bIsLocked = !this.bIsLocked;
 
-               if(this.toggleObjControls())
+               if(this.toggleObjControls()) {
+                       if(!isset(lock)) {
+                           if(oUserProperties.hasOwnProperty('unlocked-' + 
oPageProperties.map_name))
+                               var unlocked = oUserProperties['unlocked-' + 
oPageProperties.map_name].split(',');
+                           else
+                               var unlocked = [];
+
+                           if(this.bIsLocked)
+                               
unlocked.splice(unlocked.indexOf(this.conf.object_id), 1);
+                           else
+                               unlocked.push(this.conf.object_id);
+                           storeUserOption('unlocked-' + 
oPageProperties.map_name, unlocked.join(','));
+                           unlocked = null;
+                       }
+
                        return this.bIsLocked ? -1 : 1;
-               else
+               } else {
                        return 0;
+               }
        },
 
        /**
diff --git a/share/frontend/nagvis-js/js/edit.js 
b/share/frontend/nagvis-js/js/edit.js
index 73d0497..b4ee0ee 100644
--- a/share/frontend/nagvis-js/js/edit.js
+++ b/share/frontend/nagvis-js/js/edit.js
@@ -25,6 +25,41 @@
  * @author     Lars Michelsen <[email protected]>
  */
 
+/**
+ * Changes the handling of the line middle for lines with two parts
+ */
+function toggleLineMidLock(objectId) {
+       getMapObjByDomObjId(objectId).toggleLineMidLock();
+}
+
+/**
+ * Toggles the mode of the object: editable or not
+ *
+ * @author     Lars Michelsen <[email protected]>
+ */
+function toggleMapObjectLock(objectId) {
+       iNumUnlocked += getMapObjByDomObjId(objectId).toggleLock();
+}
+
+/**
+ * Toggles the mode of all map objects: editable or not
+ *
+ * @author     Lars Michelsen <[email protected]>
+ */
+function toggleAllMapObjectsLock() {
+       var unlock = false;
+       if(iNumUnlocked > 0)
+               unlock = true;
+               
+       for(var i in oMapObjects)
+               iNumUnlocked += oMapObjects[i].toggleLock(unlock);
+
+       if(!unlock)
+           storeUserOption('unlocked-' + oPageProperties.map_name, '*');
+       else
+           storeUserOption('unlocked-' + oPageProperties.map_name, '');
+}
+
 /*** Handles the object dragging ***/
 
 var draggingEnabled = true;
diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 2a3c61f..ba3ef07 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -817,19 +817,6 @@ function getMapObjByDomObjId(id) {
        }
 }
 
-function toggleLineMidLock(objectId) {
-       getMapObjByDomObjId(objectId).toggleLineMidLock();
-}
-
-/**
- * Toggles the mode of the object: editable or not
- *
- * @author     Lars Michelsen <[email protected]>
- */
-function toggleMapObjectLock(objectId) {
-       iNumUnlocked += getMapObjByDomObjId(objectId).toggleLock();
-}
-
 /**
  * Removes an element from the map
  *
@@ -842,20 +829,6 @@ function removeMapObject(objectId) {
 }
 
 /**
- * Toggles the mode of all map objects: editable or not
- *
- * @author     Lars Michelsen <[email protected]>
- */
-function toggleAllMapObjectsLock() {
-       var unlock = false;
-       if(iNumUnlocked > 0)
-               unlock = true;
-               
-       for(var i in oMapObjects)
-               iNumUnlocked += oMapObjects[i].toggleLock(unlock);
-}
-
-/**
  * refreshMapObject()
  *
  * Handles manual map object update triggered by e.g. the context menu


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to