mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-19 08:39:06 +01:00
b88fca55cb
-> help_info ajouté dans la configuration des attributs - LSeepeople : Ajout d'une bulle d'aide pour loginshell - LSdebug : Renomage des fonctions attachées : - debug() -> LSdebug() - debug_pring() -> LSdebug_print() -> Nétoyage des debug dans le code et renomage quand nécessaire. -> Ajout d'une fonctionnalité de dump de variable à LSdebug() - LSsession : Correction d'un problème de chemin pour les scripts JS
74 lines
2.3 KiB
JavaScript
74 lines
2.3 KiB
JavaScript
var LSform = new Class({
|
|
initialize: function(){
|
|
this._modules=[];
|
|
this.initializeLSform_AddAndRemoveBtns();
|
|
this.LStips = new Tips('.LStips');
|
|
},
|
|
|
|
initializeLSform_AddAndRemoveBtns: function(el) {
|
|
if (typeof(el) == 'undefined') {
|
|
el = document;
|
|
}
|
|
el.getElements('img[class=LSform-add-field-btn]').each(function(btn) {
|
|
btn.addEvent('click',this.onAddFieldBtnClick.bind(this,btn));
|
|
}, this);
|
|
el.getElements('img[class=LSform-remove-field-btn]').each(function(btn) {
|
|
btn.addEvent('click',this.onRemoveFieldBtnClick.bind(this,btn));
|
|
}, this);
|
|
},
|
|
|
|
addModule: function(name,obj) {
|
|
this._modules[name]=obj;
|
|
},
|
|
|
|
onAddFieldBtnClick: function(img){
|
|
var getAttrName = /LSform_add_field_btn_(.*)_.*/
|
|
var attrName = getAttrName.exec(img.id)[1];
|
|
LSdebug(attrName);
|
|
|
|
var data = {
|
|
template: 'LSform',
|
|
action: 'onAddFieldBtnClick',
|
|
attribute: attrName,
|
|
objecttype: $('LSform_objecttype').value,
|
|
objectdn: $('LSform_objectdn').value,
|
|
idform: $('LSform_idform').value,
|
|
img: img.id
|
|
};
|
|
LSdebug(data);
|
|
data.imgload = varLSdefault.loadingImgDisplay(img);
|
|
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onAddFieldBtnClickComplete.bind(this)}).send();
|
|
},
|
|
|
|
onAddFieldBtnClickComplete: function(responseText, responseXML) {
|
|
var data = JSON.decode(responseText);
|
|
LSdebug(data);
|
|
if ( varLSdefault.checkAjaxReturn(data) ) {
|
|
var li = new Element('li');
|
|
var img = $(data.img);
|
|
li.set('html',data.html);
|
|
li.injectAfter(img.getParent());
|
|
this.initializeLSform_AddAndRemoveBtns(li);
|
|
if (typeof(this._modules[data.fieldtype]) != "undefined") {
|
|
try {
|
|
this._modules[data.fieldtype].reinitialize(li);
|
|
}
|
|
catch(e) {
|
|
LSdebug('Pas de reinitialise pour ' + data.fieldtype);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
onRemoveFieldBtnClick: function(img) {
|
|
if (img.getParent().getParent().getChildren().length == 1) {
|
|
img.getPrevious().getPrevious().value='';
|
|
}
|
|
else {
|
|
img.getParent().destroy();
|
|
}
|
|
}
|
|
});
|
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
|
varLSform = new LSform();
|
|
});
|