From e06291b7fdaf7b99eda8b5a9521d832b6fd83cc1 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 --- 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 d79ce466e0..ba3c00b5e7 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -549,7 +549,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, @@ -582,7 +581,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 %]