% include('elements/search.html',
'title' => $title,
'name_singular' => 'member',
'query' => $query,
'count_query' => $count_query,
'header' => [ 'Email address' ],
'fields' => [ $email_sub, ], #just this one for now
'html_init' => $html_init,
)
%>
<%init>
#XXX ACL:
#make sure the mailing list is attached to a customer service i can see/view
$cgi->param('listnum') =~ /^(\d+)$/ or die 'illegal listnum';
my $listnum = $1;
my $mailinglist = qsearchs('mailinglist', { 'listnum' => $listnum })
or die "unknown listnum $listnum";
my $title = $mailinglist->listname. ' mailing list';
my $svc_mailinglist = $mailinglist->svc_mailinglist;
my $query = {
'table' => 'mailinglistmember',
'hashref' => { 'listnum' => $listnum },
};
my $count_query = "SELECT COUNT(*) FROM mailinglistmember WHERE listnum = $listnum";
my $email_sub = sub {
my $member = shift;
my $r = $member->email; #just this one for now
my $a = qq[';
$r .= " (${a}remove)";
$r;
};
my $html_init = '';
if ( $svc_mailinglist ) {
my $svcnum = $svc_mailinglist->svcnum;
my $label = encode_entities($svc_mailinglist->label);
$html_init .= qq[View customer mailing list: $label
];
}
$html_init .= <<"END";
END
%init>