Module: nagvis Branch: master Commit: 25ddffa1f52bea71e67469ab59126952e8df73bb URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=25ddffa1f52bea71e67469ab59126952e8df73bb
Author: Lars Michelsen <[email protected]> Date: Wed Aug 26 22:56:27 2009 +0200 Making use of new state related options in js frontend now --- share/nagvis/ajax_handler.php | 3 ++ share/nagvis/includes/classes/GlobalMainCfg.php | 2 +- share/nagvis/includes/js/frontend.js | 19 +++++++++++- share/nagvis/includes/js/nagvis.js | 36 ----------------------- 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/share/nagvis/ajax_handler.php b/share/nagvis/ajax_handler.php index 6a77cd3..3aa8db4 100755 --- a/share/nagvis/ajax_handler.php +++ b/share/nagvis/ajax_handler.php @@ -236,6 +236,9 @@ switch($_GET['action']) { echo $MAP->parseObjectsJson(); } break; + case 'getStateProperties': + echo json_encode($CORE->MAINCFG->getStateWeight()); + break; case 'getHoverTemplate': if(!isset($_GET['name']) || $_GET['name'] == '') { echo 'Error: '.$CORE->LANG->getText('parameterNameNotSet'); diff --git a/share/nagvis/includes/classes/GlobalMainCfg.php b/share/nagvis/includes/classes/GlobalMainCfg.php index 037154e..9297568 100644 --- a/share/nagvis/includes/classes/GlobalMainCfg.php +++ b/share/nagvis/includes/classes/GlobalMainCfg.php @@ -245,7 +245,7 @@ class GlobalMainCfg { 'pending' => Array('must' => 1, 'editable' => 1, 'default' => '0', - 'match' => MATCH_INTEGER) + 'match' => MATCH_INTEGER), 'pending_bgcolor' => Array('must' => 1, 'editable' => 1, 'default' => '#C0C0C0', diff --git a/share/nagvis/includes/js/frontend.js b/share/nagvis/includes/js/frontend.js index c2a8a9c..11425ae 100755 --- a/share/nagvis/includes/js/frontend.js +++ b/share/nagvis/includes/js/frontend.js @@ -317,7 +317,7 @@ function getBackgroundColor(oObj) { if(oObj.summary_state == 'PENDING' || oObj.summary_state == 'OK' || oObj.summary_state == 'UP') { sColor = oPageProperties.background_color; } else { - sColor = oStates[oObj.summary_state].bgColor; + sColor = oStates[oObj.summary_state].bgcolor; } oObj = null; @@ -1081,6 +1081,19 @@ function getMapProperties(mapName) { } /** + * getStateProperties() + * + * Fetches the current state properties like colors and + * sounds from the core + * + * @return Boolean Success? + * @author Lars Michelsen <[email protected]> + */ +function getStateProperties() { + return getSyncRequest(oGeneralProperties.path_htmlbase+'/nagvis/ajax_handler.php?action=getStateProperties') +} + +/** * parseMap() * * Parses the map on initial page load or changed map configuration @@ -1192,6 +1205,10 @@ function runWorker(iCount, sType, sIdentifier) { // Initialize everything eventlog("worker", "info", "Initializing Worker (Run-ID: "+iCount+")"); + // Load state properties + eventlog("worker", "debug", "Loading the state properties"); + oStates = getStateProperties(); + // Handle the page rendering if(sType == 'map') { // Loading a simple map diff --git a/share/nagvis/includes/js/nagvis.js b/share/nagvis/includes/js/nagvis.js index 67912bf..c85b7b0 100644 --- a/share/nagvis/includes/js/nagvis.js +++ b/share/nagvis/includes/js/nagvis.js @@ -45,42 +45,6 @@ var iNow = Date.parse(new Date()); // Define some state options var oStates = {}; -oStates.UNREACHABLE = {}; -oStates.UNREACHABLE.color = '#F1811B'; -oStates.UNREACHABLE.bgColor = '#F1811B'; -oStates.UNREACHABLE.sound = 'std_unreachable.mp3'; -oStates.DOWN = {}; -oStates.DOWN.color = '#FF0000'; -oStates.DOWN.bgColor = '#FF0000'; -oStates.DOWN.sound = 'std_down.mp3'; -oStates.CRITICAL = {}; -oStates.CRITICAL.color = '#FF0000'; -oStates.CRITICAL.bgColor = '#FF0000'; -oStates.CRITICAL.sound = 'std_critical.mp3'; -oStates.WARNING = {}; -oStates.WARNING.color = '#FFFF00'; -oStates.WARNING.bgColor = '#FFFF00'; -oStates.WARNING.sound = 'std_warning.mp3'; -oStates.UNKNOWN = {}; -oStates.UNKNOWN.color = '#FFCC66'; -oStates.UNKNOWN.bgColor = '#FFCC66'; -oStates.UNKNOWN.sound = ''; -oStates.ERROR = {}; -oStates.ERROR.color = '#0000FF'; -oStates.ERROR.bgColor = '#0000FF'; -oStates.ERROR.sound = ''; -oStates.UP = {}; -oStates.UP.color = '#00FF00'; -oStates.UP.bgColor = '#00FF00'; -oStates.UP.sound = ''; -oStates.OK = {}; -oStates.OK.color = '#00FF00'; -oStates.OK.bgColor = '#00FF00'; -oStates.OK.sound = ''; -oStates.PENDING = {}; -oStates.PENDING.color = '#C0C0C0'; -oStates.PENDING.bgColor = '#C0C0C0'; -oStates.PENDING.sound = ''; function date(format, timestamp) { // http://kevin.vanzonneveld.net ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
