Author: Lars Michelsen <[email protected]>
Date: Wed Apr 20 12:32:34 2011 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Wed Apr 20 12:32:34 2011 +0200
Added an indicator for the edit mode to the header menu
---
share/frontend/nagvis-js/js/edit.js | 4 ++--
share/frontend/nagvis-js/js/frontend.js | 23 ++++++++++++++++++++---
share/userfiles/templates/default.css | 1 +
share/userfiles/templates/default.header.html | 3 +++
4 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/share/frontend/nagvis-js/js/edit.js
b/share/frontend/nagvis-js/js/edit.js
index 838a23d..e709fee 100644
--- a/share/frontend/nagvis-js/js/edit.js
+++ b/share/frontend/nagvis-js/js/edit.js
@@ -38,7 +38,7 @@ function toggleLineMidLock(objectId) {
* @author Lars Michelsen <[email protected]>
*/
function toggleMapObjectLock(objectId) {
- iNumUnlocked += getMapObjByDomObjId(objectId).toggleLock();
+ updateNumUnlocked(getMapObjByDomObjId(objectId).toggleLock());
}
/**
@@ -52,7 +52,7 @@ function toggleAllMapObjectsLock() {
lock = true;
for(var i in oMapObjects)
- iNumUnlocked += oMapObjects[i].toggleLock(lock);
+ updateNumUnlocked(oMapObjects[i].toggleLock(lock));
if(!lock)
storeUserOption('unlocked-' + oPageProperties.map_name, '*');
diff --git a/share/frontend/nagvis-js/js/frontend.js
b/share/frontend/nagvis-js/js/frontend.js
index 37d90c6..0c02615 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -824,6 +824,23 @@ function getMapObjByDomObjId(id) {
}
}
+function updateNumUnlocked(num) {
+ iNumUnlocked += num;
+ if(iNumUnlocked == 0) {
+ 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;
+ }
+ }
+}
+
/**
* Removes an element from the map
*
@@ -834,7 +851,7 @@ function removeMapObject(objectId) {
obj.detachChilds();
obj.remove();
if(!obj.bIsLocked)
- iNumUnlocked -= 1;
+ updateNumUnlocked(-1);
obj = null;
saveObjectRemove(objectId);
}
@@ -1014,7 +1031,7 @@ function setMapObjects(aMapObjectConf) {
// Save the number of unlocked objects
if(!oObj.bIsLocked)
- iNumUnlocked += 1;
+ updateNumUnlocked(1);
// Save object to map objects array
if(oObj !== null)
@@ -1610,7 +1627,7 @@ function parseMap(iMapCfgAge, type, mapName) {
obj.remove();
if(!obj.bIsLocked)
- iNumUnlocked -= 1;
+ updateNumUnlocked(-1);
obj = null;
diff --git a/share/userfiles/templates/default.css
b/share/userfiles/templates/default.css
index 47a6157..f63bc34 100644
--- a/share/userfiles/templates/default.css
+++ b/share/userfiles/templates/default.css
@@ -573,6 +573,7 @@ td#popupWindowContent a:hover
{color:#779D2A;text-decoration:underline}
text-decoration: none;
}
+#editIndicator span
{margin:0;padding:0;width:100%;height:31px;padding-left:8px;padding-right:8px;line-height:31px;font-weight:bold;width:90px;color:#ff0000}
.dropdown {margin:0;padding:0;width:100%;position:relative;z-index:100}
.dropdown dt, .header div#refreshCounterHead
{margin:0;padding:0;width:100%;height:31px;padding-left:8px;padding-right:8px;line-height:31px;font-weight:bold;cursor:pointer;background:url('../images/templates/default.header.png')}
.dropdown dt:hover
{background:url('../images/templates/default.header_over.png')}
diff --git a/share/userfiles/templates/default.header.html
b/share/userfiles/templates/default.header.html
index a006053..f120b95 100644
--- a/share/userfiles/templates/default.header.html
+++ b/share/userfiles/templates/default.header.html
@@ -136,6 +136,9 @@
</ul>
<ul class="head right">
<li><div id="refreshCounterHead"></div></li>
+ <li id="editIndicator" style="display:none">
+ <span>Edit Mode!</span>
+ </li>
<li>
<dl class="dropdown">
<dt id="user-ddheader" onmouseover="ddMenu('user',1)"
onmouseout="ddMenu('user',-1)">{$langUser}<img
src="{$pathTemplateImages}default.header_down.png" alt="∇" /></dt>
------------------------------------------------------------------------------
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