<& /htmlheader &>

<& modelheader &>
<h2>SSM Object History<br>
Object <% $ssmObjectName %><br>
<a href="/model/<% $model %>/ssmtimeline.html?ssmObjectName=<% $ssmObjectName %>">Timeline</a>
</h2>

% my $histcomp;
% if ($events and @{$events}) {
% foreach my $h (sort { $a->eventTime <=> $b->eventTime } @{$events}) {
% $histcomp = 'hist' . $h->eventType;   # history component name
<& $histcomp, event => $h &>
<p height=10>
% } #foreach
% } #if

<& /htmlfooter &>

<%args>
$ssmObjectName => undef
$ssmId => undef
</%args>

<%init>
my $inst = $m->notes('INST');
my $model = $m->notes('MODEL');
use Data::Dumper;
use PS::MOPS::DC::SSM;
use PS::MOPS::DC::History;
if ($ssmObjectName =~ /^(\d+)$/) {
    # object name looks like ID, so treat like ID
    $ssmObjectName = undef;
    $ssmId = $1;
}

if ($ssmObjectName) {
    $ssmId = modcs_objectName2ssmId($inst, $ssmObjectName);
}
else {
    $ssmObjectName = modcs_ssmId2objectName($inst, $ssmId);
}
my $events = modch_retrieve($inst, ssmId => $ssmId);
</%init>
