Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>IDR-04 Test Integrator</title>
<script type="text/javascript">
var testPlan = {testLevel:${testLevel}, halt:${haltStatus}, loop:${loopStatus}, output:${outputStatus}, run:${runStatus}};
var testObject1 = {display:${testDisplay1}, status:${testStatus1}, enabled:${testEnabled1}, name:"${testName1}", result:"${testResult1}"};
var testObject2 = {display:${testDisplay2}, status:${testStatus2}, enabled:${testEnabled2}, name:"${testName2}", result:"${testResult2}"};
var testObject3 = {display:${testDisplay3}, status:${testStatus3}, enabled:${testEnabled3}, name:"${testName3}", result:"${testResult3}"};
var testObject4 = {display:${testDisplay4}, status:${testStatus4}, enabled:${testEnabled4}, name:"${testName4}", result:"${testResult4}"};
var testObject5 = {display:${testDisplay5}, status:${testStatus5}, enabled:${testEnabled5}, name:"${testName5}", result:"${testResult5}"};
var testObject6 = {display:${testDisplay6}, status:${testStatus6}, enabled:${testEnabled6}, name:"${testName6}", result:"${testResult6}"};
var testObject7 = {display:${testDisplay7}, status:${testStatus7}, enabled:${testEnabled7}, name:"${testName7}", result:"${testResult7}"};
var testObject8 = {display:${testDisplay8}, status:${testStatus8}, enabled:${testEnabled8}, name:"${testName8}", result:"${testResult8}"};
var testObject9 = {display:${testDisplay9}, status:${testStatus9}, enabled:${testEnabled9}, name:"${testName9}", result:"${testResult9}"};
var testObject10 = {display:${testDisplay10}, status:${testStatus10}, enabled:${testEnabled10}, name:"${testName10}", result:"${testResult10}"};
var testObject11 = {display:${testDisplay11}, status:${testStatus11}, enabled:${testEnabled11}, name:"${testName11}", result:"${testResult11}"};
var testObject12 = {display:${testDisplay12}, status:${testStatus12}, enabled:${testEnabled12}, name:"${testName12}", result:"${testResult12}"};
var testObject13 = {display:${testDisplay13}, status:${testStatus13}, enabled:${testEnabled13}, name:"${testName13}", result:"${testResult13}"};
var testObject14 = {display:${testDisplay14}, status:${testStatus14}, enabled:${testEnabled14}, name:"${testName14}", result:"${testResult14}"};
var testObject15 = {display:${testDisplay15}, status:${testStatus15}, enabled:${testEnabled15}, name:"${testName15}", result:"${testResult15}"};
var testObject16 = {display:${testDisplay16}, status:${testStatus16}, enabled:${testEnabled16}, name:"${testName16}", result:"${testResult16}"};
var testObjects = new Array(testObject1, testObject2, testObject3, testObject4, testObject5, testObject6, testObject7, testObject8, testObject9, testObject10, testObject11, testObject12, testObject13, testObject14, testObject15, testObject16);
var ipAddress = "0.0.0.0";
var IFrameObj; // our IFrame object
<!-- ************************************ -->
<!-- *** preload variables and images *** -->
<!-- ************************************ -->
function start()
{
if(document.images) preImages("pass.png", "fail.png");
preVars();
// loadPage();
}
window.onload = start;
function preVars()
{
document.form1.textOut.value = "!";
document.form1.LOOPCNT.value = "0";
TMDisplay(document.form1.TM);
}
function preImages()
{
var testImages = new Array();
for (var x = 0; x < preImages.arguments.length; x++)
{
testImages[x] = new Image();
testImages[x].src = preImages.arguments[x];
}
}
<!-- ***************************** -->
<!-- *** update checkbox value *** -->
<!-- ***************************** -->
function amIChecked(id)
{
if(document.getElementById(id).checked == true) document.getElementById(id).value = "C";
else document.getElementById(id).value = "N";
}
<!-- *************************** -->
<!-- *** display test status *** -->
<!-- *************************** -->
function displayStatus(status)
{
switch (status)
{
case 0: return ''; //'<img id="TestStatus" src="None.png" width="40" height="40" alt="No Status" border="0" />'; // No Status
case 1: return ''; //'<img id="TestStatus" src="Run.png" width="40" height="40" alt="Running" border="0" />'; // Running
case 2: return '<img id="TestStatus" src="pass.png" width="40" height="40" alt="Passed" border="0" />'; // Passed
case 3: return '<img id="TestStatus" src="fail.png" width="40" height="40" alt="Failed" border="0" />'; // Failed
default: return 'XXX'; // should never occur
}
}
<!-- *************************** -->
<!-- *** save output to file *** -->
<!-- *************************** -->
function WriteToFile()
{
str = document.form1.textOut.value;
mydoc = document.open();
mydoc.write(str);
mydoc.execCommand("saveAs", true, "IDR04TestIntegratorOutput.txt");
mydoc.close();
history.back();
return false;
}
<!-- ****************************** -->
<!-- *** display drop down menu *** -->
<!-- ****************************** -->
function TMDisplay(dropdown)
{
// clear all check boxes and values...
for (var i = 0; i < 16; i++)
{
document.getElementById('cb' + i).checked = false;
document.getElementById('cb' + i).value = "N";
document.getElementById('cb' + i).disabled = true;
}
// grab chosen combobox value
var selVal = dropdown.options[dropdown.selectedIndex].value;
if (selVal == 1) // production board test
{
document.getElementById('cb0').checked = true; document.getElementById('cb0').value = "C";
document.getElementById('cb1').checked = true; document.getElementById('cb1').value = "C";
document.getElementById('cb2').checked = true; document.getElementById('cb2').value = "C";
document.getElementById('cb3').checked = true; document.getElementById('cb3').value = "C";
document.getElementById('cb4').checked = true; document.getElementById('cb4').value = "C";
document.getElementById('cb5').checked = true; document.getElementById('cb5').value = "C";
}
else if (selVal == 2) // ess unit test
{
document.getElementById('cb6').checked = true; document.getElementById('cb6').value = "C";
document.getElementById('cb7').checked = true; document.getElementById('cb7').value = "C";
document.getElementById('cb8').checked = true; document.getElementById('cb8').value = "C";
document.getElementById('cb9').checked = true; document.getElementById('cb9').value = "C";
document.getElementById('cb10').checked = true; document.getElementById('cb10').value = "C";
document.getElementById('cb11').checked = true; document.getElementById('cb11').value = "C";
}
else if (selVal == 3) // basic board test
{
document.getElementById('cb12').checked = true; document.getElementById('cb12').value = "C";
document.getElementById('cb13').checked = true; document.getElementById('cb13').value = "C";
document.getElementById('cb14').checked = true; document.getElementById('cb14').value = "C";
document.getElementById('cb15').checked = true; document.getElementById('cb15').value = "C";
}
else if (selVal == 4) // debug mode - hand select tests
{
for (var i = 0; i < 16; i++)
{
document.getElementById('cb' + i).disabled = false;
}
}
}
<!-- ************************** -->
<!-- *** build query string *** -->
<!-- ************************** -->
function BuildQueryString(theFormName)
{
var theForm = document.forms[theFormName];
var qs = 'hidden.htm'
for (var e = 0; e < theForm.elements.length; e++)
{
if (theForm.elements[e].name != '')
{
qs += (qs == 'hidden.htm') ? '?' : '&'
qs += theForm.elements[e].name + '=' + escape(theForm.elements[e].value);
}
}
return qs;
}
<!-- ********************** -->
<!-- *** call to server *** -->
<!-- ********************** -->
function CallToServer(theFormName)
{
// document.testPlan.run = 2;
document.getElementById('RUNSTATUS').value = "2";
document.getElementById('TestControl').disabled = true;
// enable all check boxes before sending POST
for (var i = 0; i < 16; i++) document.getElementById('cb' + i).disabled = false;
if (!document.createElement) {return true};
var IFrameDoc;
// build POST URL
var URL = BuildQueryString(theFormName);
document.getElementById('textOut').value = URL; // TESTING URL BUILD ***********************************
// build iframe
if (!IFrameObj && document.createElement)
{
// create the IFrame and assign a reference to the
// object to our global variable IFrameObj.
// this will only happen the first time
// callToServer() is called
try
{
var tempIFrame=document.createElement('iframe');
tempIFrame.setAttribute('id','RSIFrame');
tempIFrame.setAttribute('name','RSIFrame');
tempIFrame.setAttribute('src','hidden.htm');
tempIFrame.style.border='0px';
tempIFrame.style.width='0px';
tempIFrame.style.height='0px';
IFrameObj = document.body.appendChild(tempIFrame);
if (document.frames) IFrameObj = document.frames['RSIFrame']; // for IE5 Mac
}
catch(exception) // for IE5 PC
{
iframeHTML='\<iframe name="RSIFrame" id="RSIFrame" src="hidden.htm" style="';
iframeHTML+='border:0px;';
iframeHTML+='width:0px;';
iframeHTML+='height:0px;';
iframeHTML+='"><\/iframe>';
document.body.innerHTML+=iframeHTML;
IFrameObj = new Object();
IFrameObj.document = new Object();
IFrameObj.document.location = new Object();
IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
IFrameObj.document.location.replace = function(location) { this.iframe.src = location; }
}
}
if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) // for NS6
{
setTimeout('callToServer()',10); // pause
return false;
}
if (IFrameObj.contentDocument) IFrameDoc = IFrameObj.contentDocument; // for NS6
else if (IFrameObj.contentWindow) IFrameDoc = IFrameObj.contentWindow.document; // For IE5.5 and IE6
else if (IFrameObj.document) IFrameDoc = IFrameObj.document; // For IE5
else return true;
// disable all check boxes after sending POST
for (var i = 0; i < 16; i++) document.getElementById('cb' + i).disabled = true;
// send URL to iframe for POSTing
IFrameDoc.location.replace(URL);
return false;
}
<!-- *********************************************** -->
<!-- *** handle response from server->hidden.htm *** -->
<!-- *********************************************** -->
function HandleResponse(doc)
{
var iframe = document.getElementById('RSIFrame');
document.testPlan = iframe.contentWindow['testPlan'];
document.testObjects = iframe.contentWindow['testObjects'];
document.testObject1 = iframe.contentWindow['testObject1'];
document.testObject2 = iframe.contentWindow['testObject2'];
document.testObject3 = iframe.contentWindow['testObject3'];
document.testObject4 = iframe.contentWindow['testObject4'];
document.testObject5 = iframe.contentWindow['testObject5'];
document.testObject6 = iframe.contentWindow['testObject6'];
document.testObject7 = iframe.contentWindow['testObject7'];
document.testObject8 = iframe.contentWindow['testObject8'];
document.testObject9 = iframe.contentWindow['testObject9'];
document.testObject10 = iframe.contentWindow['testObject10'];
document.testObject11 = iframe.contentWindow['testObject11'];
document.testObject12 = iframe.contentWindow['testObject12'];
document.testObject13 = iframe.contentWindow['testObject13'];
document.testObject14 = iframe.contentWindow['testObject14'];
document.testObject15 = iframe.contentWindow['testObject15'];
document.testObject16 = iframe.contentWindow['testObject16'];
document.getElementById('form1').textOut.value = document.testPlan.results;
document.getElementById('form1').LOOPCNT.value = document.testPlan.count;
// setTimeout(100);
CheckStatus(); // check status of tests run...
document.getElementById('TestControl').disabled = false;
}
<!-- ************************************* -->
<!-- *** check overall status of tests *** -->
<!-- ************************************* -->
function CheckStatus()
{
var failed = false;
document.getElementById('AllTestStatus').style.color = "green";
var i = 0;
while (i < 16)
{
if (testObjects[i].status == 3)
{
document.getElementById('AllTestStatus').style.color = "red";
failed = true;
i++;
}
else i++;
}
if (failed == true) document.getElementById('AllTestStatus').value = "FAILURE!";
else document.getElementById('AllTestStatus').value = "SUCCESS!";
}
<!-- **************************************** -->
<!-- *** input IP Addy and load main page *** -->
<!-- **************************************** -->
function loadPage()
{
// var ip1 = document.getElementById('IP1').value;
// var ip2 = document.getElementById('IP2').value;
// var ip3 = document.getElementById('IP3').value;
// var ip4 = document.getElementById('IP4').value;
// document.ipAddress = ip1.toString() + '.' + ip2.toString() + '.' + ip3.toString() + '.' + ip4.toString();
// document.getElementById('Page').removeChild(document.getElementById('IPPrompt'));
// document.getElementById('mainPage').style.visibility = "visible";
// alert(document.ipAddress);
document.getElementById('slowScreenSplash').style.display = "none";
document.getElementById('mainPage').style.visibility = "visible";
}
<!-- ******************** -->
<!-- *** clear output *** -->
<!-- ******************** -->
function ClearOutput()
{
document.getElementById('textOut').value = "!";
return false;
}
</script>
<!-- ****************** -->
<!-- *** start HTML *** -->
<!-- ****************** -->
</head>
<body bgcolor="#ffba00">
<div id="Page">
<!--
<div align="center" id="IPPrompt" style="visibility: hidden">
<form name="ipform" id="ipform"><font size="6">
Enter IP Address of Board:</font><br><input id="IP1" name="IP1" style="WIDTH: 60px; HEIGHT: 21px" size="4"> <font>.</font> <input id="IP2" name="IP2" style="WIDTH: 60px; HEIGHT: 21px" size="4"> <font>.</font> <input id="IP3" name="IP3" style="WIDTH: 60px; HEIGHT: 21px" size="4"> <font>.</font> <input id="IP4" name="IP4" style="WIDTH: 60px; HEIGHT: 21px" size="4">
<input type="button" value="Submit" style="LEFT: 108px; WIDTH: 150px; TOP: 568px; HEIGHT: 30px" onclick="loadPage()">
</form>
</div>
-->
<div id="slowScreenSplash" Style="position:absolute;z-index:5;top:40%;left:15%;visibility:hidden" align="center">
Please wait while page loads...
</div>
<div id="mainPage" style="visibility: visible">
<form name="form1" id="form1" onsubmit="return CallToServer(this.name)" action="" method="POST">
<table border="0">
<tr>
<td>
<font face="Raavi" size="6"><strong>Wabtec IDR-04 Test Integrator</strong></font>
<font face="System" size="2"><br>
Test Action:<br><select id="TM" style="WIDTH: 359px" onchange="TMDisplay(this.form.TM)" name="TM"><option value="1" selected>Run Production Board Test (Use FN xxx)</option><option value="2">Run Top Level Unit Test (Use FN xxx)</option>
<option value="3">Basic Board Test (No Fixture)</option><option value="4">Debug - Select Tests From List</option></select>
<br><select id="ERR" name="ERR" style="WIDTH: 143px"><option value="1" selected>Halt On Error</option><option value="2">Continue on Error</option></select><select id="LOOP" name="LOOP" style="WIDTH: 96px"><option value="1" selected>Run Once</option><option value="2">Loop
Test</option></select><select id="OUTPUT" style="WIDTH: 120px" name="OUTPUT"><option value="1" selected>Brief Output</option><option value="2">Verbose Output</option></select>
<br><br>
<input type="submit" id="TestControl" style="LEFT: 120px; TOP: 165px WIDTH: 150px; HEIGHT: 30px" alt="Start Test" size="102" value="Start Testing">
<br><br><input id="LOOPCNT" name="LOOPCNT" style="WIDTH: 38px; HEIGHT: 21px" size="4" readonly> Test Loop Count</font>
<font size="2"><br><br>Test Results:<br><textarea id="textOut" style="WIDTH: 365px; HEIGHT: 225px" name="textOut" rows="15" readonly cols="41"></textarea><br>
<input style="LEFT: 108px; WIDTH: 150px; TOP: 568px; HEIGHT: 30px" onclick="return ClearOutput()" type="submit" size="102" value="Clear Test Results">
<input style="LEFT: 108px; WIDTH: 150px; TOP: 568px; HEIGHT: 30px" onclick="return WriteToFile()" type="submit" size="102" value="Save Test Results"><br>
<input type="hidden" name="RUNSTATUS" id="RUNSTATUS" value="1">
<br>
<br>
<table width="100%" border="0">
<tr>
<td width="133"><font size="4">Status of Tests:</font></td>
<td> <input id="AllTestStatus" name="AllTestStatus" style="WIDTH: 85px; HEIGHT: 21px; color: black; font-weight: bold" size="6" readonly value="No Tests Run"></font></td>
</tr>
</table>
</font>
</td>
<td><font face="System" size="2"> Test Selection:<br></font>
<table border="0">
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject1.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB0" id="cb0" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject1.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject2.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB1" id="cb1" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject2.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject3.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB2" id="cb2" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject3.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject4.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB3" id="cb3" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject4.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject5.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB4" id="cb4" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject5.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject6.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB5" id="cb5" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject6.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject7.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB6" id="cb6" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject7.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject8.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB7" id="cb7" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject8.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject9.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB8" id="cb8" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject9.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject10.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB9" id="cb9" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject10.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject11.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB10" id="cb10" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject11.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject12.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB11" id="cb11" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject12.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject13.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB12" id="cb12" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject13.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject14.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB13" id="cb13" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject14.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject15.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB14" id="cb14" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject15.name)</script></font></p></td></tr>
<tr><td width="31"><p align="center"><script type="text/javascript">document.write(displayStatus(testObject16.status))</script></p></td><td width="33"><p align="center"><input style="WIDTH: 15px; HEIGHT: 30px" type="checkbox" size="15" name="CB15" id="cb15" onclick="amIChecked(this.id)"></p></td><td><p align="left"><font face="System" size="1"><script type="text/javascript">document.write(testObject16.name)</script></font></p></td></tr>
</table>
</td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>