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 <galen.charlton@liblime.com>
This commit is contained in:
Ryan Higgins 2009-05-27 10:31:47 -05:00 committed by Henri-Damien LAURENT
parent 2d0476d6d9
commit a6df74d80b
4 changed files with 40 additions and 9 deletions

View File

@ -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"),

View File

@ -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

View File

@ -4,7 +4,12 @@
<link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" />
<!-- TMPL_IF name="opacstylesheet" --><link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="opacstylesheet" -->" /><!-- TMPL_ELSE -->
<!-- TMPL_IF name="opaclayoutstylesheet" --><link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/<!-- TMPL_VAR NAME="opaclayoutstylesheet" -->" /><!-- TMPL_ELSE --><link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/opac.css" /><!-- /TMPL_IF --><!-- /TMPL_IF -->
<!-- TMPL_IF name="opaccolorstylesheet" --><link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/<!-- TMPL_VAR NAME="opaccolorstylesheet" -->" /><!-- /TMPL_IF -->
<!-- TMPL_IF name="opaccolorstylesheet" -->
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/<!-- TMPL_VAR NAME="opaccolorstylesheet" -->" />
<!-- /TMPL_IF -->
<!-- TMPL_IF name="opac_css_override" -->
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/<!-- TMPL_VAR NAME="opac_css_override" -->" />
<!-- /TMPL_IF -->
<link rel="stylesheet" type="text/css" media="print" href="<!-- TMPL_VAR NAME="themelang" -->/css/print.css" />
<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/ui.tabs.css" />
<!-- TMPL_IF NAME="OPACUserCSS" --><style type="text/css"><!-- TMPL_VAR NAME="OPACUserCSS" --></style><!-- /TMPL_IF -->

View File

@ -17,7 +17,7 @@
<div id="fluid">
<div id="fluid-offset">
<!-- TMPL_UNLESS NAME="advsearch" --><form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform">
<label for="masthead_search" class="left"> Search <!-- TMPL_IF name="mylibraryfirst" --> <!-- TMPL_IF name="loggedinusername" -->(in <!-- TMPL_VAR name="LoginBranchcode" --> only)<!-- /TMPL_IF --><!-- /TMPL_IF --></label>
<label for="masthead_search" class="left"> Search <!-- TMPL_IF name="mylibraryfirst" --> (in <!-- TMPL_VAR name="mylibraryfirst" --> only)<!-- /TMPL_IF --><!-- /TMPL_IF --></label>
<select name="idx" id="masthead_search" class="left" style="max-width:10em;width:10em;">
<!-- TMPL_IF NAME="ms_kw" -->
<option selected="selected" value="">Library Catalog</option>
@ -59,10 +59,15 @@
<!-- TMPL_ELSE -->
<input type="text" name="q" class="left" style="width: 35%; font-size: 111%;" />
<!-- /TMPL_IF -->
<!-- TMPL_IF name="mylibraryfirst" --><!-- TMPL_IF name="loggedinusername" -->
<input name="limit" value="<!-- TMPL_VAR name="LoginBranchcode" -->" type="hidden" />
<!-- /TMPL_IF --><!-- /TMPL_IF -->
<input type="submit" value="Go" id="searchsubmit" class="left" />
<!-- TMPL_UNLESS NAME="opac_limit_override" -->
<!-- TMPL_IF name="mylibraryfirst" -->
<input name="limit" value="branch:<!-- TMPL_VAR name="mylibraryfirst" -->" type="hidden" />
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF NAME="opac_search_limit" -->
<input name="limit" value="<!-- TMPL_VAR name="opac_search_limit" -->" type="hidden" />
<!-- /TMPL_IF -->
<input type="submit" value="Go" id="searchsubmit" class="left" />
<!-- TMPL_IF NAME="opacbookbag" --><span id="cmspan"></span><!-- /TMPL_IF -->
<!--TMPL_IF NAME="virtualshelves" --><a href="/cgi-bin/koha/opac-shelves.pl" id="listsmenulink" class=""><i></i><span><i></i><span></span>Lists </span></a><!-- /TMPL_IF -->