my $msg = RequiredFields($requiredFields, $rec);
- my $function = (caller(1))[3];
+ my $function = (caller(1))[3];
+ my $calledFrom = (caller(2))[3];
+ my $lineNbr = (caller(2))[2];
- croak "Internal error: $function: $msg" if $msg;
+ croak "Internal error: $function called from $calledFrom:$lineNbr\n\nThe field $msg" if $msg;
return;
} # CheckParms
chomp @output;
- wantarray ? return ($status, @output) : $status;
+ return wantarray ? ($status, @output) : $status;
} # Execute
sub GetChildren(;$) {
print $out "$_\n";
} # for
+ close $out;
+
return;
} # RedirectOutput
my ($status, $rule) = OnBlacklist($rec{sender});
- if ($status != 0) {
+ if ($status) {
print br {-class => 'error'},
"The email address $rec{sender} is already on ${Userid}'s $rec{type} list";
} else {
my ($status, $rule) = OnNulllist($rec{sender});
- if ($status != 0) {
+ if ($status) {
print br {-class => 'error'},
"The email address $rec{sender} is already on ${Userid}'s $rec{type} list";
} else {
my ($status, $rule) = OnNulllist($item->{sender}, $userid);
- if ($status == 0) {
+ if ($status) {
display ' Already on list';
} else {
my ($message, $msg) = Add2Nulllist(%$item);
if ($seq->{sequence}) {
my $count = DeleteList(
- userid => $item->{userid}
+ userid => $item->{userid},
type => $otherlist,
- sequence => $seq->{sequence}
+ sequence => $seq->{sequence},
);
display "Removed $item->{sender} from ${Userid}'s " . ucfirst $otherlist . ' list'
if $count > 0;
ResequenceList(
- userid => $rec{userid},
+ userid => $item->{userid},
type => $otherlist,
);
} # if
my ($status, $rule) = OnWhitelist($rec{sender}, $rec{userid});
- if ($status != 0) {
+ if ($status) {
print br {-class => 'error'},
"The email address $rec{sender} is already on ${Userid}'s $rec{type} list";
} else {
} # unless
} # unless
- my ($list, $sequence, $comment);
+ $hit_count //= '';
+
+ my $list = '';
+ my $sequence = 0;
+ my $comment = '';
# Parse rule
if ($rule) {
$rule =~ s/\\@/\@/;
} # if
+ $sequence //= 0;
$next++;
# Start Sender line
}, $comment;
print end_Tr;
+ my $msgnbr = 0;
+
for my $rec (@$msgs) {
+ $msgnbr++;
+
# We increased $next earlier so do not add 1 here
if (($next % $lines) == (@senders % $lines)) {
$dataclass = 'tablebottomdata';
- $rightclass = 'tablebottomright';
- $subjectclass = 'subjectbottom';
+ $rightclass = 'tablebottomright' if $msgnbr == @$msgs;
+
+ # Only subjectbottom the last message
+ $subjectclass = 'subjectbottom' if $msgnbr == @$msgs;
} # if
if ($date eq substr ($rec->{timestamp}, 0, 10)) {
-class => $subjectclass,
-colspan => 4,
}, a {
- -href => "display.cgi?sender=$sender;msg_date=$rec->{timestamp}",
+ -href => "display.cgi?sender=$sender;msg_date=$rec->{timestamp}",
}, ' ' . $rec->{subject},
- td {-class => $rightclass,
- -width => '150',
- -align => 'right'}, span {-class => 'date'}, $rec->{date} . ' ',
+ td {-class => $rightclass,
+ -width => '150',
+ -align => 'right'}, span {-class => 'date'}, $rec->{date} . ' ',
];
} # for
} # for
$condition .= "type = '$type' and timestamp > '$sod' and timestamp < '$eod'";
} # if
-$total = CountLog(
+# Need to count distinct on sender
+$total = CountLogDistinct(
userid => $userid,
+ column => 'sender',
additional => $condition,
);
# 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->bodayhandle->print;
+ $subpart->bodyhandle->print;
} else {
print $subpart->print_body;
} # if
margin: 2px;
width: 125px;
}
-
-.smallnumber a:link {
- color: yellow;
+.quickstats a:link {
+ color: white;
text-decoration: none;
}
-
-.smallnumber a:visited {
+.quickstats a:visited {
color: white;
- font-weight: bold;
- background-color: yellow;
-}
-.smallnumber a:hover {
- color: yellow;
- background: blue;
}
-
.quickstats a:hover {
- background: blue;
- color: white;
+ color: steelblue;
+ background: white;
+}
+.quickstats a:active {
+ color: Yellow;
}
.toolbar a:hover {
border-left: solid 3px SteelBlue;
border-right: 1px dotted #ccc;
border-bottom: solid 3px SteelBlue;
- font-size: 14px;
+ font-size: 12px;
-moz-border-radius-bottomleft: 7px;
border-bottom-left-radius: 7px;
}
.menu {
font-weight: bold;
}
-
.menu a:link {
color: White;
text-decoration: none;
}
-
.menu a:visited {
color: White;
}
-
.menu a:hover {
color: Yellow;
background: none;
}
-
.menu a:active {
color: Yellow;
}
.intromenu {
font-weight: bold;
}
-
.intromenu a:link {
color: Red;
}
-
.intromenu a:visited {
color: white;
}
-
.intromenu a:hover {
color: White;
background: Red;
}
-
.intromenu a:active {
color: Yellow;
}
CountEmail
CountList
CountLog
+ CountLogDistinct
Decrypt
DeleteEmail
DeleteList
# Add to white list
$params{sequence} = 0;
+
my ($err, $msg) = AddList(%params);
return -$err, $msg if $err;
while (my $rec = $db->getnext) {
last unless $rec->{userid};
- $status = Whitelist($rec->{sender}, $rec->data);
+ $status = Whitelist($rec->{sender}, $rec->{data});
last if $status;
return $db->count('log', $condition);
} # CountLog
+sub CountLogDistinct(%) {
+ my (%params) = @_;
+
+ CheckParms(['userid', 'column'], \%params);
+
+ my ($additional_condition) = delete $params{additional} || '';
+
+ my $condition = "userid='$userid'";
+ $condition .= " and $additional_condition" if $additional_condition;
+
+ return $db->count_distinct('log', $params{column}, $condition);
+} # CountLog
+
sub Decrypt ($$) {
my ($password, $userid) = @_;
for (@Types) {
my $condition = "type=\'$_\' and (timestamp > \'$sod\' and timestamp < \'$eod\')";
- $stats{$_} = MAPS::CountLog(
+ $stats{$_} = MAPS::CountLogDistinct(
userid => $params{userid},
+ column => 'sender',
additional => $condition,
);
} # for
sub displayquickstats($) {
my ($userid) = @_;
- # Quick stats are today only.
+ # Quick stats are today only
my $today = Today2SQLDatetime;
my $time = substr $today, 11;
my $date = substr $today, 0, 10;
my $value = $dates{$date}{$_};
my $percent;
+
if ($_ eq 'mailloop' || $_ eq 'registered') {
$percent = 'n/a';
} else {
0 : $dates{$date}{$_} / $dates{$date}{processed} * 100;
$percent = sprintf '%5.1f%s', $percent, '%';
} # if
- my $stat = $value == 0 ?
- 0 : a {-href => "detail.cgi?type=$_;date=$date"}, $value;
- print
- td {-class => 'smalllabel'}, ucfirst ($_);
- print
- td {-class => 'smallnumber'}, $stat;
- print
- td {-class => 'smallnumber'}, $percent;
+
+ my $report = ucfirst $_;
+
+ if ($value) {
+ $report = a {-href => "detail.cgi?type=$_;date=$date"}, $report;
+ $value = a {-href => "detail.cgi?type=$_;date=$date"}, $value;
+ $percent = a {-href => "detail.cgi?type=$_;date=$date"}, $percent;
+ } # if
+
+ print td {-class => 'smalllabel'}, $report,
+ td {-class => 'smallnumber'}, $value,
+ td {-class => 'smallnumber'}, $percent;
+
print end_Tr;
- } # foreach
+ } # for
+
print end_table;
print end_div;
# I'm OK with homonyms
[-Subroutines::ProhibitBuiltinHomonyms]
+
+# I'm OK with so called ambiguous names
+[-NamingConventions::ProhibitAmbiguousNames]