summaryrefslogtreecommitdiff
path: root/fml/lib/Mail/ThreadTrack/Print
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-11-11 00:57:35 +0000
committerfukachan <fukachan>2001-11-11 00:57:35 +0000
commit6349632193b322c6590ab7f3740fa2115471eb73 (patch)
treebe435fd503d5b9aa1f912574ded3b6f41357df22 /fml/lib/Mail/ThreadTrack/Print
parent4fad7f6f004c0f1b65c58a979c6fcd2f1d0a50c6 (diff)
downloadfml8-6349632193b322c6590ab7f3740fa2115471eb73.tar.gz
fml8-6349632193b322c6590ab7f3740fa2115471eb73.tar.bz2
fml8-6349632193b322c6590ab7f3740fa2115471eb73.zip
dynamic binding accoding to mode: text or html
Diffstat (limited to 'fml/lib/Mail/ThreadTrack/Print')
-rw-r--r--fml/lib/Mail/ThreadTrack/Print/HTML.pm92
-rw-r--r--fml/lib/Mail/ThreadTrack/Print/Text.pm147
2 files changed, 227 insertions, 12 deletions
diff --git a/fml/lib/Mail/ThreadTrack/Print/HTML.pm b/fml/lib/Mail/ThreadTrack/Print/HTML.pm
index 2112abcf..69e1e960 100644
--- a/fml/lib/Mail/ThreadTrack/Print/HTML.pm
+++ b/fml/lib/Mail/ThreadTrack/Print/HTML.pm
@@ -1,11 +1,26 @@
+#-*- 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: Sort.pm,v 1.4 2001/11/10 08:50:41 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_for_thread
{
my ($self, $thread_id) = @_;
@@ -46,9 +61,44 @@ sub show_articles_for_thread
}
-# This shows summary on C<$thread_id> in HTML language.
-# It is used in C<FML::CGI::ThreadSystem>.
-sub _show_thread_by_html_table
+# Descriptions: show guide
+# Arguments: $self $args
+# Side Effects: none
+# Return Value: none
+sub __start_thread_summary
+{
+ my ($self, $args) = @_;
+ my $fd = $self->{ _fd } || \*STDOUT;
+
+ print $fd "<TABLE BORDER=4>\n";
+ print $fd "<TD>id\n";
+ print $fd "<TD>summary\n";
+ print $fd "<TD>age\n";
+ print $fd "<TD>status\n";
+ print $fd "<TD>change\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 "</TABLE>\n";
+}
+
+
+# Descriptions: This shows summary on C<$thread_id> in HTML language.
+# It is used in C<FML::CGI::ThreadSystem>.
+# Arguments: $self $args
+# Side Effects: none
+# Return Value: none
+sub __print_thread_summary
{
my ($self, $optargs) = @_;
my $config = $self->{ _config };
@@ -57,12 +107,10 @@ sub _show_thread_by_html_table
my $action = 'fmlthread.cgi';
my $target = $config->{ thread_cgi_target_window } || 'ThreadCGIWindow';
- # printf($fd $format,
- # $date, $age, $status, $tid, $rh->{ _articles }->{ $tid });
my $date = $optargs->{ date };
my $age = $optargs->{ age };
my $status = $optargs->{ status };
- my $tid = $optargs->{ tid };
+ my $tid = $optargs->{ thread_id };
my $articles = $optargs->{ articles };
my $aid = (split(/\s+/, $articles))[0];
@@ -75,7 +123,11 @@ sub _show_thread_by_html_table
$action .= "&thread_id=$xtid&article_id=$aid";
print "<TR>\n";
- print "<TD>$tid\n";
+ print "<TD>";
+ print "<A HREF=\"$action&action=show\"\n\tTARGET=\"$target.show\">";
+ print $tid;
+ print "\n</A>\n";
+
print "<TD>";
# summary
@@ -91,14 +143,30 @@ sub _show_thread_by_html_table
print "<TD>$age\n";
print "<TD>$status\n";
print "<TD>";
- print "<A HREF=\"$action&action=close\" TARGET=\"$target.close\">";
- print "[close]</A>\n";
- print "<BR>\n";
- print "<A HREF=\"$action&action=show\" TARGET=\"$target.show\">";
- print "[see articles]</A>\n";
+ my $name = "change-status=$tid";
+ my $values = ['open', 'analyzed', 'closed'];
+ my $default = $status;
+ print checkbox_group(-name=>$name,
+ -values=>$values,
+ -defaults=>$default,
+ -linebreak=>'true',
+ );
+
+ # print "<A HREF=\"$action&action=close\" TARGET=\"$target.close\">";
+ # print "[close]</A>\n";
print "\n\n";
}
+# Descriptions: dummy
+# Arguments: none
+# Side Effects: none
+# Return Value: none
+sub __print_message_summary
+{
+ ;
+}
+
+
1;
diff --git a/fml/lib/Mail/ThreadTrack/Print/Text.pm b/fml/lib/Mail/ThreadTrack/Print/Text.pm
index 0afc6045..2bd5895d 100644
--- a/fml/lib/Mail/ThreadTrack/Print/Text.pm
+++ b/fml/lib/Mail/ThreadTrack/Print/Text.pm
@@ -1 +1,148 @@
+#-*- 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: Sort.pm,v 1.4 2001/11/10 08:50:41 fukachan Exp $
+#
+
+package Mail::ThreadTrack::Print::Text;
+use strict;
+use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
+use Carp;
+
+my $is_show_cost_indicate = 0;
+
+my $format = "%-20s %10s %5s %8s %s\n";
+
+
+# Descriptions: show guide line
+# Arguments: $self $args
+# Side Effects: none
+# Return Value: none
+sub __start_thread_summary
+{
+ my ($self, $args) = @_;
+ my $fd = $self->{ _fd } || \*STDOUT;
+
+ printf($fd $format, 'id', 'date', 'age', 'status', 'articles');
+ print $fd "-" x60;
+ print $fd "\n";
+}
+
+
+# Descriptions: print formated brief summary
+# Arguments: $self $args
+# Side Effects: none
+# Return Value: none
+sub __print_thread_summary
+{
+ my ($self, $optargs) = @_;
+ my $fd = $self->{ _fd } || \*STDOUT;
+ my $date = $optargs->{ date };
+ my $age = $optargs->{ age };
+ my $status = $optargs->{ status };
+ my $thread_id = $optargs->{ thread_id };
+ my $articles = $optargs->{ articles };
+ my $aid = (split(/\s+/, $articles))[0];
+
+ printf($fd $format, $thread_id, $date, $age, $status,
+ _format_list(25, $articles));
+}
+
+
+# Descriptions:
+# Arguments: $self $args
+# Side Effects:
+# Return Value: none
+sub __end_thread_summary
+{
+ my ($self, $args) = @_;
+ my $fd = $self->{ _fd } || \*STDOUT;
+}
+
+
+# Descriptions: create a string of "a b c .." style up to $num bytes
+# Arguments: $num $str
+# Side Effects: none
+# Return Value: string
+sub _format_list
+{
+ my ($max, $str) = @_;
+ my (@idlist) = split(/\s+/, $str);
+ my $r = '';
+
+ for (@idlist) {
+ $r .= $_ . " ";
+ if (length($r) > $max) {
+ $r .= "...";
+ last;
+ }
+ }
+
+ return $r;
+}
+
+
+# Descriptions: print message summary
+# Arguments: $self $args
+# Side Effects: none
+# Return Value: none
+sub __print_message_summary
+{
+ my ($self, $thread_id) = @_;
+ my $config = $self->{ _config };
+ my $age = $self->{ _age } || {};
+ my $cost = $self->{ _cost } || {};
+ my $fd = $self->{ _fd } || \*STDOUT;
+ my $rh = $self->{ _hash_table };
+
+ if (defined $config->{ spool_dir }) {
+ my ($aid, @aid, $file);
+ my $spool_dir = $config->{ spool_dir };
+
+ THREAD_ID_LIST:
+ for my $thread_id (@$thread_id) {
+ if ($is_show_cost_indicate) {
+ my $how_bad = _cost_to_indicator( $cost->{ $thread_id } );
+ printf $fd "\n%6s %-10s %s\n", $how_bad, $thread_id;
+ }
+ else {
+ printf $fd "\n>Thread-Id: %-10s %s\n", $thread_id;
+ }
+
+ # show only the first article of this thread $thread_id
+ if (defined $rh->{ _articles }->{ $thread_id }) {
+ (@aid) = split(/\s+/, $rh->{ _articles }->{ $thread_id });
+ $aid = $aid[0];
+ $file = File::Spec->catfile($spool_dir, $aid);
+ if (-f $file) {
+ $self->print( $self->message_summary($file) );
+ }
+ }
+ }
+ }
+}
+
+
+# Descriptions: ( broken now ;-)
+# Arguments: $string
+# Side Effects: none
+# Return Value: string
+sub _cost_to_indicator
+{
+ my ($cost) = @_;
+ my $how_bad = 0;
+
+ if ($cost =~ /(\w+)\-(\d+)/) {
+ $how_bad += $2;
+ $how_bad += 2 if $1 =~ /open/;
+ $how_bad = "!" x ($how_bad > 6 ? 6 : $how_bad);
+ }
+
+ $how_bad;
+}
+
+
1;