From dcd27b81211e46941094ee3781ebf77fe0215822 Mon Sep 17 00:00:00 2001 From: Chad Billman Date: Thu, 21 Jan 2016 11:23:51 -0500 Subject: [PATCH] Add branch selector to the opac header Display a dropdown to select a branch on the opac. Used to limit the searches to a branch with out requiring a login or advanced filters. QA Followup from kyle@bywatersolutions.com * Change "Buildings" to "Libraries", add span with class for easy changing * Fix use of tabs * Update license version * Add "Clear selection" option * Remove use of TT markup inside HTML tags https://bugs.koha-community.org/show_bug.cgi?id=15749 --- .../opac-tmpl/bootstrap/en/includes/masthead.inc | 37 +++++++++++++++++++ opac/opac-setbranch.pl | 41 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100755 opac/opac-setbranch.pl diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 949ccf3..329ba41 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -76,6 +76,43 @@ [% END # / IF virtualshelves %] + + [% IF Koha.Preference('SearchMyLibraryFirst') %] +
  • + + [% END %] + + [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
    [% END %] [% IF Koha.Preference( 'opacuserlogin' ) == 1 || opaclanguagesdisplay || EnableOpacSearchHistory %] diff --git a/opac/opac-setbranch.pl b/opac/opac-setbranch.pl new file mode 100755 index 0000000..13b73b5 --- /dev/null +++ b/opac/opac-setbranch.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use Modern::Perl; + +use CGI; +use C4::Auth qw/:DEFAULT get_session/; + +my $input = new CGI; + +my $cookie =~ m/CGISESSID=(\w*);.*/; +my $sessionID = $1; +my $session = get_session($sessionID); + +if ( $input->param('newbranch') ) { + $session->param( 'mylibraryfirst', $input->param('newbranch') ); + $session->param( 'branch', $input->param('newbranch') ); +} +else { + $session->param( 'mylibraryfirst', undef ); + $session->param( 'branch', undef ); +} + +$session->flush; + +print $input->redirect('/cgi-bin/koha/opac-main.pl'); + -- 1.9.1