ldapsaisie/trunk/includes/js/LSdefault.js

184 lines
4.8 KiB
JavaScript
Raw Normal View History

var LSdefault = new Class({
initialize: function(){
this.LSdebug = $('LSdebug');
this.LSdebug.addEvent('dblclick',this.LSdebugHidde.bind(this));
this.LSdebugInfos = $('LSdebug_infos');
this.LSdebug.setOpacity(0);
this.LSdebugHidden = $('LSdebug_hidden');
this.LSdebugHidden.addEvent('click',this.LSdebugHidde.bind(this));
this.LSerror = $('LSerror');
this.LSerror.setOpacity(0);
this.LSinfos = $('LSinfos');
- config.inc.php : Ajout d'une constante LS_CSS_DIR - Ajout d'un LSformElement Date : -> includes/class/class.LSattr_ldap_date.php -> includes/class/class.LSattr_html_date.php -> includes/class/class.LSformElement_date.php -> includes/class/class.LSformRule_date.php -> includes/libs/jscalendar -> includes/js/LSformElement_date.js -> includes/js/LSformElement_date_field.js -> templates/images/calendar.png - LSformElement : Ajout d'une méthode exportValues() utilisée par LSform::exportValues() - LSform : -> Utlisation de LSformElement::exportValues() pour exporter les données du formulaire -> Méthode setValuesFromPostData() est désormais invoqué à chaque invocation de la méthode validate() - LSformElement_select_object : Ajout d'une méthode exportValues() pour coller au nouveau mode d'exportation des données de l'annuaire - LSldapObjet : Correction d'un bug potentiel (foreach sur une variable à false) dans la méthode updateData() - LSsession : -> Méthode addCssFile() & addJSscript() : ajout d'un paramètre pour la possibilité d'inclusion de fichier externe (hors des dossiers par défaut ex: les libs) -> Utilisation de la Constante LS_CSS_DIR au lieu d'une chemin en dure -> Paramètrage JS depuis Php : -> Méthode addJSconfigParam() : ajouter un paramètre de config. JS -> Méthode displayTemplate() adaptée pour -> top.tpl : adapté pour afficher une div contenant les paramètres JSONisés -> LSdefault.css : adapté pour ne pas afficher la div contenant les params. -> LSdefault.js : récupère les informations et Initialise une variable javascript LSjsConfig - LSconfirmBox : Correction d'un debug : "delete this;"
2008-07-18 16:02:46 +02:00
this.LSjsConfigEl = $('LSjsConfig');
if ($type(this.LSjsConfigEl)) {
this.LSjsConfig = JSON.decode(this.LSjsConfigEl.innerHTML);
}
else {
this.LSjsConfig = [];
}
this.loading_img=[];
this.loading_img_id=-1;
this.LSsession_topDn = $('LSsession_topDn');
if (this.LSsession_topDn) {
this.LSsession_topDn.addEvent('change',this.onLSsession_topDnChange.bind(this));
}
this.fx = {
LSdebug: new Fx.Tween(this.LSdebug,{property: 'opacity',duration:600}),
LSerror: new Fx.Tween(this.LSerror,{property: 'opacity',duration:500}),
LSinfos: new Fx.Tween(this.LSinfos,{property: 'opacity',duration:500})
};
if (this.LSdebugInfos.innerHTML != '') {
this.displayDebugBox();
}
if (this.LSerror.innerHTML != '') {
this.displayErrorBox();
}
if (this.LSinfos.innerHTML != '') {
this.displayInfosBox();
}
},
onLSsession_topDnChange: function() {
$('LSsession_topDn_form').submit();
},
LSdebugHidde: function(){
this.fx.LSdebug.start(0.8,0);
},
checkAjaxReturn: function(data) {
if (typeof(data) == 'object') {
if (typeof(data.imgload) != "undefined") {
this.loadingImgHide(data.imgload);
}
else {
this.loadingImgHide();
}
if (typeof(data.LSdebug) != "undefined") {
LSdebug(data.LSdebug);
this.displayDebug(data.LSdebug);
}
if (typeof(data.LSerror) != "undefined") {
this.displayError(data.LSerror);
return;
}
return true;
}
else {
LSdebug('retour non-interprétable');
this.loadingImgHide();
return;
}
},
displayError: function(html) {
this.LSerror.set('html',html);
this.displayErrorBox();
},
displayDebug: function(html) {
this.LSdebugInfos.set('html',html);
this.displayDebugBox();
},
- LSview : ajout de input hidden pour contenir les informations du type et du DN de l'objet affiché. - LSmail : Ajout d'une fonctionalité d'envoie de mail depuis l'interface. -> Modification de LSformElement_mail pour utiliser cette fonctionalité -> Agrémentation du fichier index_ajax.php -> Ajout d'un LSaddons :: mail - LSsession : -> Ajout d'une méthode getEmailSender() -> Utilisation de la méthode getEmailSender() pour la partie de récupération de mot de passe -> Revue des méthodes loadLSaddon() et loadLSaddons() - LSconfirmBox : -> Ajout de binding onClose() et onCancel() - LSsmoothbox : -> Déport de la creation de la structure dans la méthode build() -> Suppression du principe de refreshElement au profit de binding sur les évenements onClose, onValid et onCancel -> Ajout des méthodes addEvent() et fireEvent() -> Suppression de la méthode setRefreshElement() -> Ajout de la méthode asNew() pour remettre l'objet dans son état d'origine pour l'utilisation simultané de l'objet par plusieurs autres -> Vérification lors du clique sur le closeBtn qu'une précédente confirmBox n'est pas déjà ouvert -> La méthode close() ne fait plus que fermer la LSsmoothbox et les méthodes valid() et cancel() gère les cas de fermeture et lance la méthode close() -> Ajout de la méthode openHTML() pour l'ouverture de la LSsmoothbox avec un code HTML passé en paramètre -> Ajout de la méthode setOption() - LSrelation & LSformElement_select_object : -> Utilisation du principe d'évenement de la LSsmoothbox plutôt que du refreshElement -> Utilisation de la méthode asNew() pour eviter tout problème de concurence - LSdefault : Ajout de la méthode displayInfos()
2008-09-25 17:15:33 +02:00
displayInfos: function(html) {
this.LSinfos.set('html',html);
this.displayInfosBox();
},
displayErrorBox: function() {
this.LSerror.setStyle('top',getScrollTop()+10);
this.fx.LSerror.start(0,0.8);
(function(){this.fx.LSerror.start(0.8,0);}).delay(10000, this);
},
displayInfosBox: function() {
this.LSinfos.setStyle('top',getScrollTop()+10);
this.fx.LSinfos.start(0,0.9);
(function(){this.fx.LSinfos.start(0.9,0);}).delay(5000, this);
},
displayDebugBox: function() {
this.LSdebug.setStyle('top',getScrollTop()+10);
this.fx.LSdebug.start(0,0.8);
},
loadingImgDisplay: function(el,position,size) {
this.loading_img_id++;
this.loading_img[this.loading_img_id] = new Element('img');
if (size=='big') {
var src = this.imagePath('loading.gif');
}
else {
var src = this.imagePath('ajax-loader.gif');
}
this.loading_img[this.loading_img_id].src=src;
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;
},
loadingImgHide: function(id) {
if (isNaN(id)) {
this.loading_img.each(function(el) {
if (typeof(el) != 'undefined')
el.destroy();
},this);
this.loading_img_id=-1;
}
else {
this.loading_img[id].destroy();
}
},
ajaxDisplayDebugAndError: function() {
var LSdebug_txt = $('LSdebug_txt');
if (LSdebug_txt) {
var debug = LSdebug_txt.innerHTML;
if (debug) {
this.displayDebug(debug.toString());
}
}
var LSerror_txt = $('LSerror_txt');
if (LSerror_txt) {
var error=LSerror_txt.innerHTML;
if (error) {
this.displayError(error.toString());
}
}
},
imagePath: function(image) {
return this.LSjsConfig['LS_IMAGES_DIR'] + '/' + image;
},
getParams: function(name) {
if ($type(this.LSjsConfig[name])) {
return this.LSjsConfig[name];
}
return new Hash();
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSdefault = new LSdefault();
});