From ca5e412c1b5ceeb6928469e6e5f33214259ea585 Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Wed, 27 May 2009 10:31:47 -0500 Subject: [PATCH] bug 3244: Support for multiple PAC interfaces. Adds three env vars allowing url-specific search limits, and defining how the limit interacts with 'SearchMyLibraryFirst'. See http://wiki.koha.org/doku.php?id=en:development:rfcs3.2:rfc32_multiple_opac Signed-off-by: Galen Charlton --- C4/Auth.pm | 20 ++++++++++++++++--- etc/koha-httpd.conf | 7 +++++++ .../prog/en/includes/doc-head-close.inc | 7 ++++++- .../opac-tmpl/prog/en/includes/masthead.inc | 15 +++++++++----- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index a5ac005bd9..f24f9af540 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -308,9 +308,20 @@ sub get_template_and_user { } else { warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' ); + #TODO : replace LibraryName syspref with 'system name', and remove this html processing my $LibraryNameTitle = C4::Context->preference("LibraryName"); $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; + # variables passed from CGI: opac_css_override and opac_search_limits. + my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'}; + my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'}; + my $mylibraryfirst = C4::Context->preference("SearchMyLibraryFirst"); + my $opac_name; + if($opac_limit_override && ($opac_search_limit =~ /branch:(\w+)/) ){ + $opac_name = C4::Branch::GetBranchName($1) # opac_search_limit is a branch, so we use it. + } elsif($mylibraryfirst){ + $opac_name = C4::Branch::GetBranchName($mylibraryfirst); + } $template->param( AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), @@ -327,9 +338,12 @@ sub get_template_and_user { OPACUserCSS => "". C4::Context->preference("OPACUserCSS"), OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"), OpacAuthorities => C4::Context->preference("OpacAuthorities"), - OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . - $ENV{'SERVER_NAME'} . + OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} . ($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"), + opac_name => $opac_name, + opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, + opac_search_limit => $opac_search_limit, + opac_limit_override => $opac_limit_override, OpacBrowser => C4::Context->preference("OpacBrowser"), OpacCloud => C4::Context->preference("OpacCloud"), OpacMainUserBlock => "" . C4::Context->preference("OpacMainUserBlock"), @@ -342,7 +356,7 @@ sub get_template_and_user { XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"), XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"), hidelostitems => C4::Context->preference("hidelostitems"), - mylibraryfirst => C4::Context->preference("SearchMyLibraryFirst"), + mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst")) ? C4::Context->userenv->{'branch'} : '', opacbookbag => "" . C4::Context->preference("opacbookbag"), opaccolorstylesheet => "". C4::Context->preference("opaccolorstylesheet"), opaccredits => "" . C4::Context->preference("opaccredits"), diff --git a/etc/koha-httpd.conf b/etc/koha-httpd.conf index d8fc9232a6..0841898153 100644 --- a/etc/koha-httpd.conf +++ b/etc/koha-httpd.conf @@ -16,6 +16,13 @@ # TransferLog __LOG_DIR__/koha-opac-access_log SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml" SetEnv PERL5LIB "__PERL_MODULE_DIR__" + +# Repeat this virtualhost stanza changing the following environment vars to +# create multiple OPAC interfaces with custom css and/or search limits: +# SetEnv OPAC_CSS_OVERRIDE mystyle.css +# SetEnv OPAC_SEARCH_LIMIT branch:CODE +# SetEnv OPAC_LIMIT_OVERRIDE 1 + Options +FollowSymLinks ErrorDocument 400 /cgi-bin/koha/errors/400.pl diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc index 7710751f53..2238fba449 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc @@ -4,7 +4,12 @@ /includes/favicon.ico" type="image/x-icon" /> " /> /css/" />/css/opac.css" /> -/css/" /> + + /css/" /> + + + /css/" /> + /css/print.css" /> /lib/jquery/plugins/ui.tabs.css" /> diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index 997c0a5d47..7162ab8824 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -17,7 +17,7 @@
- + - - " type="hidden" /> - - + + + " type="hidden" /> + + + + " type="hidden" /> + + Lists -- 2.20.1