mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Fix sortability of mail queue dates
This commit is contained in:
@@ -1310,25 +1310,26 @@ while($lines[++$l]) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
# simplify_date(datestring)
|
||||
# simplify_date(datestring, [format])
|
||||
# Given a date from an email header, convert to the user's preferred format
|
||||
sub simplify_date
|
||||
{
|
||||
local $u = &parse_mail_date($_[0]);
|
||||
local ($date, $fmt) = @_;
|
||||
local $u = &parse_mail_date($date);
|
||||
if ($u) {
|
||||
local $fmt = $userconfig{'date_fmt'} || $config{'date_fmt'} || "dmy";
|
||||
$fmt ||= $userconfig{'date_fmt'} || $config{'date_fmt'} || "dmy";
|
||||
local $strf = $fmt eq "dmy" ? "%d/%m/%Y" :
|
||||
$fmt eq "mdy" ? "%m/%d/%Y" :
|
||||
"%Y/%m/%d";
|
||||
return strftime("$strf %H:%M", localtime($u));
|
||||
}
|
||||
elsif ($_[0] =~ /^(\S+),\s+0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
|
||||
elsif ($date =~ /^(\S+),\s+0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
|
||||
return "$2/$3/$4 $5:$6";
|
||||
}
|
||||
elsif ($_[0] =~ /^0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
|
||||
elsif ($date =~ /^0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
|
||||
return "$1/$2/$3 $4:$5";
|
||||
}
|
||||
return $_[0];
|
||||
return $date;
|
||||
}
|
||||
|
||||
# simplify_from(from)
|
||||
@@ -2457,6 +2458,13 @@ my $rv = eval {
|
||||
$7 < 50 ? $7+100 : $7 < 1000 ? $7 : $7-1900);
|
||||
return $tm;
|
||||
}
|
||||
elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)/) {
|
||||
# Format like Tue Dec 7 12:58:52
|
||||
local @now = localtime(time());
|
||||
local $tm = timelocal($6, $5, $4, $3, &month_to_number($2),
|
||||
$now[5]);
|
||||
return $tm;
|
||||
}
|
||||
elsif ($str =~ /^(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)\s+(\S+)/) {
|
||||
# Format like Dec 7 12:58:52 2004 GMT
|
||||
local $tm = timelocal($5, $4, $3, $2, &month_to_number($1),
|
||||
|
||||
@@ -62,3 +62,5 @@ Converted all pages to use the new Webmin UI library, for a more consistent and
|
||||
Autoreply messages containing non-ASCII characters are now properly quoted-printable encoded.
|
||||
---- Changes since 1.440 ----
|
||||
Added a module config option to control if the user is prompted for confirmation before deleting queued messages.
|
||||
---- Changes since 1.450 ----
|
||||
Changed the mail queue date format to yyyy/mm/dd, for easier sorting.
|
||||
|
||||
@@ -40,3 +40,5 @@ Autoreply messages containing non-ASCII characters are now properly quoted-print
|
||||
---- Changes since 1.440 ----
|
||||
Added a Module Config option to control if the user is prompted for confirmation before deleting queued messages.
|
||||
A custom command to rebuild all maps can be specified on the Module Config page, to be used instead of makemap or newaliases.
|
||||
---- Changes since 1.450 ----
|
||||
Changed the mail queue date format to yyyy/mm/dd, for easier sorting.
|
||||
|
||||
@@ -611,7 +611,7 @@ foreach my $f (@$qfiles) {
|
||||
else {
|
||||
push(@cols, $n);
|
||||
}
|
||||
push(@cols, "<font size=1>$mail->{'header'}->{'date'}</font>") if ($show{'Date'});
|
||||
push(@cols, "<font size=1>".&simplify_date($mail->{'header'}->{'date'}, "ymd")."</font>") if ($show{'Date'});
|
||||
push(@cols, "<font size=1>$mail->{'header'}->{'from'}</font>") if ($show{'From'});
|
||||
push(@cols, "<font size=1>$mail->{'header'}->{'to'}</font>") if ($show{'To'});
|
||||
push(@cols, "<font size=1>$mail->{'header'}->{'cc'}</font>") if ($show{'Cc'});
|
||||
|
||||
Reference in New Issue
Block a user