#-*- perl -*- # # Copyright (C) 2001 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # # $FML: HTML.pm,v 1.6 2001/11/11 13:37:42 fukachan Exp $ # package Mail::ThreadTrack::Print::HTML; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; use CGI qw/:standard/; use Mail::ThreadTrack::Print::Utils qw(decode_mime_string STR2EUC); # Descriptions: show articles as HTML in this thread # Arguments: $self $str # Side Effects: none # Return Value: none sub show_articles_in_thread { my ($self, $thread_id) = @_; my $mode = $self->get_mode || 'text'; my $config = $self->{ _config }; my $spool_dir = $config->{ spool_dir }; my $articles = $self->{ _hash_table }->{ _articles }->{ $thread_id }; print ""; print "show contents related with thread_id=$thread_id\n"; print ""; print "
\n";
if (defined($articles) && defined($spool_dir) && -d $spool_dir) {
use FileHandle;
my $s = '';
for (split(/\s+/, $articles)) {
my $file = File::Spec->catfile($spool_dir, $_);
my $fh = new FileHandle $file;
while (defined($_ = $fh->getline())) {
next if 1 .. /^$/;
$s = STR2EUC($_);
$s =~ s/&/&/g;
$s =~ s/</g;
$s =~ s/>/>/g;
$s =~ s/\"/"/g;
print $s;
}
$fh->close;
}
}
print "";
}
# Descriptions: show guide
# Arguments: $self $args
# Side Effects: none
# Return Value: none
sub __start_thread_summary
{
my ($self, $args) = @_;
my $config = $self->{ _config };
my $ml_name = $config->{ ml_name };
my $fd = $self->{ _fd } || \*STDOUT;
my $action = $config->{ myname };
my $target = '_top';
# statistics
if (defined $self->{ _ticket_id_stat }) {
my $stat = $self->{ _ticket_id_stat };
for my $key ('open', 'analyzed', 'closed') {
print $fd "$key: ";
print $fd defined $stat->{ $key } ? $stat->{ $key } : 0;
print $fd ", ";
}
print $fd br, "\n";
}
print $fd start_form(-action=>$action, -target=>$target);
print $fd submit(-name => 'submit');
print $fd reset(-name => 'reset');
print $fd "\n";
print $fd hidden(-name => 'ml_name',
-default => [ $ml_name ],
), "\n";
param('action', 'change_status'); # we need to override
print $fd hidden(-name => 'action',
-default => [ 'change_status ' ],
), "\n";
print $fd "| id\n"; print $fd " | change\n"; print $fd " | summary\n"; print $fd " | age\n"; print $fd " | status\n"; } # Descriptions: finalize thread list # close TABLE tag # Arguments: $self $args # Side Effects: none # Return Value: none sub __end_thread_summary { my ($self, $args) = @_; my $fd = $self->{ _fd } || \*STDOUT; print $fd " |