Spark Webserver
submitResult();
Upgrade TypeApp
Folder
Browser
AppDatabaseKernelU-Boot
Current
New
Please make sure the upgrade package has been upload to STB by FTP!
0%
OK
var interVal;
var bOkInfoWindDisplay = false;
var bFileListWindDisplay = false;
function saveInfoShow(info){
$('#okInfo').text(info);
$('#ok').focus();
$('#infoOk').show();
bOkInfoWindDisplay = true;
}
$(document).ready(function(){
closeFileList();
$('#infoOk').hide();
//$('#upgrade_title').hide();
$('#progress_bar').hide();
bOkInfoWindDisplay = false;
$('#upgrade').hide();
// saveInfoShow("Upgrade failed: STBID unmatch!");
//okInfo hide
$('#ok').click(function(){
$('#infoOk').hide();
bOkInfoWindDisplay = false;
});
$.getJSON('./json/get_upgrade_info', function(data){
var temp;
var val = data.current.app;
if (val == undefined)
{
val = "";
}
$('#cur_app').text(val);
val = data.current.db;
if (val == undefined)
{
val = "";
}
$('#cur_database').text(val);
val = data.current.kernel;
if (val == undefined)
{
val = "";
}
$('#cur_kernel').text(val);
val = data.current.uboot;
if (val == undefined)
{
val = "";
}
$('#cur_uboot').text(val);
val = data.newVersion.app;
if (val == undefined)
{
val = "";
}
$('#new_app').text(val);
val = data.newVersion.db;
if (val == undefined)
{
val = "";
}
$('#new_database').text(val);
val = data.newVersion.kernel;
if (val == undefined)
{
val = "";
}
$('#new_kernel').text(val);
val = data.newVersion.uboot;
if (val == undefined)
{
val = "";
}
$('#new_uboot').text(val);
$('#percent_str').text(data.upgrade.progress + "%");
$('#light').css("width", (data.upgrade.progress * 936 / 100) + "px");
});
$(document).keydown(function(event)
{
event.preventDefault();
switch(event.keyCode)
{
case 13: // enter /ok
{
if(bOkInfoWindDisplay)
{
$('#infoOk').hide();
bOkInfoWindDisplay = false;
}
}
break;
case 5: //menu
case 27: // exit
{
if(bFileListWindDisplay)
{
closeFileList();
}
break;
}
default:
{
break;
}
}
});
});
function freshPage()
{
$.getJSON('./json/get_upgrade_info', function(data){
if (3 == data.upgrade.status)
{
if (0 == data.upgrade.code)
{
saveInfoShow("Upgrade success.");
return;
}
else if (2 == data.upgrade.code)
{
saveInfoShow("Upgrade failed: STBID unmatch!")
}
else if (3 == data.upgrade.code)
{
saveInfoShow("Upgrade failed: Upgrade package error!")
}
else if (4 == data.upgrade.code)
{
saveInfoShow("Upgrade failed: Incompatible version of database and app!")
}
else
{
saveInfoShow("Upgrade failed.")
}
//$('#upgrade_title').hide();
$('#upgrade_title').text("Please make sure the upgrade package has been upload to STB by FTP!");
$('#progress_bar').hide();
$('#back').show();
$('#home').show();
$('#check').show();
clearInterval(interVal);
return;
}
$('#upgrade_title').text(data.upgrade.title);
$('#percent_str').text(data.upgrade.progress + "%");
$('#light').css("width", (data.upgrade.progress * 936 / 100) + "px");
});
}
function upgradeStart()
{
$.getJSON('./json/get_upgrade_info?start=1', function(data){
if (data.error != undefined)
{
saveInfoShow(data.error.message);
}
else
{
$('#upgrade_title').text(data.upgrade.title);
$('#percent_str').text(data.upgrade.progress + "%");
$('#light').css("width", (data.upgrade.progress * 936 / 100) + "px");
$('#upgrade_title').show();
$('#progress_bar').show();
$('#back').hide();
$('#home').hide();
$('#upgrade').hide();
$('#check').hide();
interVal = setInterval("freshPage()", 1000);
}
});
}
function upgradeCheckPath()
{
var api = "./json/get_upgrade_info?path=" + document.getElementById("file_path").value;
$.getJSON(api, function(data){
var val = data.error;
if (val != undefined)
{
$('#upgrade').hide();
saveInfoShow(data.error.message);
return;
}
else
{
val = data.newVersion.app;
if (val != undefined)
{
$('#new_app').text(val);
}
else
{
$('#new_app').text("-----");
}
val = data.newVersion.db;
if (val != undefined)
{
$('#new_database').text(val);
}
else
{
$('#new_database').text("-----");
}
val = data.newVersion.kernel;
if (val != undefined)
{
$('#new_kernel').text(val);
}
else
{
$('#new_kernel').text("-----");
}
val = data.newVersion.uboot;
if (val != undefined)
{
$('#new_uboot').text(val);
}
else
{
$('#new_uboot').text("-----");
}
if (0 == data.upgrade.code)
{
$('#upgrade').show();
}
}
});
}
var gFileListData;
function showFileList(start, end)
{
var strHtml= "";
var i = start;
$("#filelist").empty();
strHtml += "";
for (; i < end; i++)
{
strHtml += " ";
strHtml += gFileListData.data[i].name;
strHtml += "";
}
strHtml += "";
$("#filelist").html(strHtml);
}
function entryNextDir(index)
{
var api = "init";
if (index < 0)
{
api = "./json/get_file_list";
}
else if (index < gFileListData.number)
{
if (gFileListData.data[index].is_dir != 0)
{
api = "./json/get_file_list?op=1&idx=" + index;
}
else
{
closeFileList();
$('#file_path').val(gFileListData.current_path + "/" + gFileListData.data[index].name);
upgradeCheckPath();
return;
}
}
else
{
alert(gFileListData.number);
closeFileList();
return;
}
$.getJSON(api, function(data){
gFileListData = data;
showFileList(0, gFileListData.number);
});
}
function openFileList()
{
if (bFileListWindDisplay)
{
closeFileList();
return;
}
$('#filelist').show();
entryNextDir(-1);
bFileListWindDisplay = true;
}
function closeFileList()
{
$('#filelist').hide();
bFileListWindDisplay = false;
}
function showabc(start, end)
{
var strHtml= "";
var i = start;
$("#filelist").empty();
strHtml += "";
for (; i < end; i++)
{
strHtml += " ";
strHtml += "name";
strHtml += "";
}
strHtml += "";
$("#filelist").html(strHtml);
}
Wyszukiwarka
Podobne podstrony:
Audio system upgrades BMW E39 ENGwylaczenie aktualizacji systemu XPEV (Electric Vehicle) and Hybrid Drive Systemssystem ósemkowyANALIZA KOMPUTEROWA SYSTEMÓW POMIAROWYCH — MSEInstalacja systemu Windows z pendrive aMIERNICTWO I SYSTEMY POMIAROWE I0 04 2012 OiORola laboratoriów w świetle wymagań systemów zarządzania jakosciąRozdział 04 System obsługi przerwań sprzętowychwięcej podobnych podstron