From 091c08deea9a8692a30c78be5b0bd7f2c764b3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Wed, 23 Apr 2014 16:32:20 +0200 Subject: [PATCH] [Proof of concept] Bug 12162 - Add class="branchcode" to body tag to make OPAC CSS-styleable per branch This patch implements branch specific CSS for Opac Main page and OPAC Search. If the proof of concept works out, other Opac pages can be adapted. To test: Apply patch Edit system preference OPACUserCSS and insert something like /*Background for all branches*/ body { background-color: red; } /*Yellow background and pink border for branch with code CPL*/ body.CPL { background-color: yellow; border: 10px solid pink; } /*Green background and red border for branch with code FFL*/ body.FFL { background-color: green; border: 10px solid red; } Go to Opac. Switch between branches CPL and FFL, see how background color changes... --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt | 4 ++-- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 2 +- opac/opac-main.pl | 4 ++++ opac/opac-search.pl | 5 +++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index c55eccc..f8b0ca6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -5,7 +5,7 @@ [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %][% END %] - + [% INCLUDE 'masthead.inc' %]
@@ -392,4 +392,4 @@ }); //]]> -[% END %] \ No newline at end of file +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt index 5b68c19..028ad6c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -4,7 +4,7 @@ [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %][% END %] - + [% INCLUDE 'masthead.inc' %]
diff --git a/opac/opac-main.pl b/opac/opac-main.pl index a58659c..b5adff6 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -39,6 +39,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); +if (C4::Context->userenv) { + $template->param(homebranch => C4::Context->userenv->{'branch'},); +} + my $casAuthentication = C4::Context->preference('casAuthentication'); $template->param( casAuthentication => $casAuthentication, diff --git a/opac/opac-search.pl b/opac/opac-search.pl index e2236c2..d16a6e0 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -120,6 +120,11 @@ else { authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), } ); + +if (C4::Context->userenv) { + $template->param(homebranch => C4::Context->userenv->{'branch'},); +} + if ($template_name eq 'opac-results.tmpl') { $template->param('COinSinOPACResults' => C4::Context->preference('COinSinOPACResults')); } -- 1.7.10.4