From de1f2657ad814e335775a12d68071ff65f107e83 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 7 Jun 2019 12:52:45 +0000 Subject: [PATCH] Bug 23078: Use Koha.Preference in OPAC global header include This patch updates the OPAC's doc-head-close.inc so that it uses 'Koha.Preference' syntax to output system preference data. The patch removes handling of two preferences from Auth.pm which which are covered by this template change. This patch also makes some minor changes to consolidate multiple template checks for "bidi" To test, apply the patch and test the affected OPAC system preferences: - OpacFavicon - opaclayoutstylesheet - OPACUserCSS - OPACBaseURL Confirm that changes made to these preferences are reflected in the OPAC. Signed-off-by: frederik Signed-off-by: Nadine Pierre Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit 6a222fa2afd367257b7e0c9815a92521883128d4) Signed-off-by: Fridolin Somers (cherry picked from commit a6718b95c1b123a5fb8616a84c110c37a55b3ffd) Signed-off-by: Lucas Gass --- C4/Auth.pm | 2 -- .../bootstrap/en/includes/doc-head-close.inc | 31 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 572ac5a6e6..c7f9d352d0 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -546,7 +546,6 @@ sub get_template_and_user { my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' }); $template->param( - OpacAdditionalStylesheet => C4::Context->preference("OpacAdditionalStylesheet"), AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), LibrarySearchGroups => \@search_groups, opac_name => $opac_name, @@ -579,7 +578,6 @@ sub get_template_and_user { 'Version' => C4::Context->preference('Version'), hidelostitems => C4::Context->preference("hidelostitems"), mylibraryfirst => ( C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv ) ? C4::Context->userenv->{'branch'} : '', - opaclayoutstylesheet => "" . C4::Context->preference("opaclayoutstylesheet"), opacbookbag => "" . C4::Context->preference("opacbookbag"), opaccredits => "" . C4::Context->preference("opaccredits"), OpacFavicon => C4::Context->preference("OpacFavicon"), diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc index ad2217e500..9d4e0f532f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc @@ -1,50 +1,53 @@ [% USE raw %] +[% USE Koha %] [%- USE KohaPlugins -%] [% USE Asset %] - + [% IF ( bidi ) %] [% Asset.css("lib/bootstrap/css/bootstrap-rtl.min.css") | $raw %] + [% Asset.css("lib/jquery/jquery-ui-rtl.css") | $raw %] + [% Asset.css("css/right-to-left.css") | $raw %] [% ELSE %] [% Asset.css("lib/bootstrap/css/bootstrap.min.css") | $raw %] + [% Asset.css("lib/jquery/jquery-ui.css") | $raw %] [% END %] - -[% IF ( bidi ) %] - [% Asset.css("lib/jquery/jquery-ui-rtl.css") | $raw %] +[% IF ( Koha.Preference('opaclayoutstylesheet') ) %] + [% SET opaclayoutstylesheet = Koha.Preference('opaclayoutstylesheet') %] [% ELSE %] - [% Asset.css("lib/jquery/jquery-ui.css") | $raw %] + [% SET opaclayoutstylesheet = 'opac.css' %] [% END %] - -[% SET opaclayoutstylesheet='opac.css' UNLESS opaclayoutstylesheet %] [% IF (opaclayoutstylesheet.match('^https?:|^\/')) %] [% ELSE %] [% Asset.css("css/" _ opaclayoutstylesheet) | $raw %] [% END %] -[% IF ( OpacAdditionalStylesheet ) %] +[% IF ( Koha.Preference('OpacAdditionalStylesheet') ) %] + [% SET OpacAdditionalStylesheet = Koha.Preference('OpacAdditionalStylesheet') %] [% IF (OpacAdditionalStylesheet.match('^https?:|^\/')) %] [% ELSE %] - + [% END %] [% END %] [% IF ( opac_css_override ) %] - + [% END %] [% Asset.css("css/print.css", { media = "print" }) | $raw %] -[% IF ( bidi ) %] - [% Asset.css("css/right-to-left.css") | $raw %] +[% IF ( Koha.Preference('OPACUserCSS') ) %] + [% END %] -[% IF ( OPACUserCSS ) %][% END %] [% IF SCO_login %] [% SET SCOUserCSS = Koha.Preference('SCOUserCSS') %] [% IF SCOUserCSS %] [% END %] [% END %] - +[% IF ( Koha.Preference('OPACBaseURL') ) %] + +[% END %] [% PROCESS cssinclude %]