<%perl>
# simtest-config.html
#
# @author D. Chang
</%perl>

<%args>
$test_run_id
</%args>

<%perl>
use DBI;

my $simtest_config_path="/usr/local/MOPS_DEV/testing-config/simtests";
my $simtest_config_filename;
my $simtest_id;

my $dbuser="root";
my $dbpass="panstar1";
#my $dbuser="mops";
#my $dbpass="mops";
my $dbname="psmops_testing_results";
my $dbhost="schmopc01.ifa.hawaii.edu";
my $dbconnect="DBI:mysql:$dbname:$dbhost";
my $dbh=DBI->connect($dbconnect,$dbuser,$dbpass) || die "ERROR: Cannot connect to database $dbname.";

# Get Simtest configuration filename.
my $sql="SELECT id, simtest_config
         FROM simtest_results 
         WHERE test_run=$test_run_id";
my $sth=$dbh->prepare($sql);
my $result=$sth->execute;
my $simtest_ids_ref=$sth->fetchall_arrayref();
$simtest_id=$simtest_ids_ref->[0]->[0];
$simtest_config_filename=$simtest_ids_ref->[0]->[1];

# Read Simtest configuration file.
open(FILE,"<$simtest_config_path/$simtest_config_filename");
my @data=<FILE>;
close(FILE);
</%perl>

<& header.mas &>
<h2>Simtest Configuration</h2>

Simtest ID = <% $simtest_id %><br>
Simtest configuration filename = <% $simtest_config_filename %>
<p>
<table border="0"><tr><td>&nbsp;&nbsp;</td><td>
<table border="1" cellpadding="12"><tr><td>
<tt>
<%perl>
foreach my $line (@data){
    if($line=~s/\</\&lt;/g){}
    print $line;
    print "<br>";
}
</%perl>
</tt>
</td></tr></table>
</td></tr></table>
</p>
<br>
<& footer.mas &>
