Bugzilla – Attachment 10379 Details for
Bug 8263
Make OPAC stylesheet preferences more consistent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Rebased patch for 8263
patch.txt (text/plain), 13.15 KB, created by
Marcel de Rooy
on 2012-06-20 12:11:37 UTC
(
hide
)
Description:
Rebased patch for 8263
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2012-06-20 12:11:37 UTC
Size:
13.15 KB
patch
obsolete
>From 52da1a5552d493709574162aa2bf628bdc13408c Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 18 Jun 2012 11:42:50 +0200 >Subject: [PATCH] 8263 Consistent stylesheet prefs >Content-Type: text/plain; charset="utf-8" > >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. >--- > 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(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 66e70bd..9cabe72 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -387,16 +387,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"), >@@ -439,7 +431,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"), >@@ -944,19 +935,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"), >@@ -969,7 +953,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"), >@@ -980,7 +963,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"), >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 47bda04..e0baf2f 100644 >--- a/C4/Templates.pm >+++ b/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); >diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl >index 3659791..fb5f9ba 100755 >--- a/admin/systempreferences.pl >+++ b/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"; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 5c9f36c..a6bbd8a 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -89,7 +89,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'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index e4ea15b..372837a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -138,17 +138,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 <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 >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc >index 8634cfd..f067dc1 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc >@@ -3,13 +3,18 @@ > <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('^http:|^\/')) %] >+ <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('^http:|^\/')) %] >+ <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 %]" /> >-- >1.7.7.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8263
:
10354
|
10355
|
10379
|
10396
|
10633
|
10930
|
11035
|
11036