From ed8aa433b532789a1e2a1bb1931dc0e818a69495 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 20 Feb 2009 13:42:35 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSconfirmBox=20:=20Cr=C3=A9ation=20d'une=20?= =?UTF-8?q?classe=20PHP=20g=C3=A9rant=20les=20d=C3=A9pendances=20d'afficha?= =?UTF-8?q?ge=20=09et=20permettant=20l'internationnalisation=20des=20label?= =?UTF-8?q?s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/includes/class/class.LSconfirmBox.php | 44 +++++++++++++++++++++ trunk/includes/js/LSconfirmBox.js | 21 +++++++--- 2 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 trunk/includes/class/class.LSconfirmBox.php diff --git a/trunk/includes/class/class.LSconfirmBox.php b/trunk/includes/class/class.LSconfirmBox.php new file mode 100644 index 00000000..0bbe3239 --- /dev/null +++ b/trunk/includes/class/class.LSconfirmBox.php @@ -0,0 +1,44 @@ + _('Confirmation'), + 'text' => _('You confirm your choice ?'), + 'validate' => _('Validate'), + 'cancel' => _('Cancel') + )); + } + +} + +?> diff --git a/trunk/includes/js/LSconfirmBox.js b/trunk/includes/js/LSconfirmBox.js index 4333cdb8..5cf1caa5 100644 --- a/trunk/includes/js/LSconfirmBox.js +++ b/trunk/includes/js/LSconfirmBox.js @@ -1,6 +1,15 @@ var LSconfirmBox = new Class({ initialize: function(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.display(); }, @@ -16,7 +25,7 @@ var LSconfirmBox = new Class({ this.title.set('html',this._options.title); } else { - this.title.set('html','Confirmation'); + this.title.set('html',this.labels.title); }; this.title.injectInside(this.box) @@ -31,7 +40,7 @@ var LSconfirmBox = new Class({ this.text.set('html',this._options.text); } else { - this.text.set('html','You confirm your choice ?'); + this.text.set('html',this.labels.text); } this.text.injectInside(this.box); @@ -45,7 +54,7 @@ var LSconfirmBox = new Class({ this.confirmBtn.set('html',this._options.validate_label); } else { - this.confirmBtn.set('html','Validate'); + this.confirmBtn.set('html',this.labels.validate); } this.confirmBtn.injectInside(this.btnsBox); this.confirmBtn.addEvent('click',this.confirm.bind(this)); @@ -56,7 +65,7 @@ var LSconfirmBox = new Class({ this.cancelBtn.set('html',this._options.cancel_label); } else { - this.cancelBtn.set('html','Cancel'); + this.cancelBtn.set('html',this.labels.cancel); } this.cancelBtn.injectInside(this.btnsBox); this.cancelBtn.addEvent('click',this.cancel.bind(this)); @@ -120,11 +129,11 @@ var LSconfirmBox = new Class({ }, getStartStyles: function() { - if (typeof(this._options.startElement) != 'undefined') { + if ($type(this._options.startElement)) { var startStyles = { top: this._options.startElement.getCoordinates().top, left: this._options.startElement.getCoordinates().left, - width: this._options.startElement.getStyle('width').toInt(), + width: this._options.startElement.getWidth().toInt(), opacity: 0 }; }