mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +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({
|
||||
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();
|
||||
|
||||
|
@ -58,7 +65,7 @@ var LSsmoothbox = new Class({
|
|||
this._displayValidBtn = false;
|
||||
this.validBtn = new Element('span');
|
||||
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.addEvent('click',this.valid.bindWithEvent(this,true));
|
||||
},
|
||||
|
@ -173,8 +180,6 @@ var LSsmoothbox = new Class({
|
|||
var startStyles = this.getStartStyles();
|
||||
var endStyles = this.getEndStyles();
|
||||
|
||||
|
||||
this.closeStyles = startStyles;
|
||||
this.win.setStyles(startStyles);
|
||||
|
||||
this.fx.winOpen.setOptions({onComplete: this.displayContent.bind(this)});
|
||||
|
@ -210,10 +215,7 @@ var LSsmoothbox = new Class({
|
|||
if (!this._closeConfirmOpened) {
|
||||
this._closeConfirmOpened = 1;
|
||||
this.confirmBox = new LSconfirmBox({
|
||||
text: 'Are you sure to want to close this window and lose all changes ?',
|
||||
title: 'Warning',
|
||||
validate_label: 'Validate',
|
||||
cancel_label: 'Cancel',
|
||||
text: this.labels.close_confirm_text,
|
||||
startElement: this.closeBtn,
|
||||
onConfirm: this.cancel.bind(this),
|
||||
onClose: (function(){this._closeConfirmOpened=0;}).bind(this)
|
||||
|
@ -240,14 +242,21 @@ var LSsmoothbox = new Class({
|
|||
delete this.confirmBox;
|
||||
}
|
||||
|
||||
var closeStyles = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
top: this.closeBtn.getTop(),
|
||||
left: this.closeBtn.getLeft()
|
||||
};
|
||||
|
||||
this.fx.over.cancel();
|
||||
this.fx.over.start(0);
|
||||
this.hideContent();
|
||||
this.fx.winClose.start({
|
||||
width: this.closeStyles.width,
|
||||
height: this.closeStyles.height,
|
||||
top: this.closeStyles.top,
|
||||
left: this.closeStyles.left,
|
||||
width: closeStyles.width,
|
||||
height: closeStyles.height,
|
||||
top: closeStyles.top,
|
||||
left: closeStyles.left,
|
||||
opacity: [1, 0]
|
||||
});
|
||||
this._open=0;
|
||||
|
@ -384,7 +393,7 @@ var LSsmoothbox = new Class({
|
|||
fnct(this);
|
||||
}
|
||||
catch(e) {
|
||||
LSdebug('LSsmoothbox :: '+event+'() -> rater');
|
||||
LSdebug('LSsmoothbox :: '+event+'() -> failed');
|
||||
}
|
||||
},this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue