summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/Mail/ThreadTrack/Print.pm86
-rw-r--r--fml/lib/Mail/ThreadTrack/Print/HTML.pm (renamed from fml/lib/Mail/ThreadTrack/Print/CGI.pm)3
-rw-r--r--fml/lib/Mail/ThreadTrack/Print/Sort.pm6
-rw-r--r--fml/lib/Mail/ThreadTrack/Print/Text.pm1
4 files changed, 52 insertions, 44 deletions
diff --git a/fml/lib/Mail/ThreadTrack/Print.pm b/fml/lib/Mail/ThreadTrack/Print.pm
index 22a580a5..e4d2c808 100644
--- a/fml/lib/Mail/ThreadTrack/Print.pm
+++ b/fml/lib/Mail/ThreadTrack/Print.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Print.pm,v 1.10 2001/11/09 10:42:07 fukachan Exp $
+# $FML: Print.pm,v 1.11 2001/11/09 11:30:30 fukachan Exp $
#
package Mail::ThreadTrack::Print;
@@ -65,26 +65,13 @@ It is also larger if $status is C<open>.
=cut
-sub _load_library
-{
- my ($self) = @_;
-
- require Mail::ThreadTrack::Print::Message;
- require Mail::ThreadTrack::Print::Sort;
- unshift(@ISA, qw(
- Mail::ThreadTrack::Print::Message
- Mail::ThreadTrack::Print::Sort
- ));
-}
-
-
sub summary
{
my ($self, @opts) = @_;
$self->_load_library();
$self->db_open();
- $self->do_summary(@opts);
+ $self->_do_summary(@opts);
$self->db_close();
}
@@ -95,13 +82,36 @@ sub review
$self->_load_library();
$self->db_open();
- $self->do_review(@opts);
+ $self->_do_review(@opts);
$self->db_close();
}
-sub do_summary
+sub _load_library
+{
+ my ($self) = @_;
+ my $mode = $self->get_mode || 'text';
+
+ require Mail::ThreadTrack::Print::Message;
+ require Mail::ThreadTrack::Print::Sort;
+ my @list =
+ qw(Mail::ThreadTrack::Print::Message Mail::ThreadTrack::Print::Sort);
+
+ if ($mode eq 'text') {
+ require Mail::ThreadTrack::Print::Text;
+ push(@list, 'Mail::ThreadTrack::Print::Text');
+ }
+ elsif ($mode eq 'html') {
+ require Mail::ThreadTrack::Print::HTML;
+ push(@list, 'Mail::ThreadTrack::Print::HTML');
+ }
+
+ unshift(@ISA, @list);
+}
+
+
+sub _do_summary
{
my ($self) = @_;
my ($tid, $status, $thread_id);
@@ -112,20 +122,14 @@ sub do_summary
$thread_id = $self->list_up_thread_id();
if (@$thread_id) {
- # sort the thread output order it out by cost
- # and print the thread summary in that order.
- $self->sort($thread_id);
-
- if ($mode eq 'html') {
- print $fd "<TABLE BORDER=4>\n";
- $self->_print_thread_summary($thread_id);
- print $fd "</TABLE>\n";
- }
- else {
- $self->_print_thread_summary($thread_id);
-
- # show short summary for each article
- $self->_print_article_summary($thread_id);
+ # sort the thread output order by cost and
+ # print the thread summary in that order.
+ $self->sort_thread_id($thread_id);
+ $self->_print_thread_summary($thread_id);
+
+ # show short summary for each message
+ unless ($mode eq 'html') {
+ $self->_print_message_summary($thread_id);
}
}
}
@@ -142,6 +146,7 @@ sub _print_thread_summary
my $format = "%10s %5s %8s %-20s %s\n";
if ($mode eq 'text') {
+ print $fd "<TABLE BORDER=4>\n";
printf($fd $format, 'date', 'age', 'status', 'thread id', 'articles');
print $fd "-" x60;
print $fd "\n";
@@ -167,8 +172,8 @@ sub _print_thread_summary
if ($mode eq 'html') {
eval q{
- use Mail::ThreadTrack::Print::CGI;
- push(@ISA, qw(Mail::ThreadTrack::Print::CGI));
+ use Mail::ThreadTrack::Print::HTML;
+ push(@ISA, qw(Mail::ThreadTrack::Print::HTML));
};
}
else {
@@ -176,6 +181,10 @@ sub _print_thread_summary
$date, $age, $status, $tid, $rh->{ _articles }->{ $tid });
}
}
+
+ if ($mode eq 'html') {
+ print $fd "</TABLE>\n";
+ }
}
@@ -192,7 +201,7 @@ sub _cost_to_indicator
}
-sub _print_article_summary
+sub _print_message_summary
{
my ($self, $thread_id) = @_;
my $config = $self->{ _config };
@@ -203,12 +212,9 @@ sub _print_article_summary
if (defined $config->{ spool_dir }) {
my ($aid, @aid, $file);
-
- if ($is_show_cost_indicate) {
- print $fd "\n\"!\" mark: stalled? please check and reply it.\n";
- }
-
my $spool_dir = $config->{ spool_dir };
+
+ THREAD_ID_LIST:
for my $tid (@$thread_id) {
if ($is_show_cost_indicate) {
my $how_bad = _cost_to_indicator( $cost->{ $tid } );
@@ -232,7 +238,7 @@ sub _print_article_summary
}
-sub do_review
+sub _do_review
{
my ($self, $str, $min, $max) = @_;
my $config = $self->{ _config };
diff --git a/fml/lib/Mail/ThreadTrack/Print/CGI.pm b/fml/lib/Mail/ThreadTrack/Print/HTML.pm
index b1d19115..243fdf90 100644
--- a/fml/lib/Mail/ThreadTrack/Print/CGI.pm
+++ b/fml/lib/Mail/ThreadTrack/Print/HTML.pm
@@ -1,4 +1,4 @@
-package Mail::ThreadTrack::Print::CGI;
+package Mail::ThreadTrack::Print::HTML;
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
@@ -198,3 +198,4 @@ sub run_cgi
1;
+1;
diff --git a/fml/lib/Mail/ThreadTrack/Print/Sort.pm b/fml/lib/Mail/ThreadTrack/Print/Sort.pm
index 062ead50..0b675206 100644
--- a/fml/lib/Mail/ThreadTrack/Print/Sort.pm
+++ b/fml/lib/Mail/ThreadTrack/Print/Sort.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Utils.pm,v 1.1 2001/11/09 10:37:06 fukachan Exp $
+# $FML: Sort.pm,v 1.1 2001/11/09 11:28:42 fukachan Exp $
#
package Mail::ThreadTrack::Print::Sort;
@@ -13,7 +13,7 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
use Carp;
-=head2 sort($thread_id_list)
+=head2 sort_thread_id($thread_id_list)
=cut
@@ -22,7 +22,7 @@ use Carp;
# Arguments: $self $args
# Side Effects:
# Return Value: none
-sub sort
+sub sort_thread_id
{
my ($self, $thread_id_list) = @_;
diff --git a/fml/lib/Mail/ThreadTrack/Print/Text.pm b/fml/lib/Mail/ThreadTrack/Print/Text.pm
index e69de29b..0afc6045 100644
--- a/fml/lib/Mail/ThreadTrack/Print/Text.pm
+++ b/fml/lib/Mail/ThreadTrack/Print/Text.pm
@@ -0,0 +1 @@
+1;