From 6bae88f43d1d88c9568a94fb407541111f098415 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 5 Nov 2012 12:22:24 -0500 Subject: [PATCH] Bug 9009 - Add separate user js and css for SCO module Add system preferences SCOUserCSS and SCOUserJS to define separate CSS and JavaScript for the Self Checkout Module. Test plan: 1) Apply patch 2) Run updatedatabase.pl 3) Add something arbitrary to the new sysprefs SCOUserCSS and SCOUserJS ( such as TestCSS and TestJS ). 4) Load the SCO module in a browser, and view the HTML, verify the CSS and JS values in the system preferences have been included. Signed-off-by: Marc Veron I tested with an alert('hello') as JavaScript and some background-color for the CSS. Worked as expected. Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov --- installer/data/mysql/sysprefs.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../prog/en/modules/admin/preferences/circulation.pref | 10 ++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tt | 3 +++ koha-tmpl/opac-tmpl/prog/en/modules/sco/receipt.tt | 2 ++ koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt | 3 ++- opac/sco/help.pl | 5 +++++ opac/sco/sco-main.pl | 5 +++++ 8 files changed, 37 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 95d0e7d675..d5d15d7981 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -404,3 +404,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','Media file extensions','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldsOnPatronsPossessions', '1', 'Allow holds on records that patron have items of it',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded [% END %] + +[% IF ( SCOUserJS ) %][% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/receipt.tt b/koha-tmpl/opac-tmpl/prog/en/modules/sco/receipt.tt index 81784126a0..7e363d2871 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/receipt.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/receipt.tt @@ -26,6 +26,8 @@ function closeNow() } +[% IF ( SCOUserCSS ) %][% END %] +[% IF ( SCOUserJS ) %][% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt index 729b2f375e..5441ccf472 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt @@ -98,12 +98,13 @@ $(document).ready(function(){ }); [% IF ( opacuserjs ) %][% END %] - +[% IF ( SCOUserJS ) %][% END %] [% IF ( OPACUserCSS ) %][% END %] +[% IF ( SCOUserCSS ) %][% END %] diff --git a/opac/sco/help.pl b/opac/sco/help.pl index b3f43983d5..abcb396657 100755 --- a/opac/sco/help.pl +++ b/opac/sco/help.pl @@ -52,5 +52,10 @@ if (C4::Context->preference('SelfCheckHelpMessage')) { $template->param(SelfCheckHelpMessage => C4::Context->preference('SelfCheckHelpMessage')); } +$template->param( + SCOUserJS => C4::Context->preference('SCOUserJS'), + SCOUserCSS => C4::Context->preference('SCOUserCSS'), +); + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index f857b6a450..25a3594b7c 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -263,4 +263,9 @@ if ($borrower->{cardnumber}) { ); } +$template->param( + SCOUserJS => C4::Context->preference('SCOUserJS'), + SCOUserCSS => C4::Context->preference('SCOUserCSS'), +); + output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5