From 5b9e181198a61f5c123f5e8d5acec4c30cc8908a Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 24 Jan 2013 14:11:53 +0100 Subject: LDAP: implement deleteConfiguration feature --- apps/user_ldap/js/settings.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'apps/user_ldap/js') diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index c3484da5ac6..49bbc60d81c 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -45,12 +45,32 @@ var LdapConfiguration = { $(this).removeAttr('checked'); } }); + }, + + deleteConfiguration: function() { + $.post( + OC.filePath('user_ldap','ajax','deleteConfiguration.php'), + $('#ldap_serverconfig_chooser').serialize(), + function (result) { + if(result.status == 'success') { + $('#ldap_serverconfig_chooser option:selected').remove(); + $('#ldap_serverconfig_chooser option:first').select(); + LdapConfiguration.refreshConfig(); + } else { + OC.dialogs.alert( + result.message, + 'Deletion failed' + ); + } + } + ); } } $(document).ready(function() { $('#ldapSettings').tabs(); $('#ldap_action_test_connection').button(); + $('#ldap_action_delete_configuration').button(); LdapConfiguration.refreshConfig(); $('#ldap_action_test_connection').click(function(event){ event.preventDefault(); @@ -73,6 +93,19 @@ $(document).ready(function() { ); }); + $('#ldap_action_delete_configuration').click(function(event) { + event.preventDefault(); + OC.dialogs.confirm( + 'Do you really want to delete the current Server Configuration?', + 'Confirm Deletion', + function(deleteConfiguration) { + if(deleteConfiguration) { + LdapConfiguration.deleteConfiguration(); + } + } + ); + }); + $('#ldap_submit').click(function(event) { event.preventDefault(); $.post( -- cgit v1.2.3