2008-02-26 18:40:05 +01:00
|
|
|
var LSselect = new Class({
|
|
|
|
initialize: function(){
|
2008-06-18 14:27:35 +02:00
|
|
|
this.main_page = $('LSobject-select-main-div').getParent();
|
|
|
|
this.content = $('content');
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-09-28 13:05:02 +02:00
|
|
|
this.multiple = LSselect_multiple;
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-06-18 14:27:35 +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
|
|
|
|
2008-07-05 22:28:49 +02:00
|
|
|
this.tempInput = [];
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
this.LSselect_search_form.addEvent('submit',this.onSubmitSearchForm.bindWithEvent(this));
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-04-25 15:48:12 +02:00
|
|
|
this.LSselect_topDn = $('LSselect_topDn');
|
2008-06-18 14:27:35 +02:00
|
|
|
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
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
this.initializeContent();
|
2008-07-29 17:44:28 +02:00
|
|
|
varLSdefault.ajaxDisplayDebugAndError();
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
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);
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-02-26 18:40:05 +01: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
|
|
|
|
2009-01-07 20:58:08 +01:00
|
|
|
$$('.sortBy_displayName').each(function(el) {
|
|
|
|
el.addEvent('click',this.sortBy.bind(this,'displayName'));
|
2008-06-20 17:52:15 +02:00
|
|
|
}, this);
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-06-20 17:52:15 +02:00
|
|
|
$$('.sortBy_subDn').each(function(el) {
|
|
|
|
el.addEvent('click',this.sortBy.bind(this,'subDn'));
|
|
|
|
}, this);
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-07-19 21:14:57 +02:00
|
|
|
$$('td.LSobject-select-names').each(function(el) {
|
|
|
|
el.addEvent('click',this.onNameClick.bind(this,el));
|
|
|
|
}, this);
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
oncheckboxChange: function(checkbox){
|
|
|
|
if (checkbox.checked) {
|
|
|
|
var data = {
|
|
|
|
template: 'LSselect',
|
2009-02-20 15:05:22 +01:00
|
|
|
action: 'addItem',
|
2008-02-26 18:40:05 +01:00
|
|
|
objectdn: checkbox.value,
|
2008-09-28 13:05:02 +02:00
|
|
|
objecttype: $('LSselect-object').getProperties('caption').caption,
|
|
|
|
multiple: this.multiple
|
2008-02-26 18:40:05 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var data = {
|
|
|
|
template: 'LSselect',
|
2009-02-20 15:05:22 +01:00
|
|
|
action: 'dropItem',
|
2008-02-26 18:40:05 +01:00
|
|
|
objectdn: checkbox.value,
|
2008-09-28 13:05:02 +02:00
|
|
|
objecttype: $('LSselect-object').getProperties('caption').caption,
|
|
|
|
multiple: this.multiple
|
|
|
|
};
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
data.imgload=varLSdefault.loadingImgDisplay(checkbox.getParent().getNext(),'inside');
|
2008-07-05 22:28:49 +02:00
|
|
|
new Request({url: 'index_ajax.php', data: data, onSuccess: this.oncheckboxChangeComplete.bind(this)}).send();
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
oncheckboxChangeComplete: function(responseText, responseXML) {
|
2008-07-05 22:28:49 +02:00
|
|
|
var data = JSON.decode(responseText);
|
2008-05-13 22:25:03 +02:00
|
|
|
varLSdefault.loadingImgHide(data.imgload);
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
onChangePageClick: function(event, a) {
|
|
|
|
new Event(event).stop();
|
|
|
|
var data = {
|
|
|
|
ajax: true
|
|
|
|
};
|
2008-11-03 15:47:30 +01:00
|
|
|
this.searchImgload = varLSdefault.loadingImgDisplay($('LSselect_title'),'inside');
|
2008-07-05 22:28:49 +02:00
|
|
|
new Request({url: a.href, data: data, onSuccess: this.onChangePageClickComplete.bind(this)}).send();
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
onChangePageClickComplete: function(responseText, responseXML) {
|
|
|
|
varLSdefault.loadingImgHide(this.searchImgload);
|
2008-07-05 22:28:49 +02:00
|
|
|
this.content.set('html',responseText);
|
2008-02-26 18:40:05 +01:00
|
|
|
this.initializeContent();
|
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-04-25 15:48:12 +02:00
|
|
|
onChangeLSselect_topDn: function() {
|
2008-06-18 14:27:35 +02:00
|
|
|
this.submitSearchForm();
|
2008-04-25 15:48:12 +02:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
onSubmitSearchForm: function(event) {
|
2008-02-26 18:40:05 +01:00
|
|
|
new Event(event).stop();
|
2008-06-18 14:27:35 +02:00
|
|
|
this.submitSearchForm();
|
2008-04-25 15:48:12 +02:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
submitSearchForm: function() {
|
2008-11-03 15:47:30 +01:00
|
|
|
this.searchImgload = varLSdefault.loadingImgDisplay($('LSselect_title'),'inside');
|
2008-07-05 22:28:49 +02:00
|
|
|
this.LSselect_search_form.set('send',{
|
|
|
|
data: this.LSselect_search_form,
|
|
|
|
evalScripts: true,
|
|
|
|
onSuccess: this.onSubmitSearchFormComplete.bind(this),
|
2008-09-28 13:05:02 +02:00
|
|
|
url: this.LSselect_search_form.get('action'),
|
|
|
|
multiple: this.multiple
|
2008-02-26 18:40:05 +01:00
|
|
|
});
|
2008-07-05 22:28:49 +02:00
|
|
|
this.LSselect_search_form.send();
|
2008-02-26 18:40:05 +01:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-07-05 22:28:49 +02:00
|
|
|
onSubmitSearchFormComplete: function(responseText, responseXML) {
|
|
|
|
varLSdefault.loadingImgHide(this.searchImgload);
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-07-05 22:28:49 +02:00
|
|
|
this.content.set('html',responseText);
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-07-05 22:28:49 +02:00
|
|
|
varLSdefault.ajaxDisplayDebugAndError();
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-07-05 22:28:49 +02:00
|
|
|
this.tempInput.each(function(el) {
|
|
|
|
el.destroy();
|
|
|
|
},this);
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
this.initializeContent();
|
|
|
|
},
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
onClickLSselect_refresh_btn: function() {
|
2008-07-05 22:28:49 +02:00
|
|
|
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);
|
2008-06-18 14:27:35 +02:00
|
|
|
this.submitSearchForm();
|
2008-06-20 17:52:15 +02:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-06-20 17:52:15 +02:00
|
|
|
sortBy: function(value) {
|
2008-07-05 22:28:49 +02:00
|
|
|
this.tempInput['sortBy'] = new Element('input');
|
2009-10-30 01:03:17 +01:00
|
|
|
this.tempInput['sortBy'].setProperty('name','sortBy');
|
2008-07-05 22:28:49 +02:00
|
|
|
this.tempInput['sortBy'].setProperty('type','hidden');
|
|
|
|
this.tempInput['sortBy'].setProperty('value',value);
|
|
|
|
this.tempInput['sortBy'].injectInside(this.LSselect_search_form);
|
2008-06-20 17:52:15 +02:00
|
|
|
this.submitSearchForm();
|
2008-07-19 21:14:57 +02:00
|
|
|
},
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2008-07-19 21:14:57 +02:00
|
|
|
onNameClick: function(td) {
|
|
|
|
var input = td.getParent().getFirst().getFirst();
|
|
|
|
input.checked = (!input.checked);
|
|
|
|
input.fireEvent('click');
|
2008-06-18 14:27:35 +02:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
});
|