@@ -, +, @@ --- C4/Auth.pm | 30 ++++---------------- C4/Templates.pm | 7 ++-- admin/systempreferences.pl | 1 - installer/data/mysql/sysprefs.sql | 1 - .../prog/en/modules/admin/preferences/opac.pref | 9 +---- .../opac-tmpl/prog/en/includes/doc-head-close.inc | 17 +++++++---- 6 files changed, 22 insertions(+), 43 deletions(-) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -388,16 +388,8 @@ sub get_template_and_user { } 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"), @@ -441,7 +433,6 @@ sub get_template_and_user { 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"), @@ -946,19 +937,12 @@ sub checkauth { } 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"), @@ -972,7 +956,6 @@ sub checkauth { 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"), @@ -983,7 +966,6 @@ sub checkauth { 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"), --- a/C4/Templates.pm +++ a/C4/Templates.pm @@ -104,9 +104,10 @@ sub output { ( $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 @@ -211,7 +212,6 @@ sub _get_template_file { 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"; @@ -227,7 +227,6 @@ sub gettemplate { 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); --- a/admin/systempreferences.pl +++ a/admin/systempreferences.pl @@ -335,7 +335,6 @@ $tabsysprefs{opaccredits} = "OPAC"; $tabsysprefs{opaclayoutstylesheet} = "OPAC"; $tabsysprefs{OpacNav} = "OPAC"; $tabsysprefs{opacsmallimage} = "OPAC"; -$tabsysprefs{opacstylesheet} = "OPAC"; $tabsysprefs{opacthemes} = "OPAC"; $tabsysprefs{opacuserjs} = "OPAC"; $tabsysprefs{opacheader} = "OPAC"; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -90,7 +90,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES 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'); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -151,17 +151,12 @@ OPAC: - 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 http:// (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 http:// (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 http://.) + - 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 http:// (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 --- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc +++ a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc @@ -3,13 +3,18 @@ -[% IF ( opacstylesheet ) %][% ELSE %] -[% IF ( opaclayoutstylesheet ) %][% ELSE %][% END %][% END %] -[% IF ( opaccolorstylesheet ) %] - +[% SET opaclayoutstylesheet='opac.css' UNLESS opaclayoutstylesheet %] +[% IF (opaclayoutstylesheet.match('^https?:|^\/')) %] + +[% ELSE %] + [% END %] -[% IF ( opacexternalsheet ) %] - +[% IF ( opaccolorstylesheet ) %] + [% IF (opaccolorstylesheet.match('^https?:|^\/')) %] + + [% ELSE %] + + [% END %] [% END %] [% IF ( opac_css_override ) %] --