mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 11:52:59 +01:00
- LSformElement_select_object : Correction de bugs
This commit is contained in:
parent
f9c9b8cb6b
commit
8849d59f5f
3 changed files with 75 additions and 33 deletions
|
@ -41,7 +41,6 @@ img.LSformElement_select_object_deleteBtn {
|
||||||
input.LSformElement_select_object_searchAdd {
|
input.LSformElement_select_object_searchAdd {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
width: 134px;
|
width: 134px;
|
||||||
display: block;
|
|
||||||
background-image: url(../../images/black/find.png);
|
background-image: url(../../images/black/find.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
|
|
|
@ -41,7 +41,6 @@ img.LSformElement_select_object_deleteBtn {
|
||||||
input.LSformElement_select_object_searchAdd {
|
input.LSformElement_select_object_searchAdd {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
width: 134px;
|
width: 134px;
|
||||||
display: block;
|
|
||||||
background-image: url(../../images/default/find.png);
|
background-image: url(../../images/default/find.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
|
|
|
@ -46,11 +46,7 @@ var LSformElement_select_object_field = new Class({
|
||||||
|
|
||||||
this._searchAddOpen = 0;
|
this._searchAddOpen = 0;
|
||||||
document.addEvent('click',this.closeIfOpenSearchAdd.bind(this));
|
document.addEvent('click',this.closeIfOpenSearchAdd.bind(this));
|
||||||
this.searchAddBtn = new Element('img');
|
this.addSearchAddBtn();
|
||||||
this.searchAddBtn.setProperty('src',varLSdefault.imagePath('add.png'));
|
|
||||||
this.searchAddBtn.addClass('btn');
|
|
||||||
this.searchAddBtn.addEvent('click',this.onSearchAddBtnClick.bindWithEvent(this));
|
|
||||||
this.searchAddBtn.injectAfter(this.addBtn);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addDeleteBtn: function(a) {
|
addDeleteBtn: function(a) {
|
||||||
|
@ -60,7 +56,7 @@ var LSformElement_select_object_field = new Class({
|
||||||
src: varLSdefault.imagePath('delete.png'),
|
src: varLSdefault.imagePath('delete.png'),
|
||||||
alt: this.params.deleteBtns
|
alt: this.params.deleteBtns
|
||||||
});
|
});
|
||||||
btn.addEvent('click',this.onDeleteBtn.bind(this,btn));
|
btn.addEvent('click',this.onDeleteBtnClick.bind(this,btn));
|
||||||
btn.injectAfter(a);
|
btn.injectAfter(a);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -72,6 +68,14 @@ var LSformElement_select_object_field = new Class({
|
||||||
this.addBtn.injectInside(insideEl);
|
this.addBtn.injectInside(insideEl);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addSearchAddBtn: function() {
|
||||||
|
this.searchAddBtn = new Element('img');
|
||||||
|
this.searchAddBtn.setProperty('src',varLSdefault.imagePath('add.png'));
|
||||||
|
this.searchAddBtn.addClass('btn');
|
||||||
|
this.searchAddBtn.addEvent('click',this.onSearchAddBtnClick.bindWithEvent(this));
|
||||||
|
this.searchAddBtn.injectAfter(this.addBtn);
|
||||||
|
},
|
||||||
|
|
||||||
onAddBtnClick: function(event) {
|
onAddBtnClick: function(event) {
|
||||||
new Event(event).stop();
|
new Event(event).stop();
|
||||||
|
|
||||||
|
@ -167,8 +171,10 @@ var LSformElement_select_object_field = new Class({
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var a = this.ul.getElement('a');
|
var a = this.ul.getElement('a');
|
||||||
|
if ($type(a)) {
|
||||||
a.href="view.php?LSobject="+this.params['object_type']+"&dn="+dn;
|
a.href="view.php?LSobject="+this.params['object_type']+"&dn="+dn;
|
||||||
a.set('html',name);
|
a.set('html',name);
|
||||||
|
a.removeClass('LSformElement_select_object_deleted');
|
||||||
|
|
||||||
var input = this.ul.getElement('input');
|
var input = this.ul.getElement('input');
|
||||||
input.setProperties({
|
input.setProperties({
|
||||||
|
@ -176,9 +182,35 @@ var LSformElement_select_object_field = new Class({
|
||||||
name: this.name+'[]'
|
name: this.name+'[]'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.ul.empty();
|
||||||
|
var li = new Element('li');
|
||||||
|
|
||||||
|
var a = new Element('a');
|
||||||
|
a.addClass('LSformElement_select_object');
|
||||||
|
a.href="view.php?LSobject="+this.params['object_type']+"&dn="+dn;
|
||||||
|
a.set('html',name);
|
||||||
|
a.injectInside(li);
|
||||||
|
|
||||||
|
var input = new Element('input');
|
||||||
|
input.setProperties({
|
||||||
|
type: 'hidden',
|
||||||
|
value: dn,
|
||||||
|
name: this.name+'[]'
|
||||||
|
});
|
||||||
|
input.addClass('LSformElement_select_object');
|
||||||
|
input.injectAfter(a);
|
||||||
|
|
||||||
|
this.addDeleteBtn(a);
|
||||||
|
li.injectInside(this.ul);
|
||||||
|
this.addSingleAddBtn(li);
|
||||||
|
this.addSearchAddBtn();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addNoValueLabelIfEmpty: function() {
|
addNoValueLabelIfEmpty: function() {
|
||||||
|
if (this.params.multiple) {
|
||||||
if (!$type(this.ul.getElement('a.LSformElement_select_object'))) {
|
if (!$type(this.ul.getElement('a.LSformElement_select_object'))) {
|
||||||
var li = new Element('li');
|
var li = new Element('li');
|
||||||
li.addClass('LSformElement_select_object');
|
li.addClass('LSformElement_select_object');
|
||||||
|
@ -186,21 +218,33 @@ var LSformElement_select_object_field = new Class({
|
||||||
li.set('html',this.params.noValueLabel);
|
li.set('html',this.params.noValueLabel);
|
||||||
li.injectInside(this.ul);
|
li.injectInside(this.ul);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var a = this.ul.getElement('a.LSformElement_select_object');
|
||||||
|
if ($type(a)) {
|
||||||
|
if (a.hasClass("LSformElement_select_object_deleted")) {
|
||||||
|
a.set('html',this.params.noValueLabel);
|
||||||
|
a.removeClass('LSformElement_select_object_deleted');
|
||||||
|
var input = this.ul.getElement('input.LSformElement_select_object');
|
||||||
|
input.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeleteBtn: function(img) {
|
onDeleteBtnClick: function(img) {
|
||||||
var li = img.getParent();
|
var li = img.getParent();
|
||||||
var a = li.getFirst('a');
|
var a = li.getFirst('a');
|
||||||
var input = li.getFirst('input');
|
var input = li.getFirst('input');
|
||||||
|
if (input.value!="") {
|
||||||
if (a.hasClass('LSformElement_select_object_deleted')) {
|
if (a.hasClass('LSformElement_select_object_deleted')) {
|
||||||
input.name=this.name+'[]';
|
input.name=this.name+'[]';
|
||||||
a.addClass('LSformElement_select_object');
|
|
||||||
a.removeClass('LSformElement_select_object_deleted');
|
a.removeClass('LSformElement_select_object_deleted');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
input.name=($random(1,10000));
|
input.name=($random(1,10000));
|
||||||
a.addClass('LSformElement_select_object_deleted');
|
a.addClass('LSformElement_select_object_deleted');
|
||||||
a.removeClass('LSformElement_select_object');
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -235,7 +279,7 @@ var LSformElement_select_object_field = new Class({
|
||||||
}
|
}
|
||||||
|
|
||||||
this._lastSearch = "";
|
this._lastSearch = "";
|
||||||
this.searchAddInput.setStyle('display','block');
|
this.searchAddInput.setStyle('display','inline');
|
||||||
this.searchAddInput.focus();
|
this.searchAddInput.focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -266,7 +310,7 @@ var LSformElement_select_object_field = new Class({
|
||||||
idform: varLSform.idform,
|
idform: varLSform.idform,
|
||||||
pattern: this.searchAddInput.value
|
pattern: this.searchAddInput.value
|
||||||
};
|
};
|
||||||
data.imgload=varLSdefault.loadingImgDisplay(this.searchAddBtn);
|
data.imgload=varLSdefault.loadingImgDisplay(this.searchAddInput);
|
||||||
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onSearchAddComplete.bind(this)}).send();
|
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onSearchAddComplete.bind(this)}).send();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue