X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=maps%2Fbin%2Fdisplay.cgi;h=0a0cfcd9ca38fbecc7ffff3232a7c942373d0fbd;hb=a9acda90df2ba4a4777fe263005a5d45ffd869e0;hp=533ecae8eb94911ae4a6606fc2a8d8b59a732733;hpb=c844e4026669bb365f68f79c4b6195ff675c0d80;p=clearscm.git diff --git a/maps/bin/display.cgi b/maps/bin/display.cgi index 533ecae..0a0cfcd 100755 --- a/maps/bin/display.cgi +++ b/maps/bin/display.cgi @@ -16,9 +16,10 @@ use strict; use warnings; use FindBin; -$0 = $FindBin::Script; +local $0 = $FindBin::Script; use lib "$FindBin::Bin/../lib"; +use lib "$FindBin::Bin/../../lib"; use MAPS; use MAPSWeb; @@ -30,15 +31,15 @@ use MIME::Parser; use MIME::Base64; use MIME::Words qw(:all); -my $userid = cookie('MAPSUser'); -my $sender = param('sender'); +my $userid = cookie('MAPSUser'); +my $sender = param('sender'); # CGI will replace '+' with ' ', which many mailers are starting to do, # so add it back $sender =~ s/ /\+/; -my $msg_date = param('msg_date'); -my $table_name = 'message'; +my $msg_date = param('msg_date'); +my $table_name = 'message'; sub ParseEmail(@) { my (@header) = @_; @@ -73,9 +74,13 @@ sub Body($) { my ($date) = @_; # Find unique message using $date - my $handle = FindEmail $sender, $date; + my ($err, $msg) = FindEmail( + userid => $userid, + sender => $sender, + timestamp => $date, + ); - my ($userid, $sender, $subject, $timestamp, $message) = GetEmail $handle; + my $rec = GetEmail; my $parser = MIME::Parser->new(); @@ -84,7 +89,7 @@ sub Body($) { $parser->output_to_core(1); $parser->tmp_to_core(1); - my $entity = $parser->parse_data ($message); + my $entity = $parser->parse_data($rec->{data}); my %header = ParseEmail @{($entity->header)[0]}; @@ -96,7 +101,8 @@ sub Body($) { -cellpadding => 0, -width => "100%"}); print start_table ({-align => "center", - -bgcolor => "#d4d0c8", + -bgcolor => 'steelblue', + #-bgcolor => "#d4d0c8", -border => 0, -cellspacing => 2, -cellpadding => 2, @@ -106,7 +112,8 @@ sub Body($) { -border => 0, -cellspacing => 0, -cellpadding => 2, - -bgcolor => "#ece9d8", + -bgcolor => 'black', + #-bgcolor => "#ece9d8", -width => "100%"}) . "\n"; for (keys (%header)) { @@ -115,10 +122,12 @@ sub Body($) { my $str = decode_mimewords($header{$_}); print Tr ([ - th ({-align => "right", - -bgcolor => "#ece9d8", - -width => "8%"}, "$_:") . "\n" . - td ({-bgcolor => "white"}, $str) + th ({-align => 'right', + -bgcolor => 'steelblue', + -style => 'color: white', + #-bgcolor => "#ece9d8", + -width => "8%"}, ucfirst "$_:") . "\n" . + td ({-bgcolor => 'white'}, $str) ]); } # for @@ -126,8 +135,8 @@ sub Body($) { print ""; print end_table; - print start_table ({-align => "center", - -bgcolor => "black", + print start_table ({-align => 'center', + -bgcolor => 'steelblue', -border => 0, -cellspacing => 0, -cellpadding => 2, @@ -137,7 +146,7 @@ sub Body($) { -border => 0, -cellspacing => 0, -cellpadding => 2, - -bgcolor => "white", + -bgcolor => 'white', -width => "100%"}) . "\n"; print "
'; - $entity->print_body; + print $entity->print_body; print ''; } # if } else { @@ -163,9 +172,9 @@ sub Body($) { # There should be an easier way to get this but I couldn't find one. my $encoding = ${$subpart->{mail_inet_head}{mail_hdr_hash}{'Content-Transfer-Encoding'}[0]}; if ($encoding =~ /base64/) { - $subpart->bodyhandle->print(); + $subpart->bodyhandle->print; } else { - $subpart->print_body; + print $subpart->print_body; } # if last; } elsif ($subpart->mime_type eq 'multipart/related') { @@ -188,7 +197,7 @@ sub Body($) { $part->bodyhandle->print(); } else { print '
'; - $part->print_body; + print $part->print_body; print ''; } # if } # if @@ -212,6 +221,8 @@ $userid = Heading( $table_name, ); +$userid //= $ENV{USER}; + SetContext($userid); NavigationBar($userid);