rbrindley: branch 2.0 r4699 - in /branches/2.0/config: js/users.js users.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Apr 2 10:38:51 CDT 2009


Author: rbrindley
Date: Thu Apr  2 10:38:48 2009
New Revision: 4699

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

- every users function in js/users.js was wrapped in the USERS_MISC_FUNCTIONS object, this is unnecessary and now removed
- updated users.html and users.js to just call the functions, no longer using USERS_MISC_FUNCTIONS


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

Modified: branches/2.0/config/js/users.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/users.js?view=diff&rev=4699&r1=4698&r2=4699
==============================================================================
--- branches/2.0/config/js/users.js (original)
+++ branches/2.0/config/js/users.js Thu Apr  2 10:38:48 2009
@@ -23,240 +23,235 @@
 var zapchan_Before = '';
 var MULTI_FIELDS = ['edit_check_multiple_obcid','edit_multiple_obcid','edit_check_multiple_dialplan','edit_multiple_dialplan','edit_check_multiple_hasvoicemail','edit_multiple_hasvoicemail','edit_check_multiple_vmsecret', 'edit_multiple_vmCHoice1', 'edit_multiple_vmCHoice2', 'edit_multiple_vmsecret', 'edit_check_multiple_hassip', 'edit_multiple_hassip', 'edit_check_multiple_hasiax', 'edit_multiple_hasiax', 'edit_check_multiple_allow',  'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three', 'edit_multiple_codec_fourth', 'edit_multiple_codec_fifth', 'edit_check_multiple_flashrxflash',  'edit_multiple_flash', 'edit_multiple_rxflash', 'edit_check_multiple_secret', 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret', 'edit_check_multiple_nat',  'edit_multiple_nat', 'edit_check_multiple_canreinvite', 'edit_multiple_canreinvite', 'edit_check_multiple_dtmfmode',  'edit_multiple_dtmfmode', 'edit_check_multiple_insecure',  'edit_multiple_insecure', 'edit_check_multiple_3waycalling',  'edit_multiple_3waycalling', 'edit_check_multiple_indirectory',  'edit_multiple_indirectory', 'edit_check_multiple_callwaiting',  'edit_multiple_callwaiting', 'edit_check_multiple_cti',  'edit_multiple_cti', 'edit_check_multiple_isagent',  'edit_multiple_isagent', 'edit_check_multiple_pickupgroup',  'edit_multiple_pickupgroup'];
 
-var USERS_MISC_FUNCTIONS = {
-	show_UserEdit_normal : function(){ // USERS_MISC_FUNCTIONS.show_UserEdit_normal();
-		$('#edit_User_Advanced_DIV').hideWithBg();
-		$('#edit_userExtension_div').showWithBg();
-	},
-
-	save_User_Advanced : function(){ // USERS_MISC_FUNCTIONS.save_User_Advanced();
-		parent.ASTGUI.dialog.waitWhile('Saving ..') ;
-
-		try{
-			ASTGUI.miscFunctions.empty_context({ filename:'users.conf', context : EXTENSION_EDIT, cb : function(){
-				var x = new listOfActions('users.conf');
-
-				var user_lines = ASTGUI.getFieldValue('edit_USER_Advanced_details') ;
-				user_lines = user_lines.split('\n');
-				user_lines.each( function(this_line){
-					x.new_action( 'append', EXTENSION_EDIT , this_line.beforeChar('=') , this_line.afterChar('=') );
-				});
-				x.callActions( function(){
-					ASTGUI.dialog.waitWhile('Updated User information <BR> Reloading GUI ... ');
-					setTimeout( function(){ top.window.location.reload(); } , 2000 );
-				});
-			}});
-		}catch(err){
-			alert("Error saving User information");
-			top.window.location.reload();
-		}
-	},
-
-	show_UserEdit_Advanced : function(){ // USERS_MISC_FUNCTIONS.show_UserEdit_Advanced();
-		parent.ASTGUI.dialog.waitWhile('Loading ..') ;
-		$('#edit_User_Advanced_DIV').showWithBg();
-		$('#edit_userExtension_div').hideWithBg();
-		$('#edit_User_Advanced_DIV .dialog_title > span').html( 'Edit User ' + EXTENSION_EDIT + " -- Advanced");
-
-		var textarea = _$('edit_USER_Advanced_details');
-		textarea.value = '';
-		var t = config2json({filename:'users.conf', usf:0});
-		if( t.hasOwnProperty(EXTENSION_EDIT) ){
-			//textarea.rows = t[EXTENSION_EDIT].length + 1 ;
-			textarea.value = t[EXTENSION_EDIT].join('\n');
-		}
-
-		parent.ASTGUI.dialog.hide() ;
-	},
-
-	initialize_formFields : function(){ // USERS_MISC_FUNCTIONS.initialize_formFields();
-		//Load dialplans into 'edit_user_dialplan'
-		var dps = parent.pbx.call_plans.list() ;
-		dps.each(function(plan){
-			var t = plan.withOut(ASTGUI.contexts.CallingPlanPrefix);
-			ASTGUI.selectbox.append( 'edit_user_dialplan' , t, plan);
-			ASTGUI.selectbox.append( 'edit_multiple_dialplan' , t, plan);
+var show_UserEdit_normal = function(){ // show_UserEdit_normal();
+	$('#edit_User_Advanced_DIV').hideWithBg();
+	$('#edit_userExtension_div').showWithBg();
+};
+
+var save_User_Advanced = function(){ // save_User_Advanced();
+	parent.ASTGUI.dialog.waitWhile('Saving ..') ;
+
+	try{
+		ASTGUI.miscFunctions.empty_context({ filename:'users.conf', context : EXTENSION_EDIT, cb : function(){
+			var x = new listOfActions('users.conf');
+
+			var user_lines = ASTGUI.getFieldValue('edit_USER_Advanced_details') ;
+			user_lines = user_lines.split('\n');
+			user_lines.each( function(this_line){
+				x.new_action( 'append', EXTENSION_EDIT , this_line.beforeChar('=') , this_line.afterChar('=') );
+			});
+			x.callActions( function(){
+				ASTGUI.dialog.waitWhile('Updated User information <BR> Reloading GUI ... ');
+				setTimeout( function(){ top.window.location.reload(); } , 2000 );
+			});
+		}});
+	}catch(err){
+		alert("Error saving User information");
+		top.window.location.reload();
+	}
+};
+
+var show_UserEdit_Advanced = function(){ // show_UserEdit_Advanced();
+	parent.ASTGUI.dialog.waitWhile('Loading ..') ;
+	$('#edit_User_Advanced_DIV').showWithBg();
+	$('#edit_userExtension_div').hideWithBg();
+	$('#edit_User_Advanced_DIV .dialog_title > span').html( 'Edit User ' + EXTENSION_EDIT + " -- Advanced");
+
+	var textarea = _$('edit_USER_Advanced_details');
+	textarea.value = '';
+	var t = config2json({filename:'users.conf', usf:0});
+	if( t.hasOwnProperty(EXTENSION_EDIT) ){
+		//textarea.rows = t[EXTENSION_EDIT].length + 1 ;
+		textarea.value = t[EXTENSION_EDIT].join('\n');
+	}
+
+	parent.ASTGUI.dialog.hide() ;
+};
+
+var initialize_formFields = function(){ // initialize_formFields();
+	//Load dialplans into 'edit_user_dialplan'
+	var dps = parent.pbx.call_plans.list() ;
+	dps.each(function(plan){
+		var t = plan.withOut(ASTGUI.contexts.CallingPlanPrefix);
+		ASTGUI.selectbox.append( 'edit_user_dialplan' , t, plan);
+		ASTGUI.selectbox.append( 'edit_multiple_dialplan' , t, plan);
+	});
+	// Load Analog stations into 'edit_fxs'
+	ASTGUI.selectbox.append( 'edit_fxs' ,'None', '');
+	parent.sessionData.FXS_PORTS_DETECTED.each( function(item) { ASTGUI.selectbox.append( 'edit_fxs' , 'Port ' + item, item); } );
+
+	(function(){
+		var R = [];
+		R.push( {optionText:'None', optionValue :'' });
+		for ( var r in parent.sessionData.listOfCodecs ){
+			R.push( {optionText: parent.sessionData.listOfCodecs[r] , optionValue : r });
+		}
+		ASTGUI.selectbox.populateArray('codec_one', R);
+		ASTGUI.selectbox.populateArray('codec_two', R);
+		ASTGUI.selectbox.populateArray('codec_three', R);
+		ASTGUI.selectbox.populateArray('codec_fourth', R);
+		ASTGUI.selectbox.populateArray('codec_fifth', R);
+		ASTGUI.selectbox.populateArray('edit_multiple_codec_one', R);
+		ASTGUI.selectbox.populateArray('edit_multiple_codec_two', R);
+		ASTGUI.selectbox.populateArray('edit_multiple_codec_three', R);
+		ASTGUI.selectbox.populateArray('edit_multiple_codec_fourth', R);
+		ASTGUI.selectbox.populateArray('edit_multiple_codec_fifth', R);
+	})();
+
+	ASTGUI.selectbox.populateOptions( 'edit_pickupgroup', 20 );
+	ASTGUI.selectbox.populateOptions( 'edit_multiple_pickupgroup', 20 );
+
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_hasSip' , ['edit_nat','edit_canreinvite','edit_dtmfmode','edit_insecure'] );
+
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_obcid' , [ 'edit_multiple_obcid' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_dialplan' , [ 'edit_multiple_dialplan' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hasvoicemail' , [ 'edit_multiple_hasvoicemail' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_vmsecret' , [ 'edit_multiple_vmCHoice1', 'edit_multiple_vmCHoice2', 'edit_multiple_vmsecret'] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hassip' , [ 'edit_multiple_hassip' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hasiax' , [ 'edit_multiple_hasiax' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_allow' , [ 'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three' , 'edit_multiple_codec_fourth' , 'edit_multiple_codec_fifth'  ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_flashrxflash' , [ 'edit_multiple_flash', 'edit_multiple_rxflash'  ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_secret' , [ 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret'  ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_nat' , [ 'edit_multiple_nat' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_canreinvite' , [ 'edit_multiple_canreinvite' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_dtmfmode' , [ 'edit_multiple_dtmfmode' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_insecure' , [ 'edit_multiple_insecure' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_3waycalling' , [ 'edit_multiple_3waycalling' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_indirectory' , [ 'edit_multiple_indirectory' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_callwaiting' , [ 'edit_multiple_callwaiting' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_cti' , [ 'edit_multiple_cti' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_isagent' , [ 'edit_multiple_isagent' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_pickupgroup' , [ 'edit_multiple_pickupgroup' ] );
+
+	
+};
+
+var load_users_table = function(){ // load_users_table
+	var TBL = _$('table_userslist') ;
+	var addCell = ASTGUI.domActions.tr_addCell; // temporarily store the function
+	var ul = parent.pbx.users.list();  ul = ul.sortNumbers( );
+	if(!ul.length){
+		ASTGUI.domActions.clear_table( TBL );
+		var newRow = TBL.insertRow(-1);
+		newRow.className = 'even';
+		addCell( newRow , { html:'No users created !!'} );
+		return ;
+	}
+	(function(){ // add first row
+		var CA = document.createElement('input'); CA.type = 'checkbox' ; CA.id = 'CHECKALL' ;
+		ASTGUI.events.add( CA , 'click' , function(){
+			if( _$('CHECKALL').checked ) {
+				ASTGUI.domActions.CheckAll('selected_extensions');
+			}else{
+				ASTGUI.domActions.unCheckAll('selected_extensions');
+			}
 		});
-		// Load Analog stations into 'edit_fxs'
-		ASTGUI.selectbox.append( 'edit_fxs' ,'None', '');
-		parent.sessionData.FXS_PORTS_DETECTED.each( function(item) { ASTGUI.selectbox.append( 'edit_fxs' , 'Port ' + item, item); } );
-
-		(function(){
-			var R = [];
-			R.push( {optionText:'None', optionValue :'' });
-			for ( var r in parent.sessionData.listOfCodecs ){
-				R.push( {optionText: parent.sessionData.listOfCodecs[r] , optionValue : r });
-			}
-			ASTGUI.selectbox.populateArray('codec_one', R);
-			ASTGUI.selectbox.populateArray('codec_two', R);
-			ASTGUI.selectbox.populateArray('codec_three', R);
-			ASTGUI.selectbox.populateArray('codec_fourth', R);
-			ASTGUI.selectbox.populateArray('codec_fifth', R);
-			ASTGUI.selectbox.populateArray('edit_multiple_codec_one', R);
-			ASTGUI.selectbox.populateArray('edit_multiple_codec_two', R);
-			ASTGUI.selectbox.populateArray('edit_multiple_codec_three', R);
-			ASTGUI.selectbox.populateArray('edit_multiple_codec_fourth', R);
-			ASTGUI.selectbox.populateArray('edit_multiple_codec_fifth', R);
-		})();
-
-		ASTGUI.selectbox.populateOptions( 'edit_pickupgroup', 20 );
-		ASTGUI.selectbox.populateOptions( 'edit_multiple_pickupgroup', 20 );
-
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_hasSip' , ['edit_nat','edit_canreinvite','edit_dtmfmode','edit_insecure'] );
-
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_obcid' , [ 'edit_multiple_obcid' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_dialplan' , [ 'edit_multiple_dialplan' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hasvoicemail' , [ 'edit_multiple_hasvoicemail' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_vmsecret' , [ 'edit_multiple_vmCHoice1', 'edit_multiple_vmCHoice2', 'edit_multiple_vmsecret'] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hassip' , [ 'edit_multiple_hassip' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hasiax' , [ 'edit_multiple_hasiax' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_allow' , [ 'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three' , 'edit_multiple_codec_fourth' , 'edit_multiple_codec_fifth'  ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_flashrxflash' , [ 'edit_multiple_flash', 'edit_multiple_rxflash'  ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_secret' , [ 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret'  ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_nat' , [ 'edit_multiple_nat' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_canreinvite' , [ 'edit_multiple_canreinvite' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_dtmfmode' , [ 'edit_multiple_dtmfmode' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_insecure' , [ 'edit_multiple_insecure' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_3waycalling' , [ 'edit_multiple_3waycalling' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_indirectory' , [ 'edit_multiple_indirectory' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_callwaiting' , [ 'edit_multiple_callwaiting' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_cti' , [ 'edit_multiple_cti' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_isagent' , [ 'edit_multiple_isagent' ] );
-		ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_pickupgroup' , [ 'edit_multiple_pickupgroup' ] );
-
-		
-	},
-
-	load_users_table : function(){ // USERS_MISC_FUNCTIONS.load_users_table
-		var TBL = _$('table_userslist') ;
-		var addCell = ASTGUI.domActions.tr_addCell; // temporarily store the function
-		var ul = parent.pbx.users.list();  ul = ul.sortNumbers( );
-		if(!ul.length){
-			ASTGUI.domActions.clear_table( TBL );
-			var newRow = TBL.insertRow(-1);
-			newRow.className = 'even';
-			addCell( newRow , { html:'No users created !!'} );
-			return ;
-		}
-		(function(){ // add first row
-			var CA = document.createElement('input'); CA.type = 'checkbox' ; CA.id = 'CHECKALL' ;
-			ASTGUI.events.add( CA , 'click' , function(){
-				if( _$('CHECKALL').checked ) {
-					ASTGUI.domActions.CheckAll('selected_extensions');
-				}else{
-					ASTGUI.domActions.unCheckAll('selected_extensions');
-				}
-			});
-
-			var newRow = TBL.insertRow(-1);
-			newRow.className = "frow";
-
-			var newcell = newRow.insertCell( newRow.cells.length );
-			newcell.width = '15px' ;
-			newcell.appendChild( CA );
-
-			addCell( newRow , { html:'Extension'} );
-			addCell( newRow , { html:'Full Name'} );
-			addCell( newRow , { html:'Port'} );
-			addCell( newRow , { html:'SIP'} );
-			addCell( newRow , { html:'IAX'} );
-			addCell( newRow , { html:'DialPlan', onclickFunction: function(){ parent.miscFunctions.click_panel('dialplans.html'); } } );
-			addCell( newRow , { html:'OutBound CID'} );
-			addCell( newRow , { html:''} );
-		})();
-	
-		ul.each(function(user){ // list each user in table
-			var tmp = [] ;
-			tmp[0] = "<span class='guiButton' onclick=\"USERS_MISC_FUNCTIONS.EDIT_USER_FORM('" + user +"')\">Edit</span>&nbsp;"
-				+ "<span class='guiButtonDelete' onclick=\"USERS_MISC_FUNCTIONS.DELETE_USER('" + user +"')\">Delete</span>" ;
-			tmp[1] = parent.sessionData.pbxinfo.GLOBALS[ASTGUI.globals.obcidUsrPrefix + user] || '<span class=\'no_obcid\'>none</span>' ;
-
-			var ud = parent.sessionData.pbxinfo.users[user]; // temporarily store all details of this user
-			var newRow = TBL.insertRow(-1); //newRow.className = "frow";
-			newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
-			addCell( newRow , { html: "<input type=checkbox  class='selected_extensions' value='"+ user +"'>" } );
-			addCell( newRow , { html: user } );
-			addCell( newRow , { html: ud.getProperty('fullname') || '--' } );
-			addCell( newRow , { html: ud.getProperty(top.sessionData.DahdiChannelString) || '--' } );
-			addCell( newRow , { html: ( ud.getProperty('hassip').isAstTrue() ) ? 'Yes' : '--' , align:'center'} );
-			addCell( newRow , { html: ( ud.getProperty('hasiax').isAstTrue() ) ? 'Yes' : '--' , align:'center'} );
-
-			var tmp_this_dp = ud.getProperty('context').withOut(ASTGUI.contexts.CallingPlanPrefix) ;
-			if( !tmp_this_dp || !parent.sessionData.pbxinfo.callingPlans[ud.getProperty('context')] ){
-				addCell( newRow , { html: '<font color=red>No DialPlan assigned</font>'});
-			}else{
-				addCell( newRow , { html: tmp_this_dp } );
-			}
-
-			addCell( newRow , { html:tmp[1], align:'center'} );
-			addCell( newRow , { html:tmp[0], align:'center'} );
-		});
-	},
-
-	RESET_USER_FORM_FIELDS: function(){ // USERS_MISC_FUNCTIONS.RESET_USER_FORM_FIELDS();
-		ASTGUI.resetTheseFields( ['new_ext','edit_fullname','edit_user_dialplan','edit_OutBoundCallerid','edit_hasvoicemail','edit_vmsecret','edit_email','edit_hasSip','edit_hasIax','edit_fxs','edit_flash','edit_rxflash','codec_one','codec_two','codec_three','codec_fourth','codec_fifth','macaddress','linenumber','edit_secret','edit_nat','edit_canreinvite','edit_dtmfmode','edit_insecure','edit_3wayCalling','edit_inDirectory','edit_callWaiting','edit_cti','edit_isagent','edit_pickupgroup','edit_linekeys'] );
-		_$('edit_fxs').selectedIndex = 0; _$('codec_one').selectedIndex = 0; _$('codec_two').selectedIndex = 0; _$('codec_three').selectedIndex = 0; _$('codec_fourth').selectedIndex = 0; 
-		_$('codec_fifth').selectedIndex = 0; _$('linenumber').selectedIndex = 0; _$('edit_pickupgroup').selectedIndex = 0;
-
-		ASTGUI.updateFieldToValue( 'edit_user_dialplan', parent.sessionData.GUI_PREFERENCES.getProperty('default_dialplan') );
-
-		if( isNewUSER == false){
-			_$('new_ext').disabled = true;
-			var uinfo = parent.sessionData.pbxinfo.users[EXTENSION_EDIT];
-
-			if( uinfo.getProperty('mailbox').contains('MailboxStore') ){
-				$('#tmp_hideIfRmwi').hide();
-			}else{
-				$('#tmp_hideIfRmwi').show();
-			}
-
-			ASTGUI.updateFieldToValue( 'new_ext', EXTENSION_EDIT );
-//			ASTGUI.updateFieldToValue( 'macaddress', uinfo.getProperty('macaddress') );
-			ASTGUI.updateFieldToValue( 'edit_fullname', uinfo.getProperty('fullname') );
-			ASTGUI.updateFieldToValue( 'edit_user_dialplan', uinfo.getProperty('context') );
-			$('#edit_callerid_span').html(EXTENSION_EDIT);
-			ASTGUI.updateFieldToValue( 'edit_OutBoundCallerid', parent.astgui_manageusers.getOBCID_user(EXTENSION_EDIT) );
-			ASTGUI.updateFieldToValue( 'edit_hasvoicemail', uinfo.getProperty('hasvoicemail') );
-			ASTGUI.updateFieldToValue( 'edit_vmsecret', uinfo.getProperty('vmsecret') );
-			ASTGUI.updateFieldToValue( 'edit_email', uinfo.getProperty('email') );
-			ASTGUI.updateFieldToValue( 'edit_hasSip', uinfo.getProperty('hassip') );
-			ASTGUI.updateFieldToValue( 'edit_hasIax', uinfo.getProperty('hasiax') );
-			ASTGUI.updateFieldToValue( 'edit_fxs', uinfo.getProperty(top.sessionData.DahdiChannelString) );
-			ASTGUI.updateFieldToValue( 'edit_flash', uinfo.getProperty('flash') );
-			ASTGUI.updateFieldToValue( 'edit_rxflash', uinfo.getProperty('rxflash') );
-			// CODECS
-			if( uinfo.getProperty('allow') == 'all'){
-				ASTGUI.updateFieldToValue( 'codec_one', 'ulaw' );
-				ASTGUI.updateFieldToValue( 'codec_two', 'alaw' );
-				ASTGUI.updateFieldToValue( 'codec_three', 'gsm' );
-				ASTGUI.updateFieldToValue( 'codec_fourth', 'g726' );
-				ASTGUI.updateFieldToValue( 'codec_fifth', 'g722' );
-			}else{
-				var codecs_tmp = uinfo.getProperty('allow').split(',') ;
-				ASTGUI.updateFieldToValue( 'codec_one', (codecs_tmp[0] && codecs_tmp[0].trim()) ||'' );
-				ASTGUI.updateFieldToValue( 'codec_two', (codecs_tmp[1] && codecs_tmp[1].trim()) ||'' );
-				ASTGUI.updateFieldToValue( 'codec_three', (codecs_tmp[2] && codecs_tmp[2].trim()) ||'' );
-				ASTGUI.updateFieldToValue( 'codec_fourth', (codecs_tmp[3] && codecs_tmp[3].trim()) ||'' );
-				ASTGUI.updateFieldToValue( 'codec_fifth', (codecs_tmp[4] && codecs_tmp[4].trim()) ||'' );
-			}
-
-
-			ASTGUI.updateFieldToValue( 'macaddress', uinfo.getProperty('macaddress') );
-			ASTGUI.updateFieldToValue( 'linenumber', uinfo.getProperty('linenumber') );
-			ASTGUI.updateFieldToValue( 'edit_linekeys', uinfo.getProperty('LINEKEYS') );
-			ASTGUI.updateFieldToValue( 'edit_secret', uinfo.getProperty('secret') );
-			ASTGUI.updateFieldToValue( 'edit_nat', uinfo.getProperty('nat') );
-			ASTGUI.updateFieldToValue( 'edit_canreinvite', uinfo.getProperty('canreinvite') );
-			ASTGUI.updateFieldToValue( 'edit_dtmfmode', uinfo.getProperty('dtmfmode') );
-			ASTGUI.updateFieldToValue( 'edit_insecure', uinfo.getProperty('insecure') );
-			ASTGUI.updateFieldToValue( 'edit_3wayCalling', uinfo.getProperty('threewaycalling') );
-			ASTGUI.updateFieldToValue( 'edit_inDirectory', uinfo.getProperty('hasdirectory') );
-			ASTGUI.updateFieldToValue( 'edit_callWaiting', uinfo.getProperty('callwaiting') );
-			ASTGUI.updateFieldToValue( 'edit_cti', uinfo.getProperty('hasmanager') );
-			ASTGUI.updateFieldToValue( 'edit_isagent', uinfo.getProperty('hasagent') );
-			ASTGUI.updateFieldToValue( 'edit_pickupgroup', uinfo.getProperty('pickupgroup') );
-			zapchan_Before = uinfo.getProperty(top.sessionData.DahdiChannelString);
+
+		var newRow = TBL.insertRow(-1);
+		newRow.className = "frow";
+
+		var newcell = newRow.insertCell( newRow.cells.length );
+		newcell.width = '15px' ;
+		newcell.appendChild( CA );
+
+		addCell( newRow , { html:'Extension'} );
+		addCell( newRow , { html:'Full Name'} );
+		addCell( newRow , { html:'Port'} );
+		addCell( newRow , { html:'SIP'} );
+		addCell( newRow , { html:'IAX'} );
+		addCell( newRow , { html:'DialPlan', onclickFunction: function(){ parent.miscFunctions.click_panel('dialplans.html'); } } );
+		addCell( newRow , { html:'OutBound CID'} );
+		addCell( newRow , { html:''} );
+	})();
+
+	ul.each(function(user){ // list each user in table
+		var tmp = [] ;
+		tmp[0] = "<span class='guiButton' onclick=\"EDIT_USER_FORM('" + user +"')\">Edit</span>&nbsp;"
+			+ "<span class='guiButtonDelete' onclick=\"DELETE_USER('" + user +"')\">Delete</span>" ;
+		tmp[1] = parent.sessionData.pbxinfo.GLOBALS[ASTGUI.globals.obcidUsrPrefix + user] || '<span class=\'no_obcid\'>none</span>' ;
+
+		var ud = parent.sessionData.pbxinfo.users[user]; // temporarily store all details of this user
+		var newRow = TBL.insertRow(-1); //newRow.className = "frow";
+		newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
+		addCell( newRow , { html: "<input type=checkbox  class='selected_extensions' value='"+ user +"'>" } );
+		addCell( newRow , { html: user } );
+		addCell( newRow , { html: ud.getProperty('fullname') || '--' } );
+		addCell( newRow , { html: ud.getProperty(top.sessionData.DahdiChannelString) || '--' } );
+		addCell( newRow , { html: ( ud.getProperty('hassip').isAstTrue() ) ? 'Yes' : '--' , align:'center'} );
+		addCell( newRow , { html: ( ud.getProperty('hasiax').isAstTrue() ) ? 'Yes' : '--' , align:'center'} );
+
+		var tmp_this_dp = ud.getProperty('context').withOut(ASTGUI.contexts.CallingPlanPrefix) ;
+		if( !tmp_this_dp || !parent.sessionData.pbxinfo.callingPlans[ud.getProperty('context')] ){
+			addCell( newRow , { html: '<font color=red>No DialPlan assigned</font>'});
 		}else{
+			addCell( newRow , { html: tmp_this_dp } );
+		}
+
+		addCell( newRow , { html:tmp[1], align:'center'} );
+		addCell( newRow , { html:tmp[0], align:'center'} );
+	});
+};
+
+var RESET_USER_FORM_FIELDS = function(){ // RESET_USER_FORM_FIELDS();
+	ASTGUI.resetTheseFields( ['new_ext','edit_fullname','edit_user_dialplan','edit_OutBoundCallerid','edit_hasvoicemail','edit_vmsecret','edit_email','edit_hasSip','edit_hasIax','edit_fxs','edit_flash','edit_rxflash','codec_one','codec_two','codec_three','codec_fourth','codec_fifth','macaddress','linenumber','edit_secret','edit_nat','edit_canreinvite','edit_dtmfmode','edit_insecure','edit_3wayCalling','edit_inDirectory','edit_callWaiting','edit_cti','edit_isagent','edit_pickupgroup','edit_linekeys'] );
+	_$('edit_fxs').selectedIndex = 0; _$('codec_one').selectedIndex = 0; _$('codec_two').selectedIndex = 0; _$('codec_three').selectedIndex = 0; _$('codec_fourth').selectedIndex = 0; 
+	_$('codec_fifth').selectedIndex = 0; _$('linenumber').selectedIndex = 0; _$('edit_pickupgroup').selectedIndex = 0;
+
+	ASTGUI.updateFieldToValue( 'edit_user_dialplan', parent.sessionData.GUI_PREFERENCES.getProperty('default_dialplan') );
+
+	if( isNewUSER == false){
+		_$('new_ext').disabled = true;
+		var uinfo = parent.sessionData.pbxinfo.users[EXTENSION_EDIT];
+
+		if( uinfo.getProperty('mailbox').contains('MailboxStore') ){
+			$('#tmp_hideIfRmwi').hide();
+		}else{
+			$('#tmp_hideIfRmwi').show();
+		}
+
+		ASTGUI.updateFieldToValue( 'new_ext', EXTENSION_EDIT );
+		ASTGUI.updateFieldToValue( 'edit_fullname', uinfo.getProperty('fullname') );
+		ASTGUI.updateFieldToValue( 'edit_user_dialplan', uinfo.getProperty('context') );
+		$('#edit_callerid_span').html(EXTENSION_EDIT);
+		ASTGUI.updateFieldToValue( 'edit_OutBoundCallerid', parent.astgui_manageusers.getOBCID_user(EXTENSION_EDIT) );
+		ASTGUI.updateFieldToValue( 'edit_hasvoicemail', uinfo.getProperty('hasvoicemail') );
+		ASTGUI.updateFieldToValue( 'edit_vmsecret', uinfo.getProperty('vmsecret') );
+		ASTGUI.updateFieldToValue( 'edit_email', uinfo.getProperty('email') );
+		ASTGUI.updateFieldToValue( 'edit_hasSip', uinfo.getProperty('hassip') );
+		ASTGUI.updateFieldToValue( 'edit_hasIax', uinfo.getProperty('hasiax') );
+		ASTGUI.updateFieldToValue( 'edit_fxs', uinfo.getProperty(top.sessionData.DahdiChannelString) );
+		ASTGUI.updateFieldToValue( 'edit_flash', uinfo.getProperty('flash') );
+		ASTGUI.updateFieldToValue( 'edit_rxflash', uinfo.getProperty('rxflash') );
+		if( uinfo.getProperty('allow') == 'all'){
+			ASTGUI.updateFieldToValue( 'codec_one', 'ulaw' );
+			ASTGUI.updateFieldToValue( 'codec_two', 'alaw' );
+			ASTGUI.updateFieldToValue( 'codec_three', 'gsm' );
+			ASTGUI.updateFieldToValue( 'codec_fourth', 'g726' );
+			ASTGUI.updateFieldToValue( 'codec_fifth', 'g722' );
+		}else{
+			var codecs_tmp = uinfo.getProperty('allow').split(',') ;
+			ASTGUI.updateFieldToValue( 'codec_one', (codecs_tmp[0] && codecs_tmp[0].trim()) ||'' );
+			ASTGUI.updateFieldToValue( 'codec_two', (codecs_tmp[1] && codecs_tmp[1].trim()) ||'' );
+			ASTGUI.updateFieldToValue( 'codec_three', (codecs_tmp[2] && codecs_tmp[2].trim()) ||'' );
+			ASTGUI.updateFieldToValue( 'codec_fourth', (codecs_tmp[3] && codecs_tmp[3].trim()) ||'' );
+			ASTGUI.updateFieldToValue( 'codec_fifth', (codecs_tmp[4] && codecs_tmp[4].trim()) ||'' );
+		}
+		ASTGUI.updateFieldToValue( 'macaddress', uinfo.getProperty('macaddress') );
+		ASTGUI.updateFieldToValue( 'linenumber', uinfo.getProperty('linenumber') );
+		ASTGUI.updateFieldToValue( 'edit_linekeys', uinfo.getProperty('LINEKEYS') );
+		ASTGUI.updateFieldToValue( 'edit_secret', uinfo.getProperty('secret') );
+		ASTGUI.updateFieldToValue( 'edit_nat', uinfo.getProperty('nat') );
+		ASTGUI.updateFieldToValue( 'edit_canreinvite', uinfo.getProperty('canreinvite') );
+		ASTGUI.updateFieldToValue( 'edit_dtmfmode', uinfo.getProperty('dtmfmode') );
+		ASTGUI.updateFieldToValue( 'edit_insecure', uinfo.getProperty('insecure') );
+		ASTGUI.updateFieldToValue( 'edit_3wayCalling', uinfo.getProperty('threewaycalling') );
+		ASTGUI.updateFieldToValue( 'edit_inDirectory', uinfo.getProperty('hasdirectory') );
+		ASTGUI.updateFieldToValue( 'edit_callWaiting', uinfo.getProperty('callwaiting') );
+		ASTGUI.updateFieldToValue( 'edit_cti', uinfo.getProperty('hasmanager') );
+		ASTGUI.updateFieldToValue( 'edit_isagent', uinfo.getProperty('hasagent') );
+		ASTGUI.updateFieldToValue( 'edit_pickupgroup', uinfo.getProperty('pickupgroup') );
+		zapchan_Before = uinfo.getProperty(top.sessionData.DahdiChannelString);
+	}else{
 			_$('new_ext').disabled = false;
 			ASTGUI.updateFieldToValue( 'codec_one', 'ulaw' );
 			ASTGUI.updateFieldToValue( 'codec_two', 'gsm' );
@@ -268,420 +263,419 @@
 			var tmp_newEXT = tmp_allextensions.firstAvailable( parent.sessionData.GUI_PREFERENCES.getProperty('ue_start') );
 			ASTGUI.updateFieldToValue( 'new_ext', tmp_newEXT );
 			$('#edit_callerid_span').html(tmp_newEXT);
-		}
-
-		_$('edit_hasSip').updateStatus();
-	},
-
-	NEW_USER_FORM : function(){ // USERS_MISC_FUNCTIONS.NEW_USER_FORM();
-		var dps = parent.pbx.call_plans.list() ;
-		if(!dps.length){
-			ASTGUI.yesOrNo (
-				{	msg: "No DialPlans defined !! <BR><BR> A dialplan is required for creating new users. <BR> You will now be redirected to the 'Manage DialPlans' page.",
-					ifyes: function(){ parent.miscFunctions.click_panel('dialplans.html'); } ,
-					ifno: function(){ } ,
-					btnYes_text :'&nbsp;&nbsp;Ok&nbsp;&nbsp;',
-					title: 'No DialPlans found !!',
-					hideNo: true
-				}
-			);
-			return;
-		}
-
-		isNewUSER = true;
-		EXTENSION_EDIT = '';
-		zapchan_Before = '';
-		_$('edit_userExtension_div_title').innerHTML = 'Create New User';
-		ASTGUI.feedback( { msg: 'Create New User !', showfor: 2 , color: 'green', bgcolor: '#FFFFFF' } );
-		USERS_MISC_FUNCTIONS.RESET_USER_FORM_FIELDS();
-		$('#edit_userExtension_div').showWithBg();
-		$('#User_AdvancedEditButton').hide();
-	},
-
-	EDIT_USER_FORM : function(a){ // USERS_MISC_FUNCTIONS.EDIT_USER_FORM();
-		$('#User_AdvancedEditButton').show();
-		isNewUSER = false ;
-		EXTENSION_EDIT = a ;
-		ASTGUI.feedback( { msg: 'Edit User Extension !', showfor: 2 , color: 'green', bgcolor: '#FFFFFF' } );
-		_$('edit_userExtension_div_title').innerHTML = 'Edit User Extension - ' + a ;
-		USERS_MISC_FUNCTIONS.RESET_USER_FORM_FIELDS();
-		$('#edit_userExtension_div').showWithBg();
-		try{_$('edit_userExtension_div').scrollIntoView(true);}catch(err){}
-	},
+	}
+
+	_$('edit_hasSip').updateStatus();
+};
+
+var NEW_USER_FORM = function(){ // NEW_USER_FORM();
+	var dps = parent.pbx.call_plans.list() ;
+	if(!dps.length){
+		ASTGUI.yesOrNo (
+			{	msg: "No DialPlans defined !! <BR><BR> A dialplan is required for creating new users. <BR> You will now be redirected to the 'Manage DialPlans' page.",
+				ifyes: function(){ parent.miscFunctions.click_panel('dialplans.html'); } ,
+				ifno: function(){ } ,
+				btnYes_text :'&nbsp;&nbsp;Ok&nbsp;&nbsp;',
+				title: 'No DialPlans found !!',
+				hideNo: true
+			}
+		);
+		return;
+	}
+
+	isNewUSER = true;
+	EXTENSION_EDIT = '';
+	zapchan_Before = '';
+	_$('edit_userExtension_div_title').innerHTML = 'Create New User';
+	ASTGUI.feedback( { msg: 'Create New User !', showfor: 2 , color: 'green', bgcolor: '#FFFFFF' } );
+	RESET_USER_FORM_FIELDS();
+	$('#edit_userExtension_div').showWithBg();
+	$('#User_AdvancedEditButton').hide();
+};
+
+var EDIT_USER_FORM = function(a){ // EDIT_USER_FORM();
+	$('#User_AdvancedEditButton').show();
+	isNewUSER = false ;
+	EXTENSION_EDIT = a ;
+	ASTGUI.feedback( { msg: 'Edit User Extension !', showfor: 2 , color: 'green', bgcolor: '#FFFFFF' } );
+	_$('edit_userExtension_div_title').innerHTML = 'Edit User Extension - ' + a ;
+	RESET_USER_FORM_FIELDS();
+	$('#edit_userExtension_div').showWithBg();
+	try{_$('edit_userExtension_div').scrollIntoView(true);}catch(err){}
+};
 	
-	getSelectedUsers : function(){ // USERS_MISC_FUNCTIONS.getSelectedUsers();
-		return ASTGUI.domActions.get_checked('selected_extensions') ; 
-	},
-
-	EDIT_SELECTEDUSERs_FORM : function(){ // USERS_MISC_FUNCTIONS.EDIT_SELECTEDUSERs_FORM();
-		var sel_users = USERS_MISC_FUNCTIONS.getSelectedUsers();
-		if(!sel_users.length){
-			ASTGUI.feedback( { msg: ' Please select one or more users to modify !', showfor: 4 });
-			return;
-		}
-		ASTGUI.resetTheseFields( MULTI_FIELDS );
-		MULTI_FIELDS.each( function(this_field_str){
-			try{
-				_$(this_field_str).updateStatus();
-			}catch(err){
-
-			}
-		});
-
-		_$('edit_multiple_codec_one').selectedIndex = 0
-		_$('edit_multiple_codec_two').selectedIndex = 0
-		_$('edit_multiple_codec_three').selectedIndex = 0
-		_$('edit_multiple_codec_fourth').selectedIndex = 0
-		_$('edit_multiple_codec_fifth').selectedIndex = 0
-		$('#edit_selectedExtensions_div').showWithBg();
-	},
-
-	DELETE_USER : function(a){ // USERS_MISC_FUNCTIONS.DELETE_USER();
-		var reload_page = function(){
-			ASTGUI.feedback( { msg:'Deleted User - ' + a , showfor:2,  color:'#a02920' } );
+var getSelectedUsers = function(){ // getSelectedUsers();
+	return ASTGUI.domActions.get_checked('selected_extensions') ; 
+};
+
+var EDIT_SELECTEDUSERs_FORM = function(){ // EDIT_SELECTEDUSERs_FORM();
+	var sel_users = getSelectedUsers();
+	if(!sel_users.length){
+		ASTGUI.feedback( { msg: ' Please select one or more users to modify !', showfor: 4 });
+		return;
+	}
+	ASTGUI.resetTheseFields( MULTI_FIELDS );
+	MULTI_FIELDS.each( function(this_field_str){
+		try{
+			_$(this_field_str).updateStatus();
+		}catch(err){
+
+		}
+	});
+
+	_$('edit_multiple_codec_one').selectedIndex = 0
+	_$('edit_multiple_codec_two').selectedIndex = 0
+	_$('edit_multiple_codec_three').selectedIndex = 0
+	_$('edit_multiple_codec_fourth').selectedIndex = 0
+	_$('edit_multiple_codec_fifth').selectedIndex = 0
+	$('#edit_selectedExtensions_div').showWithBg();
+};
+
+var DELETE_USER = function(a){ // DELETE_USER();
+	var reload_page = function(){
+		ASTGUI.feedback( { msg:'Deleted User - ' + a , showfor:2,  color:'#a02920' } );
+		parent.ASTGUI.dialog.hide();
+		window.location.reload();
+	};
+	if (!confirm('Are you sure you want to delete the selected user - ' + a + ' ?')) { return; }
+	var yn = confirm("Delete user's voicemail box too ?" );
+	parent.ASTGUI.dialog.waitWhile(' deleting user ' + a );
+	parent.pbx.users.remove({user: a , vmdel: yn , callback: reload_page});
+};
+
+var DELETE_SELECTED_USERS = function(){ // DELETE_SELECTED_USERS();
+	var sel_users = getSelectedUsers();
+	if(!sel_users.length){
+		ASTGUI.feedback( { msg: ' Please select one or more users to delete !', showfor: 4 });
+		return;
+	}
+	if( !confirm('Are you sure you want to delete the selected users - ' + sel_users.join(',') + ' ? \n\n Note: This would delete any voicemails stored in the users mailboxes.') ) { return; }
+
+	var after_deletingFirstUser = function(){
+		sel_users.removeFirst();
+		if(!sel_users.length ){
+			ASTGUI.feedback( { msg:'Deleted selected Users !!', showfor:2,  color:'#a02920' } );
 			parent.ASTGUI.dialog.hide();
 			window.location.reload();
-		};
-		if (!confirm('Are you sure you want to delete the selected user - ' + a + ' ?')) { return; }
-		var yn = confirm("Delete user's voicemail box too ?" );
-		parent.ASTGUI.dialog.waitWhile(' deleting user ' + a );
-		parent.pbx.users.remove({user: a , vmdel: yn , callback: reload_page});
-	},
-
-	DELETE_SELECTED_USERS : function(){ // USERS_MISC_FUNCTIONS.DELETE_SELECTED_USERS();
-		var sel_users = USERS_MISC_FUNCTIONS.getSelectedUsers();
-		if(!sel_users.length){
-			ASTGUI.feedback( { msg: ' Please select one or more users to delete !', showfor: 4 });
+		}else{
+			delete_firstUser();
+		}
+	};
+
+	var delete_firstUser = function(){
+		//var yn = confirm("Delete voicemail box for user " + sel_users[0] + " ?" );
+		parent.ASTGUI.dialog.waitWhile(' deleting user ' + sel_users[0] );
+		parent.pbx.users.remove({user: sel_users[0] , vmdel: true , callback: after_deletingFirstUser});
+	};
+
+	parent.ASTGUI.dialog.waitWhile(' Deleting selected users .... ');
+	delete_firstUser();
+};
+
+var check_duplicate_lineNumber = function(){ // check_duplicate_lineNumber()  check if another user has the same mac address and line number
+	var ul = parent.pbx.users.list();
+	for( var f=0 ; f < ul.length ; f++ ){
+		var uinfo = parent.sessionData.pbxinfo.users[ ul[f] ];
+		if( !isNewUSER && EXTENSION_EDIT == ul[f] ){
+			continue;
+		}
+		var ma = ASTGUI.getFieldValue('macaddress');
+		var ln = ASTGUI.getFieldValue('linenumber');
+		if( ma && ma == uinfo.getProperty('macaddress') && ln == uinfo.getProperty('linenumber') ){
+			return false;
+		}
+	}
+	return true;
+};
+
+var SAVE_USER_FORM = function(){ // SAVE_USER_FORM();
+	if ( !ASTGUI.checkRequiredFields(['new_ext']) ) return ;
+	if ( !ASTGUI.validateFields(['new_ext'] ) ) return ;
+
+	if ( !ASTGUI.getFieldValue('edit_hasSip').isAstTrue() && ASTGUI.getFieldValue('edit_fxs') && !ASTGUI.getFieldValue('macaddress') ){
+		ASTGUI.updateFieldToValue( 'macaddress',  ASTGUI.getFieldValue('new_ext') );
+	}else if( ASTGUI.getFieldValue('edit_hasSip').isAstTrue() ){
+		if ( !ASTGUI.validateFields(['macaddress'])) return ;
+	}
+
+	if( ! check_duplicate_lineNumber() ){
+		ASTGUI.highlightField('linenumber', "duplicate 'Line Number'");
+		return;
+	}
+	var tmp = ASTGUI.getFieldValue('edit_OutBoundCallerid') ;
+	if( tmp && tmp.length < 2 ){
+		ASTGUI.highlightField('edit_OutBoundCallerid', "OutBound CallerId should be atleast 2 digits");
+		return;
+	}
+	if( tmp && tmp.length > 19  ){
+		ASTGUI.highlightField('edit_OutBoundCallerid', "Too many digits in OutBound CallerId");
+		return;
+	}
+	tmp = '';
+	if( !_$('edit_hasSip').checked && !_$('edit_hasIax').checked && !_$('edit_fxs').value ){
+		ASTGUI.feedback( { msg:'You need to choose a technology or assign an analog station for this user extension.' , showfor: 3, color: 'red' } );
+		return;
+	}
+
+	if( (ASTGUI.getFieldValue('edit_hasSip').isAstTrue() ||  ASTGUI.getFieldValue('edit_hasIax').isAstTrue() ) && !ASTGUI.getFieldValue('codec_one') && !ASTGUI.getFieldValue('codec_two') && !ASTGUI.getFieldValue('codec_three') && !ASTGUI.getFieldValue('codec_fourth') && !ASTGUI.getFieldValue('codec_fifth') ){
+		ASTGUI.feedback( { msg:'You need to choose at least one codec !' , showfor: 5, color: 'red' } );
+		return;
+	}
+
+	if( isNewUSER  ){
+			var NU_EXT = ASTGUI.getFieldValue('new_ext');
+			if( parent.miscFunctions.ifExtensionAlreadyExists(NU_EXT) ){
+				ASTGUI.highlightField('new_ext', 'Extension already exists');
+				parent.ASTGUI.dialog.hide();
+				return;
+			}
+			if( ! ASTGUI.miscFunctions.isExtensionInRange( NU_EXT ,'ue_start','ue_end') ){
+				ASTGUI.highlightField('new_ext' , 'Extension is not in preferred range');
+				parent.ASTGUI.dialog.hide();
+				return;
+			}
+			var cb = function(){
+				// Now we will call this function again , to update the rest of the User Properties
+				EXTENSION_EDIT = NU_EXT ;
+				isNewUSER = false ;
+				setTimeout( function(){  SAVE_USER_FORM();  } , 500 );
+			};
+			var newuser_settings = ASTGUI.toCustomObject( { fullname : ASTGUI.getFieldValue('edit_fullname'), registersip: 'no', host: 'dynamic', callgroup : '1' } );
+			parent.ASTGUI.dialog.waitWhile(' Saving... ');
+			top.pbx.users.add( NU_EXT, newuser_settings, cb);
 			return;
-		}
-		if( !confirm('Are you sure you want to delete the selected users - ' + sel_users.join(',') + ' ? \n\n Note: This would delete any voicemails stored in the users mailboxes.') ) { return; }
-
-		var after_deletingFirstUser = function(){
-			sel_users.removeFirst();
-			if(!sel_users.length ){
-				ASTGUI.feedback( { msg:'Deleted selected Users !!', showfor:2,  color:'#a02920' } );
-				parent.ASTGUI.dialog.hide();
-				window.location.reload();
+	}else{
+		///////////////////

[... 637 lines stripped ...]



More information about the asterisk-gui-commits mailing list