|
|
|
@ -8,13 +8,13 @@ var LdapConfiguration = {
|
|
|
|
OC.filePath('user_ldap','ajax','getConfiguration.php'),
|
|
|
|
OC.filePath('user_ldap','ajax','getConfiguration.php'),
|
|
|
|
$('#ldap_serverconfig_chooser').serialize(),
|
|
|
|
$('#ldap_serverconfig_chooser').serialize(),
|
|
|
|
function (result) {
|
|
|
|
function (result) {
|
|
|
|
if(result.status == 'success') {
|
|
|
|
if(result.status === 'success') {
|
|
|
|
$.each(result.configuration, function(configkey, configvalue) {
|
|
|
|
$.each(result.configuration, function(configkey, configvalue) {
|
|
|
|
elementID = '#'+configkey;
|
|
|
|
elementID = '#'+configkey;
|
|
|
|
|
|
|
|
|
|
|
|
//deal with Checkboxes
|
|
|
|
//deal with Checkboxes
|
|
|
|
if($(elementID).is('input[type=checkbox]')) {
|
|
|
|
if($(elementID).is('input[type=checkbox]')) {
|
|
|
|
if(configvalue == 1) {
|
|
|
|
if(configvalue === 1) {
|
|
|
|
$(elementID).attr('checked', 'checked');
|
|
|
|
$(elementID).attr('checked', 'checked');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$(elementID).removeAttr('checked');
|
|
|
|
$(elementID).removeAttr('checked');
|
|
|
|
@ -37,13 +37,13 @@ var LdapConfiguration = {
|
|
|
|
|
|
|
|
|
|
|
|
resetDefaults: function() {
|
|
|
|
resetDefaults: function() {
|
|
|
|
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
|
|
|
|
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
|
|
|
|
if($(this).attr('id') == 'ldap_serverconfig_chooser') {
|
|
|
|
if($(this).attr('id') === 'ldap_serverconfig_chooser') {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$(this).val($(this).attr('data-default'));
|
|
|
|
$(this).val($(this).attr('data-default'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('#ldap').find('input[type=checkbox]').each(function() {
|
|
|
|
$('#ldap').find('input[type=checkbox]').each(function() {
|
|
|
|
if($(this).attr('data-default') == 1) {
|
|
|
|
if($(this).attr('data-default') === 1) {
|
|
|
|
$(this).attr('checked', 'checked');
|
|
|
|
$(this).attr('checked', 'checked');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$(this).removeAttr('checked');
|
|
|
|
$(this).removeAttr('checked');
|
|
|
|
@ -56,7 +56,7 @@ var LdapConfiguration = {
|
|
|
|
OC.filePath('user_ldap','ajax','deleteConfiguration.php'),
|
|
|
|
OC.filePath('user_ldap','ajax','deleteConfiguration.php'),
|
|
|
|
$('#ldap_serverconfig_chooser').serialize(),
|
|
|
|
$('#ldap_serverconfig_chooser').serialize(),
|
|
|
|
function (result) {
|
|
|
|
function (result) {
|
|
|
|
if(result.status == 'success') {
|
|
|
|
if(result.status === 'success') {
|
|
|
|
$('#ldap_serverconfig_chooser option:selected').remove();
|
|
|
|
$('#ldap_serverconfig_chooser option:selected').remove();
|
|
|
|
$('#ldap_serverconfig_chooser option:first').select();
|
|
|
|
$('#ldap_serverconfig_chooser option:first').select();
|
|
|
|
LdapConfiguration.refreshConfig();
|
|
|
|
LdapConfiguration.refreshConfig();
|
|
|
|
@ -74,7 +74,7 @@ var LdapConfiguration = {
|
|
|
|
$.post(
|
|
|
|
$.post(
|
|
|
|
OC.filePath('user_ldap','ajax','getNewServerConfigPrefix.php'),
|
|
|
|
OC.filePath('user_ldap','ajax','getNewServerConfigPrefix.php'),
|
|
|
|
function (result) {
|
|
|
|
function (result) {
|
|
|
|
if(result.status == 'success') {
|
|
|
|
if(result.status === 'success') {
|
|
|
|
if(doNotAsk) {
|
|
|
|
if(doNotAsk) {
|
|
|
|
LdapConfiguration.resetDefaults();
|
|
|
|
LdapConfiguration.resetDefaults();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -115,7 +115,7 @@ $(document).ready(function() {
|
|
|
|
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
|
|
|
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
|
|
|
$('#ldap').serialize(),
|
|
|
|
$('#ldap').serialize(),
|
|
|
|
function (result) {
|
|
|
|
function (result) {
|
|
|
|
if (result.status == 'success') {
|
|
|
|
if (result.status === 'success') {
|
|
|
|
OC.dialogs.alert(
|
|
|
|
OC.dialogs.alert(
|
|
|
|
result.message,
|
|
|
|
result.message,
|
|
|
|
t('user_ldap', 'Connection test succeeded')
|
|
|
|
t('user_ldap', 'Connection test succeeded')
|
|
|
|
@ -150,7 +150,7 @@ $(document).ready(function() {
|
|
|
|
$('#ldap').serialize(),
|
|
|
|
$('#ldap').serialize(),
|
|
|
|
function (result) {
|
|
|
|
function (result) {
|
|
|
|
bgcolor = $('#ldap_submit').css('background');
|
|
|
|
bgcolor = $('#ldap_submit').css('background');
|
|
|
|
if (result.status == 'success') {
|
|
|
|
if (result.status === 'success') {
|
|
|
|
//the dealing with colors is a but ugly, but the jQuery version in use has issues with rgba colors
|
|
|
|
//the dealing with colors is a but ugly, but the jQuery version in use has issues with rgba colors
|
|
|
|
$('#ldap_submit').css('background', '#fff');
|
|
|
|
$('#ldap_submit').css('background', '#fff');
|
|
|
|
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
|
|
|
|
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
|
|
|
|
@ -168,7 +168,7 @@ $(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
|
|
$('#ldap_serverconfig_chooser').change(function(event) {
|
|
|
|
$('#ldap_serverconfig_chooser').change(function(event) {
|
|
|
|
value = $('#ldap_serverconfig_chooser option:selected:first').attr('value');
|
|
|
|
value = $('#ldap_serverconfig_chooser option:selected:first').attr('value');
|
|
|
|
if(value == 'NEW') {
|
|
|
|
if(value === 'NEW') {
|
|
|
|
LdapConfiguration.addConfiguration(false);
|
|
|
|
LdapConfiguration.addConfiguration(false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
LdapConfiguration.refreshConfig();
|
|
|
|
LdapConfiguration.refreshConfig();
|
|
|
|
|