2008-02-05 17:11:21 +01:00
|
|
|
var LSdefault = new Class({
|
|
|
|
initialize: function(){
|
2009-01-22 17:38:54 +01:00
|
|
|
// LSdebug
|
2009-04-14 20:00:10 +02:00
|
|
|
this.LSdebug = new LSinfosBox({
|
|
|
|
name: 'LSdebug',
|
|
|
|
fxDuration: 600,
|
|
|
|
closeBtn: 1,
|
|
|
|
autoClose: 0
|
|
|
|
});
|
|
|
|
this.LSdebugInfos = $('LSdebug_txt');
|
2008-07-05 22:28:49 +02:00
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
// LSerror
|
2009-04-14 20:00:10 +02:00
|
|
|
this.LSerror = new LSinfosBox({
|
|
|
|
name: 'LSerror',
|
|
|
|
opacity: 0.9,
|
|
|
|
autoClose: 10000
|
|
|
|
});
|
|
|
|
this.LSerror_div = $('LSerror_txt');
|
2008-09-09 17:48:07 +02:00
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
// LSinfos
|
2009-04-14 20:00:10 +02:00
|
|
|
this.LSinfos = new LSinfosBox({name: 'LSinfos'});
|
|
|
|
this.LSinfos_div = $('LSinfos_txt');
|
2008-07-05 22:28:49 +02:00
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
// LSjsConfig
|
2008-07-18 16:02:46 +02:00
|
|
|
this.LSjsConfigEl = $('LSjsConfig');
|
|
|
|
if ($type(this.LSjsConfigEl)) {
|
2018-04-26 11:06:10 +02:00
|
|
|
this.LSjsConfig = JSON.decode(atob(this.LSjsConfigEl.innerHTML));
|
2008-07-18 16:02:46 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.LSjsConfig = [];
|
|
|
|
}
|
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
this.loading_img=[];
|
|
|
|
this.loading_img_id=-1;
|
2009-01-22 17:38:54 +01:00
|
|
|
|
|
|
|
// LSsession_topDn
|
2008-04-25 15:48:12 +02:00
|
|
|
this.LSsession_topDn = $('LSsession_topDn');
|
|
|
|
if (this.LSsession_topDn) {
|
|
|
|
this.LSsession_topDn.addEvent('change',this.onLSsession_topDnChange.bind(this));
|
|
|
|
}
|
2008-07-05 22:28:49 +02:00
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
// Display Infos
|
2008-07-05 22:28:49 +02:00
|
|
|
if (this.LSdebugInfos.innerHTML != '') {
|
2009-04-14 20:00:10 +02:00
|
|
|
this.LSdebug.display(this.LSdebugInfos.innerHTML);
|
2008-07-05 22:28:49 +02:00
|
|
|
}
|
|
|
|
|
2009-04-14 20:00:10 +02:00
|
|
|
if (this.LSerror_div.innerHTML != '') {
|
|
|
|
this.LSerror.display(this.LSerror_div.innerHTML);
|
2008-07-05 22:28:49 +02:00
|
|
|
}
|
2008-09-09 17:48:07 +02:00
|
|
|
|
2009-04-14 20:00:10 +02:00
|
|
|
if (this.LSinfos_div.innerHTML != '') {
|
|
|
|
this.LSinfos.display(this.LSinfos_div.innerHTML);
|
2008-09-09 17:48:07 +02:00
|
|
|
}
|
2008-11-14 18:36:49 +01:00
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
// :)
|
2008-11-25 00:40:47 +01:00
|
|
|
var getMoo = /moo$/;
|
|
|
|
if (getMoo.exec(window.location)) {
|
2009-01-22 17:38:54 +01:00
|
|
|
this.moo();
|
2008-11-25 00:40:47 +01:00
|
|
|
}
|
2009-01-22 17:38:54 +01:00
|
|
|
document.addEvent('keyup',this.onWantMoo.bindWithEvent(this));
|
2008-11-25 00:40:47 +01:00
|
|
|
|
2017-01-25 11:59:54 +01:00
|
|
|
this.LStips = new Tips('.LStips', {'text': ""});
|
2009-02-20 15:05:22 +01:00
|
|
|
|
|
|
|
if ($type(this.LSjsConfig['keepLSsessionActive'])) {
|
|
|
|
this.LSjsConfig['keepLSsessionActive'] = (Math.round(this.LSjsConfig['keepLSsessionActive']*0.70)*1000);
|
|
|
|
this.keepLSsession.delay(this.LSjsConfig['keepLSsessionActive'],this);
|
|
|
|
}
|
2009-03-19 18:42:51 +01:00
|
|
|
|
|
|
|
this.initializeLang();
|
|
|
|
},
|
|
|
|
|
|
|
|
initializeLang: function() {
|
|
|
|
this.LSlang = $('LSlang');
|
|
|
|
if ($type(this.LSlang)) {
|
|
|
|
this.LSlang_select = $('LSlang_select');
|
|
|
|
if (this.LSlang_select) {
|
|
|
|
this.LSlang_open=0;
|
|
|
|
window.addEvent('click',this.closeLSlang.bind(this));
|
|
|
|
this.LSlang.addEvent('click',this.onLSlangClick.bind(this));
|
|
|
|
this.LSlang_select.getElements('img').each(function(img) {
|
|
|
|
img.addEvent('click',this.onSelectLSlangImgClick.bind(this,img));
|
|
|
|
},this);
|
2009-03-19 21:43:44 +01:00
|
|
|
document.getElements('.LSlang_hidden').each(function(el) {
|
|
|
|
el.dispose();
|
|
|
|
},this);
|
2009-03-19 18:42:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
onLSlangClick: function() {
|
|
|
|
LSdebug(this.LSlang_select);
|
|
|
|
var infos = this.LSlang.getCoordinates();
|
|
|
|
this.LSlang_select.setStyle('top',infos.bottom);
|
|
|
|
this.LSlang_select.setStyle('left',infos.right);
|
|
|
|
this.LSlang_select.setStyle('display','block');
|
|
|
|
this.LSlang_open=1;
|
|
|
|
},
|
|
|
|
|
|
|
|
closeLSlang: function(event) {
|
|
|
|
event = new Event(event);
|
|
|
|
if (event.target.id!='LSlang') {
|
|
|
|
this.LSlang_select.setStyle('display','none');
|
|
|
|
this.LSlang_open = 0;
|
|
|
|
}
|
|
|
|
},
|
2018-06-15 16:09:36 +02:00
|
|
|
|
|
|
|
getCurrentLang: function() {
|
|
|
|
if ($type(this.LSlang)) {
|
|
|
|
return this.LSlang.get('alt');
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2009-03-19 18:42:51 +01:00
|
|
|
|
|
|
|
onSelectLSlangImgClick: function(img) {
|
|
|
|
window.location='index.php?lang='+img.alt;
|
2008-04-25 15:48:12 +02:00
|
|
|
},
|
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
onWantMoo: function(event) {
|
|
|
|
event=new Event(event);
|
2018-06-15 16:03:24 +02:00
|
|
|
if ((event.alt) && (event.control) && (event.key=='m')) {
|
2009-01-22 17:38:54 +01:00
|
|
|
this.moo.run(null,this);
|
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
},
|
|
|
|
|
2009-01-22 17:38:54 +01:00
|
|
|
moo: function() {
|
2009-04-14 20:00:10 +02:00
|
|
|
var mooTxt = "<pre> (__) .ooooooooooooooooooo.\n (oo) °°°°0 I love LdapSaisie 0\n /------\\\/ °ooooooooooooooooooo°\n / | ||\n * /\---/\\\n ~~ ~~</pre>";
|
2009-10-29 22:58:57 +01:00
|
|
|
this.LSinfos.displayOrAdd(mooTxt);
|
2008-02-08 18:39:24 +01:00
|
|
|
},
|
2009-01-22 17:38:54 +01:00
|
|
|
|
|
|
|
onLSsession_topDnChange: function() {
|
|
|
|
$('LSsession_topDn_form').submit();
|
2009-01-21 18:08:09 +01:00
|
|
|
},
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-07-05 22:28:49 +02:00
|
|
|
checkAjaxReturn: function(data) {
|
2009-04-14 20:00:10 +02:00
|
|
|
this.LSerror.close(0);
|
2008-11-10 00:18:35 +01:00
|
|
|
if ($type(data) == 'object') {
|
2009-01-21 18:08:09 +01:00
|
|
|
if (($type(data.LSredirect)) && (!$type(data.LSdebug)) ) {
|
|
|
|
document.location = data.LSredirect;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-11-10 00:18:35 +01:00
|
|
|
if ($type(data.imgload)) {
|
2008-07-05 22:28:49 +02:00
|
|
|
this.loadingImgHide(data.imgload);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.loadingImgHide();
|
|
|
|
}
|
|
|
|
|
2008-11-10 00:18:35 +01:00
|
|
|
if ($type(data.LSdebug)) {
|
2009-10-29 22:58:57 +01:00
|
|
|
this.LSdebug.displayOrAdd(data.LSdebug);
|
2008-07-05 22:28:49 +02:00
|
|
|
}
|
|
|
|
|
2008-11-10 00:18:35 +01:00
|
|
|
if ($type(data.LSinfos)) {
|
2009-10-29 22:58:57 +01:00
|
|
|
this.LSinfos.displayOrAdd(data.LSinfos);
|
2008-11-10 00:18:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($type(data.LSerror)) {
|
2009-10-29 22:58:57 +01:00
|
|
|
this.LSerror.displayOrAdd(data.LSerror);
|
2008-07-05 22:28:49 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
2009-02-17 14:46:41 +01:00
|
|
|
LSdebug('Non computable return value');
|
2008-07-05 22:28:49 +02:00
|
|
|
this.loadingImgHide();
|
|
|
|
return;
|
|
|
|
}
|
2008-02-08 18:39:24 +01:00
|
|
|
},
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-05-15 17:21:54 +02:00
|
|
|
loadingImgDisplay: function(el,position,size) {
|
2008-02-26 18:40:05 +01:00
|
|
|
this.loading_img_id++;
|
|
|
|
this.loading_img[this.loading_img_id] = new Element('img');
|
2008-05-15 17:21:54 +02:00
|
|
|
if (size=='big') {
|
2013-06-19 02:17:39 +02:00
|
|
|
var src = this.imagePath('loading');
|
2008-05-15 17:21:54 +02:00
|
|
|
}
|
|
|
|
else {
|
2013-06-19 02:17:39 +02:00
|
|
|
var src = this.imagePath('ajax-loader');
|
2008-05-15 17:21:54 +02:00
|
|
|
}
|
|
|
|
this.loading_img[this.loading_img_id].src=src;
|
2008-02-26 18:40:05 +01:00
|
|
|
if (position=='inside') {
|
|
|
|
this.loading_img[this.loading_img_id].injectInside(el);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.loading_img[this.loading_img_id].injectAfter(el);
|
|
|
|
}
|
|
|
|
return this.loading_img_id;
|
2008-02-08 18:39:24 +01:00
|
|
|
},
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
loadingImgHide: function(id) {
|
|
|
|
if (isNaN(id)) {
|
|
|
|
this.loading_img.each(function(el) {
|
2009-04-14 20:00:10 +02:00
|
|
|
if ($type(el))
|
2008-07-05 22:28:49 +02:00
|
|
|
el.destroy();
|
2008-02-26 18:40:05 +01:00
|
|
|
},this);
|
|
|
|
this.loading_img_id=-1;
|
|
|
|
}
|
|
|
|
else {
|
2008-07-05 22:28:49 +02:00
|
|
|
this.loading_img[id].destroy();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
ajaxDisplayDebugAndError: function() {
|
2009-10-29 22:58:57 +01:00
|
|
|
var LSdebug_txt = $('LSdebug_txt_ajax');
|
2008-07-05 22:28:49 +02:00
|
|
|
if (LSdebug_txt) {
|
|
|
|
var debug = LSdebug_txt.innerHTML;
|
|
|
|
if (debug) {
|
2009-10-29 22:58:57 +01:00
|
|
|
this.LSdebug.displayOrAdd(debug);
|
2008-07-05 22:28:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-29 22:58:57 +01:00
|
|
|
var LSerror_txt = $('LSerror_txt_ajax');
|
2008-07-05 22:28:49 +02:00
|
|
|
if (LSerror_txt) {
|
|
|
|
var error=LSerror_txt.innerHTML;
|
|
|
|
if (error) {
|
2009-10-29 22:58:57 +01:00
|
|
|
this.LSerror.displayOrAdd(error);
|
2008-07-05 22:28:49 +02:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-10-09 03:31:33 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
imagePath: function(image) {
|
2013-06-19 02:17:39 +02:00
|
|
|
return 'image.php?i=' + image;
|
2008-10-16 14:01:26 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
getParams: function(name) {
|
|
|
|
if ($type(this.LSjsConfig[name])) {
|
|
|
|
return this.LSjsConfig[name];
|
|
|
|
}
|
|
|
|
return new Hash();
|
2008-11-10 03:10:42 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
addHelpInfo: function(el,group,name) {
|
|
|
|
if ($type(this.LSjsConfig['helpInfos'])) {
|
|
|
|
if ($type(el)=='element') {
|
|
|
|
if ($type(this.LSjsConfig['helpInfos'][group])) {
|
|
|
|
if ($type(this.LSjsConfig['helpInfos'][group][name])) {
|
2008-11-14 18:36:49 +01:00
|
|
|
this.addTip(el);
|
2008-11-10 03:10:42 +01:00
|
|
|
el.store('tip:title',this.LSjsConfig['helpInfos'][group][name]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setHelpInfo: function(el,group,name) {
|
|
|
|
if ($type(this.LSjsConfig['helpInfos'])) {
|
|
|
|
if ($type(el)=='element') {
|
|
|
|
if ($type(this.LSjsConfig['helpInfos'][group])) {
|
|
|
|
if ($type(this.LSjsConfig['helpInfos'][group][name])) {
|
|
|
|
el.store('tip:title',this.LSjsConfig['helpInfos'][group][name]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 18:36:49 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
addTip: function(el) {
|
|
|
|
this.LStips.attach(el);
|
|
|
|
},
|
|
|
|
|
|
|
|
removeTip: function(el) {
|
|
|
|
this.LStips.detach(el);
|
2009-02-20 15:05:22 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
keepLSsession: function() {
|
|
|
|
LSdebug('Keep LSsession');
|
|
|
|
new Request({url: 'index_ajax.php', data: {}, onSuccess: this.keepLSsessionComplete.bind(this)}).send();
|
|
|
|
},
|
|
|
|
|
|
|
|
keepLSsessionComplete: function() {
|
|
|
|
LSdebug('Keep LSsession OK');
|
|
|
|
this.keepLSsession.delay(this.LSjsConfig['keepLSsessionActive'],this);
|
2009-10-29 22:58:57 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
log: function(data) {
|
|
|
|
this.LSdebug.addInfo(data);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
|
|
|
});
|
2008-07-28 18:30:40 +02:00
|
|
|
|
2008-02-05 17:11:21 +01:00
|
|
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
2008-02-08 18:39:24 +01:00
|
|
|
varLSdefault = new LSdefault();
|
2008-02-05 17:11:21 +01:00
|
|
|
});
|