2008-02-26 18:40:05 +01:00
|
|
|
var LSselect = new Class({
|
|
|
|
initialize: function(){
|
|
|
|
this.initializeContent();
|
|
|
|
|
|
|
|
$$('form.LSselect_search').each(function(el) {
|
|
|
|
var input = new Element('input');
|
|
|
|
input.setProperty('name','ajax');
|
|
|
|
input.setProperty('type','hidden');
|
|
|
|
input.injectInside(el);
|
|
|
|
el.addEvent('submit',this.onSubmitSearchForm.bindWithEvent(this,el));
|
|
|
|
}, this);
|
|
|
|
|
2008-04-25 15:48:12 +02:00
|
|
|
this.LSselect_topDn = $('LSselect_topDn');
|
|
|
|
this.LSselect_topDn.addEvent('change',this.onChangeLSselect_topDn.bind(this));
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
initializeContent: function() {
|
|
|
|
$$('input.LSobject-select').each(function(el) {
|
|
|
|
el.addEvent('click',this.oncheckboxChange.bind(this,el));
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
$$('a.LSobject-list-page').each(function(el) {
|
|
|
|
el.addEvent('click',this.onChangePageClick.bindWithEvent(this,el));
|
|
|
|
}, this);
|
|
|
|
},
|
|
|
|
|
|
|
|
oncheckboxChange: function(checkbox){
|
|
|
|
if (checkbox.checked) {
|
|
|
|
var data = {
|
|
|
|
template: 'LSselect',
|
|
|
|
action: 'addLSselectobject-item',
|
|
|
|
objectdn: checkbox.value,
|
|
|
|
objecttype: $('LSselect-object').getProperties('caption').caption
|
|
|
|
};
|
|
|
|
LSdebug('plus');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSdebug('mois');
|
|
|
|
var data = {
|
|
|
|
template: 'LSselect',
|
|
|
|
action: 'dropLSselectobject-item',
|
|
|
|
objectdn: checkbox.value,
|
|
|
|
objecttype: $('LSselect-object').getProperties('caption').caption
|
|
|
|
};
|
|
|
|
}
|
|
|
|
LSdebug(data);
|
|
|
|
data.imgload=varLSdefault.loadingImgDisplay(checkbox.getParent().getNext(),'inside');
|
|
|
|
new Ajax('index_ajax.php', {data: data, onComplete: this.oncheckboxChangeComplete.bind(this)}).request();
|
|
|
|
},
|
|
|
|
|
|
|
|
oncheckboxChangeComplete: function(responseText, responseXML) {
|
|
|
|
var data = Json.evaluate(responseText);
|
2008-05-13 22:25:03 +02:00
|
|
|
varLSdefault.loadingImgHide(data.imgload);
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
onChangePageClick: function(event, a) {
|
|
|
|
new Event(event).stop();
|
|
|
|
var data = {
|
|
|
|
ajax: true
|
|
|
|
};
|
|
|
|
this.searchImgload = varLSdefault.loadingImgDisplay($('title'),'inside');
|
|
|
|
new Ajax(a.href, {data: data, onComplete: this.onChangePageClickComplete.bind(this)}).request();
|
|
|
|
},
|
|
|
|
|
|
|
|
onChangePageClickComplete: function(responseText, responseXML) {
|
|
|
|
varLSdefault.loadingImgHide(this.searchImgload);
|
|
|
|
$('content').setHTML(responseText);
|
|
|
|
this.initializeContent();
|
|
|
|
},
|
|
|
|
|
2008-04-25 15:48:12 +02:00
|
|
|
onChangeLSselect_topDn: function() {
|
|
|
|
form = this.LSselect_topDn.getParent().getParent();
|
|
|
|
this.submitSearchForm(form);
|
|
|
|
},
|
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
onSubmitSearchForm: function(event, form) {
|
|
|
|
new Event(event).stop();
|
2008-04-25 15:48:12 +02:00
|
|
|
this.submitSearchForm(form);
|
|
|
|
},
|
|
|
|
|
|
|
|
submitSearchForm: function(form) {
|
2008-02-26 18:40:05 +01:00
|
|
|
var imgload = varLSdefault.loadingImgDisplay($('title'),'inside');
|
|
|
|
form.send({
|
|
|
|
update: $('content'),
|
|
|
|
onComplete: this.onSubmitSearchFormComplete.bind(this,imgload)
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onSubmitSearchFormComplete: function(imgload) {
|
|
|
|
varLSdefault.loadingImgHide(imgload);
|
|
|
|
this.initializeContent();
|
|
|
|
},
|
|
|
|
|
|
|
|
submit: function() {
|
|
|
|
var values = new Array();
|
|
|
|
$('content').getElements('input[name^=LSobjects_selected]').each(function(el) {
|
|
|
|
values.push(el.value);
|
|
|
|
},this);
|
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|