1 package OpenILS::WWW::FastJS;
2 use strict; use warnings;
6 use Apache::Const -compile => qw(OK REDIRECT :log);
7 use APR::Const -compile => qw(:error SUCCESS);
8 use Apache::RequestRec ();
9 use Apache::RequestIO ();
10 use Apache::RequestUtil;
13 use Template qw(:template);
15 use OpenSRF::EX qw(:try);
18 my $main_ttk = "opac/logic/fastjs.ttk";
19 my $init_ttk = "opac/logic/page_init.ttk";
21 my $includes = ['/pines/cvs/ILS/Open-ILS/src/templates'];
23 my $plugin_base = 'OpenILS::Template::Plugin';
28 my $cgi = CGI->new( $apache );
29 print "Content-type: text/javascript; charset=utf-8\n\n";
31 my @files = $cgi->param("file");
32 warn "INcluding js files @files\n";
36 template => $main_ttk,
37 pre_process => $init_ttk,
44 sub _process_template {
47 my $ttk = $params{template} || return undef;
48 my $apache = $params{apache} || undef;
49 my $pre_process = $params{pre_process} || undef;
50 my $files = $params{files} || [];
54 $template = Template->new( {
58 PLUGIN_BASE => $plugin_base,
59 PRE_PROCESS => $pre_process,
60 INCLUDE_PATH => $includes,
68 if( ! $template->process( $ttk,
69 { files => $files, doc_root => $ENV{"DOCUMENT_ROOT"} } ) ) {
71 warn "Error Occured: " . $template->error();
72 my $err = $template->error();
73 $err =~ s/\n/\<br\/\>/g;
74 warn "Error processing template $ttk\n";
75 my $string = "<br><b>Unable to process template:<br/><br/> " . $err . "!!!</b>";
76 #$template->process( $error_ttk , { error => $string } );
81 warn "Error processing template $ttk: $e - $@ \n";
82 print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";