From 0b94c34343aee2dfb449166f4884f16a71e3c7fe Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 10 Aug 2002 01:36:47 +0000 Subject: Produce echolot.html, an index file for echolot results --- Echolot/Config.pm | 3 ++- Echolot/Stats.pm | 34 ++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Config.pm b/Echolot/Config.pm index 9d818f9..ee15d58 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader -# $Id: Config.pm,v 1.34 2002/08/05 17:46:17 weasel Exp $ +# $Id: Config.pm,v 1.35 2002/08/10 01:36:47 weasel Exp $ # =pod @@ -137,6 +137,7 @@ sub init($) { # templates templates => { + 'indexfile' => 'templates/echolot.html', 'thesaurusindexfile' => 'templates/thesaurusindex.html', 'mlist' => 'templates/mlist.html', 'mlist2' => 'templates/mlist2.html', diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm index 0311bf9..5d64f35 100644 --- a/Echolot/Stats.pm +++ b/Echolot/Stats.pm @@ -1,7 +1,7 @@ package Echolot::Stats; # (c) 2002 Peter Palfrader -# $Id: Stats.pm,v 1.26 2002/08/10 00:56:24 weasel Exp $ +# $Id: Stats.pm,v 1.27 2002/08/10 01:36:47 weasel Exp $ # =pod @@ -273,28 +273,35 @@ sub read_file($;$) { sub write_file($$;$) { my ($filebasename, $html_template, $output) = @_; - my $filename = $filebasename.'.txt'; - open(F, '>'.$filename) or - cluck("Cannot open $filename: $!\n"), - return 0; - print F $output; - close (F); + my $filename; + if (defined $output) { + $filename = $filebasename.'.txt'; + open(F, '>'.$filename) or + cluck("Cannot open $filename: $!\n"), + return 0; + print F $output; + close (F); + }; return 1 unless defined $html_template; - $output =~ s/&/&/g; - $output =~ s/"/"/g; - $output =~ s//>/g; my $template = HTML::Template->new( filename => $html_template, strict => 0, + die_on_bad_params => 0, global_vars => 1 ); - $template->param ( list => $output ); + if (defined $output) { + $output =~ s/&/&/g; + $output =~ s/"/"/g; + $output =~ s//>/g; + $template->param ( list => $output ); + }; $template->param ( CURRENT_TIMESTAMP => scalar gmtime() ); $template->param ( SITE_NAME => Echolot::Config::get()->{'sitename'} ); $template->param ( seperate_rlist => Echolot::Config::get()->{'seperate_rlists'} ); $template->param ( combined_list => Echolot::Config::get()->{'combined_list'} ); + $template->param ( thesaurus => Echolot::Config::get()->{'thesaurus'} ); $template->param ( version => Echolot::Globals::get()->{'version'} ); $filename = $filebasename.'.html'; @@ -557,6 +564,9 @@ sub build_lists() { build_clist( $clist, $broken1, $broken2, $sameop, Echolot::Config::get()->{'private_resultdir'}.'/'.'clist', Echolot::Config::get()->{'templates'}->{'clist'}); build_clist( $pubclist, $broken1, $broken2, $sameop, Echolot::Config::get()->{'resultdir'}.'/'.'clist', Echolot::Config::get()->{'templates'}->{'clist'}); }; + + + write_file(Echolot::Config::get()->{'resultdir'}.'/'.'echolot', Echolot::Config::get()->{'templates'}->{'indexfile'}); }; -- cgit v1.2.3