rbrindley: branch rbrindley/astman_revamp r4653 - /team/rbrindley/astman_reva...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Mar 24 12:48:53 CDT 2009
Author: rbrindley
Date: Tue Mar 24 12:48:50 2009
New Revision: 4653
URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4653
Log:
- merged latest from branches/2.0
Modified:
team/rbrindley/astman_revamp/config/js/pbx2.js
team/rbrindley/astman_revamp/config/js/users.js
Modified: team/rbrindley/astman_revamp/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/pbx2.js?view=diff&rev=4653&r1=4652&r2=4653
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Tue Mar 24 12:48:50 2009
@@ -1585,33 +1585,57 @@
* @param user The user.
* @param vmdel Optional, default = false. Boolean to delete vms or not.
* @param callback Optional, default = null. The callback function after deleting a user.
+ * @return boolean of success.
*/
pbx.users.remove = function(params) {
- var u = new listOfSynActions('users.conf');
- u.new_action('delcat', params.user, '', '');
- u.callActions();
-
- u.clearActions('extensions.conf');
- u.new_action('delete', 'globals', ASTGUI.globals.odcidUsrPrefix + user, '');
- u.callActions();
-
- delete sessionData.pbxinfo['users'][user];
+ if (typeof params !== 'object') {
+ top.log.error('pbx.users.remove: Expecting params to be an object.');
+ return false;
+ } else if (typeof params.user === 'undefined') {
+ top.log.error('pbx.users.remove: params.user is empty.');
+ return false;
+ } else if (params.vmdel === 'undefined') {
+ top.log.error('pbx.users.remove: params.vmdel is empty.');
+ return false;
+ }
+
+ var actions = new listOfSynActions('users.conf');
+ actions.new_action('delcat', params.user, '', '');
+ var resp = actions.callActions();
+ if (!resp.contains('Response: Success')) {
+ top.log.error('pbx.users.remove: Error removing ' + params.user + ' from users.conf.');
+ return false;
+ }
+
+ actions.clearActions('extensions.conf');
+ actions.new_action('delete', 'globals', ASTGUI.globals.odcidUsrPrefix + params.user, '');
+ var resp = actions.callActions();
+ if (!resp.contains('Response: Success')) {
+ top.log.error('pbx.users.remove: Error removing global var: "' + ASTGUI.globals.odcidUsrPrefix + params.user + '" from extensions.conf.');
+ return false;
+ }
+
+ delete sessionData.pbxinfo['users'][params.user];
var qs_x = new listOfActions('queues.conf');
var qs = config2json({filename: 'queues.conf', usf:0});
for (var i in qs) {
- if (qs[q].contains('member=Agent/' + user) ) {
- qs_x.new_action('delete', i, 'member', '', 'Agent/' + user);
+ if (!qs.hasOwnProperty(i)) {
+ continue;
+ }
+
+ if (qs[i].contains('member=Agent/' + params.user) ) {
+ qs_x.new_action('delete', i, 'member', '', 'Agent/' + params.user);
}
}
qs_x.callActions(function() {
if (params.vmdel) {
- ASTGUI.systemCmd('rm ' + top.sessionData.directories.voicemails_dir + user + ' -rf', params.callback);
- } else {
- params.callback();
- }
+ ASTGUI.systemCmd('rm ' + top.sessionData.directories.voicemails_dir + params.user + ' -rf', function(){});
+ }
});
+
+ params.callback();
};
/**
Modified: team/rbrindley/astman_revamp/config/js/users.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/users.js?view=diff&rev=4653&r1=4652&r2=4653
==============================================================================
--- team/rbrindley/astman_revamp/config/js/users.js (original)
+++ team/rbrindley/astman_revamp/config/js/users.js Tue Mar 24 12:48:50 2009
@@ -86,7 +86,7 @@
initialize_formFields : function(){ // USERS_MISC_FUNCTIONS.initialize_formFields();
//Load dialplans into 'edit_user_dialplan'
- var dps = parent.astgui_manageCallPlans.listPlans() ;
+ 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);
@@ -145,7 +145,7 @@
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.astgui_manageusers.listOfUsers(); ul = ul.sortNumbers( );
+ var ul = parent.pbx.users.list(); ul = ul.sortNumbers( );
if(!ul.length){
ASTGUI.domActions.clear_table( TBL );
var newRow = TBL.insertRow(-1);
@@ -289,7 +289,7 @@
},
NEW_USER_FORM : function(){ // USERS_MISC_FUNCTIONS.NEW_USER_FORM();
- var dps = parent.astgui_manageCallPlans.listPlans() ;
+ 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.",
@@ -360,7 +360,7 @@
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.astgui_manageusers.deleteuser(a , yn , reload_page );
+ parent.pbx.users.remove({user: a , vmdel: yn , callback: reload_page});
},
DELETE_SELECTED_USERS : function(){ // USERS_MISC_FUNCTIONS.DELETE_SELECTED_USERS();
@@ -385,7 +385,7 @@
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.astgui_manageusers.deleteuser(sel_users[0] , true , after_deletingFirstUser);
+ parent.pbx.users.remove({user: sel_users[0] , vmdel: true , callback: after_deletingFirstUser});
};
parent.ASTGUI.dialog.waitWhile(' Deleting selected users .... ');
@@ -393,7 +393,7 @@
},
check_duplicate_lineNumber : function(){ // USERS_MISC_FUNCTIONS.check_duplicate_lineNumber() check if another user has the same mac address and line number
- var ul = parent.astgui_manageusers.listOfUsers();
+ 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] ){
More information about the asterisk-gui-commits
mailing list