X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2Fdetail.cgi;h=06e8bd9953d6eb0a01718caf1189822d8899d49c;hb=fabecda8b02db16f5321ae8b958b3bc3ac30a49c;hp=ef6788214f5fc5162edc0b52ca1d63e7f56c74b2;hpb=cbfba1c8c330651d563f03ba6e2b04ce48c79896;p=clearscm.git diff --git a/maps/bin/detail.cgi b/maps/bin/detail.cgi index ef67882..06e8bd9 100755 --- a/maps/bin/detail.cgi +++ b/maps/bin/detail.cgi @@ -32,10 +32,11 @@ use MAPSLog; use MAPSWeb; use DateUtils; -my $type = param 'type'; -my $next = param 'next'; -my $lines = param 'lines'; -my $date = param 'date'; +my $type = param 'type'; +my $list = substr $type, 0, -4 if $type =~ /list$/; +my $next = param 'next'; +my $lines = param 'lines'; +my $date = param 'date'; $date ||= ''; @@ -74,6 +75,17 @@ my %types = ( ] ); +sub formatRule($) { + my ($rec) = @_; + + return '' unless $rec->{pattern} or $rec->{domain}; + + $rec->{pattern} //= ''; + $rec->{domain} //= ''; + + return "$rec->{pattern}\@$rec->{domain}"; +} # formatRule + sub MakeButtons($) { my ($type) = @_; @@ -150,6 +162,8 @@ sub Body($) { my $current = $next + 1; + my ($onlist, $rec); + print div {-align => 'center'}, b ( '(' . $current . '-' . $last . ' of ' . $total . ')'); print start_form { @@ -171,12 +185,13 @@ sub Body($) { print Tr [ - th {-class => 'tablebordertopleft'}, '', - th {-class => 'tableborder'}, 'Sender', - th {-class => 'tableborder'}, 'List', - th {-class => 'tableborder'}, 'Hit Count', - th {-class => 'tableborder'}, 'Rule', - th {-class => 'tablebordertopright'}, 'Comment', + th {-class => 'tablebordertopleft'}, '', + th {-class => 'tableborder'}, 'Sender', + th {-class => 'tableborder'}, 'List', + th {-class => 'tableborder'}, 'Hit Count', + th {-class => 'tableborder'}, 'Rule', + th {-class => 'tableborder'}, 'Retention', + th {-class => 'tablebordertopright'}, 'Comment/Date', ]; my @senders = ReturnSenders( @@ -227,45 +242,16 @@ sub Body($) { $heading = $msgs->[0]{subject} if $msgs->[0]{subject}; } # if - my ($onlist, $seq); - - my $rule = 'none'; - my $hit_count = 0; - - ($onlist, $rule, $seq, $hit_count) = OnWhitelist($sender, $userid, 0); + ($onlist, $rec) = OnWhitelist($sender, $userid, 0); unless ($onlist) { - ($onlist, $rule, $seq, $hit_count) = OnBlacklist($sender, 0); + ($onlist, $rec) = OnBlacklist($sender, 0); unless ($onlist) { - ($onlist, $rule, $seq, $hit_count) = OnNulllist($sender, 0); + ($onlist, $rec) = OnNulllist($sender, 0); } # unless } # unless - $hit_count //= ''; - - my $list = ''; - my $sequence = 0; - my $comment = ''; - - # Parse rule - if ($rule) { - if ($rule =~ /\((\w+):(\d+)\)\s+"(\S*)"/) { - $list = $1; - $sequence = $2; - $rule = $3; - $comment = ''; - } elsif ($rule =~ /\((\w+):(\d+)\)\s+"(\S*) - (.*)"/) { - $list = $1; - $sequence = $2; - $rule = $3; - $comment = $4; - } # if - - $rule =~ s/\\@/\@/; - } # if - - $sequence //= 0; $next++; # Start Sender line @@ -298,24 +284,40 @@ sub Body($) { -href => "mailto:$sender$heading", }, " $sender"; - my $listlink = ($list and $sequence) ? "$list:$sequence" : ' '; + if ($rec) { + my $listlink = ($rec->{type} and $rec->{sequence}) ? "$rec->{type}:$rec->{sequence}" : ''; + + $rec->{comment} //= ''; + + print td { + -class => $dataclass, + -align => 'right', + }, a { + href => "/maps/php/list.php?type=$rec->{type}&next=" . ($rec->{sequence} - 1), + }, $listlink, + td { + -class => $dataclass, + -align => 'right', + }, "$rec->{hit_count} ", + td { + -class => $dataclass, + }, formatRule($rec), + td { + -class => $dataclass, + -align => 'right', + }, "$rec->{retention} ", + td { + -class => $rightclass, + }, $rec->{comment}; + } else { + # $rec will be undefined if this message will be returned + print td {-class => $dataclass}, + td {-class => $dataclass}, + td {-class => $dataclass}, + td {-class => $dataclass}, + td {-class => $rightclass}; + } # if - print td { - -class => $dataclass, - -align => 'right', - }, a { - href => "/maps/php/list.php?type=$list&next=" . ($sequence - 1), - }, $listlink, - td { - -class => $dataclass, - -align => 'right', - }, "$hit_count ", - td { - -class => $dataclass, - }, $rule, - td { - -class => $rightclass, - }, $comment; print end_Tr; my $msgnbr = 0; @@ -347,7 +349,7 @@ sub Body($) { Tr [ td { -class => $subjectclass, - -colspan => 4, + -colspan => 5, }, a { -href => "display.cgi?sender=$sender;msg_date=$rec->{timestamp}", }, '    ' . $rec->{subject},