[SPIP] v3.2.7-->v3.2.9
[lhc/web/www.git] / www / prive / formulaires / dateur / inc-dateur.html
1 <script type='text/javascript'>/*<![CDATA[*/
2 function date_picker_options(){
3 return {
4 buttonText: '',
5 buttonImage: '#CHEMIN_IMAGE{calendrier-16.png}',
6 buttonImageOnly: true,
7 closeText: '<:bouton_fermer|texte_script:>',
8 prevText: '<:precedent|texte_script:>',
9 nextText: '<:suivant|texte_script:>',
10 currentText: '<:date_aujourdhui|texte_script:>',
11 monthNames: [
12 '<:date_mois_1|texte_script:>','<:date_mois_2|texte_script:>','<:date_mois_3|texte_script:>','<:date_mois_4|texte_script:>','<:date_mois_5|texte_script:>','<:date_mois_6|texte_script:>',
13 '<:date_mois_7|texte_script:>','<:date_mois_8|texte_script:>','<:date_mois_9|texte_script:>','<:date_mois_10|texte_script:>','<:date_mois_11|texte_script:>','<:date_mois_12|texte_script:>'],
14 monthNamesShort: [
15 '<:date_mois_1_abbr|texte_script:>','<:date_mois_2_abbr|texte_script:>','<:date_mois_3_abbr|texte_script:>','<:date_mois_4_abbr|texte_script:>','<:date_mois_5_abbr|texte_script:>','<:date_mois_6_abbr|texte_script:>',
16 '<:date_mois_7_abbr|texte_script:>','<:date_mois_8_abbr|texte_script:>','<:date_mois_9_abbr|texte_script:>','<:date_mois_10_abbr|texte_script:>','<:date_mois_11_abbr|texte_script:>','<:date_mois_12_abbr|texte_script:>'],
17 dayNames: [
18 '<:date_jour_1|texte_script:>','<:date_jour_2|texte_script:>','<:date_jour_3|texte_script:>','<:date_jour_4|texte_script:>',
19 '<:date_jour_5|texte_script:>','<:date_jour_6|texte_script:>','<:date_jour_7|texte_script:>'],
20 dayNamesShort: [
21 '<:date_jour_1_abbr|texte_script:>','<:date_jour_2_abbr|texte_script:>','<:date_jour_3_abbr|texte_script:>','<:date_jour_4_abbr|texte_script:>',
22 '<:date_jour_5_abbr|texte_script:>','<:date_jour_6_abbr|texte_script:>','<:date_jour_7_abbr|texte_script:>'],
23 dayNamesMin: [
24 '<:date_jour_1_initiale|texte_script:>','<:date_jour_2_initiale|texte_script:>','<:date_jour_3_initiale|texte_script:>','<:date_jour_4_initiale|texte_script:>',
25 '<:date_jour_5_initiale|texte_script:>','<:date_jour_6_initiale|texte_script:>','<:date_jour_7_initiale|texte_script:>'],
26 dateFormat: 'dd/mm/yy',
27 firstDay: 1,
28 changeMonth: true,
29 changeYear: true,
30 showOtherMonths: true,
31 selectOtherMonths: true,
32 yearRange: "c-60:c+40"
33 };
34 }
35 function time_picker_options() {
36 return {
37 step: #ENV{heure_pas,30},
38 };
39 }
40 function date_picker_init(){
41 // Initialisation du sélecteur sur les champs de date
42 jQuery('input.date').not('.datePicker')
43 .addClass('datePicker').each(function() {
44 // Pour chaque champ, on regarde s'il y a des options propres
45 var options = {showOn: 'button'};
46 if (jQuery(this).data('startdate')) {
47 options.minDate = jQuery(this).data('startdate');
48 }
49 if (jQuery(this).data('enddate')) {
50 options.maxDate = jQuery(this).data('enddate');
51 }
52 if (jQuery(this).data('yearrange')) {
53 options.yearRange = jQuery(this).data('yearrange');
54 }
55 jQuery(this)
56 .datepicker(jQuery.extend(date_picker_options(),options))
57 .trigger('datePickerLoaded')
58 .next('.ui-datepicker-trigger').removeAttr('title');
59 });
60
61 // Initialisation du sélecteur sur les champs d'heure
62 jQuery("input.heure").not('.timePicker')
63 .addClass('timePicker').each(function() {
64 // Pour chaque champ, on regarde s'il y a des options propres
65 var options = {};
66 if (jQuery(this).data('starttime')) {
67 options.startTime = jQuery(this).data('starttime');
68 }
69 if (jQuery(this).data('endtime')) {
70 options.endTime = jQuery(this).data('endtime');
71 }
72 if (jQuery(this).data('step')) {
73 options.step = jQuery(this).data('step');
74 }
75 jQuery(this)
76 .timePicker(jQuery.extend(time_picker_options(), options));
77 });
78 }
79 var date_picker_loading;
80 if (window.jQuery){
81 jQuery(function(){
82 if (jQuery('input.date,input.heure').length
83 && typeof date_picker_loading=="undefined"){
84 date_picker_loading = jQuery.getScript('[(#PRODUIRE{fond=formulaires/dateur/jquery.dateur.js}|timestamp)]');
85 date_picker_loading.done(function(){
86 date_picker_init();
87 onAjaxLoad(date_picker_init);
88 })
89 }
90 });
91 }
92 /*]]>*/</script>
93 <style type="text/css">
94 [(#INCLURE{formulaires/dateur/time_picker.css}|compacte{css})]
95 img.ui-datepicker-trigger { display: inline-block; padding: 0; margin: 0; margin-[(#ENV{lang}|lang_dir|choixsiegal{ltr,left,right})]: -19px; vertical-align: middle; z-index:2 }
96 div.time-picker {font-size:11px; width:5em; /* needed for IE */}
97 .formulaire_spip input.date {width:9em;padding-[(#ENV{lang}|lang_dir|choixsiegal{ltr,right,left})]:25px;}
98 .formulaire_spip input.heure {width:7em;}
99 </style>