 var img_ajax_loader=UNIWITS.Toolbox.createElement('IMG'); var upgrade_xmlhr=null; var upgrade_url_set,upgrade_url_prefix='',upgrade_checkavailable_url=null; var upgrade_status='INIT'; var upgrade_url_set_reserv={ download: "qx-cmd-upgrade.download.html", test: "qx-cmd-upgrade.unpack-istest-1.html", unpack: "qx-cmd-upgrade.unpack.html", postprocess: "qx-cmd-upgrade.postprocess.html" }; var upgrade_url_set_login={ download: "upgrade.download", test: "upgrade.unpack?istest=1", unpack: "upgrade.unpack", postprocess: "upgrade.postprocess" }; function upgrade_start(loaderimg) { img_ajax_loader.src=loaderimg; $('optionpanel').style.display='none'; $('progresspanel').style.display=''; $('buttonpanel').style.display='none'; $('errorpanel').style.display='none'; $('errormessage').style.display='none'; $('step_downloading').className='normalinputBG'; $('step_testing').className='normalinputBG'; $('step_unpacking').className='normalinputBG'; $('step_postprocessing').className='normalinputBG'; $('step_complete').className='normalinputBG'; upgrade_status='RUNNING'; var avail='YES'; if (upgrade_checkavailable_url) upgrade_check_available(); else upgrade_download(); } function upgrade_error(xmlhr) { $('errorpanel').style.display=''; $('buttonpanel').style.display=''; $('errormessage').innerHTML=upgrade_xmlhr.status+' '+upgrade_xmlhr.responseText; img_ajax_loader.parentNode.removeChild(img_ajax_loader); upgrade_status='ERROR'; } function upgrade_check_available() { upgrade_xmlhr=UNIWITS.Toolbox.getXMLHttpRequest(upgrade_check_available_response); upgrade_xmlhr.open("GET",upgrade_checkavailable_url,true); upgrade_xmlhr.send(null); $('step_downloading').parentNode.insertBefore(img_ajax_loader,$('step_downloading').parentNode.firstChild); } function upgrade_check_available_response() { if (upgrade_xmlhr.readyState==4) if (upgrade_xmlhr.status==200) { img_ajax_loader.parentNode.removeChild(img_ajax_loader); if (upgrade_xmlhr.responseText!='NO') upgrade_download(); else upgrade_done(); } else upgrade_error(); } function upgrade_download() { upgrade_xmlhr=UNIWITS.Toolbox.getXMLHttpRequest(upgrade_download_response); upgrade_xmlhr.open("GET",upgrade_url_prefix+upgrade_url_set.download,true); upgrade_xmlhr.send(null); $('step_downloading').className='pagetitle'; $('step_downloading').appendChild(img_ajax_loader); } function upgrade_download_response() { if (upgrade_xmlhr.readyState==4) if (upgrade_xmlhr.status==200 && upgrade_xmlhr.responseText=='OK') { $('step_downloading').className='normalinputBG'; upgrade_test(); } else upgrade_error(); } function upgrade_test() { upgrade_xmlhr=UNIWITS.Toolbox.getXMLHttpRequest(upgrade_test_response); upgrade_xmlhr.open("GET",upgrade_url_prefix+upgrade_url_set.test,true); upgrade_xmlhr.send(null); $('step_testing').className='pagetitle'; $('step_testing').appendChild(img_ajax_loader); } function upgrade_test_response() { if (upgrade_xmlhr.readyState==4) if (upgrade_xmlhr.status==200 && upgrade_xmlhr.responseText=='OK') { $('step_testing').className='normalinputBG'; upgrade_unpack(); } else upgrade_error(); } function upgrade_unpack() { upgrade_xmlhr=UNIWITS.Toolbox.getXMLHttpRequest(upgrade_unpack_response); upgrade_xmlhr.open("GET",upgrade_url_prefix+upgrade_url_set.unpack,true); upgrade_xmlhr.send(null); $('step_unpacking').className='pagetitle'; $('step_unpacking').appendChild(img_ajax_loader); } function upgrade_unpack_response() { if (upgrade_xmlhr.readyState==4) if (upgrade_xmlhr.status==200 && upgrade_xmlhr.responseText=='OK') { $('step_unpacking').className='normalinputBG'; upgrade_postprocess(); } else upgrade_error(); } function upgrade_postprocess() { upgrade_xmlhr=UNIWITS.Toolbox.getXMLHttpRequest(upgrade_postprocess_response); upgrade_xmlhr.open("GET",upgrade_url_prefix+upgrade_url_set.postprocess,true); upgrade_xmlhr.send(null); $('step_postprocessing').className='pagetitle'; $('step_postprocessing').appendChild(img_ajax_loader); } function upgrade_postprocess_response() { if (upgrade_xmlhr.readyState==4) if (upgrade_xmlhr.status==200 && upgrade_xmlhr.responseText=='OK') { $('step_postprocessing').className='normalinputBG'; upgrade_done(); } else upgrade_error(); } function upgrade_done() { $('step_complete').className='pagetitle'; if (img_ajax_loader.parentNode) img_ajax_loader.parentNode.removeChild(img_ajax_loader); upgrade_status='DONE'; } 