Module: nagvis
Branch: master
Commit: a23747b3e60e78f45fb4267549fee4dd4d443782
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=a23747b3e60e78f45fb4267549fee4dd4d443782

Author: Lars Michelsen <[email protected]>
Date:   Wed Nov 17 20:08:20 2010 +0100

Fixed deletion of multiple objects of same type in WUI without reloading

---

 share/frontend/wui/classes/WuiMap.php |    8 ++++----
 share/frontend/wui/js/wui.js          |   11 ++++++++++-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/share/frontend/wui/classes/WuiMap.php 
b/share/frontend/wui/classes/WuiMap.php
index 8e4e0d0..440fa17 100644
--- a/share/frontend/wui/classes/WuiMap.php
+++ b/share/frontend/wui/classes/WuiMap.php
@@ -632,26 +632,26 @@ class WuiMap extends GlobalMap {
                
                // Edit link
                $tooltipText .= '<li><a 
style="background-image:url('.$this->CORE->getMainCfg()->getValue('paths','htmlbase').'/frontend/wui/images/modify.png)"'
-                 ." href=\"#\" 
onclick=\"showFrontendDialog('".$this->CORE->getMainCfg()->getValue('paths', 
'htmlbase')."/server/core/ajax_handler.php?mod=Map&act=addModify&do=modify&show=".$this->MAPCFG->getName()."&type=".$obj['type']."&id=".$obj['id']."',
 '".$this->CORE->getLang()->getText('change')."');contextHide();\">"
+                 ." href=\"#\" 
onclick=\"showFrontendDialog('".$this->CORE->getMainCfg()->getValue('paths', 
'htmlbase')."/server/core/ajax_handler.php?mod=Map&act=addModify&do=modify&show=".$this->MAPCFG->getName()."&type=".$obj['type']."&id='+getObjectIdOfLink(this),
 '".$this->CORE->getLang()->getText('change')."');contextHide();\">"
                        
."<span>".$this->CORE->getLang()->getText('change')."</span></a></li>";
                
                // 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=".$obj['id'].";get_click('".$obj['type']."',2,'modify');\"
 onclick=\"contextHide();\">"
+                                               ." 
href=\"javascript:objid=getObjectIdOfLink(this);get_click('".$obj['type']."',2,'modify');\"
 onclick=\"contextHide();\">"
                                                
."<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=".$obj['id'].";get_click('".$obj['type']."', 1, 
'clone');\" onclick=\"contextHide();\">"
+                                               ." 
href=\"javascript:objid=getObjectIdOfLink(this);get_click('".$obj['type']."', 
1, 'clone');\" onclick=\"contextHide();\">"
                                                
."<span>".$this->CORE->getLang()->getText('Clone')."</span></a></li>";
                }
                
                // Delete link
                $tooltipText .= "<li><a 
style='background-image:url(".$this->CORE->getMainCfg()->getValue('paths','htmlbase')."/frontend/wui/images/delete.png)'"
-                 ." href='#' 
onclick='deleteMapObject(\"box_".$obj['type']."_".$obj['id']."\");contextHide();return
 false;'>"
+                 ." href='#' 
onclick='deleteMapObject(\"box_".$obj['type']."_\"+getObjectIdOfLink(this));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 1c90c8b..b4d49c0 100644
--- a/share/frontend/wui/js/wui.js
+++ b/share/frontend/wui/js/wui.js
@@ -430,8 +430,17 @@ function saveObjectAfterMoveAndDrop(oObj) {
        oResult = null;
 }
 
+function getObjectIdOfLink(obj) {
+       var par = obj.parentNode;
+       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 -1;
+}
+
 function getDomObjectIds(objId) {
-    return [ 'box_'+objId, 'icon_'+objId+'-context', 'rel_label_'+objId, 
'abs_label_'+objId ];
+    return [ 'box_'+objId, 'icon_'+objId, 'icon_'+objId+'-context', 
'rel_label_'+objId, 'abs_label_'+objId ];
 }
 
 // This function handles object deletions on maps


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to