|
|
@ -144,7 +144,10 @@ var LdapWizard = { |
|
|
|
|
|
|
|
|
|
|
|
applyChanges: function (result) { |
|
|
|
applyChanges: function (result) { |
|
|
|
for (id in result.changes) { |
|
|
|
for (id in result.changes) { |
|
|
|
LdapWizard.saveBlacklist[id] = true; |
|
|
|
if(!$.isArray(result.changes[id])) { |
|
|
|
|
|
|
|
//no need to blacklist multiselect
|
|
|
|
|
|
|
|
LdapWizard.saveBlacklist[id] = true; |
|
|
|
|
|
|
|
} |
|
|
|
$('#'+id).val(result.changes[id]); |
|
|
|
$('#'+id).val(result.changes[id]); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -162,12 +165,12 @@ var LdapWizard = { |
|
|
|
function(result) { |
|
|
|
function(result) { |
|
|
|
LdapWizard.applyChanges(result); |
|
|
|
LdapWizard.applyChanges(result); |
|
|
|
if($('#ldap_base').val()) { |
|
|
|
if($('#ldap_base').val()) { |
|
|
|
$('#ldap_base').removeClass('hidden'); |
|
|
|
$('#ldap_base').removeClass('invisible'); |
|
|
|
LdapWizard.hideInfoBox(); |
|
|
|
LdapWizard.hideInfoBox(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
function (result) { |
|
|
|
function (result) { |
|
|
|
$('#ldap_base').removeClass('hidden'); |
|
|
|
$('#ldap_base').removeClass('invisible'); |
|
|
|
LdapWizard.showInfoBox('Please specify a port'); |
|
|
|
LdapWizard.showInfoBox('Please specify a port'); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
@ -187,28 +190,59 @@ var LdapWizard = { |
|
|
|
function(result) { |
|
|
|
function(result) { |
|
|
|
LdapWizard.applyChanges(result); |
|
|
|
LdapWizard.applyChanges(result); |
|
|
|
if($('#ldap_port').val()) { |
|
|
|
if($('#ldap_port').val()) { |
|
|
|
$('#ldap_port').removeClass('hidden'); |
|
|
|
$('#ldap_port').removeClass('invisible'); |
|
|
|
LdapWizard.hideInfoBox(); |
|
|
|
LdapWizard.hideInfoBox(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
function (result) { |
|
|
|
function (result) { |
|
|
|
$('#ldap_port').removeClass('hidden'); |
|
|
|
$('#ldap_port').removeClass('invisible'); |
|
|
|
LdapWizard.showInfoBox('Please specify the BaseDN'); |
|
|
|
LdapWizard.showInfoBox('Please specify the BaseDN'); |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
findObjectClasses: function() { |
|
|
|
|
|
|
|
param = 'action=determineObjectClasses'+ |
|
|
|
|
|
|
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LdapWizard.ajax(param, |
|
|
|
|
|
|
|
function(result) { |
|
|
|
|
|
|
|
$('#ldap_userfilter_objectclass').find('option').remove(); |
|
|
|
|
|
|
|
for (i in result.options['ldap_userfilter_objectclass']) { |
|
|
|
|
|
|
|
//FIXME: move HTML into template
|
|
|
|
|
|
|
|
objc = result.options['ldap_userfilter_objectclass'][i]; |
|
|
|
|
|
|
|
$('#ldap_userfilter_objectclass').append("<option value='"+objc+"'>"+objc+"</option>"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
LdapWizard.applyChanges(result); |
|
|
|
|
|
|
|
$('#ldap_userfilter_objectclass').multiselect('refresh'); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
function (result) { |
|
|
|
|
|
|
|
//TODO: error handling
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
hideInfoBox: function() { |
|
|
|
hideInfoBox: function() { |
|
|
|
if(LdapWizard.checkInfoShown) { |
|
|
|
if(LdapWizard.checkInfoShown) { |
|
|
|
$('#ldapWizard1 .ldapWizardInfo').addClass('hidden'); |
|
|
|
$('#ldapWizard1 .ldapWizardInfo').addClass('invisible'); |
|
|
|
LdapWizard.checkInfoShown = false; |
|
|
|
LdapWizard.checkInfoShown = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
init: function() { |
|
|
|
init: function() { |
|
|
|
if($('#ldap_port').val()) { |
|
|
|
if($('#ldap_port').val()) { |
|
|
|
$('#ldap_port').removeClass('hidden'); |
|
|
|
$('#ldap_port').removeClass('invisible'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initUserFilter: function() { |
|
|
|
|
|
|
|
LdapWizard.findObjectClasses(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onTabChange: function(event, ui) { |
|
|
|
|
|
|
|
if(ui.newTab[0].id === '#ldapWizard2') { |
|
|
|
|
|
|
|
LdapWizard.initUserFilter(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -227,8 +261,20 @@ var LdapWizard = { |
|
|
|
delete LdapWizard.saveBlacklist[inputObj.id]; |
|
|
|
delete LdapWizard.saveBlacklist[inputObj.id]; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
param = 'cfgkey='+inputObj.id+ |
|
|
|
LdapWizard._save(inputObj, $(inputObj).val()); |
|
|
|
'&cfgval='+$(inputObj).val()+ |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveMultiSelect: function(originalObj, resultObj) { |
|
|
|
|
|
|
|
values = ''; |
|
|
|
|
|
|
|
for(i = 0; i < resultObj.length; i++) { |
|
|
|
|
|
|
|
values = values + "\n" + resultObj[i].value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
LdapWizard._save($('#'+originalObj)[0], $.trim(values)); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_save: function(object, value) { |
|
|
|
|
|
|
|
param = 'cfgkey='+object.id+ |
|
|
|
|
|
|
|
'&cfgval='+value+ |
|
|
|
'&action=save'+ |
|
|
|
'&action=save'+ |
|
|
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); |
|
|
|
'&ldap_serverconfig_chooser='+$('#ldap_serverconfig_chooser').val(); |
|
|
|
|
|
|
|
|
|
|
@ -237,7 +283,7 @@ var LdapWizard = { |
|
|
|
param, |
|
|
|
param, |
|
|
|
function(result) { |
|
|
|
function(result) { |
|
|
|
if(result.status == 'success') { |
|
|
|
if(result.status == 'success') { |
|
|
|
LdapWizard.processChanges(inputObj); |
|
|
|
LdapWizard.processChanges(object); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// alert('Oooooooooooh :(');
|
|
|
|
// alert('Oooooooooooh :(');
|
|
|
|
} |
|
|
|
} |
|
|
@ -247,17 +293,28 @@ var LdapWizard = { |
|
|
|
|
|
|
|
|
|
|
|
showInfoBox: function(text) { |
|
|
|
showInfoBox: function(text) { |
|
|
|
$('#ldapWizard1 .ldapWizardInfo').text(t('user_ldap', text)); |
|
|
|
$('#ldapWizard1 .ldapWizardInfo').text(t('user_ldap', text)); |
|
|
|
$('#ldapWizard1 .ldapWizardInfo').removeClass('hidden'); |
|
|
|
$('#ldapWizard1 .ldapWizardInfo').removeClass('invisible'); |
|
|
|
LdapWizard.checkInfoShown = true; |
|
|
|
LdapWizard.checkInfoShown = true; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function() { |
|
|
|
$('#ldapAdvancedAccordion').accordion({ heightStyle: 'content', animate: 'easeInOutCirc'}); |
|
|
|
$('#ldapAdvancedAccordion').accordion({ heightStyle: 'content', animate: 'easeInOutCirc'}); |
|
|
|
$('#ldapSettings').tabs(); |
|
|
|
$('#ldapSettings').tabs({ beforeActivate: LdapWizard.onTabChange }); |
|
|
|
$('#ldap_submit').button(); |
|
|
|
$('#ldap_submit').button(); |
|
|
|
$('#ldap_action_test_connection').button(); |
|
|
|
$('#ldap_action_test_connection').button(); |
|
|
|
$('#ldap_action_delete_configuration').button(); |
|
|
|
$('#ldap_action_delete_configuration').button(); |
|
|
|
|
|
|
|
$('#ldap_userfilter_groups').multiselect(); |
|
|
|
|
|
|
|
$('#ldap_userfilter_objectclass').multiselect({ |
|
|
|
|
|
|
|
header: false, |
|
|
|
|
|
|
|
selectedList: 9, |
|
|
|
|
|
|
|
noneSelectedText: t('user_ldap', 'Select object classes'), |
|
|
|
|
|
|
|
click: function(event, ui) { |
|
|
|
|
|
|
|
LdapWizard.saveMultiSelect('ldap_userfilter_objectclass', |
|
|
|
|
|
|
|
$('#ldap_userfilter_objectclass').multiselect("getChecked") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
$('.lwautosave').change(function() { LdapWizard.save(this); }); |
|
|
|
$('.lwautosave').change(function() { LdapWizard.save(this); }); |
|
|
|
LdapConfiguration.refreshConfig(); |
|
|
|
LdapConfiguration.refreshConfig(); |
|
|
|
$('#ldap_action_test_connection').click(function(event){ |
|
|
|
$('#ldap_action_test_connection').click(function(event){ |
|
|
|