use OpenILS::WWW::FlatFielder;
use OpenILS::WWW::PhoneList ('@sysconfdir@/opensrf_core.xml');
-# Pass second argument of '1' to disable template caching.
+# Pass second argument of '1' to enable template caching.
use OpenILS::WWW::PrintTemplate ('/openils/conf/opensrf_core.xml', 0);
# - Uncomment the following 2 lines to make use of the IP redirection code
qw(OK FORBIDDEN NOT_FOUND HTTP_INTERNAL_SERVER_ERROR HTTP_BAD_REQUEST);
use Apache2::RequestRec;
use CGI;
-use HTML::Restrict;
+# Requires a new CPAN module.
+# Leaving commented for now to ease testing, pending agreement on the
+# approach for html srubbing.
+# $ sudo cpan HTML::Restrict
+#use HTML::Restrict;
use OpenSRF::Utils::JSON;
use OpenSRF::System;
use OpenSRF::Utils::SettingsClient;
my $U = 'OpenILS::Application::AppUtils';
my $bs_config;
-my $disable_cache;
+my $enable_cache; # Enable process-level template caching
sub import {
$bs_config = shift;
- $disable_cache = shift;
+ $enable_cache = shift;
}
my $init_complete = 0;
$init_complete = 1;
OpenSRF::System->bootstrap_client(config_file => $bs_config);
- OpenILS::Utils::CStoreEditor->init; # just in case
+ OpenILS::Utils::CStoreEditor->init;
return Apache2::Const::OK;
}
u => [qw(class style)],
ul => [qw(class style)],
};
-my $hr = HTML::Restrict->new(rules => $rules);
+
+my $hr;
+#my $hr = HTML::Restrict->new(rules => $rules);
sub handler {
my $r = shift;
if ($stat) { # OK
my $ctype = $template->content_type;
- if ($ctype eq 'text/html') {
- # Scrub the HTML
- $output = $hr->process($output);
+ if ($hr && $ctype eq 'text/html') {
+ $output = $hr->process($output); # Scrub the HTML
}
# TODO
# client current expects content type to only contain type.
}
return $template_cache{$owner}{$name}{$locale}
- if $template_cache{$owner} &&
+ if $enable_cache &&
+ $template_cache{$owner} &&
$template_cache{$owner}{$name} &&
$template_cache{$owner}{$name}{$locale};
while ($owner) {
- my ($org) = $U->fetch_org_unit($owner); # internally cached
+ my ($org) = $U->fetch_org_unit($owner); # cached in AppUtils
my $template = $e->search_config_print_template({
name => $name,
})->[0];
if ($template) {
- if (!$disable_cache) {
+
+ if ($enable_cache) {
$template_cache{$owner} = {} unless $template_cache{$owner};
$template_cache{$owner}{$name} = {}
unless $template_cache{$owner}{$name};