octonet/octoserve/var/www/scif.html

256 lines
7.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OctopusNet</title>
<link rel="stylesheet" type="text/css" href="/style.css">
<script type="text/javascript" src="/menu.js"></script>
<!-- Add included scripts here -->
<script type="text/javascript" src="/scifdb.lua"></script>
<script type="text/javascript" src="/scifsettings.lua"></script>
<!-- Add page scripts here -->
<script type="text/javascript">
var xmlhttp = new XMLHttpRequest();
var url = "/octoserve/tunerstatus.json";
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState == 4 )
{
if( xmlhttp.status == 200 )
myFunction(xmlhttp.responseText);
}
}
function myFunction(response)
{
try
{
var tl = JSON.parse(response);
for(i= 0; i < tl.TunerList.length; i++ )
document.getElementById("trTuner"+i).style.display = "table-row";
}
catch(err) {}
}
SCIFEnabled = false;
SelectedManufacturer = 0;
SelectedUnit = 0;
TunerList = new Array();
function SetManufacturer(ManuIndex)
{
if( SCIFEnabled ) document.getElementById("SetButton").disabled = false;
SelectedManufacturer = ManuIndex;
document.Unit.Select.length = 0;
for( j = 0; j < ManufacturerList[ManuIndex].UnitList.length; j++ )
{
document.Unit.Select.options[j] = new Option(ManufacturerList[ManuIndex].UnitList[j].Name,j, false, true);
}
SetUnit(ManufacturerList[ManuIndex].UnitList.length-1);
}
function SetUnit(UnitIndex)
{
if( SCIFEnabled ) document.getElementById("SetButton").disabled = false;
SelectedUnit = UnitIndex;
for( i = 0; i < TunerList.length; i++ )
{
TunerList[i].Select.length = 1;
CurUnit = ManufacturerList[SelectedManufacturer].UnitList[UnitIndex];
for( j = 0; j < CurUnit.Frequencies.length; j++ )
{
TunerList[i].Select.options[j+1] = new Option('Slot ' + (j+1) + ': ' + CurUnit.Frequencies[j] + ' MHz',j+1,false,true);
}
if( i < CurUnit.Frequencies.length )
{
TunerList[i].Select.options[i+1].selected = true;
}
else
{
TunerList[i].Select.options[0].selected = true;
}
}
}
function SetSlot(Tuner,SlotIndex)
{
if( SCIFEnabled ) document.getElementById("SetButton").disabled = false;
}
function SaveSettings()
{
if( SCIFEnabled )
{
CurUnit = ManufacturerList[SelectedManufacturer].UnitList[SelectedUnit];
Protocol = CurUnit.Protocol == "EN50607" ? '2' : '1';
param = 'Manufacturer='+SelectedManufacturer+'&Unit='+SelectedUnit+'&Type='+Protocol;
for( i = 0; i < TunerList.length; i++ )
{
param += '&Tuner'+(i+1)+'=';
SelectedFrequency = TunerList[i].Select.selectedIndex;
if( SelectedFrequency > 0 )
param += SelectedFrequency + ',' + CurUnit.Frequencies[SelectedFrequency-1];
else
param += '0';
}
location.replace('/scifsettings.lua?'+param);
}
else
{
location.replace('/scifsettings.lua?reset');
}
}
function SetEnable()
{
SCIFEnabled = document.getElementById("EnableButton").checked;
document.getElementById("SetButton").disabled = false;
}
function OnLoad()
{
SCIFEnabled = false;
for( i = 0; i < 12 ; i++ )
{
TunerList[i] = document.getElementById("formTuner"+i);
}
document.Manufacturer.Select.length = 0;
for( i = 0; i < ManufacturerList.length ; i++ )
{
ManuName = ManufacturerList[i].Name;
if( ManuName == '' ) ManuName = "-----------------";
document.Manufacturer.Select.options[i] = new Option(ManuName,i, false, true);
}
for( i = 0; i < Tuner.length; i++ )
{
if( Tuner[i].Slot > 0 ) SCIFEnabled = true;
}
if( SCIFEnabled )
{
document.Manufacturer.Select.selectedIndex = Manufacturer;
SetManufacturer(Manufacturer);
document.Unit.Select.selectedIndex = Unit;
SetUnit(Unit);
for( i = 0; i < Tuner.length; i++ )
{
if( i < TunerList.length )
{
TunerList[i].Select.selectedIndex = Tuner[i].Slot;
}
}
}
else
{
document.Manufacturer.Select.selectedIndex = document.Manufacturer.Select.length - 1;
SetManufacturer(document.Manufacturer.Select.length - 1);
}
document.getElementById("EnableButton").checked = SCIFEnabled;
document.getElementById("SetButton").disabled = true;
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
</script>
</head>
<body onload="OnLoad()">
<table class="maintable" align="center">
<colgroup>
<col width="182px"/>
<col width="728px"/>
</colgroup>
<tr><td class="maintd" colspan="2">
<a href="http://www.digitaldevices.de"><img src="/BannerDD.jpg" alt="DD" width="910" height="130" /></a>
</td></tr>
<tr><td class="maintd" colspan="2">&nbsp;</td></tr>
<tr>
<td class="maintd"><script type="text/javascript">CreateMenu();</script></td>
<td class="content">
<div>
<!-- Begin Content -->
<table align="center">
<tr>
<td>&nbsp;</td>
<td>
<form action="">
<input id="EnableButton" type="checkbox" value="Check" checked="false" onclick="SetEnable()">
Enable Unicable (EN 50494 / EN 50607)
</form>
</td>
</tr>
<tr>
<td>Manufacturer</td>
<td>
<form name="Manufacturer" action="">
<select name="Select" size="1" style="width: 300px" onchange="SetManufacturer(document.Manufacturer.Select.selectedIndex)" >
<option>----</option>
</select>
</form>
</td>
</tr>
<tr>
<td>Unit</td>
<td>
<form name="Unit" action="">
<select name="Select" size="1" style="width: 300px" onchange="SetUnit(document.Unit.Select.selectedIndex)">
<option>----</option>
</select>
</form>
</td>
</tr>
<script type="text/javascript">
for( var i = 0; i < 12 ; i++ )
{
// document.write('<tr id="trTuner'+i+'">');
document.write('<tr id="trTuner'+i+'" style="display:none">');
document.write('<td>Tuner ' + (i+1) + '</td>');
document.write('<td>');
document.write('<form name="Tuner'+(i+1)+'" id="formTuner'+i+'" action="">');
document.write('<select name="Select" size="1" style="width: 300px" onchange="SetSlot(1,document.Tuner' +(i+1)+'.Select.selectedIndex)">');
document.write('</option>----</option>');
document.write('</select>');
document.write('</form>');
document.write('</td>');
document.write('</tr>');
}
</script>
<tr><td colspan="2" align="right">
<div style="width: 300px">
<form name="SetSCIF" action="">
<input type="Button" value="Cancel" onclick="location.replace('index.html')" >
<input id="SetButton" type="Button" value="Set" onclick="SaveSettings()" >
</form>
</div>
</td></tr>
</table>
<!-- End Content -->
</div>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
</table>
</body>
</html>