ldapsaisie/public_html/includes/js/LSselect.js

151 lines
5 KiB
JavaScript
Raw Normal View History

var LSselect = new Class({
initialize: function(){
this.main_page = $('LSobject-select-main-div').getParent();
this.content = $('content');
2020-04-29 15:54:21 +02:00
this.multiple = LSselect_multiple;
2020-04-29 15:54:21 +02:00
this.LSselect_search_form = $('LSselect_search_form');
var input = new Element('input');
input.setProperty('name','ajax');
input.setProperty('type','hidden');
input.injectInside(this.LSselect_search_form);
2020-04-29 15:54:21 +02:00
this.tempInput = [];
2020-04-29 15:54:21 +02:00
this.LSselect_search_form.addEvent('submit',this.onSubmitSearchForm.bindWithEvent(this));
2020-04-29 15:54:21 +02:00
this.LSselect_topDn = $('LSselect_topDn');
if (this.LSselect_topDn) {
this.LSselect_topDn.addEvent('change',this.onChangeLSselect_topDn.bind(this));
}
this.LSselect_refresh_btn = $('LSselect_refresh_btn');
this.LSselect_refresh_btn.addEvent('click',this.onClickLSselect_refresh_btn.bind(this));
2020-04-29 15:54:21 +02:00
this.initializeContent();
varLSdefault.ajaxDisplayDebugAndError();
},
2020-04-29 15:54:21 +02:00
initializeContent: function() {
$$('input.LSobject-select').each(function(el) {
el.addEvent('click',this.oncheckboxChange.bind(this,el));
}, this);
2020-04-29 15:54:21 +02:00
$$('a.LSobject-list-page').each(function(el) {
el.addEvent('click',this.onChangePageClick.bindWithEvent(this,el));
}, this);
2020-04-29 15:54:21 +02:00
$$('.sortBy_displayName').each(function(el) {
el.addEvent('click',this.sortBy.bind(this,'displayName'));
}, this);
2020-04-29 15:54:21 +02:00
$$('.sortBy_subDn').each(function(el) {
el.addEvent('click',this.sortBy.bind(this,'subDn'));
}, this);
2020-04-29 15:54:21 +02:00
$$('td.LSobject-select-names').each(function(el) {
el.addEvent('click',this.onNameClick.bind(this,el));
}, this);
},
oncheckboxChange: function(checkbox){
if (checkbox.checked) {
var url = 'ajax/class/LSselect/addItem';
var data = {
objectdn: checkbox.value,
objecttype: $('LSselect-object').getProperties('caption').caption,
multiple: this.multiple
};
}
else {
var url = 'ajax/class/LSselect/dropItem';
var data = {
objectdn: checkbox.value,
objecttype: $('LSselect-object').getProperties('caption').caption,
multiple: this.multiple
};
}
data.imgload=varLSdefault.loadingImgDisplay(checkbox.getParent().getNext(),'inside');
new Request({url: url, data: data, onSuccess: this.oncheckboxChangeComplete.bind(this)}).send();
},
oncheckboxChangeComplete: function(responseText, responseXML) {
var data = JSON.decode(responseText);
varLSdefault.loadingImgHide(data.imgload);
},
2020-04-29 15:54:21 +02:00
onChangePageClick: function(event, a) {
new Event(event).stop();
var data = {
ajax: true
};
this.searchImgload = varLSdefault.loadingImgDisplay($('LSselect_title'),'inside');
new Request({url: a.href, data: data, onSuccess: this.onChangePageClickComplete.bind(this)}).send();
},
2020-04-29 15:54:21 +02:00
onChangePageClickComplete: function(responseText, responseXML) {
varLSdefault.loadingImgHide(this.searchImgload);
this.content.set('html',responseText);
this.initializeContent();
},
2020-04-29 15:54:21 +02:00
onChangeLSselect_topDn: function() {
this.submitSearchForm();
},
2020-04-29 15:54:21 +02:00
onSubmitSearchForm: function(event) {
new Event(event).stop();
this.submitSearchForm();
},
2020-04-29 15:54:21 +02:00
submitSearchForm: function() {
this.searchImgload = varLSdefault.loadingImgDisplay($('LSselect_title'),'inside');
this.LSselect_search_form.set('send',{
data: this.LSselect_search_form,
evalScripts: true,
onSuccess: this.onSubmitSearchFormComplete.bind(this),
url: this.LSselect_search_form.get('action'),
multiple: this.multiple
});
this.LSselect_search_form.send();
},
2020-04-29 15:54:21 +02:00
onSubmitSearchFormComplete: function(responseText, responseXML) {
varLSdefault.loadingImgHide(this.searchImgload);
2020-04-29 15:54:21 +02:00
this.content.set('html',responseText);
2020-04-29 15:54:21 +02:00
varLSdefault.ajaxDisplayDebugAndError();
2020-04-29 15:54:21 +02:00
this.tempInput.each(function(el) {
el.destroy();
},this);
2020-04-29 15:54:21 +02:00
this.initializeContent();
},
onClickLSselect_refresh_btn: function() {
this.tempInput['refresh'] = new Element('input');
this.tempInput['refresh'].setProperty('name','refresh');
this.tempInput['refresh'].setProperty('type','hidden');
this.tempInput['refresh'].setProperty('value',1);
this.tempInput['refresh'].injectInside(this.LSselect_search_form);
this.submitSearchForm();
},
2020-04-29 15:54:21 +02:00
sortBy: function(value) {
this.tempInput['sortBy'] = new Element('input');
- LSsearch/LSsearchEntry : Added a new classes to doing and exploit ldap object search -> view/select => change to use it (php+template+js) -> LSattr_html_select_object/LSattr_html_select_list => change to use it -> LSldapObject : -> change listObjectsName() / searchObject() / getSelectArray() / listObjects() -> comment search() function -> Add triggers to clean cache -> LSpeople : Update search config -> LSsession : Change function to use it : - getSubDnLdapServer() - loadLSprofiles() - LSrelation : Deplace error codes declaration from LSsession in class file - LSldapObject : -> change getObjectFilter() / getLabel() / getSubDnValue() / getSubDnName() for can call then staticaly -> Add afterModify() function and trigger -> Change getObjectFilter() / listObjectsInRelation() to use Net_LDAP2_Filter -> Add __get() function -> Move one LSerror code for LSrelation function from LSsession class file -> Add a global variable to save cached data ($cache) -> Change subDn and subDnName access methods - LSauth : Move LSsession auth procedure in a dedicated class -> LSsession : Change startLSsession() to use it - LSsession : -> Add getRootDn() function -> Fix getTopDn() to return root DN if no topDn is currently defined -> Create dedicated functions to support recoveryPassword mecanism : - recoverPasswd() - recoverPasswdSendMail() - recoverPasswdFirstStep() - recoverPasswdSecondStep -> Customize LSdebug return and display (php+js) -> Clean unused error codes -> Move LSrelation error codes -> Comment ajax method
2009-10-30 01:03:17 +01:00
this.tempInput['sortBy'].setProperty('name','sortBy');
this.tempInput['sortBy'].setProperty('type','hidden');
this.tempInput['sortBy'].setProperty('value',value);
this.tempInput['sortBy'].injectInside(this.LSselect_search_form);
this.submitSearchForm();
},
2020-04-29 15:54:21 +02:00
onNameClick: function(td) {
var input = td.getParent().getFirst().getFirst();
input.checked = (!input.checked);
input.fireEvent('click');
}
});