pari: branch 2.0 r4306 - in /branches/2.0/config: js/users.js users.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Dec 5 15:47:25 CST 2008


Author: pari
Date: Fri Dec  5 15:47:25 2008
New Revision: 4306

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

 New Feature: 'Advanced Edit' for Users



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/view/asterisk-gui/branches/2.0/config/js/users.js?view=diff&rev=4306&r1=4305&r2=4306
==============================================================================
--- branches/2.0/config/js/users.js (original)
+++ branches/2.0/config/js/users.js Fri Dec  5 15:47:25 2008
@@ -39,6 +39,51 @@
 };
 
 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.astgui_manageCallPlans.listPlans() ;
@@ -265,9 +310,11 @@
 		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' } );

Modified: branches/2.0/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/users.html?view=diff&rev=4306&r1=4305&r2=4306
==============================================================================
--- branches/2.0/config/users.html (original)
+++ branches/2.0/config/users.html Fri Dec  5 15:47:25 2008
@@ -76,6 +76,7 @@
 	<TABLE width="100%" cellpadding=0 cellspacing=0>
 	<TR class="dialog_title_tr">
 		<TD class="dialog_title" onmousedown="ASTGUI.startDrag(event);"><span id="edit_userExtension_div_title"></span></TD>
+		<TD width="120"><span id='User_AdvancedEditButton' class='guiButton' onclick='USERS_MISC_FUNCTIONS.show_UserEdit_Advanced();'>Advanced Edit</span></TD>
 		<TD class="dialog_title_X" onclick="ASTGUI.hideDrag(event);"> X </TD>
 	</TR>
 	</TABLE>
@@ -425,6 +426,26 @@
 </div>
 
 
+<div id="edit_User_Advanced_DIV" STYLE="width:650; max-height:450;display:none;" class='dialog'>
+	<TABLE width="100%" cellpadding=0 cellspacing=0>
+	<TR class="dialog_title_tr">
+		<TD class="dialog_title" onmousedown="ASTGUI.startDrag(event);"><span></span></TD>
+		<TD class="dialog_title_X" onclick="ASTGUI.hideDrag(event);"> X </TD>
+	</TR>
+	</TABLE>
+	<TABLE	align=center cellpadding=2 cellspacing=2 border=0 width='100%'>
+		<TR>	<TD align="center">
+				<textarea id='edit_USER_Advanced_details' rows=15 cols=80></textarea>
+			</TD>
+		</TR>
+		<TR>	<TD align=center height=50 valign=middle>
+				<span class='guiButtonCancel' onclick='USERS_MISC_FUNCTIONS.show_UserEdit_normal();'>Cancel</span>
+				<span class='guiButtonEdit' onclick='USERS_MISC_FUNCTIONS.save_User_Advanced();'>Update</span>
+			</TD>
+		</TR>
+	</TABLE>
+</div>
+
 
 <div style="display:none">
 	<form name="buynow_form" id="buynow_form" action="http://www.digium.com/en/ecosystem/partners/partners.php" method="post"></form>




More information about the asterisk-gui-commits mailing list