Module: nagvis Branch: nagvis-1.5 Commit: 4a8672fedc4a811594cc0fa0120d5c8f1efc125c URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=4a8672fedc4a811594cc0fa0120d5c8f1efc125c
Author: Lars Michelsen <[email protected]> Date: Thu Dec 2 14:52:22 2010 +0100 Made js code more resistant against wrong urls; Fixed line reposition/moving in WUI --- share/frontend/nagvis-js/js/ajax.js | 4 ++-- share/frontend/nagvis-js/js/nagvis.js | 2 ++ share/frontend/wui/classes/WuiMap.php | 4 ++-- share/frontend/wui/js/wui.js | 7 +++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/share/frontend/nagvis-js/js/ajax.js b/share/frontend/nagvis-js/js/ajax.js index 96adf61..f88255e 100644 --- a/share/frontend/nagvis-js/js/ajax.js +++ b/share/frontend/nagvis-js/js/ajax.js @@ -210,10 +210,10 @@ function getSyncRequest(sUrl, bCacheable, bRetryable) { var sResponse = null; var responseText; - if(bCacheable === null) + if(!isset(bCacheable)) bCacheable = true; - if(bRetryable === null) + if(!isset(bRetryable)) bRetryable = true; // Encode the url diff --git a/share/frontend/nagvis-js/js/nagvis.js b/share/frontend/nagvis-js/js/nagvis.js index 4d053f2..01b2712 100644 --- a/share/frontend/nagvis-js/js/nagvis.js +++ b/share/frontend/nagvis-js/js/nagvis.js @@ -812,6 +812,8 @@ addDOMLoadEvent = (function(){ * @author Lars Michelsen <[email protected]> */ function handleJSError(sMsg, sUrl, iLine) { + if(!isset(sUrl)) + var sUrl = '<Empty URL>'; // Log to javascript eventlog eventlog("js-error", "critical", "JS-Error occured: " + sMsg + " " + sUrl + " (" + iLine + ")"); diff --git a/share/frontend/wui/classes/WuiMap.php b/share/frontend/wui/classes/WuiMap.php index b074694..485ebd6 100644 --- a/share/frontend/wui/classes/WuiMap.php +++ b/share/frontend/wui/classes/WuiMap.php @@ -638,14 +638,14 @@ class WuiMap extends GlobalMap { // Position/Size link on lines if($obj['type'] == 'line' || (isset($obj['view_type']) && $obj['view_type'] == 'line')) { $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/move.png)'" - ." href=\"javascript:objid=getObjectIdOfLink(this);get_click('".$obj['type']."',2,'modify');\" onclick=\"contextHide();\">" + ." onclick=\"objid=getObjectIdOfLink(this);contextHide();\" href=\"javascript:get_click('".$obj['type']."',2,'modify');\">" ."<span>".$this->CORE->getLang()->getText('positionSize')."</span></a></li>"; } // Show clone link only for icons if((isset($obj['view_type']) && $obj['view_type'] == 'icon') || $obj['type'] == 'shape') { $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/clone.png)'" - ." href=\"javascript:objid=getObjectIdOfLink(this);get_click('".$obj['type']."', 1, 'clone');\" onclick=\"contextHide();\">" + ." onclick=\"objid=getObjectIdOfLink(this);contextHide();\" href=\"javascript:get_click('".$obj['type']."', 1, 'clone');\">" ."<span>".$this->CORE->getLang()->getText('Clone')."</span></a></li>"; } diff --git a/share/frontend/wui/js/wui.js b/share/frontend/wui/js/wui.js index 46fcef7..1c330ff 100644 --- a/share/frontend/wui/js/wui.js +++ b/share/frontend/wui/js/wui.js @@ -308,7 +308,7 @@ function get_click_pos(e) { } follow_mouse = false; - var sUrl; + var sUrl = ''; if(action_click == 'add' || action_click == 'clone') { sUrl = oGeneralProperties.path_server+'?mod=Map&act=addModify&do=add&show='+mapname+'&type='+objtype+'&coords='+coords+'&viewType='+viewType; @@ -318,6 +318,9 @@ function get_click_pos(e) { } else if(action_click == 'modify' && objid !== -1) { sUrl = oGeneralProperties.path_server+'?mod=Map&act=addModify&do=modify&show='+mapname+'&type='+objtype+'&id='+objid+'&coords='+coords; } + + if(sUrl === '') + return false; showFrontendDialog(sUrl, printLang(lang['properties'], '')); @@ -435,7 +438,7 @@ function getObjectIdOfLink(obj) { while(par && par.tagName != 'DIV') par = par.parentNode; if(par && par.tagName == 'DIV' && typeof par.id !== 'undefined') - return par.id.split('_')[2].split('-')[0] + return par.id.split('_')[2].split('-')[0]; return -1; } ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
