110 |
yyyy => $yyyy, |
yyyy => $yyyy, |
111 |
mm => $mm, |
mm => $mm, |
112 |
dd => $dd, |
dd => $dd, |
113 |
|
date_limit => $date_limit, |
114 |
}; |
}; |
115 |
|
|
116 |
if ($date_limit) { |
# |
117 |
$param->{'search'} .= "and " if ($param->{'search'}); |
# ?show_id=XXXXxxxx___message_id___xxxxXXXX |
118 |
$param->{'search'} .= $date_limit; |
if ($param->{'show_id'}) { |
119 |
} |
|
120 |
|
$mws->reset_counters; |
121 |
|
my $row = $mws->fetch_result_by_id($param->{'show_id'}); |
122 |
|
$tpl_var->{message} = $row; |
123 |
|
} elsif ($param->{'search'} || $date_limit) { |
124 |
|
|
125 |
|
# show search results |
126 |
|
# ?search=foo:bar |
127 |
|
|
128 |
# show search results |
my @search = ( $param->{'search'} ); |
|
# ?search=foo:bar |
|
|
if ($param->{'search'}) { |
|
129 |
|
|
130 |
print STDERR "search: ",$param->{'search'},"\n"; |
if ($date_limit) { |
131 |
|
push @search, "and" if (@search); |
132 |
|
push @search, "date:\"$date_limit\""; |
133 |
|
} |
134 |
|
|
135 |
my $results = $mws->search($param->{'search'}); |
print STDERR "search: ",join(" ",@search),"\n"; |
136 |
|
|
137 |
|
my $results = $mws->search(@search); |
138 |
my @res = $mws->fetch_all_results(); |
my @res = $mws->fetch_all_results(); |
139 |
|
|
140 |
$tpl_var->{results} = \@res if (@res); |
$tpl_var->{results} = \@res if (@res); |
141 |
$tpl_var->{total_hits} = $mws->{total_hits}; |
$tpl_var->{total_hits} = $mws->{total_hits}; |
142 |
|
|
|
|
|
|
# |
|
|
# ?show_id=XXXXxxxx___message_id___xxxxXXXX |
|
|
} elsif ($param->{'show_id'}) { |
|
|
|
|
|
$mws->reset_counters; |
|
|
my $row = $mws->fetch_result_by_id($param->{'show_id'}); |
|
|
$tpl_var->{message} = $row; |
|
143 |
} |
} |
144 |
|
|
|
print Dumper($mws->{counter}); |
|
145 |
|
|
146 |
# push counters to template |
# push counters to template |
147 |
foreach my $f (qw(from to cc bcc)) { |
foreach my $f (qw(from to cc bcc)) { |