Module: nagvis Branch: master Commit: 012ea8750fdd4425afc773243c154d2c9f5bf403 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=012ea8750fdd4425afc773243c154d2c9f5bf403
Author: Lars Michelsen <[email protected]> Date: Thu Aug 5 00:42:21 2010 +0200 Fixed hover menu positions on overview page --- share/frontend/nagvis-js/js/frontend.js | 4 +- share/frontend/nagvis-js/js/frontendContext.js | 3 +- share/frontend/nagvis-js/js/frontendHover.js | 6 ++-- share/frontend/nagvis-js/js/nagvis.js | 17 ++++++++++ share/frontend/wui/js/wui.js | 18 ----------- share/userfiles/templates/default.css | 16 ++++++---- share/userfiles/templates/default.hover.css | 39 +++++++++++------------ 7 files changed, 52 insertions(+), 51 deletions(-) diff --git a/share/frontend/nagvis-js/js/frontend.js b/share/frontend/nagvis-js/js/frontend.js index 7dcde6a..7975f67 100644 --- a/share/frontend/nagvis-js/js/frontend.js +++ b/share/frontend/nagvis-js/js/frontend.js @@ -383,7 +383,7 @@ function getHoverTemplates(aObjs) { oLink.href = oGeneralProperties.path_templates+i+'.hover.css'; oLink.rel = 'stylesheet'; oLink.type = 'text/css'; - document.body.appendChild(oLink); + document.getElementsByTagName("head")[0].appendChild(oLink); oLink = null; } } @@ -431,7 +431,7 @@ function getContextTemplates(aObjs) { oLink.href = oGeneralProperties.path_templates+sName+'.context.css'; oLink.rel = 'stylesheet'; oLink.type = 'text/css'; - document.body.appendChild(oLink); + document.getElementsByTagName("head")[0].appendChild(oLink); oLink = null; } } diff --git a/share/frontend/nagvis-js/js/frontendContext.js b/share/frontend/nagvis-js/js/frontendContext.js index 618b5e5..692ec07 100644 --- a/share/frontend/nagvis-js/js/frontendContext.js +++ b/share/frontend/nagvis-js/js/frontendContext.js @@ -161,8 +161,7 @@ function contextShow(event) { // hide the menu first to avoid an "up-then-over" visual effect contextMenu.style.display = 'none'; contextMenu.style.left = event.clientX + scrollLeft + 'px'; - // Need to corrent the position by 30px in IE & FF. Don't know why... - contextMenu.style.top = event.clientY + scrollTop - 30 + 'px'; + contextMenu.style.top = event.clientY + scrollTop - getHeaderHeight() + 'px'; contextMenu.style.display = ''; // Check if the context menu is "in screen". diff --git a/share/frontend/nagvis-js/js/frontendHover.js b/share/frontend/nagvis-js/js/frontendHover.js index ee4aecc..a712a98 100644 --- a/share/frontend/nagvis-js/js/frontendHover.js +++ b/share/frontend/nagvis-js/js/frontendHover.js @@ -63,7 +63,7 @@ function hoverShow(event, id) { // Hide all other hover menus hoverHide(); - var hoverSpacer = 20; + var hoverSpacer = 5; // document.body.scrollTop does not work in IE var scrollTop = document.body.scrollTop ? document.body.scrollTop : @@ -84,8 +84,8 @@ function hoverShow(event, id) { // hide the menu first to avoid an "up-then-over" visual effect hoverMenu.style.display = 'none'; - hoverMenu.style.left = event.clientX + scrollLeft + 'px'; - hoverMenu.style.top = event.clientY + scrollTop - hoverSpacer + 'px'; + hoverMenu.style.left = event.clientX + scrollLeft + hoverSpacer + 'px'; + hoverMenu.style.top = event.clientY + scrollTop + hoverSpacer - getHeaderHeight() + 'px'; hoverMenu.style.display = ''; // Check if the context menu is "in screen". diff --git a/share/frontend/nagvis-js/js/nagvis.js b/share/frontend/nagvis-js/js/nagvis.js index 2d5d122..e4b77fd 100644 --- a/share/frontend/nagvis-js/js/nagvis.js +++ b/share/frontend/nagvis-js/js/nagvis.js @@ -501,6 +501,23 @@ function getRandom(min, max) { return min + parseInt(Math.random() * (max-min+1), 0); } +/** + * Returns the current height of the header menu + */ +function getHeaderHeight() { + var ret = 0; + + // FIXME: Check if header is shown + + var oHeader = document.getElementById('header'); + if(oHeader) { + ret = oHeader.clientHeight; + oHeader = null; + } + + return ret; +} + function cloneObject(what) { var o; var i; diff --git a/share/frontend/wui/js/wui.js b/share/frontend/wui/js/wui.js index 0708fb4..a262cfa 100644 --- a/share/frontend/wui/js/wui.js +++ b/share/frontend/wui/js/wui.js @@ -124,24 +124,6 @@ function gridParse() { } } -// FIXME: Maybe move to nagvis-js frontend file to have it available in -// regular frontend in the future -function getHeaderHeight() { - var oHeader = null; - var ret = 0; - - // FIXME: Check if header is shown - - oHeader = document.getElementById('header'); - if(oHeader !== null) { - ret = oHeader.clientHeight; - } - - oHeader = null; - - return ret; -} - /** * validateValue(oField) * diff --git a/share/userfiles/templates/default.css b/share/userfiles/templates/default.css index 028b314..858064d 100644 --- a/share/userfiles/templates/default.css +++ b/share/userfiles/templates/default.css @@ -120,7 +120,11 @@ div.welcome a:hover {color:#779D2A} } /* Style on info pages (index.php?info, index.php) */ -div.infopage table { +div.infopage { + position:relative; +} + +div.infopage > table { margin: auto; margin-top: 25px; margin-bottom: 25px; @@ -131,7 +135,7 @@ div.infopage table { border-collapse:collapse; } -div.infopage table td, div.infopage table th { +div.infopage > table td, div.infopage > table th { border: 1px #a4a4a4 solid; padding: 4px; @@ -140,12 +144,12 @@ div.infopage table td, div.infopage table th { vertical-align: top; } -div.infopage table th { +div.infopage > table th { text-align: center; background-color: #eee; } -div.infopage table th.head { +div.infopage > table th.head { font-size: 20px; } @@ -157,11 +161,11 @@ div.infopage h2 { margin-left: 2px; } -div.infopage td.disabled h2 { +div.infopage > table td.disabled h2 { color: #a4a4a4; } -div.infopage td.error h2 { +div.infopage > table td.error h2 { color: #ff0000; } diff --git a/share/userfiles/templates/default.hover.css b/share/userfiles/templates/default.hover.css index caf41c9..bd4aca8 100644 --- a/share/userfiles/templates/default.hover.css +++ b/share/userfiles/templates/default.hover.css @@ -25,24 +25,23 @@ * @author Lars Michelsen <[email protected]> */ -/*overflow:visible;background-color:#f5f5f5;*/ div.hover {position:absolute;margin:0;padding:0;font-size:10px;color:#314455;z-index:1000} -table.hover_table {border-collapse:collapse;width:auto;margin:0;padding:0} -table.hover_table td, table.hover_table th {border:1px #a4a4a4 solid;padding:2px;font-size:9px;color:#314455} -table.hover_table th {text-align:center;background-color:#eee} -table.hover_table spacer {height:3px;background-color:#eee} -table.hover_table td.label {text-align:center;background-color:#eee} -table.hover_table td.labelACK {text-align:center;background-color: #eee} -table.hover_table td.labelPENDING {text-align:center;background-color:#eee} -table.hover_table td.labelOK, table.hover_table td.labelUP {text-align:center;background-color:#66FF66} -table.hover_table td.labelWARNING {text-align:center;background-color:#FFFF7E} -table.hover_table td.labelCRITICAL, table.hover_table td.labelDOWN, table.hover_table td.labelUNREACHABLE {text-align:center;background-color:#FFBBBB} -table.hover_table td.labelERROR {text-align:center;background-color:#eee} -table.hover_table td.labelUNKNOWN {text-align:center;background-color:#eee} -table.hover_table label {font-weight:bold} -table.hover_table td.statePENDING {background-color:#ffffff} -table.hover_table td.stateOK, table.hover_table td.stateUP {background-color:#00CC00} -table.hover_table td.stateWARNING {background-color:#FFFF00} -table.hover_table td.stateCRITICAL, table.hover_table td.stateDOWN, table.hover_table td.stateUNREACHABLE {background-color:#F83838} -table.hover_table td.stateERROR {background-color:#66CCFF} -table.hover_table td.stateUNKNOWN {background-color:#FFFF99} +div.hover > table {border-collapse:collapse;width:auto;margin:0;padding:0} +div.hover > table td, div.hover > table th {border:1px #a4a4a4 solid;padding:2px;font-size:9px;color:#314455;background-color:#f5f5f5} +div.hover > table th {text-align:center;background-color:#eee} +div.hover > table spacer {height:3px;background-color:#eee} +div.hover > table td.label {text-align:center;background-color:#eee} +div.hover > table td.labelACK {text-align:center;background-color: #eee} +div.hover > table td.labelPENDING {text-align:center;background-color:#eee} +div.hover > table td.labelOK, div.hover > table td.labelUP {text-align:center;background-color:#66FF66} +div.hover > table td.labelWARNING {text-align:center;background-color:#FFFF7E} +div.hover > table td.labelCRITICAL, div.hover > table td.labelDOWN, div.hover > table td.labelUNREACHABLE {text-align:center;background-color:#FFBBBB} +div.hover > table td.labelERROR {text-align:center;background-color:#eee} +div.hover > table td.labelUNKNOWN {text-align:center;background-color:#eee} +div.hover > table label {font-weight:bold} +div.hover > table td.statePENDING {background-color:#ffffff} +div.hover > table td.stateOK, div.hover > table td.stateUP {background-color:#00CC00} +div.hover > table td.stateWARNING {background-color:#FFFF00} +div.hover > table td.stateCRITICAL, div.hover > table td.stateDOWN, div.hover > table td.stateUNREACHABLE {background-color:#F83838} +div.hover > table td.stateERROR {background-color:#66CCFF} +div.hover > table td.stateUNKNOWN {background-color:#FFFF99} ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
