[SPIP] ~spip v3.2.0-->v3.2.1
[lhc/web/www.git] / www / prive / formulaires / dateur / inc-dateur.html
index c2a7815..f1730b3 100644 (file)
@@ -33,21 +33,48 @@ function date_picker_options(){
                yearRange: "c-60:c+40"
        };
 }
+function time_picker_options() {
+       return {
+               step: #ENV{heure_pas,30},
+       };
+}
 function date_picker_init(){
+       // Initialisation du sélecteur sur les champs de date
        jQuery('input.date').not('.datePicker')
-               .addClass('datePicker').each(function(){
+               .addClass('datePicker').each(function() {
+                       // Pour chaque champ, on regarde s'il y a des options propres
                        var options = {showOn: 'button'};
-                       if (jQuery(this).attr('data-startDate'))
-                               options.minDate = jQuery(this).attr('data-startDate');
-                       if (jQuery(this).attr('data-endDate'))
-                               options.maxDate = jQuery(this).attr('data-endDate');
-                       if (jQuery(this).attr('data-yearRange'))
-                               options.yearRange = jQuery(this).attr('data-yearRange');
+                       if (jQuery(this).data('startdate')) {
+                               options.minDate = jQuery(this).data('startdate');
+                       }
+                       if (jQuery(this).data('enddate')) {
+                               options.maxDate = jQuery(this).data('enddate');
+                       }
+                       if (jQuery(this).data('yearrange')) {
+                               options.yearRange = jQuery(this).data('yearrange');
+                       }
                        jQuery(this)
                                .datepicker(jQuery.extend(date_picker_options(),options))
                                .trigger('datePickerLoaded');
                });
-       jQuery("input.heure").not('.timePicker').addClass('timePicker').timePicker({step:#ENV{heure_pas,30}});
+       
+       // Initialisation du sélecteur sur les champs d'heure
+       jQuery("input.heure").not('.timePicker')
+               .addClass('timePicker').each(function() {
+                       // Pour chaque champ, on regarde s'il y a des options propres
+                       var options = {};
+                       if (jQuery(this).data('starttime')) {
+                               options.startTime = jQuery(this).data('starttime');
+                       }
+                       if (jQuery(this).data('endtime')) {
+                               options.endTime = jQuery(this).data('endtime');
+                       }
+                       if (jQuery(this).data('step')) {
+                               options.step = jQuery(this).data('step');
+                       }
+                       jQuery(this)
+                               .timePicker(jQuery.extend(time_picker_options(), options));
+               });
 }
 var date_picker_loading;
 if (window.jQuery){