mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 22:43:47 +01:00
- LSsmoothbox : Création d'une classe PHP gérant les dépendances d'affichage
et permettant l'internationnalisation. Modification de l'effet de fermeture.
This commit is contained in:
parent
ed8aa433b5
commit
323e560694
2 changed files with 66 additions and 12 deletions
45
trunk/includes/class/class.LSsmoothbox.php
Normal file
45
trunk/includes/class/class.LSsmoothbox.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (C) 2007 Easter-eggs
|
||||||
|
* http://ldapsaisie.labs.libre-entreprise.org
|
||||||
|
*
|
||||||
|
* Author: See AUTHORS file in top-level directory.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
class LSsmoothbox {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Méthode chargeant les dépendances d'affichage
|
||||||
|
*
|
||||||
|
* @retval void
|
||||||
|
*/
|
||||||
|
public static function loadDependenciesDisplay() {
|
||||||
|
if (LSsession :: loadLSclass('LSconfirmBox')) {
|
||||||
|
LSconfirmBox :: loadDependenciesDisplay();
|
||||||
|
}
|
||||||
|
LSsession :: addJSscript('LSsmoothbox.js');
|
||||||
|
LSsession :: addCssFile('LSsmoothbox.css');
|
||||||
|
|
||||||
|
LSsession :: addJSconfigParam('LSsmoothbox_labels', array(
|
||||||
|
'close_confirm_text' => _('Are you sure to want to close this window and lose all changes ?'),
|
||||||
|
'validate' => _('Validate')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -1,5 +1,12 @@
|
||||||
var LSsmoothbox = new Class({
|
var LSsmoothbox = new Class({
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
this.labels = varLSdefault.LSjsConfig['LSsmoothbox_labels'];
|
||||||
|
if (!$type(this.labels)) {
|
||||||
|
this.labels = {
|
||||||
|
close_confirm_text: 'Are you sure to want to close this window and lose all changes ?',
|
||||||
|
validate: 'Validate'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
this.build();
|
this.build();
|
||||||
|
|
||||||
|
@ -58,7 +65,7 @@ var LSsmoothbox = new Class({
|
||||||
this._displayValidBtn = false;
|
this._displayValidBtn = false;
|
||||||
this.validBtn = new Element('span');
|
this.validBtn = new Element('span');
|
||||||
this.validBtn.setProperty('id','validBtn-LSsmoothbox');
|
this.validBtn.setProperty('id','validBtn-LSsmoothbox');
|
||||||
this.validBtn.set('html','Valider');
|
this.validBtn.set('html',this.labels.validate);
|
||||||
this.validBtn.injectInside(this.win);
|
this.validBtn.injectInside(this.win);
|
||||||
this.validBtn.addEvent('click',this.valid.bindWithEvent(this,true));
|
this.validBtn.addEvent('click',this.valid.bindWithEvent(this,true));
|
||||||
},
|
},
|
||||||
|
@ -173,8 +180,6 @@ var LSsmoothbox = new Class({
|
||||||
var startStyles = this.getStartStyles();
|
var startStyles = this.getStartStyles();
|
||||||
var endStyles = this.getEndStyles();
|
var endStyles = this.getEndStyles();
|
||||||
|
|
||||||
|
|
||||||
this.closeStyles = startStyles;
|
|
||||||
this.win.setStyles(startStyles);
|
this.win.setStyles(startStyles);
|
||||||
|
|
||||||
this.fx.winOpen.setOptions({onComplete: this.displayContent.bind(this)});
|
this.fx.winOpen.setOptions({onComplete: this.displayContent.bind(this)});
|
||||||
|
@ -210,10 +215,7 @@ var LSsmoothbox = new Class({
|
||||||
if (!this._closeConfirmOpened) {
|
if (!this._closeConfirmOpened) {
|
||||||
this._closeConfirmOpened = 1;
|
this._closeConfirmOpened = 1;
|
||||||
this.confirmBox = new LSconfirmBox({
|
this.confirmBox = new LSconfirmBox({
|
||||||
text: 'Are you sure to want to close this window and lose all changes ?',
|
text: this.labels.close_confirm_text,
|
||||||
title: 'Warning',
|
|
||||||
validate_label: 'Validate',
|
|
||||||
cancel_label: 'Cancel',
|
|
||||||
startElement: this.closeBtn,
|
startElement: this.closeBtn,
|
||||||
onConfirm: this.cancel.bind(this),
|
onConfirm: this.cancel.bind(this),
|
||||||
onClose: (function(){this._closeConfirmOpened=0;}).bind(this)
|
onClose: (function(){this._closeConfirmOpened=0;}).bind(this)
|
||||||
|
@ -240,14 +242,21 @@ var LSsmoothbox = new Class({
|
||||||
delete this.confirmBox;
|
delete this.confirmBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var closeStyles = {
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
top: this.closeBtn.getTop(),
|
||||||
|
left: this.closeBtn.getLeft()
|
||||||
|
};
|
||||||
|
|
||||||
this.fx.over.cancel();
|
this.fx.over.cancel();
|
||||||
this.fx.over.start(0);
|
this.fx.over.start(0);
|
||||||
this.hideContent();
|
this.hideContent();
|
||||||
this.fx.winClose.start({
|
this.fx.winClose.start({
|
||||||
width: this.closeStyles.width,
|
width: closeStyles.width,
|
||||||
height: this.closeStyles.height,
|
height: closeStyles.height,
|
||||||
top: this.closeStyles.top,
|
top: closeStyles.top,
|
||||||
left: this.closeStyles.left,
|
left: closeStyles.left,
|
||||||
opacity: [1, 0]
|
opacity: [1, 0]
|
||||||
});
|
});
|
||||||
this._open=0;
|
this._open=0;
|
||||||
|
@ -384,7 +393,7 @@ var LSsmoothbox = new Class({
|
||||||
fnct(this);
|
fnct(this);
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
LSdebug('LSsmoothbox :: '+event+'() -> rater');
|
LSdebug('LSsmoothbox :: '+event+'() -> failed');
|
||||||
}
|
}
|
||||||
},this);
|
},this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue