From 0578894f223445828ebadb56fec10f06711e5b61 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 8 Jul 2013 11:22:38 -0400 Subject: [PATCH] [PASSED QA] Bug 10552 - Several preferences missing from 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. --- C4/Auth.pm | 12 +++++++----- koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc | 12 ++++++------ koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 8 ++++---- .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tt | 1 + .../opac-tmpl/prog/en/modules/opac-MARCdetail.tt | 1 + .../opac-tmpl/prog/en/modules/opac-account.tt | 1 + .../opac-tmpl/prog/en/modules/opac-advsearch.tt | 1 + .../prog/en/modules/opac-alert-subscribe.tt | 1 + .../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 + .../opac-tmpl/prog/en/modules/opac-browser.tt | 1 + .../prog/en/modules/opac-course-details.tt | 1 + .../prog/en/modules/opac-course-reserves.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 9 +++++---- .../opac-tmpl/prog/en/modules/opac-downloadcart.tt | 1 + .../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 + .../modules/opac-memberentry-update-submitted.tt | 1 + .../opac-tmpl/prog/en/modules/opac-memberentry.tt | 1 + .../opac-tmpl/prog/en/modules/opac-messaging.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-passwd.tt | 1 + .../opac-tmpl/prog/en/modules/opac-privacy.tt | 1 + .../prog/en/modules/opac-readingrecord.tt | 2 +- .../en/modules/opac-registration-confirmation.tt | 1 + .../en/modules/opac-registration-email-sent.tt | 1 + .../prog/en/modules/opac-registration-invalid.tt | 1 + .../opac-tmpl/prog/en/modules/opac-reserve.tt | 1 + .../prog/en/modules/opac-results-grouped.tt | 1 + .../prog/en/modules/opac-search-history.tt | 1 + .../prog/en/modules/opac-serial-issues.tt | 1 + .../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 | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt | 2 +- .../opac-tmpl/prog/en/modules/opac-tags_subject.tt | 1 + .../opac-tmpl/prog/en/modules/opac-topissues.tt | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 2 +- 42 files changed, 60 insertions(+), 24 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e9d3747..d6e088a 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -328,7 +328,6 @@ sub get_template_and_user { noItemTypeImages => C4::Context->preference("noItemTypeImages"), marcflavour => C4::Context->preference("marcflavour"), persona => C4::Context->preference("persona"), - UseCourseReserves => C4::Context->preference("UseCourseReserves"), ); if ( $in->{'type'} eq "intranet" ) { $template->param( @@ -361,6 +360,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 { @@ -400,7 +400,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"), @@ -440,13 +439,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"), @@ -982,6 +979,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( @@ -993,7 +994,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 4eb56c8..b85a427 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 %] @@ -192,10 +192,10 @@
Advanced search -[% IF ( UseCourseReserves ) %] | Course Reserves[% END %] +[% IF Koha.Preference( 'UseCourseReserves' ) == 1 %] | Course reserves[% END %] [% 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 651e669..b915cb1 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 %]