From c47f777df3b722ca23fc67dd472a1439daa74b9c Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 6 Jul 2002 20:16:38 +0000 Subject: Build html files for [rm]list[12] Have templates for html files --- Echolot/Thesaurus.pm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'Echolot/Thesaurus.pm') diff --git a/Echolot/Thesaurus.pm b/Echolot/Thesaurus.pm index f707e04..a150367 100644 --- a/Echolot/Thesaurus.pm +++ b/Echolot/Thesaurus.pm @@ -1,7 +1,7 @@ package Echolot::Thesaurus; # (c) 2002 Peter Palfrader -# $Id: Thesaurus.pm,v 1.2 2002/07/06 14:08:05 weasel Exp $ +# $Id: Thesaurus.pm,v 1.3 2002/07/06 20:15:12 weasel Exp $ # =pod @@ -20,6 +20,7 @@ use strict; use warnings; use Carp qw{cluck}; use English; +use HTML::Template; sub build_thesaurus() { @@ -51,23 +52,37 @@ sub build_thesaurus() { my $time = sprintf("%02d:%02d", $hour, $min); - $data->{$remailer->{'address'}}->{$what} = { - 'href' => $filename, - 'date' => $date, - 'time' => $time, - }; + $data->{$remailer->{'address'}}->{$what.'_href'} = $filename; + $data->{$remailer->{'address'}}->{$what.'_date'} = $date; + $data->{$remailer->{'address'}}->{$what.'_time'} = $time; }; for my $addr (keys (%$data)) { my $nick = Echolot::Globals::get()->{'storage'}->get_nick($addr); $data->{$addr}->{'nick'} = defined $nick ? $nick : 'N/A'; + $data->{$addr}->{'address'} = $addr; }; + my @data = map {$data->{$_}} (sort { $data->{$a}->{'nick'} cmp $data->{$b}->{'nick'} } keys (%$data)); + + my $template = HTML::Template->new( + filename => Echolot::Config::get()->{'templates'}->{'thesaurusindexfile'}, + global_vars => 1 ); + $template->param ( remailers => \@data ); + $template->param ( CURRENT_TIMESTAMP => scalar gmtime() ); + $template->param ( SITE_NAME => Echolot::Config::get()->{'sitename'} ); + + my $file = Echolot::Config::get()->{'thesaurusindexfile'}; open (F, ">$file") or cluck ("Cannot open '$file': $!"), return 0; + print F $template->output(); + close F; + + return; + print F 'Thesaurus

Thesaurus

'."\n"; print F "\n"; -- cgit v1.2.3
nickAddressconfhelpkeystatsadminkey