rbrindley: branch 2.0 r4791 - in /branches/2.0/config: ./ js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri May 15 14:21:39 CDT 2009


Author: rbrindley
Date: Fri May 15 14:21:35 2009
New Revision: 4791

URL: http://svn.asterisk.org/svn-view/asterisk-gui?view=rev&rev=4791
Log:

- fixed an issue in the call features where fields that are required
  to be a "number" (digits only) were being accepted with "+" and "-"
  characters.


Modified:
    branches/2.0/config/features2.html
    branches/2.0/config/js/features2.js

Modified: branches/2.0/config/features2.html
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/features2.html?view=diff&rev=4791&r1=4790&r2=4791
==============================================================================
--- branches/2.0/config/features2.html (original)
+++ branches/2.0/config/features2.html Fri May 15 14:21:35 2009
@@ -340,7 +340,7 @@
 				} else {
 					var obj = $(this).parents('tr');
 					var vari = $(this).parents('td').attr('class');
-					var val = $(this).text();
+					var val = $(this).val();
 					if (validateAmap(obj, {variable: vari, value: val}, false)) {
 						$(this).parents('td').siblings('.buttons').children('.save').show();
 					} else {

Modified: branches/2.0/config/js/features2.js
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/js/features2.js?view=diff&rev=4791&r1=4790&r2=4791
==============================================================================
--- branches/2.0/config/js/features2.js (original)
+++ branches/2.0/config/js/features2.js Fri May 15 14:21:35 2009
@@ -451,24 +451,29 @@
 		switch(params.variable) {
 		case 'name':
 			params.name = params.value;
+			break;
 		case 'digits':
 			params.digits = params.value;
+			break;
 		case 'app_name':
 			params.app_name = params.value;
+			break;
 		default:
 		}	
+		delete params.variable;
+		delete params.value;
 	}
 	/* lets validate all the variables before we send */
 	try {
-		if (params.name) {
+		if (typeof params.name !== 'undefined') {
 			vali = 'name';
 			validate(params.name, {notnull: true, str: true, aststr: true});
 		}
-		if (params.digits) {
+		if (typeof params.digits !== 'undefined') {
 			vali = 'digits';
 			validate(params.digits, {notnull: true, num: true});
 		}
-		if (params.app_name) {
+		if (typeof params.app_name !== 'undefined') {
 			vali = 'app_name';
 			validate(params.app_name, {notnull: true, str: true});
 		}
@@ -577,7 +582,7 @@
 	}
 
 	/* make sure val is a num */
-	if (chks.num && isNaN(val)) {
+	if (chks.num && !val.toString().match(/^[0-9][0-9]*$/)) {
 		top.log.error('validate: val needs to be a number.');
 		throw TypeError('Invalid: This needs to be a number.');
 	}




More information about the asterisk-gui-commits mailing list