This patch makes the use of opaccolorstylesheet and opaclayoutstylesheet more consistent. They may be: 1) just a file name, 2) a complete local path or 3) a full URL starting with http: for a remote css file.
This makes the syspref opacstylesheet that was only used for a remote css file obsolete.
June 20, 2012 Rebased.
July 18, 2012: Regex allows https too (thanks to Owen Leonard).
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
} elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
$opac_name = C4::Context->userenv->{'branch'};
}
- my $checkstyle = C4::Context->preference("opaccolorstylesheet");
- if ($checkstyle =~ /http/)
- {
- $template->param( opacexternalsheet => $checkstyle);
- } else
- {
- my $opaccolorstylesheet = C4::Context->preference("opaccolorstylesheet");
- $template->param( opaccolorstylesheet => $opaccolorstylesheet);
- }
$template->param(
+ opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"),
AmazonContent => "" . C4::Context->preference("AmazonContent"),
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"),
hidelostitems => C4::Context->preference("hidelostitems"),
mylibraryfirst => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '',
opaclayoutstylesheet => "" . C4::Context->preference("opaclayoutstylesheet"),
- opacstylesheet => "" . C4::Context->preference("opacstylesheet"),
opacbookbag => "" . C4::Context->preference("opacbookbag"),
opaccredits => "" . C4::Context->preference("opaccredits"),
OpacFavicon => C4::Context->preference("OpacFavicon"),
}
my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tmpl' : 'auth.tmpl';
- my $template = C4::Templates::gettemplate( $template_name, $type, $query );
- $template->param(branchloop => \@branch_loop,);
- my $checkstyle = C4::Context->preference("opaccolorstylesheet");
- if ($checkstyle =~ /\//)
- {
- $template->param( opacexternalsheet => $checkstyle);
- } else
- {
- my $opaccolorstylesheet = C4::Context->preference("opaccolorstylesheet");
- $template->param( opaccolorstylesheet => $opaccolorstylesheet);
- }
+ my $template = C4::Templates::gettemplate($template_name, $type, $query );
$template->param(
- login => 1,
+ branchloop => \@branch_loop,
+ opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"),
+ opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
+ login => 1,
INPUTS => \@inputs,
casAuthentication => C4::Context->preference("casAuthentication"),
suggestion => C4::Context->preference("suggestion"),
OpacFavicon => C4::Context->preference("OpacFavicon"),
opacreadinghistory => C4::Context->preference("opacreadinghistory"),
opacsmallimage => C4::Context->preference("opacsmallimage"),
- opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"),
opacuserjs => C4::Context->preference("opacuserjs"),
opacbookbag => "" . C4::Context->preference("opacbookbag"),
opacheader => C4::Context->preference("opacheader"),
TagsEnabled => C4::Context->preference("TagsEnabled"),
OPACUserCSS => C4::Context->preference("OPACUserCSS"),
- opacstylesheet => C4::Context->preference("opacstylesheet"),
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
( $self->{interface} ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' );
$vars->{theme} = $self->theme;
$vars->{opaccolorstylesheet} =
- C4::Context->preference('opaccolorstylesheet');
+ C4::Context->preference('opaccolorstylesheet');
$vars->{opacsmallimage} = C4::Context->preference('opacsmallimage');
- $vars->{opacstylesheet} = C4::Context->preference('opacstylesheet');
+ $vars->{opaclayoutstylesheet} =
+ C4::Context->preference('opaclayoutstylesheet');
# add variables set via param to $vars for processing
# and clean any utf8 mess
my $is_intranet = $interface eq 'intranet';
my $htdocs = C4::Context->config($is_intranet ? 'intrahtdocs' : 'opachtdocs');
my ($theme, $lang) = themelanguage($htdocs, $tmplbase, $interface, $query);
- my $opacstylesheet = C4::Context->preference('opacstylesheet');
# if the template doesn't exist, load the English one as a last resort
my $filename = "$htdocs/$theme/$lang/modules/$tmplbase";
my ( $tmplbase, $interface, $query ) = @_;
($query) or warn "no query in gettemplate";
my $path = C4::Context->preference('intranet_includes') || 'includes';
- my $opacstylesheet = C4::Context->preference('opacstylesheet');
$tmplbase =~ s/\.tmpl$/.tt/;
my ($htdocs, $theme, $lang, $filename)
= _get_template_file($tmplbase, $interface, $query);
$tabsysprefs{opaclayoutstylesheet} = "OPAC";
$tabsysprefs{OpacNav} = "OPAC";
$tabsysprefs{opacsmallimage} = "OPAC";
-$tabsysprefs{opacstylesheet} = "OPAC";
$tabsysprefs{opacthemes} = "OPAC";
$tabsysprefs{opacuserjs} = "OPAC";
$tabsysprefs{opacheader} = "OPAC";
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacreadinghistory',1,'If ON, enables display of Patron Circulation History in OPAC','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacsmallimage','','Enter a complete URL to an image to replace the default Koha logo','','free');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacstylesheet','','Enter a complete URL to use an alternate layout stylesheet in OPAC','','free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacthemes','prog','Define the current theme for the OPAC interface.','','Themes');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacTopissue',0,'If ON, enables the \'most popular items\' link on OPAC. Warning, this is an EXPERIMENTAL feature, turning ON may overload your server',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo');
- Include the additional CSS stylesheet
- pref: opaccolorstylesheet
class: file
- - to override specified settings from the default stylesheet (leave blank to disable). Enter a filename or a complete URL beginning with <code>http://</code> (if the file lives on a remote server). Please note that if you enter a filename, the file should be in the css subdirectory for each active theme and language within the Koha templates directory.
+ - to override specified settings from the default stylesheet (leave blank to disable). Enter just a filename, a full local path or a complete URL starting with <code>http://</code> (if the file lives on a remote server). Please note that if you just enter a filename, the file should be in the css subdirectory for each active theme and language within the Koha templates directory. A full local path is expected to start from your HTTP document root.
-
- Use the CSS stylesheet
- pref: opaclayoutstylesheet
class: file
- - on all pages in the OPAC, instead of the default (leave blank to disable). Please enter filename only. The file should be in the css subdirectory for each active theme and language within the Koha templates directory.
- -
- - Use the remote CSS stylesheet
- - pref: opacstylesheet
- class: file
- - on all pages in the OPAC, instead of the default. (This should be a complete URL, starting with <code>http://</code>.)
+ - on all pages in the OPAC, instead of the default css (used when leaving this field blank). Enter just a filename, a full local path or a complete URL starting with <code>http://</code> (if the file lives on a remote server). Please note that if you just enter a filename, the file should be in the css subdirectory for each active theme and language within the Koha templates directory. A full local path is expected to start from your HTTP document root.
-
- "Include the following CSS on all pages in the OPAC:"
- pref: OPACUserCSS
<meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
<link rel="shortcut icon" href="[% IF ( OpacFavicon ) %][% OpacFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="[% themelang %]/lib/jquery/jquery-ui.css" />
-[% IF ( opacstylesheet ) %]<link rel="stylesheet" type="text/css" href="[% opacstylesheet %]" />[% ELSE %]
-[% IF ( opaclayoutstylesheet ) %]<link rel="stylesheet" type="text/css" href="[% themelang %]/css/[% opaclayoutstylesheet %]" />[% ELSE %]<link rel="stylesheet" type="text/css" href="[% themelang %]/css/opac.css" />[% END %][% END %]
-[% IF ( opaccolorstylesheet ) %]
- <link rel="stylesheet" type="text/css" href="[% themelang %]/css/[% opaccolorstylesheet %]" />
+[% SET opaclayoutstylesheet='opac.css' UNLESS opaclayoutstylesheet %]
+[% IF (opaclayoutstylesheet.match('^https?:|^\/')) %]
+ <link rel="stylesheet" type="text/css" href="[% opaclayoutstylesheet %]" />
+[% ELSE %]
+ <link rel="stylesheet" type="text/css" href="[% themelang %]/css/[% opaclayoutstylesheet %]" />
[% END %]
-[% IF ( opacexternalsheet ) %]
- <link rel="stylesheet" type="text/css" href="[% opacexternalsheet %]" />
+[% IF ( opaccolorstylesheet ) %]
+ [% IF (opaccolorstylesheet.match('^https?:|^\/')) %]
+ <link rel="stylesheet" type="text/css" href="[% opaccolorstylesheet %]" />
+ [% ELSE %]
+ <link rel="stylesheet" type="text/css" href="[% themelang %]/css/[% opaccolorstylesheet %]" />
+ [% END %]
[% END %]
[% IF ( opac_css_override ) %]
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/[% opac_css_override %]" />