From 8e8aa7992ef5388c3a6ff0e7cc5785e78cf5cfcf Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Mon, 8 Jul 2013 15:49:51 -0600 Subject: [PATCH] Followup to bug 8133 - fix JS escaping in data literals There was some unescaped data being put into JS literals, which could cause the calendar interface to fail to load. Note for testing: Template::Plugin::JavaScript must be installed, either from CPAN or libtemplate-plugin-javascript-perl. Signed-off-by: Liz Rea Interface seems to work, I don't note any regressions. I tested the following: Normal, non holiday circulation with no hours set - due dates seem correct and consistent. Holiday set for today, library opens at 9am, closes at 10:30am. Item checked out at 10am, due 10:30am - seems right! UseDaysMode was set to "calendar" Holiday set for today, library opens at 9am, closes at 10:30am. Item checked out at 10am, due tomorrow at 9:30 - seems right! UseDaysMode was set to "days" Interface looks nice, thanks! --- C4/Installer/PerlDependencies.pm | 5 +++++ .../prog/en/modules/tools/calendar.tt | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index ca220aa..aa28f37 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -689,6 +689,11 @@ our $PERL_DEPS = { 'required' => '1', 'min_ver' => '0.22', }, + 'Template::Plugin::JavaScript' => { + 'usage' => 'Core', + 'required' => '1', + 'min_ver' => '0.02', + }, }; 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt index 686e9dc..e00dc02 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/calendar.tt @@ -1,3 +1,4 @@ +[% USE 'JavaScript' %] [% USE 'KohaDates' %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › [% branchname %] Calendar @@ -15,8 +16,8 @@ var single_events = { [% FOREACH event IN single_events %] '[% event.event_date %]': { - title: '[% event.title %]', - description: '[% event.description %]', + title: '[% event.title | js %]', + description: '[% event.description | js %]', closed: [% event.closed %], eventType: 'single', open_hour: '[% event.open_hour %]', @@ -30,8 +31,8 @@ var weekly_events = { [% FOREACH event IN weekly_events %] [% event.weekday %]: { - title: '[% event.title %]', - description: '[% event.description %]', + title: '[% event.title | js %]', + description: '[% event.description | js %]', closed: [% event.closed %], eventType: 'weekly', weekday: [% event.weekday %], @@ -46,8 +47,8 @@ var yearly_events = { [% FOREACH event IN yearly_events %] '[% event.month %]-[% event.day %]': { - title: '[% event.title %]', - description: '[% event.description %]', + title: '[% event.title | js %]', + description: '[% event.description | js %]', closed: [% event.closed %], eventType: 'yearly', month: [% event.month %], -- 1.7.9.5