Module: nagvis Branch: master Commit: 93dbe00d2d1dc38356924d7241337f32cbaf16d9 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=93dbe00d2d1dc38356924d7241337f32cbaf16d9
Author: LaMi <[email protected]> Date: Tue Jan 12 22:40:34 2010 +0100 Fixed WUI object context menu links --- share/frontend/nagvis-js/js/frontendContext.js | 19 +++++++++++-------- share/frontend/wui/classes/WuiMap.php | 9 ++++----- share/frontend/wui/js/wui.js | 9 ++++----- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/share/frontend/nagvis-js/js/frontendContext.js b/share/frontend/nagvis-js/js/frontendContext.js index 18df30c..61d5cfa 100644 --- a/share/frontend/nagvis-js/js/frontendContext.js +++ b/share/frontend/nagvis-js/js/frontendContext.js @@ -77,16 +77,19 @@ function contextMouseDown(event) { } // Workaround for the different structure of targets on lines/icons - // Would be nice to fix the structure - var id; - if(target !== null && target.id !== '') { - id = target.id; - } else { - if(target.parentNode !== null && target.parentNode.parentNode !== null && target.parentNode.parentNode.parentNode !== null) { - id = target.parentNode.parentNode.parentNode.id; - } + // Would be nice to fix the structure + // For example needed by the WUI contextMenu links + var oNode = target; + while(oNode.parentNode !== null && (typeof oNode.id === 'undefined' || oNode.id === '')) { + oNode = oNode.parentNode; + } + + if(typeof oNode.id !== 'undefined' && oNode.id !== '') { + id = oNode.id; } + oNode = null; + //document.getElementById('box_host_0').appendChild(document.createTextNode("click: "+id+"\n")); // Hide all context menus except clicking the current open context menu if(id === -1 || id.indexOf('http:') === -1 && id.indexOf('-context') === -1) { // Hide all context menus diff --git a/share/frontend/wui/classes/WuiMap.php b/share/frontend/wui/classes/WuiMap.php index cf9cea6..4621a21 100644 --- a/share/frontend/wui/classes/WuiMap.php +++ b/share/frontend/wui/classes/WuiMap.php @@ -635,22 +635,21 @@ class WuiMap extends GlobalMap { // Edit link $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/internal/modify.png)'" - ." href=# onclick=popupWindow('".$this->CORE->getLang()->getText('change')."'," - ."getSyncRequest('./ajax_handler.php?action=getFormContents&form=addmodify&do=modify&map=".$this->MAPCFG->getName()."&type=".$obj['type']."&id=".$obj['id']."',true,false));>" + ." href=\"#\" onclick=\"popupWindow('".$this->CORE->getLang()->getText('change')."'," + ."getSyncRequest('./ajax_handler.php?action=getFormContents&form=addmodify&do=modify&map=".$this->MAPCFG->getName()."&type=".$obj['type']."&id=".$obj['id']."',true,false));contextHide();\">" ."<span>".$this->CORE->getLang()->getText('change')."</span></a></li>"; // Position/Size link on textboxes/lines //$tooltipText .= " ".$positionSizeText; 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/internal/move.png)'" - ." href=javascript:objid=".$obj['id'].";get_click('".$obj['type']."',2,'modify');>" + ." href=\"javascript:objid=".$obj['id'].";get_click('".$obj['type']."',2,'modify');\" onclick=\"contextHide();\">" ."<span>".$this->CORE->getLang()->getText('positionSize')."</span></a></li>"; } // Delete link $tooltipText .= "<li><a style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/internal/delete.png)'" - ." href='#' id='delete_".$obj['type']."_".$obj['id']."'" - ." onClick='return deleteMapObject(this);return false;'>" + ." href='#' onclick='deleteMapObject(\"box_".$obj['type']."_".$obj['id']."\");contextHide();return false;'>" ."<span>".$this->CORE->getLang()->getText('delete')."</span></a></li>"; $tooltipText .= "</ul>"; diff --git a/share/frontend/wui/js/wui.js b/share/frontend/wui/js/wui.js index 11e3f1c..91797cd 100644 --- a/share/frontend/wui/js/wui.js +++ b/share/frontend/wui/js/wui.js @@ -464,9 +464,9 @@ function saveObjectAfterMoveAndDrop(oObj) { } // This function handles object deletions on maps -function deleteMapObject(oObj) { +function deleteMapObject(objId) { if(confirm(printLang(lang['confirmDelete'],''))) { - var arr = oObj.id.split('_'); + var arr = objId.split('_'); var map = mapname; var type = arr[1]; var id = arr[2]; @@ -480,8 +480,7 @@ function deleteMapObject(oObj) { oResult = null; // Remove the object from the map - document.getElementById('mymap').removeChild(document.getElementById('box_'+type+'_'+id)); - oObj = null; + document.getElementById('mymap').removeChild(document.getElementById(objId)); return true; } else { @@ -674,4 +673,4 @@ function toggleFieldType(sName, sValue) { } return bReturn; -} \ No newline at end of file +} ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
