1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 13:36:52 +02:00
octonet/octoserve/var/www/doupdate.html

175 lines
4.5 KiB
HTML
Raw Normal View History

2015-08-05 22:22:06 +02:00
<!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">
<!-- Add page scripts here -->
<script type="text/javascript">
WaitCounter = 30;
UpdateError = false;
isReboot = false;
2015-08-05 22:22:06 +02:00
function FWVersion(fwdate)
{
// Jahr, Monat, Tag, Stunden, Minuten
// date = new Date("20"+fwdate.substr(0,2),fwdate.substr(2,2)-1,fwdate.substr(4,2),fwdate.substr(6,2),fwdate.substr(8,2),"0");
date = new Date(1);
date.setUTCDate(fwdate.substr(4,2));
date.setUTCFullYear("20"+fwdate.substr(0,2));
date.setUTCMonth(fwdate.substr(2,2)-1);
date.setUTCHours(fwdate.substr(6,2));
date.setUTCMinutes(fwdate.substr(8,2));
ds = date.toGMTString();
return ds.substring(5,ds.length-7);
}
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4 )
{
if ( xmlhttp.status == 200)
{
myFunction(xmlhttp.responseText);
}
isChecking = false;
}
}
function Request(url)
2015-08-05 22:22:06 +02:00
{
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
2015-08-05 22:22:06 +02:00
function myFunction(response) {
if( isReboot ) return;
var UpdateStatus = JSON.parse(response);
if( UpdateStatus.Error )
{
document.getElementById("UpdateButton").disabled = false;
document.getElementById("UpdateButton").value = "Continue";
document.getElementById("updatestatus").firstChild.nodeValue = UpdateStatus.Status;
UpdateError = true;
}
else if( UpdateStatus.Status == "Started" )
{
window.setTimeout(RequestStatus,250);
}
else if( UpdateStatus.Status == "VerifyDone" )
{
document.getElementById("UpdateButton").disabled = false;
document.getElementById("UpdateButton").value = "Reboot";
document.getElementById("updatestatus").firstChild.nodeValue = "";
}
else if( UpdateStatus.Status == "DownloadDone" )
{
document.getElementById("updatestatus").firstChild.nodeValue = "***** Verifying ******";
window.setTimeout(RequestStatus,250);
}
else if( UpdateStatus.Status == "CheckDone" )
{
document.getElementById("updatestatus").firstChild.nodeValue = "***** Downloading ******";
window.setTimeout(RequestStatus,250);
}
else
window.setTimeout(RequestStatus,250);
}
function RequestStatus()
{
xmlhttp.open("GET", "/update.lua?updatestatus", true);
xmlhttp.send();
2015-08-05 22:22:06 +02:00
}
function DoUpdate()
{
CheckDone = false;
document.getElementById("updatestatus").firstChild.nodeValue = "***** Checking ******";
Request("/update.lua?update");
2015-08-05 22:22:06 +02:00
}
function Reboot()
{
document.getElementById("UpdateButton").disabled = true;
if( UpdateError )
{
location.replace('/index.html');
}
else
{
isReboot = true;
Request("/reboot.lua?sjiwjsiowjs");
2015-08-05 22:22:06 +02:00
WaitCounter = 70;
document.getElementById("updatestatus").firstChild.nodeValue = WaitCounter;
window.setTimeout(Wait,1000);
}
}
function Wait()
{
document.getElementById("updatestatus").firstChild.nodeValue = WaitCounter;
if( WaitCounter == 0 )
{
location.replace('/index.html');
}
else
{
WaitCounter = WaitCounter - 1;
window.setTimeout(Wait,1000);
}
}
</script>
</head>
<body onload="DoUpdate()">
<table class="maintable" align="center">
<colgroup>
<col width="182px"/>
<col width="728px"/>
</colgroup>
<tr><td class="maintd" colspan="2">
<img src="/BannerDD.jpg" alt="DD" width="910" height="130" />
</td></tr>
<tr><td class="maintd" colspan="2">&nbsp;</td></tr>
<tr>
<td class="maintd"></td>
<td class="content">
<div>
<!-- Begin Content -->
<h1 align="center">DO NOT TURN THE DEVICE OFF</h1>
<table class="table" align="center">
<tr>
<td id="updatestatus">&nbsp;&nbsp;</td>
</tr>
<tr>
<td>
<form action="">
<input id="UpdateButton" type="Button" value="Continue" disabled="true" onclick="Reboot()" />
</form>
</td>
<tr>
</table>
<!-- End Content -->
</div>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
</table>
</body>
</html>