<& /htmlheader, title => $title &>
<& modelheader &>

% if ($id =~ /^L/) {
<& show_derived, objectName => $id &>
% }
% elsif ($id =~ /^o\d\d\d\dg/) {
<& show_field, fpa_id => $id &>
% }
% elsif ($id =~ /^F(\d+)/) {
<& show_field, field_id => $1 &>
% }
% elsif ($id =~ /^T(\d+)/) {
<& ttable, trkId => $1, special => $special, canSubmit => 1 &>
% }
% else {
Object "<% $id %>" was not found.
% }

<& /htmlfooter &>

<%args>
$id
$special => undef
</%args>

<%init>
# Handle date searches into czar page first.
my $inst = $m->notes('INST');
my $dbname = $inst->dbname;
if ($id eq 'latest') {
    $m->redirect("/model/$dbname/index.html");
}
elsif ($id eq 'today') {
    $m->redirect("/model/$dbname/index.html?utdate=today");
}
elsif ($id =~ m|^(\d\d\d\d)$|) {
    $m->redirect("/model/$dbname/index.html?tjd=$1");
}
elsif ($id =~ m|^(\d\d\d\d\d)$|) {
    $m->redirect(sprintf("/model/$dbname/index.html?tjd=%d", $1 + 1 - 50000));
}
elsif ($id =~ m|^(\d\d\d\d)[-./]?(\d\d)[-./]?(\d\d)|) {
    $m->redirect("/model/$dbname/index.html?utdate=$1$2$3");
}
elsif ($id =~ m|^D(\d+)|) {
    $m->redirect("/model/$dbname/detection.html?det_id=$1");
}
elsif ($id =~ /^P/ or $id =~ /^TV/) {
    # Looks like PS1 MPC submission
    $m->redirect("/submitted_details.html?desig=$id");
}

my $title = $id;
</%init>
