mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-29 21:24:51 +01:00
- LSconfirmBox : Création d'une classe PHP gérant les dépendances d'affichage
et permettant l'internationnalisation des labels.
This commit is contained in:
parent
84c954bbe9
commit
ed8aa433b5
2 changed files with 59 additions and 6 deletions
44
trunk/includes/class/class.LSconfirmBox.php
Normal file
44
trunk/includes/class/class.LSconfirmBox.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?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 LSconfirmBox {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Méthode chargeant les dépendances d'affichage
|
||||||
|
*
|
||||||
|
* @retval void
|
||||||
|
*/
|
||||||
|
public static function loadDependenciesDisplay() {
|
||||||
|
LSsession :: addJSscript('LSconfirmBox.js');
|
||||||
|
LSsession :: addCssFile('LSconfirmBox.css');
|
||||||
|
|
||||||
|
LSsession :: addJSconfigParam('LSconfirmBox_labels', array(
|
||||||
|
'title' => _('Confirmation'),
|
||||||
|
'text' => _('You confirm your choice ?'),
|
||||||
|
'validate' => _('Validate'),
|
||||||
|
'cancel' => _('Cancel')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -1,6 +1,15 @@
|
||||||
var LSconfirmBox = new Class({
|
var LSconfirmBox = new Class({
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this._options = options;
|
this._options = options;
|
||||||
|
this.labels = varLSdefault.LSjsConfig['LSconfirmBox_labels'];
|
||||||
|
if (!$type(this.labels)) {
|
||||||
|
this.labels = {
|
||||||
|
title: 'Confirmation',
|
||||||
|
text: 'You confirm your choice ?',
|
||||||
|
validate: 'Validate',
|
||||||
|
cancel: 'Cancel'
|
||||||
|
};
|
||||||
|
}
|
||||||
this.create();
|
this.create();
|
||||||
this.display();
|
this.display();
|
||||||
},
|
},
|
||||||
|
@ -16,7 +25,7 @@ var LSconfirmBox = new Class({
|
||||||
this.title.set('html',this._options.title);
|
this.title.set('html',this._options.title);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.title.set('html','Confirmation');
|
this.title.set('html',this.labels.title);
|
||||||
};
|
};
|
||||||
this.title.injectInside(this.box)
|
this.title.injectInside(this.box)
|
||||||
|
|
||||||
|
@ -31,7 +40,7 @@ var LSconfirmBox = new Class({
|
||||||
this.text.set('html',this._options.text);
|
this.text.set('html',this._options.text);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.text.set('html','You confirm your choice ?');
|
this.text.set('html',this.labels.text);
|
||||||
}
|
}
|
||||||
this.text.injectInside(this.box);
|
this.text.injectInside(this.box);
|
||||||
|
|
||||||
|
@ -45,7 +54,7 @@ var LSconfirmBox = new Class({
|
||||||
this.confirmBtn.set('html',this._options.validate_label);
|
this.confirmBtn.set('html',this._options.validate_label);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.confirmBtn.set('html','Validate');
|
this.confirmBtn.set('html',this.labels.validate);
|
||||||
}
|
}
|
||||||
this.confirmBtn.injectInside(this.btnsBox);
|
this.confirmBtn.injectInside(this.btnsBox);
|
||||||
this.confirmBtn.addEvent('click',this.confirm.bind(this));
|
this.confirmBtn.addEvent('click',this.confirm.bind(this));
|
||||||
|
@ -56,7 +65,7 @@ var LSconfirmBox = new Class({
|
||||||
this.cancelBtn.set('html',this._options.cancel_label);
|
this.cancelBtn.set('html',this._options.cancel_label);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.cancelBtn.set('html','Cancel');
|
this.cancelBtn.set('html',this.labels.cancel);
|
||||||
}
|
}
|
||||||
this.cancelBtn.injectInside(this.btnsBox);
|
this.cancelBtn.injectInside(this.btnsBox);
|
||||||
this.cancelBtn.addEvent('click',this.cancel.bind(this));
|
this.cancelBtn.addEvent('click',this.cancel.bind(this));
|
||||||
|
@ -120,11 +129,11 @@ var LSconfirmBox = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
getStartStyles: function() {
|
getStartStyles: function() {
|
||||||
if (typeof(this._options.startElement) != 'undefined') {
|
if ($type(this._options.startElement)) {
|
||||||
var startStyles = {
|
var startStyles = {
|
||||||
top: this._options.startElement.getCoordinates().top,
|
top: this._options.startElement.getCoordinates().top,
|
||||||
left: this._options.startElement.getCoordinates().left,
|
left: this._options.startElement.getCoordinates().left,
|
||||||
width: this._options.startElement.getStyle('width').toInt(),
|
width: this._options.startElement.getWidth().toInt(),
|
||||||
opacity: 0
|
opacity: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue