a6d119833c
FossilOrigin-Name: f7c7717cc3d549d6a2126efef96e702a6027c7841531b7eb276c8ebbd4106d0d
56 lines
972 B
Perl
56 lines
972 B
Perl
package search;
|
|
use strict;
|
|
use warnings;
|
|
use Exporter 'import';
|
|
|
|
our @EXPORTS = qw( content_search );
|
|
|
|
use template_helpers 'to_template';
|
|
|
|
use constant
|
|
{
|
|
SEARCH_CAT_STATUSES => 0,
|
|
SEARCH_CAT_ACCOUNTS => 1,
|
|
SEARCH_CAT_TAGS => 2
|
|
};
|
|
|
|
sub search_page
|
|
{
|
|
my ($ssn, $data, $tab, $content) = @_;
|
|
|
|
my %vars = (
|
|
prefix => '',
|
|
ssn => $ssn,
|
|
tab => $tab,
|
|
content => $content,
|
|
);
|
|
|
|
to_template(\%vars, \$data->{'search.tt'});
|
|
}
|
|
|
|
sub search_statuses
|
|
{
|
|
my ($ssn, $data, $statuses) = @_;
|
|
|
|
my %vars = (
|
|
prefix => '',
|
|
ssn => $ssn,
|
|
statuses => $statuses,
|
|
);
|
|
|
|
search_page($ssn, $data, SEARCH_CAT_STATUSES, to_template(\%vars, \$data->{'search_statuses.tt'}));
|
|
}
|
|
|
|
sub content_search
|
|
{
|
|
my ($ssn, $data, $search) = @_;
|
|
|
|
my %vars = (
|
|
prefix => '',
|
|
ssn => $ssn,
|
|
search => $search,
|
|
);
|
|
|
|
to_template(\%vars, \$data->{'content_search.tt'});
|
|
}
|
|
|