Author:   Lars Michelsen <[email protected]>
Date:     Mon Mar  5 20:00:21 2012 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Mon Mar  5 20:02:57 2012 +0100

Bugfix: Stateless lines - only showing the hover area when it is needed

Conflicts:

        share/frontend/nagvis-js/js/NagVisObject.js

---

 ChangeLog                                   |    1 +
 share/frontend/nagvis-js/js/NagVisObject.js |   24 +++++++++++++++++++-----
 share/server/core/mapcfg/default.php        |   19 +++++++++++++------
 3 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 77283e0..bc53ded 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Core
 
 Frontend
   * Bugfix: Fixed cloning shape objects (view_type error message)
+  * Bugfix: Stateless lines - only showing the hover area when it is needed
 
 1.6.4
 Core
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index fd6b6ff..e2400c5 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -91,6 +91,10 @@ var NagVisObject = Base.extend({
      * @author Lars Michelsen <[email protected]>
      */
     loadViewOpts: function() {
+        // Do not load the view options for stateless lines
+        if(this.conf.type == 'line')
+            return;
+
         // View specific hover modifier set. Will override the map configured 
option
         if(oViewProperties && oViewProperties.enableHover && 
oViewProperties.enableHover != '')
             this.conf.hover_menu = oViewProperties.enableHover;
@@ -189,7 +193,7 @@ var NagVisObject = Base.extend({
      */
     parseContextMenu: function () {
         // Add a context menu to the object when enabled or when the object is 
unlocked
-        if((this.conf.context_menu && this.conf.context_menu == '1') || 
!this.bIsLocked) {
+        if(this.needsContextMenu()) {
             if(this.conf.view_type && this.conf.view_type == 'line') {
                 this.getContextMenu(this.conf.object_id+'-linelink');
             } else if(this.conf.type == 'textbox') {
@@ -958,12 +962,22 @@ var NagVisObject = Base.extend({
         this.drawLine();
     },
 
+    needsContextMenu: function () {
+        return (this.conf.context_menu && this.conf.context_menu !== '' && 
this.conf.context_menu !== '0'
+            && this.conf.context_template && this.conf.context_template !== 
'') || !this.bIsLocked;
+    },
+
+    needsHoverMenu: function() {
+        return this.conf.hover_menu && this.conf.hover_menu !== '' && 
this.conf.hover_menu !== '0'
+            && this.conf.hover_template && this.conf.hover_template !== ''
+    },
+
+    needsLink: function() {
+        return this.conf.url && this.conf.url !== '' && this.conf.url !== '#';
+    },
 
     needsLineHoverArea: function() {
-        return (this.conf.url && this.conf.url !== '' && this.conf.url !== '#')
-            || (this.conf.hover_menu && this.conf.hover_menu !== '')
-            || (this.conf.context_menu && this.conf.context_menu !== '')
-            || !this.bIsLocked;
+        return this.needsHoverMenu() || this.needsContextMenu() || 
this.needsLink() || !this.bIsLocked;
     },
 
     parseLineHoverArea: function(oContainer) {
diff --git a/share/server/core/mapcfg/default.php 
b/share/server/core/mapcfg/default.php
index 769cbad..58b3ff4 100644
--- a/share/server/core/mapcfg/default.php
+++ b/share/server/core/mapcfg/default.php
@@ -203,10 +203,11 @@ $mapConfigVars = Array(
     ),
 
     'context_menu' => Array(
-        'must' => 0,
-        'default' => cfg('defaults', 'contextmenu'),
-        'match' => MATCH_BOOLEAN,
-        'field_type' => 'boolean'),
+        'must'       => 0,
+        'default'    => cfg('defaults', 'contextmenu'),
+        'match'      => MATCH_BOOLEAN,
+        'field_type' => 'boolean',
+    ),
     'context_template' => Array(
         'must'          => 0,
         'default'       => cfg('defaults', 'contexttemplate'),
@@ -799,6 +800,12 @@ $mapConfigVars = Array(
     ),
 );
 
+// STATELESS LINE SPECIFIC OPTIONS
+$mapConfigVars['context_menu_line'] = $mapConfigVars['context_menu'];
+$mapConfigVars['context_menu_line']['default'] = '0';
+$mapConfigVars['hover_menu_line'] = $mapConfigVars['hover_menu'];
+$mapConfigVars['hover_menu_line']['default'] = '0';
+
 //
 // map configuration variable registration
 //
@@ -1096,9 +1103,9 @@ $mapConfigVarMap['line'] = Array(
     'line_width' => null,
     'line_color' => null,
     'line_color_border' => null,
-    'context_menu' => null,
+    'context_menu_line' => 'context_menu',
     'context_template' => null,
-    'hover_menu' => null,
+    'hover_menu_line' => 'hover_menu',
     'hover_template' => null,
     'hover_url' => null,
     'hover_delay' => null,


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to