1 #HTTP_HEADER{Content-type:text/javascript}
2 if (!jQuery.fn.datepicker){
3 #INCLURE{javascript/ui/jquery.ui.core.js}
4 #INCLURE{javascript/ui/jquery.ui.widget.js}
5 #INCLURE{javascript/ui/jquery.ui.datepicker.js}
7 if (!jQuery.fn.multiDatesPicker){
8 #INCLURE{javascript/jquery-ui.multidatespicker.js}
11 var ajax_image_searching =
"<img src='#CHEMIN{images/searching.gif}' width='16' height='16' />";
14 buttonText: '
<:afficher_calendrier|texte_script:
>',
15 buttonImage: '#CHEMIN_IMAGE{calendrier-
16.png}',
16 buttonImageOnly: true,
17 prevText: '
<:precedent|texte_script:
>',
18 nextText: '
<:suivant|texte_script:
>',
19 currentText: '
<:date_aujourdhui|texte_script:
>',
20 closeText: '
<:bouton_fermer|texte_script:
>',
22 '
<: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:
>',
23 '
<: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:
>'],
25 '
<: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:
>',
26 '
<: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:
>'],
28 '
<:date_jour_1|texte_script:
>','
<:date_jour_2|texte_script:
>','
<:date_jour_3|texte_script:
>','
<:date_jour_4:|texte_script:
>',
29 '
<:date_jour_5|texte_script:
>','
<:date_jour_6|texte_script:
>','
<:date_jour_7|texte_script:
>'],
31 '
<:date_jour_1_abbr|texte_script:
>','
<:date_jour_2_abbr|texte_script:
>','
<:date_jour_3_abbr|texte_script:
>','
<:date_jour_4_abbr|texte_script:
>',
32 '
<:date_jour_5_abbr|texte_script:
>','
<:date_jour_6_abbr|texte_script:
>','
<:date_jour_7_abbr|texte_script:
>'],
34 '
<:date_jour_1_initiale|texte_script:
>','
<:date_jour_2_initiale|texte_script:
>','
<:date_jour_3_initiale|texte_script:
>','
<:date_jour_4_initiale|texte_script:
>',
35 '
<:date_jour_5_initiale|texte_script:
>','
<:date_jour_6_initiale|texte_script:
>','
<:date_jour_7_initiale|texte_script:
>'],
36 dateFormat: 'yy-mm-dd',
37 firstDay: #CONFIG{calendriermini/jour1,
1},
38 isRTL: [(#ENV{lang}|lang_dir|=={rtl}|?{true,false})],
39 changeMonth: [(#CONFIG{calendriermini/changement_rapide,
1}|?{true,false})],
40 changeYear: [(#CONFIG{calendriermini/changement_rapide,
1}|?{true,false})],
41 showOtherMonths: [(#CONFIG{calendriermini/affichage_hors_mois,
1}|?{true,false})],
42 selectOtherMonths: [(#CONFIG{calendriermini/affichage_hors_mois,
1}|?{true,false})]
45 add_tooltip_and_class: function($this,date,id,tooltip,className){
51 var d = date.getFullYear() +
"-" + (date.getMonth()+
1) +
"-" + date.getDate();
52 if (!$this.tooltip[d])
53 $this.tooltip[d] = {};
54 tooltip = tooltip.replace(/
"/g,'"'); // echapper les " pour ne pas casser le html (secu, supprimer le html en amont !)
55 $this.tooltip[d][id] = tooltip;
57 if (className && typeof className !=
"undefined"){
60 $this.cn[d][id] = className;
64 set_events: function(me,start,end,data){
66 var $this = me.get(
0);
69 var d,datebegin,dateend;
70 for(var j=
0;j
<data.length;j++){
71 d = data[j].start.split(
" ");
73 d = new Date(d[
0],d[
1]-
1,d[
2]);
75 minical.add_tooltip_and_class($this,d,data[j].id,data[j].title,data[j].className);
78 /* prendre la plus grande date de debut entre debut a afficher et l'interval donne */
79 datebegin = Math.max(start *
1000,d.getTime());
80 d = data[j].end.split(
" ");
82 d = new Date(d[
0],d[
1]-
1,d[
2]);
83 /* prendre la plus petite date de fin entre fin a afficher et l'interval donne */
84 dateend = Math.min(end *
1000, d.getTime());
85 if (dateend
>datebegin){
87 minical.add_tooltip_and_class($this,d,data[j].id,data[j].title,data[j].className);
88 datebegin = datebegin+(
3600*
24*
1000);
89 while(datebegin < dateend){
90 d = new Date(datebegin);
92 minical.add_tooltip_and_class($this,d,data[j].id,data[j].title,data[j].className);
93 datebegin = datebegin+(
3600*
24*
1000);
99 me.multiDatesPicker('addDates', dates);
100 // toujours retirer la classe active qui n'a pas de sens pour l'affichage
101 jQuery('.ui-state-active',me).removeClass('ui-state-active');
105 before_show_day: function(date) {
106 var d = date.getFullYear() +
"-" + (date.getMonth()+
1) +
"-" + date.getDate();
108 if (this.cn && this.cn[d]){
109 for (var i in this.cn[d])
110 c[
1] += ' ' + this.cn[d][i];
113 if (this.tooltip && this.tooltip[d]){
116 for (var i in this.tooltip[d]) {
117 c[
2] += glue + this.tooltip[d][i];
124 change_month_year: function(year, month, inst){
126 //console.log(
"change_month_year:"+year+
"/"+month);
127 if (typeof inst.input !=
"undefined")
130 var t = new Date(year,month-
1,
1);
131 t = parseInt(t.getTime()/
1000);
132 var start = t-
7*
24*
3600;
133 var end = t+
38*
24*
3600;
134 // stocker les year/month deja vus pour ne pas les recharger
2 fois quand on va et vient
136 if (typeof o.dateseen ==
"undefined")
138 if (!o.dateseen[year+
"/"+month]){
139 //console.log(o.dateseen);
140 o.dateseen[year+
"/"+month] = true;
141 minical.show_loading(me);
143 url:jQuery(me).attr(
"data-json"),
144 data:{start:start,end:end},
145 success:function(data, textStatus, jqXHR){
147 minical.set_events(me,start,end,data);
148 minical.hide_loading(me);
152 inst.currentDay=
0; // annuler la date active : pas de sens ici
154 show_loading : function(me){
157 hide_loading : function(me) {
161 scripts_loaded: {widget:false,datepicker:false,multidatepicker:false},
162 init : function(selecteur){
163 //if (!minical.scripts_loaded.widget || !minical.scripts_loaded.datepicker || !minical.scripts_loaded.multidatepicker)
165 [(#CONFIG{calendriermini/format_jour,initiale}|=={abbr}|oui)
166 minical.options.dayNamesMin = minical.options.dayNamesShort;
169 jQuery(selecteur).not('.loaded')
171 .multiDatesPicker(jQuery.extend(minical.options,
173 showButtonPanel: true,
174 prevText: '
<:minical:mois_precedent|texte_script:
>',
175 nextText: '
<:minical:mois_suivant|texte_script:
>',
176 create: minical.create,
177 beforeShowDay: minical.before_show_day,
178 onChangeMonthYear: minical.change_month_year,
179 onSelect: minical.on_select
184 // se mettre a la date demandee (pour afficher le bon mois)
185 me.datepicker(
"setDate" , me.attr('data-year')+
"-"+me.attr('data-month')+
"-1");
186 // et retirer la classe active qui n'a pas de sens pour l'affichage
187 jQuery('.ui-state-active',me).removeClass('ui-state-active');
188 minical.change_month_year(me.attr('data-year'),me.attr('data-month'),me);
190 .trigger('miniCalendarLoaded')
191 .find(
".alt").remove();
194 on_select : function(dateText, inst){
197 // annuler la selection !
198 me.multiDatesPicker('toggleDate', dateText);
199 var actif = (me.multiDatesPicker('gotDate', dateText) !==false);
201 var url = me.attr('data-url');
202 url = parametre_url(url,me.attr('data-vardate'),dateText);
204 window.location = url;