Bug 11343: The max number of items to process in a batch is hardcoded
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / calendar.inc
1 <script type="text/javascript">
2 //<![CDATA[
3
4 var debug    = "[% debug %]";
5 var dformat  = "[% dateformat %]";
6 var sentmsg = 0;
7 if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
8
9 function Date_from_syspref(dstring) {
10         var dateX = dstring.split(/[-/]/);
11         if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
12         if (dformat === "iso") {
13                 return new Date(dateX[0], (dateX[1] - 1), dateX[2]);  // YYYY-MM-DD to (YYYY,m(0-11),d)
14         } else if (dformat === "us") {
15                 return new Date(dateX[2], (dateX[0] - 1), dateX[1]);  // MM/DD/YYYY to (YYYY,m(0-11),d)
16         } else if (dformat === "metric") {
17                 return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD/MM/YYYY to (YYYY,m(0-11),d)
18         } else {
19                 if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
20                 return 0;
21         }
22 }
23
24 /* Instead of including multiple localization files as you would normally see with
25    jQueryUI we expose the localization strings in the default configuration */
26 jQuery(function($){
27     $.datepicker.regional[''] = {
28         closeText: _("Done"),
29         prevText: _("Prev"),
30         nextText: _("Next"),
31         currentText: _("Today"),
32         monthNames: [_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),
33         _("July"),_("August"),_("September"),_("October"),_("November"),_("December")],
34         monthNamesShort: [_("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"),
35         _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec")],
36         dayNames: [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")],
37         dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")],
38         dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")],
39         weekHeader: _("Wk"),
40         dateFormat: "[% IF ( dateformat == "us" ) %]mm/dd/yy[% ELSIF ( dateformat == "metric" ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]",
41         firstDay: [% CalendarFirstDayOfWeek %],
42         isRTL: [% IF ( bidi ) %]true[% ELSE %]false[% END %],
43         showMonthAfterYear: false,
44         yearSuffix: ''};
45     $.datepicker.setDefaults($.datepicker.regional['']);
46 });
47
48 $(document).ready(function(){
49
50 $.datepicker.setDefaults({
51         showOn: "both",
52         changeMonth: true,
53         changeYear: true,
54         buttonImage: '[% interface %]/[% theme %]/img/famfamfam/silk/calendar.png',
55         buttonImageOnly: true,
56         showButtonPanel: true,
57         showOtherMonths: true,
58         selectOtherMonths: true
59     });
60
61     $( ".datepicker" ).datepicker();
62     // http://jqueryui.com/demos/datepicker/#date-range
63     var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({
64         changeMonth: true,
65         numberOfMonths: 1,
66         onSelect: function( selectedDate ) {
67             var option = this.id == "from" ? "minDate" : "maxDate",
68                 instance = $( this ).data( "datepicker" );
69                 date = $.datepicker.parseDate(
70                     instance.settings.dateFormat ||
71                     $.datepicker._defaults.dateFormat,
72                     selectedDate, instance.settings );
73             dates.not( this ).datepicker( "option", option, date );
74         }
75     });
76 });
77 //]]>
78 </script>