Author: Lars Michelsen <[email protected]>
Date: Thu Aug 25 17:16:37 2011 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Thu Aug 25 17:16:37 2011 +0200
Also disabling the object left click actions in unlocked mode
---
ChangeLog | 1 +
share/frontend/nagvis-js/js/NagVisObject.js | 8 ++--
.../frontend/nagvis-js/js/NagVisStatefulObject.js | 44 +++++++++++++-------
3 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b20faa4..a2cf630 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@ Core
Frontend
* Readded the "edit" action to the maps module. In this mode all object are
automatically unlocked and changes to the lock state are not persisted
+ * Also disabling the object left click actions in unlocked mode
* Bugfix: Fixed several umlauts in edit mode warning messages
* Bugfix: Fixed 100% sidebar height
* Bugfix: Fixed initial positioning of relative positioned gadgets
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js
b/share/frontend/nagvis-js/js/NagVisObject.js
index 18241df..3b83cb4 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -354,8 +354,8 @@ var NagVisObject = Base.extend({
}
// Disable the hover menu by object lock when unlocked
- if(typeof(this.toggleHoverMenu) == 'function')
- this.toggleHoverMenu(this.bIsLocked);
+ if(typeof(this.toggleObjectActions) == 'function')
+ this.toggleObjectActions(this.bIsLocked);
}
justCreated = null;
@@ -415,8 +415,8 @@ var NagVisObject = Base.extend({
if(typeof(this.toggleLabelLock) == 'function')
this.toggleLabelLock();
- if(typeof(this.toggleHoverMenu) == 'function')
- this.toggleHoverMenu(this.bIsLocked);
+ if(typeof(this.toggleObjectActions) == 'function')
+ this.toggleObjectActions(this.bIsLocked);
// Only save the user option when not using the edit_mode
if(!isset(lock) && (!oViewProperties.hasOwnProperty('edit_mode')
|| oViewProperties['edit_mode'] !== true)) {
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index 975bff7..4e0b767 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -354,6 +354,16 @@ var NagVisStatefulObject = NagVisObject.extend({
},
/**
+ * Returns the object ID of the object
+ */
+ getJsObjId: function() {
+ if(this.conf.view_type && this.conf.view_type === 'line')
+ return this.conf.object_id+'-linelink';
+ else
+ return this.conf.object_id+'-icon';
+ },
+
+ /**
* PUBLIC parseHoverMenu()
*
* Parses the hover menu. Don't add this functionality to the normal icon
@@ -363,39 +373,42 @@ var NagVisStatefulObject = NagVisObject.extend({
* @author Lars Michelsen <[email protected]>
*/
parseHoverMenu: function () {
- if(this.conf.view_type && this.conf.view_type === 'line')
- this.getHoverMenu(this.conf.object_id+'-linelink');
- else
- this.getHoverMenu(this.conf.object_id+'-icon');
+ this.getHoverMenu(this.getJsObjId());
},
/**
- * PUBLIC toggleHoverMenu()
+ * PUBLIC toggleObjectActions()
*
- * This enables/disables the hover menu temporary. e.g. in unlocked
- * mode the hover menu shal be suppressed.
+ * This enables/disables the hover menu and the icon link
+ * temporary. e.g. in unlocked mode the hover menu shal be suppressed.
*
* @author Lars Michelsen <[email protected]>
*/
- toggleHoverMenu: function(enable) {
- if(this.conf.view_type && this.conf.view_type === 'line')
- var objId = this.conf.object_id+'-linelink';
- else
- var objId = this.conf.object_id+'-icon';
-
- var o = document.getElementById(objId);
+ toggleObjectActions: function(enable) {
+ var o = document.getElementById(this.getJsObjId());
if(o) {
if(enable && isset(o.disabled_onmousemove)) {
+ // Hover-menu
o.onmousemove = o.disabled_onmousemove;
o.onmouseout = o.disabled_onmouseout;
o.disabled_onmousemove = null;
o.disabled_onmouseout = null;
+
+ // Link (Left mouse action)
+ if(o.parentNode.tagName == 'A')
+ o.parentNode.onclick = null;
} else if(!enable) {
+ // Hover-menu
o.disabled_onmousemove = o.onmousemove;
o.disabled_onmouseout = o.onmouseout;
o.onmousemove = null;
o.onmouseout = null;
+
+ // Link (Left mouse action)
+ if(o.parentNode.tagName == 'A')
+ o.parentNode.onclick = function() {return false};
}
+ o = null;
}
},
@@ -517,7 +530,8 @@ var NagVisStatefulObject = NagVisObject.extend({
// Parse hover/link area only when needed. This is only the container
// The real area or labels are added later
- if((this.conf.url && this.conf.url !== '' && this.conf.url !== '#') ||
(this.conf.hover_menu && this.conf.hover_menu !== '')) {
+ if((this.conf.url && this.conf.url !== '' && this.conf.url !== '#')
+ || (this.conf.hover_menu && this.conf.hover_menu !== '')) {
var oLink = doc.createElement('a');
oLink.setAttribute('id', this.conf.object_id+'-linelink');
oLink.setAttribute('class', 'linelink');
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins