require Exporter;
use C4::Context;
use C4::Templates; # to get the template
+use C4::Languages;
use C4::Branch; # GetBranches
use C4::Search::History;
use C4::VirtualShelves;
my $in = shift;
my ( $user, $cookie, $sessionID, $flags );
+ C4::Context->interface($in->{type});
+
my $template = C4::Templates::gettemplate(
$in->{'template_name'},
$in->{'type'},
# we've saved it to the database
C4::Search::History::set_to_session({ cgi => $in->{'query'}, search_history => [] });
}
+ } elsif ( $in->{type} eq 'intranet' and C4::Context->preference('EnableSearchHistory') ) {
+ $template->param( EnableSearchHistory => 1 );
}
}
else { # if this is an anonymous session, setup to display public lists...
}
# these template parameters are set the same regardless of $in->{'type'}
+
+ # Set the using_https variable for templates
+ # FIXME Under Plack the CGI->https method always returns 'OFF'
+ my $https = $in->{query}->https();
+ my $using_https = (defined $https and $https ne 'OFF') ? 1 : 0;
+
$template->param(
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'),
singleBranchMode => C4::Context->preference("singleBranchMode"),
XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
- using_https => $in->{'query'}->https() ? 1 : 0,
+ using_https => $using_https,
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
marcflavour => C4::Context->preference("marcflavour"),
persona => C4::Context->preference("persona"),
my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
my $opac_name = '';
- if (($opac_search_limit && $opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || ($in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:(\w+)/)){
+ if (
+ ($opac_limit_override && $opac_search_limit && $opac_search_limit =~ /branch:(\w+)/) ||
+ ($in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:(\w+)/) ||
+ ($in->{'query'}->param('multibranchlimit') && $in->{'query'}->param('multibranchlimit') =~ /multibranchlimit-(\w+)/)
+ ) {
$opac_name = $1; # opac_search_limit is a branch, so we use it.
} elsif ( $in->{'query'}->param('multibranchlimit') ) {
$opac_name = $in->{'query'}->param('multibranchlimit');
# Check if we were asked using parameters to force a specific language
if ( defined $in->{'query'}->param('language') ) {
- # Extract the language, let C4::Templates::getlanguage choose
+ # Extract the language, let C4::Languages::getlanguage choose
# what to do
- my $language = C4::Templates::getlanguage($in->{'query'},$in->{'type'});
+ my $language = C4::Languages::getlanguage($in->{'query'});
my $languagecookie = C4::Templates::getlanguagecookie($in->{'query'},$language);
if ( ref $cookie eq 'ARRAY' ) {
push @{ $cookie }, $languagecookie;
$debug and print STDERR "## checkpw - checking CAS\n";
# In case of a CAS authentication, we use the ticket instead of the password
my $ticket = $query->param('ticket');
+ $query->delete('ticket'); # remove ticket to come back to original URL
my ($retval,$retcard,$retuserid) = checkpw_cas($dbh, $ticket, $query); # EXTERNAL AUTH
($retval) and return ($retval,$retcard,$retuserid);
return 0;