mirror of
https://github.com/DigitalDevices/octonet.git
synced 2023-10-10 11:36:52 +00:00
Channelscan
Added backup and restore previous list Added delete list to allow to revert to legacy mode Added ID created from key,onid,tsid,sid Userinterface improvment. (Note requires updated octoscan from, dddvb)
This commit is contained in:
@@ -102,6 +102,15 @@ function OnLoad()
|
||||
|
||||
}
|
||||
|
||||
function DisableButtons(disabled)
|
||||
{
|
||||
document.getElementById("ScanButton").disabled = disabled;
|
||||
document.getElementById("StatusButton").disabled = disabled;
|
||||
document.getElementById("DeleteButton").disabled = disabled;
|
||||
document.getElementById("RestoreButton").disabled = disabled;
|
||||
}
|
||||
|
||||
|
||||
var ScanReq = new XMLHttpRequest();
|
||||
|
||||
ScanReq.onreadystatechange=function()
|
||||
@@ -110,6 +119,12 @@ ScanReq.onreadystatechange=function()
|
||||
{
|
||||
if( ScanReq.status == 200 )
|
||||
ScanStatus(ScanReq.responseText);
|
||||
else
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
|
||||
document.getElementById("scantext").firstChild.nodeValue = "Error " + ScanReq.status;
|
||||
DisableButtons(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,31 +137,56 @@ function GetStatus()
|
||||
function ScanStatus(response)
|
||||
{
|
||||
var s = JSON.parse(response);
|
||||
if( s.status == "active" )
|
||||
var done = false;
|
||||
if( s.status )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = s.count;
|
||||
document.getElementById("scantext").firstChild.nodeValue = s.msg;
|
||||
window.setTimeout(GetStatus,500);
|
||||
if( s.status == "active" )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = s.count;
|
||||
document.getElementById("scantext").firstChild.nodeValue = s.msg;
|
||||
}
|
||||
else if( s.status == "busy" )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
|
||||
document.getElementById("scantext").firstChild.nodeValue = "BUSY";
|
||||
done = true;
|
||||
}
|
||||
else if( s.status == "done" )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = s.count;
|
||||
document.getElementById("scantext").firstChild.nodeValue = "Channels found";
|
||||
done = true;
|
||||
}
|
||||
else if( s.status == "deleted" )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
|
||||
document.getElementById("scantext").firstChild.nodeValue = "Channel list deleted";
|
||||
done = true;
|
||||
}
|
||||
else if( s.status == "restored" )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = "\u00A0";
|
||||
if( s.count == 0 )
|
||||
document.getElementById("scantext").firstChild.nodeValue = "Nothing restored";
|
||||
else
|
||||
document.getElementById("scantext").firstChild.nodeValue = "Previous channel list restored";
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
else if( s.status == "busy" )
|
||||
|
||||
if( done )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = "";
|
||||
document.getElementById("scantext").firstChild.nodeValue = "BUSY";
|
||||
}
|
||||
else if( s.status == "done" )
|
||||
{
|
||||
document.getElementById("scancount").firstChild.nodeValue = s.count;
|
||||
document.getElementById("scantext").firstChild.nodeValue = "Channels found";
|
||||
DisableButtons(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.setTimeout(GetStatus,500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function InitiateScan()
|
||||
{
|
||||
DisableButtons(true);
|
||||
|
||||
var param = "";
|
||||
for(var i = 1; i < document.Cable.Select.options.length; i += 1)
|
||||
{
|
||||
@@ -188,6 +228,26 @@ function InitiateScan()
|
||||
}
|
||||
}
|
||||
|
||||
function PollStatus()
|
||||
{
|
||||
DisableButtons(true);
|
||||
GetStatus();
|
||||
}
|
||||
|
||||
function DeleteScan()
|
||||
{
|
||||
DisableButtons(true);
|
||||
ScanReq.open("GET", "/channelscan.lua?select=delete", true);
|
||||
ScanReq.send();
|
||||
}
|
||||
|
||||
function RestoreScan()
|
||||
{
|
||||
DisableButtons(true);
|
||||
ScanReq.open("GET", "/channelscan.lua?select=restore", true);
|
||||
ScanReq.send();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
@@ -257,7 +317,8 @@ function InitiateScan()
|
||||
<td> </td>
|
||||
<td style="text-align:right">
|
||||
<form action="">
|
||||
<input type="Button" value="Start Scan" onclick="InitiateScan()" >
|
||||
<input id="ScanButton" type="Button" value="Start Scan" onclick="InitiateScan()" >
|
||||
<input id="StatusButton" type="Button" value="Get Status" onclick="PollStatus()" >
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -269,6 +330,15 @@ function InitiateScan()
|
||||
<div id="scantext" style="text-align:left"> </div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td style="text-align:right">
|
||||
<form action="">
|
||||
<input id="DeleteButton" type="Button" value="Delete Scan" onclick="DeleteScan()" >
|
||||
<input id="RestoreButton" type="Button" value="Restore Previous Scan" onclick="RestoreScan()" >
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr/>
|
||||
|
||||
Reference in New Issue
Block a user