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

Author: LaMi <l...@vertical-visions.de>
Date:   Wed Jan  6 21:48:44 2010 +0100

Fixed line_type validation

---

 share/frontend/nagvis-js/js/NagVisObject.js |    7 +++++++
 share/frontend/wui/js/addmodify.js          |    2 +-
 share/server/core/classes/GlobalMapCfg.php  |    2 +-
 share/server/core/defines/matches.php       |    2 +-
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisObject.js 
b/share/frontend/nagvis-js/js/NagVisObject.js
index 1f83314..b9f1bf2 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -104,8 +104,15 @@ var NagVisObject = Base.extend({
                        var oObj = document.getElementById(sObjId);
                        var oContainer = 
document.getElementById(this.conf.object_id);
                        
+                       if(oObj == null) {
+                               eventlog("NagVisObject", "critical", "Could not 
get context menu object (ID:"+sObjId+")");
+                               return false;
+                       }
+                       
                        if(oContainer == null) {
                                eventlog("NagVisObject", "critical", "Could not 
get context menu container (ID:"+this.conf.object_id+")");
+                               oObj = null; 
+                               return false;
                        }
                        
                        // Only create a new div when the context menu does not 
exist
diff --git a/share/frontend/wui/js/addmodify.js 
b/share/frontend/wui/js/addmodify.js
index f8dc0fa..119fb65 100644
--- a/share/frontend/wui/js/addmodify.js
+++ b/share/frontend/wui/js/addmodify.js
@@ -157,7 +157,7 @@ function validateMapCfgForm() {
        // we make some post tests (concerning the line_type and iconset values)
        if(document.addmodify.view_type && document.addmodify.view_type.value 
== 'line') {
                // we verify that the current line_type is valid
-               var valid_list=new Array("10","11","20");
+               var valid_list = new Array("10","11","12");
                for(var j = 0, len = valid_list.length; valid_list[j] != 
document.addmodify.line_type.value && j < len; j++) {
                        if(j==valid_list.length) {
                                
alert(printLang(lang['chosenLineTypeNotValid'],''));
diff --git a/share/server/core/classes/GlobalMapCfg.php 
b/share/server/core/classes/GlobalMapCfg.php
index 987f8a8..ae4146e 100644
--- a/share/server/core/classes/GlobalMapCfg.php
+++ b/share/server/core/classes/GlobalMapCfg.php
@@ -293,7 +293,7 @@ class GlobalMapCfg {
                                        'depends_on' => 'view_type',
                                        'depends_value' => 'icon'),
                                'line_type' => Array('must' => 0,
-                                       'match' => MATCH_INTEGER,
+                                       'match' => MATCH_LINE_TYPE,
                                        'field_type' => 'dropdown',
                                        'depends_on' => 'view_type',
                                        'depends_value' => 'line'),
diff --git a/share/server/core/defines/matches.php 
b/share/server/core/defines/matches.php
index 359bc94..c16bd68 100644
--- a/share/server/core/defines/matches.php
+++ b/share/server/core/defines/matches.php
@@ -59,7 +59,7 @@ define('MATCH_VIEW_TYPE_SERVICE', 
'/^(?:icon|line|gadget)$/i');
 define('MATCH_GET_OBJECT_TYPE', '/^(state|complete)$/');
 define('MATCH_OBJECT_TYPES', 
'/^(host|service|hostgroup|servicegroup|map|automap)$/');
 define('MATCH_AUTOMAP_RENDER_MODE', 
'/^(directed|undirected|radial|circular|undirected2)?$/');
-
+define('MATCH_LINE_TYPE', '/^(10|11|12)?$/');
 
 define('MATCH_URI_PART', '/^[a-zA-Z0-9-_]*$/');
 


------------------------------------------------------------------------------
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
Nagvis-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to