aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-01-23 23:41:35 +0100
committerArthur Schiwon <blizzz@owncloud.com>2013-01-23 23:41:35 +0100
commit06c284f6cc6256b22f645d2d35f966c0bc98f4df (patch)
treea3c5236e77ac8dc13dd6ce76ce1ec1e3d0ea1ca9 /apps/user_ldap/js
parent83d9e1e2f083b176e3bff9d3851211b3bc9cb560 (diff)
downloadnextcloud-server-06c284f6cc6256b22f645d2d35f966c0bc98f4df.tar.gz
nextcloud-server-06c284f6cc6256b22f645d2d35f966c0bc98f4df.zip
LDAP settings: read configuration when another server config is chosen
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r--apps/user_ldap/js/settings.js37
1 files changed, 34 insertions, 3 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index a07d140cf86..66876cadaf7 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -49,6 +49,9 @@ $(document).ready(function() {
function(keep) {
if(!keep) {
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
+ if($(this).attr('id') == 'ldap_serverconfig_chooser') {
+ return;
+ }
$(this).val($(this).attr('data-default'));
});
$('#ldap').find('input[type=checkbox]').each(function() {
@@ -61,8 +64,8 @@ $(document).ready(function() {
}
}
);
- $('#ldap_serverconfig_chooser option:selected:first').removeAttr('selected');
- var html = '<option value="'+result.configPrefix+'" selected>'+$('#ldap_serverconfig_chooser option').length+'. Server</option>';
+ $('#ldap_serverconfig_chooser option:selected').removeAttr('selected');
+ var html = '<option value="'+result.configPrefix+'" selected="selected">'+$('#ldap_serverconfig_chooser option').length+'. Server</option>';
$('#ldap_serverconfig_chooser option:last').before(html);
} else {
OC.dialogs.alert(
@@ -73,7 +76,35 @@ $(document).ready(function() {
}
);
} else {
- alert(value);
+ $.post(
+ OC.filePath('user_ldap','ajax','getConfiguration.php'),
+ $('#ldap_serverconfig_chooser').serialize(),
+ function (result) {
+ if(result.status == 'success') {
+ $.each(result.configuration, function(configkey, configvalue) {
+ elementID = '#'+configkey;
+
+ //deal with Checkboxes
+ if($(elementID).is('input[type=checkbox]')) {
+ if(configvalue == 1) {
+ $(elementID).attr('checked', 'checked');
+ } else {
+ $(elementID).removeAttr('checked');
+ }
+ return;
+ }
+
+ //On Textareas, Multi-Line Settings come as array
+ if($(elementID).is('textarea') && $.isArray(configvalue)) {
+ configvalue = configvalue.join("\n");
+ }
+
+ // assign the value
+ $('#'+configkey).val(configvalue);
+ });
+ }
+ }
+ );
}
});
}); \ No newline at end of file