From ab7120b589816a9a82927c179781e1e0feb03bd2 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sat, 27 Sep 2008 00:55:58 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSform=20:=20=20=20->=20Redimentionnement?= =?UTF-8?q?=20des=20dt=20pour=20laisser=20plus=20de=20place=20aux=20labels?= =?UTF-8?q?=20-=20LSformElement=5Fboolean,=20LSformElement=5Fselect=20:=20?= =?UTF-8?q?Ajout=20d'un=20bouton=20clear=20-=20L'ajout=20des=20boutons=20j?= =?UTF-8?q?avascript=20a=20=C3=A9t=C3=A9=20d=C3=A9port=C3=A9=20dans=20le?= =?UTF-8?q?=20code=20javascript=20:=20=20=20->=20LSformElement=5Furl=20=20?= =?UTF-8?q?=20->=20LSformElement=5Fmail=20=20=20->=20LSformElement=5Frss?= =?UTF-8?q?=20=20=20->=20LSformElement=5Fxmp=20-=20LSformElement=5Fselect?= =?UTF-8?q?=5Fobject=20=20=20->=20Activation=20du=20champ=20de=20formulair?= =?UTF-8?q?e=20directement=20dans=20le=20javascript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../class/class.LSformElement_boolean.php | 5 +- .../class/class.LSformElement_mail.php | 6 +- .../class/class.LSformElement_rss.php | 6 +- .../class/class.LSformElement_select.php | 1 + .../class.LSformElement_select_object.php | 43 ++++++---- .../class/class.LSformElement_url.php | 6 +- .../class/class.LSformElement_xmpp.php | 6 +- trunk/includes/js/LSformElement_boolean.js | 30 +++++++ trunk/includes/js/LSformElement_mail.js | 19 ++++- trunk/includes/js/LSformElement_rss.js | 19 ++++- trunk/includes/js/LSformElement_select.js | 34 ++++++++ .../js/LSformElement_select_object.js | 82 +++++++++++++++---- trunk/includes/js/LSformElement_url.js | 30 ++++++- trunk/includes/js/LSformElement_xmpp.js | 19 ++++- trunk/templates/css/LSform.css | 6 +- .../css/LSformElement_select_object.css | 2 +- trunk/templates/css/base.css | 1 + 17 files changed, 254 insertions(+), 61 deletions(-) create mode 100644 trunk/includes/js/LSformElement_boolean.js create mode 100644 trunk/includes/js/LSformElement_select.js diff --git a/trunk/includes/class/class.LSformElement_boolean.php b/trunk/includes/class/class.LSformElement_boolean.php index ec2771b0..af80c6a6 100644 --- a/trunk/includes/class/class.LSformElement_boolean.php +++ b/trunk/includes/class/class.LSformElement_boolean.php @@ -45,14 +45,15 @@ class LSformElement_boolean extends LSformElement { if (!$this -> isFreeze()) { $return['html'] = "\n"; + $GLOBALS['LSsession'] -> addJSscript('LSformElement_boolean.js'); } else { $return['html'] = "\n"; @@ -63,7 +63,7 @@ class LSformElement_mail extends LSformElement { } else { foreach ($this -> values as $value) { - $return['html'] .= "
  • ".$value.""._(
  • \n"; + $return['html'] .= "
  • ".$value."
  • \n"; } } $return['html'] .= "\n"; @@ -84,7 +84,7 @@ class LSformElement_mail extends LSformElement { */ function getEmptyField() { $multiple = $this -> getMultipleData(); - return ""._(".$multiple; + return "".$multiple; } } diff --git a/trunk/includes/class/class.LSformElement_rss.php b/trunk/includes/class/class.LSformElement_rss.php index f5c5e73c..53152992 100644 --- a/trunk/includes/class/class.LSformElement_rss.php +++ b/trunk/includes/class/class.LSformElement_rss.php @@ -51,7 +51,7 @@ class LSformElement_rss extends LSformElement { foreach ($this -> values as $value) { $multiple = $this -> getMultipleData(); $id = "LSform_".$this -> name."_".rand(); - $return['html'] .= "
  • "._(".$multiple."
  • \n"; + $return['html'] .= "
  • $multiple
  • \n"; } } $return['html'] .= "\n"; @@ -64,7 +64,7 @@ class LSformElement_rss extends LSformElement { } else { foreach ($this -> values as $value) { - $return['html'] .= "
  • ".$value.""._(
  • \n"; + $return['html'] .= "
  • ".$value."
  • \n"; $GLOBALS['LSsession'] -> addJSscript('LSformElement_rss.js'); } } @@ -80,7 +80,7 @@ class LSformElement_rss extends LSformElement { */ function getEmptyField() { $multiple = $this -> getMultipleData(); - return ""._(".$multiple; + return "".$multiple; } } diff --git a/trunk/includes/class/class.LSformElement_select.php b/trunk/includes/class/class.LSformElement_select.php index fc5997da..a71d34a5 100644 --- a/trunk/includes/class/class.LSformElement_select.php +++ b/trunk/includes/class/class.LSformElement_select.php @@ -61,6 +61,7 @@ class LSformElement_select extends LSformElement { $return['html'].="\n"; } $return['html'].="\n"; + $GLOBALS['LSsession'] -> addJSscript('LSformElement_select.js'); } else { $return['html']="\n"; @@ -64,7 +64,7 @@ class LSformElement_xmpp extends LSformElement { } else { foreach ($this -> values as $value) { - $return['html'] .= "
  • ".$value.""._(
  • \n"; + $return['html'] .= "
  • ".$value."
  • \n"; $GLOBALS['LSsession'] -> addJSscript('LSformElement_xmpp.js'); } } @@ -80,7 +80,7 @@ class LSformElement_xmpp extends LSformElement { */ function getEmptyField() { $multiple = $this -> getMultipleData(); - return ""._(".$multiple; + return "".$multiple; } } diff --git a/trunk/includes/js/LSformElement_boolean.js b/trunk/includes/js/LSformElement_boolean.js new file mode 100644 index 00000000..6bd68cec --- /dev/null +++ b/trunk/includes/js/LSformElement_boolean.js @@ -0,0 +1,30 @@ +var LSformElement_boolean = new Class({ + initialize: function(){ + this.initialiseLSformElement_boolean(); + }, + + initialiseLSformElement_boolean: function() { + $$('li.LSformElement_boolean').each(function(el) { + var btn = new Element('img'); + btn.setProperties({ + src: 'templates/images/clear.png', + alt: 'Reset', + title: 'Reset' + }); + btn.addClass('btn'); + btn.setStyle('vertical-align','top'); + btn.addEvent('click',this.onClearBtnClick.bind(this,btn)); + btn.injectInside(el); + }, this); + }, + + onClearBtnClick: function(btn) { + var li = btn.getParent(); + li.getElements('input').each(function(input) { + input.checked=false; + },this); + } +}); +window.addEvent(window.ie ? 'load' : 'domready', function() { + varLSformElement_boolean = new LSformElement_boolean(); +}); diff --git a/trunk/includes/js/LSformElement_mail.js b/trunk/includes/js/LSformElement_mail.js index e0f3607e..b3d797a4 100644 --- a/trunk/includes/js/LSformElement_mail.js +++ b/trunk/includes/js/LSformElement_mail.js @@ -11,9 +11,24 @@ var LSformElement_mail = new Class({ if (typeof(el) == 'undefined') { el = document; } - el.getElements('img.LSformElement_mail_btn').each(function(btn) { - btn.addEvent('click',this.onBtnClick.bind(this,btn)); + el.getElements('input.LSformElement_mail').each(function(input) { + this.addBtnAfter.bind(this)(input); }, this); + el.getElements('a.LSformElement_mail').each(function(a) { + this.addBtnAfter.bind(this)(a); + }, this); + }, + + addBtnAfter: function(el) { + var btn = new Element('img'); + btn.setProperties({ + src: 'templates/images/mail.png', + alt: 'Envoyer un mail', + title: 'Envoyer un mail' + }); + btn.addClass('btn'); + btn.injectAfter(el); + btn.addEvent('click',this.onBtnClick.bind(this,btn)); }, reinitialize: function(el) { diff --git a/trunk/includes/js/LSformElement_rss.js b/trunk/includes/js/LSformElement_rss.js index ecab313b..c41df6dd 100644 --- a/trunk/includes/js/LSformElement_rss.js +++ b/trunk/includes/js/LSformElement_rss.js @@ -10,9 +10,24 @@ var LSformElement_rss = new Class({ if (typeof(el) == 'undefined') { el = document; } - el.getElements('img.LSformElement_rss_btn').each(function(btn) { - btn.addEvent('click',this.onBtnClick.bind(this,btn)); + el.getElements('input.LSformElement_rss').each(function(input) { + this.addBtnAfter.bind(this)(input); }, this); + el.getElements('a.LSformElement_rss').each(function(a) { + this.addBtnAfter.bind(this)(a); + }, this); + }, + + addBtnAfter: function(el) { + var btn = new Element('img'); + btn.setProperties({ + src: 'templates/images/rss.png', + alt: 'File RSS', + title: 'File RSS' + }); + btn.addClass('btn'); + btn.injectAfter(el); + btn.addEvent('click',this.onBtnClick.bind(this,btn)); }, reinitialize: function(el) { diff --git a/trunk/includes/js/LSformElement_select.js b/trunk/includes/js/LSformElement_select.js new file mode 100644 index 00000000..a79c318f --- /dev/null +++ b/trunk/includes/js/LSformElement_select.js @@ -0,0 +1,34 @@ +var LSformElement_select = new Class({ + initialize: function(){ + this.initialiseLSformElement_select(); + }, + + initialiseLSformElement_select: function() { + $$('select.LSform').each(function(el) { + var btn = new Element('img'); + btn.setProperties({ + src: 'templates/images/clear.png', + alt: 'Reset', + title: 'Reset' + }); + btn.addClass('btn'); + btn.setStyle('vertical-align','top'); + btn.addEvent('click',this.onClearBtnClick.bind(this,btn)); + btn.injectAfter(el); + }, this); + }, + + onClearBtnClick: function(btn) { + var select = btn.getPrevious(); + this.resetSelect(select); + }, + + resetSelect: function(select) { + for(var i=0;i