mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-07-09 02:57:48 +02:00
8d8ede930c
-> config.inc.php : - Deux fichiers js à include au lieu d'un seul - Suppression du Debugger (Debugger.js incompatible) - LSformElement_image : refonte de l'affichage - Templates : - LSview-action : Passage aux balises ul/li plutôt que p/a - select.tpl : correction d'un bug concernant la sélection du subDn actif - Création de LSconfirmBox : module de confirmation - JS : -> LSform.js : Modularisation du code : - LSformElement_select_object.js - LSformElement_image.js - LSformElement_password.js - CSS : -> Modularisation : - LSselect.css - LSrelation.css - LSrelation : -> Refonte du mécanisme JS -> Modification de l'affichage -> Ajout d'une confirmation à la suppresion (LSconfirmBox) - LSsmoothbox : Refonte profonde - view.php : - Correction d'un bug : la colone action était vide lors de la mise en cache par LSselect. - LSldapObject : - getDisplayValue() : ajout d'une possibilité de l'affichage du subDn en plus du nom - LSsession : ajout d'un méthode haveSubDn() - JS : - Modularisation de la verification d'une requete Ajax -> LSdefault : nouvelles méthodes : -> checkAjaxReturn() : Pour les retours JSON -> ajaxDisplayDebugAndError() : Pour les retours HTML (Type LSselect)
60 lines
2 KiB
JavaScript
60 lines
2 KiB
JavaScript
var LSform = new Class({
|
|
initialize: function(){
|
|
$$('img.LSform-add-field-btn').each(function(el) {
|
|
el.addEvent('click',this.onAddFieldBtnClick.bind(this,el));
|
|
}, this);
|
|
|
|
$$('img.LSform-remove-field-btn').each(function(el) {
|
|
el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
|
|
}, this);
|
|
},
|
|
|
|
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());
|
|
li.getElements('img[class=LSform-add-field-btn]').each(function(el) {
|
|
el.addEvent('click',this.onAddFieldBtnClick.bind(this,el));
|
|
}, this);
|
|
li.getElements('img[class=LSform-remove-field-btn]').each(function(el) {
|
|
el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
|
|
}, this);
|
|
}
|
|
},
|
|
|
|
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();
|
|
});
|