Bugzilla – Attachment 14168 Details for
Bug 9166
OPAC needs configuration file for datepicker
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9166 [Revised] OPAC needs configuration file for datepicker
Bug-9166-Revised-OPAC-needs-configuration-file-for.patch (text/plain), 7.86 KB, created by
Paul Poulain
on 2012-12-17 17:34:48 UTC
(
hide
)
Description:
Bug 9166 [Revised] OPAC needs configuration file for datepicker
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2012-12-17 17:34:48 UTC
Size:
7.86 KB
patch
obsolete
>From 70eca1713511b106a0561e4a8c95df230dbcf67e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 29 Nov 2012 08:58:24 -0500 >Subject: [PATCH] Bug 9166 [Revised] 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 <jonathan.druart@biblibre.com> >the datepicker plugin works for opac-reserve and opac-user > >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >--- > koha-tmpl/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 + > koha-tmpl/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 0000000..2f30c9c >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc >@@ -0,0 +1,77 @@ >+<script type="text/javascript"> >+//<![CDATA[ >+ >+var debug = "[% debug %]"; >+var dformat = "[% dateformat %]"; >+var sentmsg = 0; >+if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");} >+ >+function Date_from_syspref(dstring) { >+ var dateX = dstring.split(/[-/]/); >+ if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));} >+ if (dformat === "iso") { >+ return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d) >+ } else if (dformat === "us") { >+ return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d) >+ } else if (dformat === "metric") { >+ return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d) >+ } else { >+ if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);} >+ return 0; >+ } >+} >+ >+/* Instead of including multiple localization files as you would normally see with >+ jQueryUI we expose the localization strings in the default configuration */ >+jQuery(function($){ >+ $.datepicker.regional[''] = { >+ closeText: _('Done'), >+ prevText: _('Prev'), >+ nextText: _('Next'), >+ currentText: _('Today'), >+ monthNames: [_('January'),_('February'),_('March'),_('April'),_('May'),_('June'), >+ _('July'),_('August'),_('September'),_('October'),_('November'),_('December')], >+ monthNamesShort: [_('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), >+ _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec')], >+ dayNames: [_('Sunday'), _('Monday'), _('Tuesday'), _('Wednesday'), _('Thursday'), _('Friday'), _('Saturday')], >+ dayNamesShort: [_('Sun'), _('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat')], >+ dayNamesMin: [_('Su'),_('Mo'),_('Tu'),_('We'),_('Th'),_('Fr'),_('Sa')], >+ weekHeader: _('Wk'), >+ dateFormat: '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]', >+ firstDay: [% CalendarFirstDayOfWeek %], >+ isRTL: [% IF ( bidi ) %]true[% ELSE %]false[% END %], >+ showMonthAfterYear: false, >+ yearSuffix: ''}; >+ $.datepicker.setDefaults($.datepicker.regional['']); >+}); >+ >+$(document).ready(function(){ >+ >+$.datepicker.setDefaults({ >+ showOn: "both", >+ changeMonth: true, >+ changeYear: true, >+ buttonImage: '[% interface %]/lib/famfamfam/silk/calendar.png', >+ buttonImageOnly: true, >+ showButtonPanel: true, >+ showOtherMonths: true >+ }); >+ >+ $( ".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 ); >+ } >+ }); >+}); >+//]]> >+</script> >\ 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 5e30183..398a89c 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 8096baf..e206561 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' %] > <script type="text/javascript"> > // <![CDATA[ > var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection."); >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >index 43b8329..c28d84f 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >@@ -3,6 +3,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your library home > [% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.metadata.min.js"></script> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> > <script type="text/JavaScript"> >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9166
:
13770
|
13844
|
14010
|
14057
|
14077
| 14168