pari: branch 2.0 r3690 - /branches/2.0/config/bulkadd.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Aug 20 12:03:27 CDT 2008


Author: pari
Date: Wed Aug 20 12:03:26 2008
New Revision: 3690

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=3690
Log:

 improvements to 'Bulk Add'

  + Make sure the first column is 'User'

  + skip any blank lines




Modified:
    branches/2.0/config/bulkadd.html

Modified: branches/2.0/config/bulkadd.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/bulkadd.html?view=diff&rev=3690&r1=3689&r2=3690
==============================================================================
--- branches/2.0/config/bulkadd.html (original)
+++ branches/2.0/config/bulkadd.html Wed Aug 20 12:03:26 2008
@@ -36,15 +36,19 @@
 	var NEW_USERS = {} ;
 	var csv_text = _$('ta_ba_csv').value ;
 	var tmp_lines = csv_text.split('\n');
-	var HEADS = tmp_lines[0]; tmp_lines.splice(0, 1);
-	var tmp_Heads = HEADS.split(',');
+	var tmp_Heads = tmp_lines[0]; tmp_lines.splice(0, 1);
+	var HEADS = tmp_Heads.split(',');
+	if( HEADS[0] != 'User' ){
+		alert('The first column should be User');
+		return;
+	}
 
 	var newusers_list = [];
 	for(var tli =0; tli< tmp_lines.length ; tli++ ){
 		var this_line = tmp_lines[tli];
+		if( this_line.trim() == '' ){ continue; }
 		var this_user_details = this_line.split(',');
-
-		if( this_user_details.length != tmp_Heads.length ){
+		if( this_user_details.length != HEADS.length ){
 			alert('Error: Invalid Number of Fields in line ' + (tli + 1) );
 			return;
 		}
@@ -57,8 +61,8 @@
 
 		newusers_list.push( this_user ) ;
 		NEW_USERS[ this_user ] = {} ;
-		for( var f = 1 ; f < tmp_Heads.length ; f++ ){
-			NEW_USERS[ this_user ][ tmp_Heads[f] ] = this_user_details[ f ] ;
+		for( var f = 1 ; f < HEADS.length ; f++ ){
+			NEW_USERS[ this_user ][ HEADS[f] ] = this_user_details[ f ] ;
 		}
 	};
 
@@ -94,8 +98,8 @@
 		<tr><td  align=center>
 			<BR>
 			<B>Enter list of users as CSV text</B><BR>
-			Heads: User<sup>1</sup>,fullname,cid_number, context, hasvoicemail, vmsecret, email, hassip, hasiax, secret
-
+			<B>Heads:</B> User<sup>1</sup>,fullname,cid_number, context, hasvoicemail, vmsecret, email, hassip, hasiax, secret<BR>
+			1. 'User' should always be the first column, the remaining fields can be in any order.
 		</td></tr>
 		<tr><td  align=center>
 			<textarea id='ta_ba_csv' rows=10 cols=120></textarea>




More information about the asterisk-gui-commits mailing list