sub get_template_and_user {
my $in = shift;
my $template =
- C4::Templates::gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
+ C4::Templates::gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'}, $in->{'is_plugin'} );
my ( $user, $cookie, $sessionID, $flags );
if ( $in->{'template_name'} !~m/maintenance/ ) {
( $user, $cookie, $sessionID, $flags ) = checkauth(
}
my $borrowernumber;
- my $insecure = C4::Context->preference('insecure');
- if ($user or $insecure) {
+ if ($user) {
require C4::Members;
# It's possible for $user to be the borrowernumber if they don't have a
# userid defined (and are logging in through some other method, such
# We are going to use the $flags returned by checkauth
# to create the template's parameters that will indicate
# which menus the user can access.
- if (( $flags && $flags->{superlibrarian}==1) or $insecure==1) {
+ if ( $flags && $flags->{superlibrarian}==1 ) {
$template->param( CAN_user_circulate => 1 );
$template->param( CAN_user_catalogue => 1 );
$template->param( CAN_user_parameters => 1 );
$template->param( CAN_user_reserveforothers => 1 );
$template->param( CAN_user_borrow => 1 );
$template->param( CAN_user_editcatalogue => 1 );
- $template->param( CAN_user_updatecharges => 1 );
+ $template->param( CAN_user_updatecharges => 1 );
$template->param( CAN_user_acquisition => 1 );
$template->param( CAN_user_management => 1 );
$template->param( CAN_user_tools => 1 );
$template->param( CAN_user_serials => 1 );
$template->param( CAN_user_reports => 1 );
$template->param( CAN_user_staffaccess => 1 );
+ $template->param( CAN_user_plugins => 1 );
+ $template->param( CAN_user_coursereserves => 1 );
foreach my $module (keys %$all_perms) {
foreach my $subperm (keys %{ $all_perms->{$module} }) {
$template->param( "CAN_user_${module}_${subperm}" => 1 );
}
if(C4::Context->preference('dateformat')){
- $template->param( dateformat => C4::Context->preference('dateformat') );
- if(C4::Context->preference('dateformat') eq "metric"){
- $template->param(dateformat_metric => 1);
- } elsif(C4::Context->preference('dateformat') eq "us"){
- $template->param(dateformat_us => 1);
- } else {
- $template->param(dateformat_iso => 1);
- }
- } else {
- $template->param(dateformat_iso => 1);
+ $template->param(dateformat => C4::Context->preference('dateformat'))
}
# these template parameters are set the same regardless of $in->{'type'}
GoogleJackets => C4::Context->preference("GoogleJackets"),
OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"),
KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"),
- LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
+ LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:undef),
LoginFirstname => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
LoginSurname => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
emailaddress => C4::Context->userenv?C4::Context->userenv->{"emailaddress"}:undef,
CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
CircAutocompl => C4::Context->preference("CircAutocompl"),
FRBRizeEditions => C4::Context->preference("FRBRizeEditions"),
- IndependantBranches => C4::Context->preference("IndependantBranches"),
+ IndependentBranches => C4::Context->preference("IndependentBranches"),
IntranetNav => C4::Context->preference("IntranetNav"),
IntranetmainUserblock => C4::Context->preference("IntranetmainUserblock"),
LibraryName => C4::Context->preference("LibraryName"),
- LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
+ LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:undef),
advancedMARCEditor => C4::Context->preference("advancedMARCEditor"),
canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
OPACLocalCoverImages => C4::Context->preference('OPACLocalCoverImages'),
AllowMultipleCovers => C4::Context->preference('AllowMultipleCovers'),
EnableBorrowerFiles => C4::Context->preference('EnableBorrowerFiles'),
+ UseKohaPlugins => C4::Context->preference('UseKohaPlugins'),
+ UseCourseReserves => C4::Context->preference("UseCourseReserves"),
);
}
else {
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+)/)){
$opac_name = $1; # opac_search_limit is a branch, so we use it.
+ } elsif ( $in->{'query'}->param('multibranchlimit') ) {
+ $opac_name = $in->{'query'}->param('multibranchlimit');
} elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
$opac_name = C4::Context->userenv->{'branch'};
}
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"),
BranchesLoop => GetBranchesLoop($opac_name),
- CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
+ BranchCategoriesLoop => GetBranchCategories( 'searchdomain', 1, $opac_name ),
+ CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
LibraryName => "" . C4::Context->preference("LibraryName"),
LibraryNameTitle => "" . $LibraryNameTitle,
LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"),
OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"),
- OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"),
+ OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"),
OPACItemHolds => C4::Context->preference("OPACItemHolds"),
OPACShelfBrowser => "". C4::Context->preference("OPACShelfBrowser"),
- OpacShowRecentComments => C4::Context->preference("OpacShowRecentComments"),
OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"),
OPACUserCSS => "". C4::Context->preference("OPACUserCSS"),
OPACMobileUserCSS => "". C4::Context->preference("OPACMobileUserCSS"),
OpacAuthorities => C4::Context->preference("OpacAuthorities"),
OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} .
($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"),
- opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'},
+ opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'},
opac_search_limit => $opac_search_limit,
opac_limit_override => $opac_limit_override,
OpacBrowser => C4::Context->preference("OpacBrowser"),
OpacNavRight => "" . C4::Context->preference("OpacNavRight"),
OpacNavBottom => "" . C4::Context->preference("OpacNavBottom"),
OpacPasswordChange => C4::Context->preference("OpacPasswordChange"),
- OPACPatronDetails => C4::Context->preference("OPACPatronDetails"),
+ OPACPatronDetails => C4::Context->preference("OPACPatronDetails"),
OPACPrivacy => C4::Context->preference("OPACPrivacy"),
OPACFinesTab => C4::Context->preference("OPACFinesTab"),
OpacTopissue => C4::Context->preference("OpacTopissue"),
opacsmallimage => "" . C4::Context->preference("opacsmallimage"),
opacuserjs => C4::Context->preference("opacuserjs"),
opacuserlogin => "" . C4::Context->preference("opacuserlogin"),
- reviewson => C4::Context->preference("reviewson"),
ShowReviewer => C4::Context->preference("ShowReviewer"),
ShowReviewerPhoto => C4::Context->preference("ShowReviewerPhoto"),
suggestion => "" . C4::Context->preference("suggestion"),
virtualshelves => "" . C4::Context->preference("virtualshelves"),
OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
- OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"),
OPACXSLTDetailsDisplay => C4::Context->preference("OPACXSLTDetailsDisplay"),
OPACXSLTResultsDisplay => C4::Context->preference("OPACXSLTResultsDisplay"),
SyndeticsClientCode => C4::Context->preference("SyndeticsClientCode"),
$branchname = GetBranchName($branchcode);
}
my $branches = GetBranches();
- if (C4::Context->boolean_preference('IndependantBranches') && C4::Context->boolean_preference('Autolocation')){
+ if (C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation')){
# we have to check they are coming from the right ip range
my $domain = $branches->{$branchcode}->{'branchip'};
if ($ip !~ /^$domain/){
$session->param('sessiontype','anon');
}
} # END unless ($userid)
- my $insecure = C4::Context->boolean_preference('insecure');
# finished authentification, now respond
- if ( $loggedin || $authnotrequired || ( defined($insecure) && $insecure ) )
+ if ( $loggedin || $authnotrequired )
{
# successful login
unless ($cookie) {
push @inputs, { name => $name, value => $value };
}
+ my $LibraryNameTitle = C4::Context->preference("LibraryName");
+ $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi;
+ $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg;
+
my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tmpl' : 'auth.tmpl';
my $template = C4::Templates::gettemplate($template_name, $type, $query );
$template->param(
casAuthentication => C4::Context->preference("casAuthentication"),
suggestion => C4::Context->preference("suggestion"),
virtualshelves => C4::Context->preference("virtualshelves"),
- LibraryName => C4::Context->preference("LibraryName"),
+ LibraryName => "" . C4::Context->preference("LibraryName"),
+ LibraryNameTitle => "" . $LibraryNameTitle,
opacuserlogin => C4::Context->preference("opacuserlogin"),
OpacNav => C4::Context->preference("OpacNav"),
OpacNavRight => C4::Context->preference("OpacNavRight"),
IntranetNav => C4::Context->preference("IntranetNav"),
IntranetFavicon => C4::Context->preference("IntranetFavicon"),
intranetuserjs => C4::Context->preference("intranetuserjs"),
- IndependantBranches=> C4::Context->preference("IndependantBranches"),
+ IndependentBranches=> C4::Context->preference("IndependentBranches"),
AutoLocation => C4::Context->preference("AutoLocation"),
wrongip => $info{'wrongip'},
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"),
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"),
persona => C4::Context->preference("Persona"),
+ opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'},
);
$template->param( OpacPublic => C4::Context->preference("OpacPublic"));
$template->param( loginprompt => 1 ) unless $info{'nopermission'};
+ if($type eq 'opac'){
+ my ($total, $pubshelves) = C4::VirtualShelves::GetSomeShelfNames(undef, 'MASTHEAD');
+ $template->param(
+ pubshelves => $total->{pubtotal},
+ pubshelvesloop => $pubshelves,
+ );
+ }
+
if ($cas) {
# Is authentication against multiple CAS servers enabled?