Module: nagvis Branch: master Commit: 8fbb6582d77f0c2e82a03cf86e02c3d3cc0c2ec5 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=8fbb6582d77f0c2e82a03cf86e02c3d3cc0c2ec5
Author: Lars Michelsen <[email protected]> Date: Wed Dec 29 11:04:16 2010 +0100 Better error handling on problems during ajax requests --- share/frontend/nagvis-js/js/frontend.js | 33 ++++++++++++++++--------------- share/frontend/nagvis-js/js/nagvis.js | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/share/frontend/nagvis-js/js/frontend.js b/share/frontend/nagvis-js/js/frontend.js index 3f257b1..2b2840f 100644 --- a/share/frontend/nagvis-js/js/frontend.js +++ b/share/frontend/nagvis-js/js/frontend.js @@ -129,7 +129,7 @@ function showFrontendDialog(sUrl, sTitle, sWidth) { } var oContent = getSyncRequest(sUrl, false, false); - if(oContent && typeof oContent !== 'undefined') { + if(isset(oContent)) { // Store url for maybe later refresh oContent.url = sUrl; @@ -292,16 +292,19 @@ function getCfgFileAges(viewType, mapName) { if(!isset(mapName)) var mapName = oPageProperties.map_name; - if(viewType === 'map') { - viewType = null; - return getSyncRequest(oGeneralProperties.path_server+'?mod=General&act=getCfgFileAges&f[]=mainCfg&m[]='+escapeUrlValues(mapName), true); - } else if(viewType === 'automap') { - viewType = null; - return getSyncRequest(oGeneralProperties.path_server+'?mod=General&act=getCfgFileAges&f[]=mainCfg&am[]='+escapeUrlValues(mapName), true); - } else { - viewType = null; - return getSyncRequest(oGeneralProperties.path_server+'?mod=General&act=getCfgFileAges&f[]=mainCfg', true); - } + var result = null; + if(viewType === 'map') + result = getSyncRequest(oGeneralProperties.path_server+'?mod=General&act=getCfgFileAges&f[]=mainCfg&m[]='+escapeUrlValues(mapName), true); + else if(viewType === 'automap') + result = getSyncRequest(oGeneralProperties.path_server+'?mod=General&act=getCfgFileAges&f[]=mainCfg&am[]='+escapeUrlValues(mapName), true); + else + result = getSyncRequest(oGeneralProperties.path_server+'?mod=General&act=getCfgFileAges&f[]=mainCfg', true); + + viewType = null; + if(isset(result)) + return result; + else + return {}; } /** @@ -860,14 +863,12 @@ function refreshMapObject(objectId) { name = null; var bStateChanged = false; - if(o.length > 0) { + if(isset(o) && o.length > 0) bStateChanged = updateObjects(o, aMapObjects, oPageProperties.view_type); - } o = null; - if(bStateChanged) { + if(bStateChanged) updateMapBasics(); - } bStateChanged = null; } @@ -1755,7 +1756,7 @@ function parseUrl(sUrl) { + '?mod=Url&act=getContents&show=' + escapeUrlValues(sUrl)); - if(typeof oUrlContents !== 'undefined' && oUrlContents.content) { + if(isset(oUrlContents)) { // Replace the current contents with the new url var urlContainer = document.getElementById('url'); urlContainer.innerHTML = oUrlContents.content; diff --git a/share/frontend/nagvis-js/js/nagvis.js b/share/frontend/nagvis-js/js/nagvis.js index b1dd140..1baf2a0 100644 --- a/share/frontend/nagvis-js/js/nagvis.js +++ b/share/frontend/nagvis-js/js/nagvis.js @@ -1009,7 +1009,7 @@ function storeUserOption(key, value) { * @author Lars Michelsen <[email protected]> */ function isset(v) { - return typeof(v) !== 'undefined'; + return typeof(v) !== 'undefined' && v !== null; } /*** Handles the object dragging ***/ ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
