From 21454708cb4212dd6615d15a82c134c1f2fa43f4 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 8 Jul 2013 11:22:38 -0400 Subject: [PATCH] Bug 10552: make several sysprefs available to the OPAC login page Several system preference variables are unavailable to the OPAC login template because they are not explicitly enabled for that page. Instead of adding them to Auth.pm using the old method this patch uses the new system preference check syntax using the Koha TT plugin. The following preferences are now checked using this syntax in masthead.inc: OpacAddMastheadLibraryPulldown UseCourseReserves reviewson OpacShowRecentComments In order for the call in masthead.inc to the new plugin to work on all OPAC pages "[% USE Koha %]" must be added to any template which includes it (most of them). Also in this patch: A change to Auth.pm to enable correct display of the LibraryName in the title of the OPAC login page. To test, turn on the above system preferences and confirm that the relevant links appear under the OPAC's main search bar on all pages including the login page. Confirm that the text specified in the LibraryName system preference is shown as the title of the login page. Confirm that course reserves and comments are displayed correctly on the biblio detail page. Signed-off-by: Liz Rea I checked both prog and ccsr - all seems well and the links are appearing and disappearing in accordance with the appropriate sysprefs. Signed-off-by: Katrin Fischer Works as described. Signed-off-by: Galen Charlton (cherry picked from commit 04dd98fa846d4f28edc5811cb90e8a5ba4b6289b) Conflicts: koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt koha-tmpl/opac-tmpl/prog/en/modules/opac-course-reserves.tt koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt Signed-off-by: Tomas Cohen Arazi --- C4/Auth.pm | 11 +++++++---- koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc | 10 +++++----- koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 6 +++--- .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tt | 1 + .../opac-tmpl/prog/en/modules/opac-MARCdetail.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt | 1 + .../opac-tmpl/prog/en/modules/opac-alert-subscribe.tt | 1 + .../opac-tmpl/prog/en/modules/opac-auth-MARCdetail.tt | 1 + .../opac-tmpl/prog/en/modules/opac-auth-detail.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt | 1 + .../prog/en/modules/opac-authorities-home.tt | 1 + .../en/modules/opac-authoritiessearchresultlist.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-browser.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 5 +++-- .../opac-tmpl/prog/en/modules/opac-downloadcart.tt | 1 + .../opac-tmpl/prog/en/modules/opac-downloadshelf.tt | 1 + .../prog/en/modules/opac-full-serial-issues.tt | 1 + .../opac-tmpl/prog/en/modules/opac-imageviewer.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt | 1 + .../en/modules/opac-memberentry-update-submitted.tt | 1 + .../opac-tmpl/prog/en/modules/opac-memberentry.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt | 1 + .../opac-tmpl/prog/en/modules/opac-readingrecord.tt | 2 +- .../prog/en/modules/opac-registration-confirmation.tt | 1 + .../prog/en/modules/opac-registration-email-sent.tt | 1 + .../prog/en/modules/opac-registration-invalid.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt | 1 + .../opac-tmpl/prog/en/modules/opac-results-grouped.tt | 1 + .../opac-tmpl/prog/en/modules/opac-search-history.tt | 1 + .../opac-tmpl/prog/en/modules/opac-serial-issues.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-showreviews.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-suggestions.tt | 2 ++ koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-tags_subject.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-topissues.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 2 +- 40 files changed, 55 insertions(+), 19 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index d16d3401a2..d4d1509a57 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -352,6 +352,7 @@ sub get_template_and_user { AllowMultipleCovers => C4::Context->preference('AllowMultipleCovers'), EnableBorrowerFiles => C4::Context->preference('EnableBorrowerFiles'), UseKohaPlugins => C4::Context->preference('UseKohaPlugins'), + UseCourseReserves => C4::Context->preference("UseCourseReserves"), ); } else { @@ -391,7 +392,6 @@ sub get_template_and_user { OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"), OPACItemHolds => C4::Context->preference("OPACItemHolds"), OPACShelfBrowser => "". C4::Context->preference("OPACShelfBrowser"), - OpacShowRecentComments => C4::Context->preference("OpacShowRecentComments"), OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"), OPACUserCSS => "". C4::Context->preference("OPACUserCSS"), OPACMobileUserCSS => "". C4::Context->preference("OPACMobileUserCSS"), @@ -431,13 +431,11 @@ sub get_template_and_user { opacsmallimage => "" . C4::Context->preference("opacsmallimage"), opacuserjs => C4::Context->preference("opacuserjs"), opacuserlogin => "" . C4::Context->preference("opacuserlogin"), - reviewson => C4::Context->preference("reviewson"), ShowReviewer => C4::Context->preference("ShowReviewer"), ShowReviewerPhoto => C4::Context->preference("ShowReviewerPhoto"), suggestion => "" . C4::Context->preference("suggestion"), virtualshelves => "" . C4::Context->preference("virtualshelves"), OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"), - OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"), OPACXSLTDetailsDisplay => C4::Context->preference("OPACXSLTDetailsDisplay"), OPACXSLTResultsDisplay => C4::Context->preference("OPACXSLTResultsDisplay"), SyndeticsClientCode => C4::Context->preference("SyndeticsClientCode"), @@ -973,6 +971,10 @@ sub checkauth { push @inputs, { name => $name, value => $value }; } + my $LibraryNameTitle = C4::Context->preference("LibraryName"); + $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; + $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; + my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tmpl' : 'auth.tmpl'; my $template = C4::Templates::gettemplate($template_name, $type, $query ); $template->param( @@ -984,7 +986,8 @@ sub checkauth { casAuthentication => C4::Context->preference("casAuthentication"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), - LibraryName => C4::Context->preference("LibraryName"), + LibraryName => "" . C4::Context->preference("LibraryName"), + LibraryNameTitle => "" . $LibraryNameTitle, opacuserlogin => C4::Context->preference("opacuserlogin"), OpacNav => C4::Context->preference("OpacNav"), OpacNavRight => C4::Context->preference("OpacNavRight"), diff --git a/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc index 254e4b4752..9815649af0 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc @@ -29,7 +29,7 @@ [% IF ( OpacPublic ) %]
[% UNLESS ( advsearch ) %] -[% IF ( OpacAddMastheadLibraryPulldown ) %] +[% IF Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 %] [% IF ( OpacShowFiltersPulldownMobile and not OpacShowLibrariesPulldownMobile ) or ( not OpacShowFiltersPulldownMobile and OpacShowLibrariesPulldownMobile ) %]
[% ELSE %] @@ -94,7 +94,7 @@ [% END %]
- [% IF ( OpacAddMastheadLibraryPulldown ) %] + [% IF Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 %] [% IF ( OpacShowLibrariesPulldownMobile ) %]
[% ELSE %] @@ -142,7 +142,7 @@ [% ELSE %] - [% IF ( OpacAddMastheadLibraryPulldown ) %] + [% IF Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 %] [% IF ( OpacShowFiltersPulldownMobile and not OpacShowLibrariesPulldownMobile ) or ( not OpacShowFiltersPulldownMobile and OpacShowLibrariesPulldownMobile ) %]
[% ELSE %] @@ -170,7 +170,7 @@
- [% IF ( OpacAddMastheadLibraryPulldown ) %] + [% IF Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 %] [% IF ( OpacShowLibrariesPulldownMobile ) %]
[% ELSE %] @@ -194,7 +194,7 @@ Advanced search [% IF ( OpacBrowser ) %] | Browse by hierarchy[% END %] [% IF ( OpacAuthorities ) %] | Authority search[% END %] -[% IF ( opacuserlogin && reviewson && OpacShowRecentComments ) %] | Recent comments[% END %] +[% IF ( opacuserlogin && ( Koha.Preference( 'reviewson' ) == 1 ) && ( Koha.Preference( 'OpacShowRecentComments' ) == 1 ) ) %] | Recent comments[% END %] [% IF ( TagsEnabled ) %] | Tag cloud[% END %] [% IF ( OpacCloud ) %] | Subject cloud[% END %] [% IF ( OpacTopissue ) %] | Most popular[% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index 80f58e22ed..02d1e3f116 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -30,7 +30,7 @@
[% UNLESS ( advsearch ) %] @@ -84,7 +84,7 @@ [% ELSE %]
[% END %] - [% IF ( OpacAddMastheadLibraryPulldown ) %] + [% IF Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 %]