From 0c08501e9da61c0444c60d0116ccc696f03d8f66 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 29 Nov 2012 08:58:24 -0500 Subject: [PATCH] Bug 9166: OPAC needs configuration file for datepicker This patch adds a configuration include file for the datepicker. This file makes redundant the datepicker initialization in js/script.js, so that section is removed. This change should enable two things: the CalendarFirstDayOfWeek preference should now work in the OPAC, and the calendar should now use the current selected language. To test, try the calendar widget when placing a hold in the OPAC. The CalendarFirstDayOfWeek preference should be respected for Monday and Sunday. Switch languages. The calendar interface labels should reflect the current chosen language. Revision adds the configuration include to opac-user as well (required by the suspend holds feature). Signed-off-by: Jonathan Druart the datepicker plugin works for opac-reserve and opac-user Signed-off-by: Paul Poulain Signed-off-by: Jared Camins-Esakov --- .../opac-tmpl/prog/en/includes/calendar.inc | 77 +++++++++++++++++++ koha-tmpl/opac-tmpl/prog/en/js/script.js | 25 +----- .../opac-tmpl/prog/en/modules/opac-reserve.tt | 1 + .../opac-tmpl/prog/en/modules/opac-user.tt | 1 + 4 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc new file mode 100644 index 0000000000..2f30c9c21f --- /dev/null +++ b/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc @@ -0,0 +1,77 @@ + \ No newline at end of file diff --git a/koha-tmpl/opac-tmpl/prog/en/js/script.js b/koha-tmpl/opac-tmpl/prog/en/js/script.js index 5e301837b0..398a89c9fc 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/script.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/script.js @@ -7,35 +7,12 @@ function Dopop(link) { newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizeable=yes'); } -$.datepicker.setDefaults({ - showOn: "both", - changeMonth: true, - changeYear: true, - buttonImage: '/opac-tmpl/lib/famfamfam/silk/calendar.png', - buttonImageOnly: true, - showButtonPanel: true - }); - $(document).ready(function(){ $(".close").click(function(){ window.close(); }); $(".focus").focus(); - $( ".datepicker" ).datepicker(); - // http://jqueryui.com/demos/datepicker/#date-range - var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ - changeMonth: true, - numberOfMonths: 1, - onSelect: function( selectedDate ) { - var option = this.id == "from" ? "minDate" : "maxDate", - instance = $( this ).data( "datepicker" ); - date = $.datepicker.parseDate( - instance.settings.dateFormat || - $.datepicker._defaults.dateFormat, - selectedDate, instance.settings ); - dates.not( this ).datepicker( "option", option, date ); - } - }); + // clear the basket when user logs out $("#logout").click(function(){ var nameCookie = "bib_list"; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index 8096baf07d..e2065618e9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -1,5 +1,6 @@ [% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog › Placing a hold [% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'calendar.inc' %]