From 5e4a6150df52d23195637a14501f28da5fe2f81e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 1 Sep 2011 13:24:43 -0400 Subject: [PATCH] Tpac: Support for skinning via Apache configuration More generally, support for augmenting the Template Toolkit template path list to allow for per-vhost template paths. For example, a 3-tier consortium could do something like this: [...] PerlAddVar OILSTemplatePath "/openils/var/templates_branch_abc" PerlAddVar OILSTemplatePath "/openils/var/templates_system_xyz" PerlAddVar OILSTemplatePath "/openils/var/templates_shared" Signed-off-by: Bill Erickson --- Open-ILS/examples/apache/eg_vhost.conf | 7 +++++++ Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf index 48a259c61f..f018c73d8e 100644 --- a/Open-ILS/examples/apache/eg_vhost.conf +++ b/Open-ILS/examples/apache/eg_vhost.conf @@ -536,6 +536,13 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] Options +ExecCGI PerlSendHeader On allow from all + + # Example of overriding template paths. Template paths will be + # checked in order of their appearance here. The server will then + # go on to check template paths configured in oils_web.xml. + # PerlAddVar OILSTemplatePath "/openils/var/templates_BranchABC" + # PerlAddVar OILSTemplatePath "/openils/var/templates_SystemABC" + SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm index 220dc9d7e5..92dc3c5662 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm @@ -153,6 +153,12 @@ sub load_context { $ctx->{skin} = $cgi->cookie(OILS_HTTP_COOKIE_SKIN) || 'default'; $ctx->{theme} = $cgi->cookie(OILS_HTTP_COOKIE_THEME) || 'default'; + # Any paths configured in Apache will be placed in front of + # any paths configured in the global oils_web.xml config. + my @template_paths = $r->dir_config->get('OILSTemplatePath'); + unshift(@{$ctx->{template_paths}}, $_) for reverse @template_paths; + $r->log->debug("template paths => @{$ctx->{template_paths}}"); + $ctx->{locale} = $cgi->cookie(OILS_HTTP_COOKIE_LOCALE) || parse_accept_lang($r->headers_in->get('Accept-Language')) || 'en-US'; -- 2.43.2