1 package OpenILS::WWW::Web;
6 use Apache2::Const -compile => qw(OK REDIRECT :log);
7 use APR::Const -compile => qw(:error SUCCESS);
8 use Apache2::RequestRec ();
9 use Apache2::RequestIO ();
10 use Apache2::RequestUtil;
15 use OpenSRF::EX qw(:try);
18 my $main_ttk = "opac/logic/page_router.ttk";
19 my $error_ttk = "opac/pages/error.ttk";
20 my $init_ttk = "opac/logic/page_init.ttk";
21 my $bootstrap = "@sysconfdir@/opensrf_core.xml";
22 my $child_init_ttk = "opac/logic/child_init.ttk";
24 my $includes = []; # [ '/pines/cvs/ILS/Open-ILS/src/templates' ];
27 my ( $self, $tdir ) = @_;
31 my $plugin_base = 'OpenILS::Template::Plugin';
36 print "Content-type: text/html; charset=utf-8\n\n";
40 template => $main_ttk,
41 pre_process => $init_ttk
44 return Apache2::Const::OK;
47 sub child_init_handler {
48 _process_template( template => $child_init_ttk );
51 sub _process_template {
54 my $ttk = $params{template} || return undef;
55 my $apache = $params{apache} || undef;
56 my $pre_process = $params{pre_process} || undef;
57 my $param_hash = $params{params} || {};
61 $template = Template->new(
66 PLUGIN_BASE => $plugin_base,
67 PRE_PROCESS => $pre_process,
68 INCLUDE_PATH => $includes,
76 if ( !$template->process( $ttk, $param_hash ) ) {
77 warn "Error Occured: " . $template->error();
78 my $err = $template->error();
79 $err =~ s/\n/\<br\/\>/g;
80 warn "Error processing template $ttk\n";
82 "<br><b>Unable to process template:<br/><br/> "
85 $template->process( $error_ttk, { error => $string } );
91 warn "Error processing template $ttk: $e - $@ \n";
92 print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";
98 # This module appears obsolete (probably superceded by EGWeb.pm
99 # The template files it references do not exist in the codebase.
100 # File is not referenced elsewhere in the codebase. Candidate for deletion.