<& /htmlheader &>
<& modelheader &>

All stamps for <% $inst->dbname() %>.<p>

% foreach my $item (@stuff) {
<& stamp_img, known_id => $item->{known_id}, det_id => $item->{det_id} &>
% }

Limit: <% $limit_str %>

<& /htmlfooter &>

<%args>
$sortby => 'num'
$limit => undef
</%args>

<%init>
use Data::Dumper;
my $inst = $m->notes('INST');
my $dbh = $inst->dbh();
my %stuff;

# Create a query from the DB, and create HTML schtuff.
my $href;
my $limit_str = "";

if ($limit) {
    $limit_str = "limit $limit";
}
my $sth = $dbh->prepare("select t.known_id known_id, d.det_id det_id from detections d join tracklet_attrib ta using (det_id) join tracklets t using (tracklet_id) where t.known_id is not null order by t.known_id $limit_str")
    or die $dbh->errstr;
$sth->execute() or die $sth->errstr;

my @stuff;
while ($href = $sth->fetchrow_hashref()) {
    push @stuff, $href;
}
</%init>
