Author:   Lars Michelsen <[email protected]>
Date:     Wed Apr 27 15:06:14 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Apr 27 15:06:14 2011 +0200

moved the line middle unlock link to an own control; Made the line middle drag 
control smaller

---

 share/frontend/nagvis-js/js/NagVisObject.js        |   98 ++++++++++++++++----
 .../frontend/nagvis-js/js/NagVisStatefulObject.js  |    2 +-
 share/userfiles/templates/default.context.html     |    7 +-
 share/userfiles/templates/default.css              |    6 +-
 4 files changed, 85 insertions(+), 28 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 9850c9a..4b458e4 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -813,7 +813,11 @@ var NagVisObject = Base.extend({
 
         var size = 20;
         for(var i = 0, l = x.length; i < l; i++) {
-            this.parseControlDrag(i, x[i], y[i], - size / 2, - size / 2, size);
+           // Line middle drag coord needs to be smaller
+           if(l > 2 && i == 1) 
+               this.parseControlDrag(i, x[i], y[i], - 5, -5, 10);
+           else
+               this.parseControlDrag(i, x[i], y[i], - size / 2, - size / 2, 
size);
             makeDragable([this.conf.object_id+'-drag-'+i], this.saveObject, 
this.moveObject);
         }
 
@@ -822,6 +826,9 @@ var NagVisObject = Base.extend({
         this.parseControlModify(x.length+1, this.getLineMid(this.conf.x, 'x'), 
this.getLineMid(this.conf.y, 'y'),
                                 30, -15, 10);
 
+        if(this.conf.view_type === 'line' && (this.conf.line_type == 10 || 
this.conf.line_type == 13 || this.conf.line_type == 14))
+           this.parseControlToggleLineMid(x.length+2, 
this.getLineMid(this.conf.x, 'x'), this.getLineMid(this.conf.y, 'y'), 15, 0, 
10);
+
         size = null;
         x = null;
         y = null;
@@ -850,28 +857,30 @@ var NagVisObject = Base.extend({
     },
 
     parseControlDrag: function (num, objX, objY, offX, offY, size) {
-        var drag = document.createElement('div');
-        drag.setAttribute('id',         this.conf.object_id+'-drag-' + num);
-        drag.setAttribute('class',     'control drag' + size);
-        drag.setAttribute('className', 'control drag' + size);
-        drag.style.zIndex   = parseInt(this.conf.z)+1;
-        drag.style.width    = size + 'px';
-        drag.style.height   = size + 'px';
-        drag.style.left     = (objX + offX) + 'px';
-        drag.style.top      = (objY + offY) + 'px';
-        drag.objOffsetX     = offX;
-        drag.objOffsetY     = offY;
-
-        drag.onmouseover = function() {
+        var ctl = document.createElement('div');
+        ctl.setAttribute('id',         this.conf.object_id+'-drag-' + num);
+        ctl.setAttribute('class',     'control drag' + size);
+        ctl.setAttribute('className', 'control drag' + size);
+       // FIXME: Multilanguage
+       ctl.title          = 'Move object';
+        ctl.style.zIndex   = parseInt(this.conf.z)+1;
+        ctl.style.width    = size + 'px';
+        ctl.style.height   = size + 'px';
+        ctl.style.left     = (objX + offX) + 'px';
+        ctl.style.top      = (objY + offY) + 'px';
+        ctl.objOffsetX     = offX;
+        ctl.objOffsetY     = offY;
+
+        ctl.onmouseover = function() {
             document.body.style.cursor = 'move';
         };
 
-        drag.onmouseout = function() {
+        ctl.onmouseout = function() {
             document.body.style.cursor = 'auto';
         };
 
-        this.addControl(drag);
-        drag = null;
+        this.addControl(ctl);
+        ctl = null;
     },
 
     /**
@@ -885,6 +894,8 @@ var NagVisObject = Base.extend({
         ctl.setAttribute('id',         this.conf.object_id+'-delete-' + num);
         ctl.setAttribute('class',     'control delete' + size);
         ctl.setAttribute('className', 'control delete' + size);
+       // FIXME: Multilanguage
+       ctl.title          = 'Delete object';
         ctl.style.zIndex   = parseInt(this.conf.z)+1;
         ctl.style.width    = size + 'px';
         ctl.style.height   = size + 'px';
@@ -901,7 +912,7 @@ var NagVisObject = Base.extend({
 
             // FIXME: Multilanguage
             if(!confirm('Really delete the object?'))
-            return;
+                return;
 
             obj.saveObject(this, null);
             obj.remove();
@@ -940,6 +951,8 @@ var NagVisObject = Base.extend({
         ctl.setAttribute('id',         this.conf.object_id+'-modify-' + num);
         ctl.setAttribute('class',     'control modify' + size);
         ctl.setAttribute('className', 'control mdoify' + size);
+       // FIXME: Multilanguage
+       ctl.title          = 'Modify object';
         ctl.style.zIndex   = parseInt(this.conf.z)+1;
         ctl.style.width    = size + 'px';
         ctl.style.height   = size + 'px';
@@ -981,6 +994,53 @@ var NagVisObject = Base.extend({
 
 
     /**
+     * Adds the modify button to the controls including
+     * all eventhandlers
+     *
+     * Author: Lars Michelsen <[email protected]>
+     */
+    parseControlToggleLineMid: function (num, objX, objY, offX, offY, size) {
+        var ctl= document.createElement('div');
+        ctl.setAttribute('id',         this.conf.object_id+'-togglemid-' + 
num);
+        ctl.setAttribute('class',     'control togglemid' + size);
+        ctl.setAttribute('className', 'control togglemid' + size);
+       // FIXME: Multilanguage
+       ctl.title          = 'Lock/Unlock line middle';
+        ctl.style.zIndex   = parseInt(this.conf.z)+1;
+        ctl.style.width    = size + 'px';
+        ctl.style.height   = size + 'px';
+        ctl.style.left     = (objX + offX) + 'px';
+        ctl.style.top      = (objY + offY) + 'px';
+        ctl.objOffsetX     = offX;
+        ctl.objOffsetY     = offY;
+
+        ctl.onclick = function(event) {
+            // In the event handler this points to the ctl object
+            var arr   = this.id.split('-');
+            var objId = arr[0];
+
+           toggleLineMidLock(event, objId);
+           contextHide();
+
+            objId = null;
+            arr   = null;
+
+            document.body.style.cursor = 'auto';
+        };
+
+        ctl.onmouseover = function() {
+            document.body.style.cursor = 'pointer';
+        };
+
+        ctl.onmouseout = function() {
+            document.body.style.cursor = 'auto';
+        };
+
+        this.addControl(ctl);
+        ctl = null;
+    },
+
+    /**
      * Handler for the move event
      *
      * Important: This is called from an event handler
@@ -1089,4 +1149,4 @@ var NagVisObject = Base.extend({
 
 
     highlight: function(show) {}
-});
\ No newline at end of file
+});
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js 
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index 1a69972..b570638 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -1008,4 +1008,4 @@ var NagVisStatefulObject = NagVisObject.extend({
         oObjIconDiv = null;
         oObjIcon    = null;
     }
-});
\ No newline at end of file
+});
diff --git a/share/userfiles/templates/default.context.html 
b/share/userfiles/templates/default.context.html
index 608ad6f..cae642b 100644
--- a/share/userfiles/templates/default.context.html
+++ b/share/userfiles/templates/default.context.html
@@ -2,11 +2,6 @@
     <li><a href="#" onClick="refreshMapObject(event, '[obj_id]'); 
contextHide();return false">[lang_refresh_status]</a></li>
     <!-- BEGIN not_automap -->
     <li><a href="#" onClick="toggleMapObjectLock(event, '[obj_id]'); 
contextHide();return false">[lang_toggle_lock]</a></li>
-    <!-- BEGIN line -->
-    <!-- BEGIN line_two_parts -->
-    <li><a href="#" onClick="toggleLineMidLock(event, '[obj_id]'); 
contextHide();return false">[lang_toggle_line_mid]</a></li>
-    <!-- END line_two_parts -->
-    <!-- END line -->
     <!-- END not_automap -->
     <!-- BEGIN host -->
     <li class="spacer"></li>
@@ -18,4 +13,4 @@
     <li><a 
href="[html_cgi]/cmd.cgi?cmd_typ=56&host=[name]&service=[service_description]" 
target="_blank">[lang_schedule_downtime]</a></li>
     <li><a 
href="[html_cgi]/cmd.cgi?cmd_typ=7&host=[name]&service=[service_description]&force_check"
 target="_blank">[lang_reschedule_next_check]</a></li>
     <!-- END service -->
-</ul>
\ No newline at end of file
+</ul>
diff --git a/share/userfiles/templates/default.css 
b/share/userfiles/templates/default.css
index 15de9aa..714bd61 100644
--- a/share/userfiles/templates/default.css
+++ b/share/userfiles/templates/default.css
@@ -152,7 +152,9 @@ div.control.modify10 {
     background-image: url('../images/templates/default.control_modify.gif');
 }
 
-
+div.control.togglemid10 {
+    background-image: url('../images/templates/default.control_togglemid.gif');
+}
 
 /* Style on info pages (index.php?info, index.php) */
 div.infopage {
@@ -606,4 +608,4 @@ td#popupWindowContent a:hover 
{color:#779D2A;text-decoration:underline}
 #sidebar li.lvl5 a{padding-left:70px;width:130px}
 #sidebar li.open a.title {background: 
url('../images/templates/default.folder_open.gif') no-repeat left #eaf0f2;}
 #sidebar li.closed a.title {background: 
url('../images/templates/default.folder_closed.gif') no-repeat left #eaf0f2;}
-#sidebar li a:hover {background-color:#d9e1e4;color:#779D2A}
\ No newline at end of file
+#sidebar li a:hover {background-color:#d9e1e4;color:#779D2A}


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to