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

Author: LaMi <[email protected]>
Date:   Sat Jan 16 17:12:20 2010 +0100

Fixed WUI context menu on textboxes

---

 share/frontend/nagvis-js/js/frontendContext.js |   15 +++++++++++++++
 share/frontend/wui/classes/WuiMap.php          |    9 ++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/share/frontend/nagvis-js/js/frontendContext.js 
b/share/frontend/nagvis-js/js/frontendContext.js
index 61d5cfa..b560b0b 100644
--- a/share/frontend/nagvis-js/js/frontendContext.js
+++ b/share/frontend/nagvis-js/js/frontendContext.js
@@ -146,6 +146,13 @@ function contextShow(event) {
                if(target.id !== '') {
                        id = target.id;
                }
+
+               if(typeof id === 'undefined') {
+                       eventlog("context", "error", "Target object search had 
no id");
+
+                       _replaceContext = false;
+                       return false;
+               }
                
                // Only the object id is interesing so remove the other contents
                // like -icon or -line. Simply split the string by - and take 
the
@@ -157,6 +164,14 @@ function contextShow(event) {
                }
                
                var contextMenu = document.getElementById(id+'-context');
+
+               // Maybe there is no context menu defined for one object?
+               if(contextMenu === null) {
+                       eventlog("context", "error", "Found no context menu wit 
the id \""+id+"-context\"");
+                       
+                       _replaceContext = false;
+                       return false;
+               }
                
                // hide the menu first to avoid an "up-then-over" visual effect
                contextMenu.style.display = 'none';
diff --git a/share/frontend/wui/classes/WuiMap.php 
b/share/frontend/wui/classes/WuiMap.php
index 9fdab3f..697978e 100644
--- a/share/frontend/wui/classes/WuiMap.php
+++ b/share/frontend/wui/classes/WuiMap.php
@@ -559,7 +559,7 @@ class WuiMap extends GlobalMap {
                
                $id = 'box_'.$obj['type'].'_'.$obj['id'];
                
-               $ret .= "<div id=\"".$id."\" class=\"box resizeMe\" 
style=\"border-color:".$sBorderColor.";background-color:".$sBgColor.";left:".$obj['x']."px;top:".$obj['y']."px;z-index:".$obj['z'].";width:".$obj['w'].";height:".$obj['h'].";overflow:visible;\"
 onmousedown=\"contextMouseDown(event);\" 
oncontextmenu=\"contextShow(event);\">";
+               $ret .= "<div id=\"".$id."\" class=\"box resizeMe\" 
style=\"border-color:".$sBorderColor.";background-color:".$sBgColor.";left:".$obj['x']."px;top:".$obj['y']."px;z-index:".$obj['z'].";width:".$obj['w'].";height:".$obj['h'].";overflow:visible;\"
 onmousedown=\"contextMouseDown(event);\" oncontextmenu=\"return 
contextShow(event);\">";
                $ret .= "\t<span>".$obj['text']."</span>";
                $ret .= "</div>";
                $ret .= $this->parseContextMenu($obj);
@@ -569,7 +569,11 @@ class WuiMap extends GlobalMap {
        }
 
        function parseContextMenu($obj) {
-               $id = 'icon_'.$obj['type'].'_'.$obj['id'].'-context';
+               if($obj['type'] === 'textbox') {
+                       $id = 'box_'.$obj['type'].'_'.$obj['id'].'-context';
+               } else {
+                       $id = 'icon_'.$obj['type'].'_'.$obj['id'].'-context';
+               }
                
                $ret = '<div id="'.$id.'" class="context" 
style="z-index:1000;display:none;position:absolute;overflow:visible;"';
                $ret .= $this->infoBox($obj);
@@ -640,7 +644,6 @@ class WuiMap extends GlobalMap {
                        
."<span>".$this->CORE->getLang()->getText('change')."</span></a></li>";
                
                // Position/Size link on textboxes/lines
-               //$tooltipText .= "&nbsp;".$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');\"
 onclick=\"contextHide();\">"


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to