On 2011-09-11, the code was merged to the master branch of the Evergreen git repository at http://git.evergreen-ils.org.
The TPAC needs to be installed as part of an overall system upgrade to master; it will be an integrated part of the Evergreen 2.2 release.
Pay close attention to the following files on upgrade:
Open-ILS/examples/apache/eg_vhost.conf
Open-ILS/src/templates/*
, which now gets installed into /openils/var/templates/
Open-ILS/web/*
, which includes stylesheets under Open-ILS/web/css
and images under Open-ILS/web/images
that are required by the TPAC.Navigate to http://SERVER/eg/opac/home and you should see the default server-side TPAC skin
Skinning the TT OPAC is much easier than skinning previous incarnations of the Evergreen OPAC.
/openils/var/my_own_templates
.# Templates will be loaded from the following paths in reverse order. PerlAddVar OILSWebTemplatePath "/openils/var/templates" PerlAddVar OILSWebTemplatePath "/openils/var/my_own_templates"
<VirtualHost *:80> ServerName myhostname DocumentRoot /openils/var/web/ DirectoryIndex index.xml index.html index.xhtml Include eg_vhost.conf <Location /eg> PerlAddVar OILSWebTemplatePath "/openils/var/my_own_templates" </Location> </VirtualHost>
.tt2
files that you would edit into a directory structure that mirrors that of the stock template path. That is, if you want to have your own version of /openils/var/templates/default/opac/parts/topnav.tt2
, put it at /openils/var/my_own_templates/default/opac/parts/topnav.tt2
./openils/var/templates
into my_own_templates
– that is not necessary..po
file for your locale. Requires the Locale::Maketext::Extract::Plugin::TT2
Perl module:sudo -u opensrf xgettext.pl --plugin=tt2 --directory=Open-ILS/src/templates/opac/ --output-dir=/openils/var/templates/locale --output=tpac.fr_CA.po
eg_vhost.conf
file in the <Location /eg>
section:PerlAddVar OILSWebLocale "en_ca" PerlAddVar OILSWebLocale "/openils/var/templates/locale/tpac.en_CA.po" PerlAddVar OILSWebLocale "fr_ca" PerlAddVar OILSWebLocale "/openils/var/templates/locale/tpac.fr_CA.po"
... #: Open-ILS/src/templates/opac/parts/topnav.tt2:34 msgid "My Account" msgstr "Mon compte" ...
It's possible to override specific behavior of the default OPAC mod_perl handler by sub-classing the default and selecting methods to override.
package EGCatLoaderLocal; use base 'OpenILS::WWW::EGCatLoader'; # override a single method sub redirect_auth { my $self = shift; return $self->generic_redirect("http://my-fancy-auth-service.example.org"); }
<Location /eg/opac> #PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGCatLoader" PerlSetVar OILSWebContextLoader "EGCatLoaderLocal" </Location>
l()
) to mark text that needs to be translated:<h1>[% l('Search results') %]</h1>
The localization macro accepts parameters so that you can create complex strings that represent a complete sentence or translatable phrase. In the following example, variable [_1]
is replaced by the value of the first argument, user_name, and [_2]
is replaced by the value of the second argument, library_name:
[% l('Hello [_1]! You are browsing the [_2] catalog', user_name, library_name) %]
html
filter to escape text generated from outside of the template in HTML, and the uri
filter to escape URIs. For example, in the following example the text in the first table cell is not escaped because it is static text from the template itself, while the attrs.author text comes from the database and therefore should be escaped:<td>[% l("Author:") %]'</td><td>[% attrs.author | html %]</td>
Note that the uri
filter is not necessary in cases where the URI has passed through the CGI plugin, such as in the mkurl()
macro.