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

Author: LaMi <[email protected]>
Date:   Sat Feb 13 17:17:18 2010 +0100

Fixed validation problem; Creation of lines in WUI

---

 share/frontend/wui/js/addmodify.js                |   37 +++++++++++----------
 share/frontend/wui/js/wui.js                      |    1 +
 share/server/core/classes/WuiViewMapAddModify.php |    2 +-
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/share/frontend/wui/js/addmodify.js 
b/share/frontend/wui/js/addmodify.js
index 124eeac..6c20895 100644
--- a/share/frontend/wui/js/addmodify.js
+++ b/share/frontend/wui/js/addmodify.js
@@ -96,14 +96,13 @@ function validateMapCfgForm() {
                        // Filter helper fields
                        if(document.addmodify.elements[i].name.charAt(0) !== 
'_') {
                                var sName = document.addmodify.elements[i].name;
+                               var sType = document.addmodify.type.value;
                                
-                               // Skip options which use the default value
                                var oField = document.getElementById(sName);
                                var oFieldDefault = 
document.getElementById('_'+sName);
-                               
                                if(oField && oFieldDefault) {
-                                       // Skip option only when the field and 
default value are equal
-                                       if(oField.value === 
oFieldDefault.value) {
+                                       if(oField.value === oFieldDefault.value 
&& validMapConfig[sType][sName]['must'] != '1') {
+                                               // Skip option only when the 
field and default value are equal
                                                continue;
                                        }
                                }
@@ -111,25 +110,27 @@ function validateMapCfgForm() {
                                oFieldDefault = null;
                                oField = null;
                                
-                               
if(document.addmodify.elements[i].name.substring(document.addmodify.elements[i].name.length-6,document.addmodify.elements[i].name.length)=='_name')
 {
-                                       
object_name=document.addmodify.elements[i].value;
+                               if(sName.substring(sName-6, sName.length) == 
'_name') {
+                                       object_name = 
document.addmodify.elements[i].value;
                                }
-                               if(document.addmodify.elements[i].name == 
'iconset') {
-                                       
iconset=document.addmodify.elements[i].value;
+                               if(sName == 'iconset') {
+                                       iconset = 
document.addmodify.elements[i].value;
                                }
-                               if(document.addmodify.elements[i].name == 'x') {
-                                       x=document.addmodify.elements[i].value;
+                               if(sName == 'x') {
+                                       x = 
document.addmodify.elements[i].value;
                                }
-                               if(document.addmodify.elements[i].name == 'y') {
-                                       y=document.addmodify.elements[i].value;
+                               if(sName == 'y') {
+                                       y = 
document.addmodify.elements[i].value;
                                }
                                
-                               if(document.addmodify.elements[i].name == 
'allowed_for_config') {
-                                       
users_tab=document.addmodify.elements[i].value.split(',');
-                                       suicide=true;
+                               if(sName == 'allowed_for_config') {
+                                       users_tab = 
document.addmodify.elements[i].value.split(',');
+                                       
+                                       suicide = true;
                                        for(var k = 0, len2 = users_tab.length; 
k < len2; k++) {
                                                if ( (users_tab[k]=='EVERYONE') 
|| (users_tab[k]==username) ) { suicide=false; }
                                        }
+                                       
                                        if(suicide) {
                                                
alert(printLang(lang['unableToWorkWithMap'],''));
                                                
document.addmodify.elements[i].focus();
@@ -139,12 +140,12 @@ function validateMapCfgForm() {
                                
                                if(document.addmodify.elements[i].value != '') {
                                        // Print a note to the user: This map 
object will display the summary state of the current map
-                                       if(document.addmodify.type.value == 
"map" && document.addmodify.elements[i].name == "map_name" && 
document.addmodify.elements[i].value == document.addmodify.map.value) {
+                                       if(sType == "map" && sName == 
"map_name" && document.addmodify.elements[i].value == 
document.addmodify.map.value) {
                                                
alert(printLang(lang['mapObjectWillShowSummaryState'],''));
                                        }
                                } else {
-                                       
if(validMapConfig[document.addmodify.type.value][document.addmodify.elements[i].name]['must']
 == '1') {
-                                               
alert(printLang(lang['mustValueNotSet'],'ATTRIBUTE~'+document.addmodify.elements[i].name+',TYPE~'+document.addmodify.type.value+',MAPNAME~'+document.addmodify.map.value));
+                                       if(validMapConfig[sType][sName]['must'] 
== '1') {
+                                               
alert(printLang(lang['mustValueNotSet'],'ATTRIBUTE~'+sName+',TYPE~'+sType+',MAPNAME~'+document.addmodify.map.value));
                                                
document.addmodify.elements[i].focus();
                                                
                                                return false;
diff --git a/share/frontend/wui/js/wui.js b/share/frontend/wui/js/wui.js
index b3e9ebf..32fb5a4 100644
--- a/share/frontend/wui/js/wui.js
+++ b/share/frontend/wui/js/wui.js
@@ -625,6 +625,7 @@ function toggleDependingFields(formName, name, value) {
                                         && 
oConfig[sTypeName][sOptName]['depends_value'] != value) {
                                        
                                        
document.getElementById(sFieldName).parentNode.parentNode.style.display = 
'none';
+                                       
document.getElementById(sFieldName).value = '';
                                } else 
if(oConfig[sTypeName][sOptName]['depends_on'] === sMasterName
                                         && 
oConfig[sTypeName][sOptName]['depends_value'] == value) {
                                        
diff --git a/share/server/core/classes/WuiViewMapAddModify.php 
b/share/server/core/classes/WuiViewMapAddModify.php
index d9b1c24..e5c0421 100644
--- a/share/server/core/classes/WuiViewMapAddModify.php
+++ b/share/server/core/classes/WuiViewMapAddModify.php
@@ -344,7 +344,7 @@ class WuiViewMapAddModify {
                                        }
                                        
                                        // Reset selected when not modifying 
(e.g. adding)
-                                       if($this->aOpts['do'] != 'modify') {
+                                       if($this->aOpts['do'] != 'modify' && 
$propname != 'view_type') {
                                                $selected = '';
                                        }
                                        


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to