diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_date.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_date.docbook index cb9290a0..db1edf65 100644 --- a/doc/conf/LSattribute/LSattr_html/LSattr_html_date.docbook +++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_date.docbook @@ -12,6 +12,8 @@ 'format' => '[Format d'affichage de la date]', 'time' => '[Booleen pour le choix ou non de l heure]', 'manual' => '[Booleen pour l edition manuelle ou non]', + 'showNowButton' => '[Booleen]', + 'showTodayButton' => '[Booleen]', 'style' => '[Nom du style utilise]' ),]]> ... @@ -176,6 +178,22 @@ + + showNowButton + + Booléen définissant si le bouton Maintenant est + affiché ou non. Par défaut, il est affiché. + + + + + showTodayButton + + Booléen définissant si le bouton Aujourd'hui est + affiché ou non. Par défaut, il est affiché. + + + style diff --git a/public_html/includes/class/class.LSformElement_date.php b/public_html/includes/class/class.LSformElement_date.php index cd9c0426..00db2bae 100644 --- a/public_html/includes/class/class.LSformElement_date.php +++ b/public_html/includes/class/class.LSformElement_date.php @@ -165,7 +165,9 @@ class LSformElement_date extends LSformElement { 'format' => $this -> php2js_format($this -> getFormat()), 'style' => $this -> getStyle(), 'time' => (isset($this -> params['html_options']['time'])?$this -> params['html_options']['time']:true), - 'manual' => (isset($this -> params['html_options']['manual'])?$this -> params['html_options']['manual']:true) + 'manual' => (isset($this -> params['html_options']['manual'])?$this -> params['html_options']['manual']:true), + 'showNowButton' => (isset($this -> params['html_options']['showNowButton'])?$this -> params['html_options']['showNowButton']:true), + 'showTodayButton' => (isset($this -> params['html_options']['showTodayButton'])?$this -> params['html_options']['showTodayButton']:true), ); LSsession :: addJSconfigParam($this -> name,$params); diff --git a/public_html/includes/js/LSformElement_date_field.js b/public_html/includes/js/LSformElement_date_field.js index 9250beff..7b679dd1 100644 --- a/public_html/includes/js/LSformElement_date_field.js +++ b/public_html/includes/js/LSformElement_date_field.js @@ -13,7 +13,12 @@ var LSformElement_date_field = new Class({ if (!$type(this.params.manual)) { this.params.manual = true; } - + if (!$type(this.params.showNowButton)) { + this.params.showNowButton = true; + } + if (!$type(this.params.showTodayButton)) { + this.params.showNowButton = true; + } if (!$type(this.params.style)) { this.params.style = 'dashboard'; } @@ -37,19 +42,28 @@ var LSformElement_date_field = new Class({ } ); - this.nowBtn = new Element('img'); - this.nowBtn.src = varLSdefault.imagePath('now'); - this.nowBtn.addClass('btn'); - this.nowBtn.addEvent('click',this.onNowBtnClick.bind(this)); - this.nowBtn.injectAfter(this.input); - varLSdefault.addHelpInfo(this.nowBtn,'LSformElement_date','now'); + if (this.params.showNowButton) { + this.nowBtn = new Element('img'); + this.nowBtn.src = varLSdefault.imagePath('now'); + this.nowBtn.addClass('btn'); + this.nowBtn.addEvent('click',this.onNowBtnClick.bind(this)); + this.nowBtn.injectAfter(this.input); + varLSdefault.addHelpInfo(this.nowBtn,'LSformElement_date','now'); + } - this.todayBtn = new Element('img'); - this.todayBtn.src = varLSdefault.imagePath('calendar'); - this.todayBtn.addClass('btn'); - this.todayBtn.addEvent('click',this.onTodayBtnClick.bind(this)); - this.todayBtn.injectAfter(this.nowBtn); - varLSdefault.addHelpInfo(this.todayBtn,'LSformElement_date','today'); + if (this.params.showTodayButton) { + this.todayBtn = new Element('img'); + this.todayBtn.src = varLSdefault.imagePath('calendar'); + this.todayBtn.addClass('btn'); + this.todayBtn.addEvent('click',this.onTodayBtnClick.bind(this)); + if (!$type(this.nowBtn)) { + this.todayBtn.injectAfter(this.input); + } + else { + this.todayBtn.injectAfter(this.nowBtn); + } + varLSdefault.addHelpInfo(this.todayBtn,'LSformElement_date','today'); + } }, onNowBtnClick: function() {