From a6df74d80b6c5cbde3e1928bfb3df4fa60ea37f3 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 eb7a464186..f94358c01d 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -294,9 +294,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( OPACAmazonContent => "" . C4::Context->preference("OPACAmazonContent"), AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), @@ -312,9 +323,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"), @@ -327,7 +341,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 d9ab95bc4e..3d44e073d8 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 93f0444671..6c2b9ca3fa 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.39.5