Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2733:f2bb15d5f5c9
#144 #190. Better handling of 'completed' tags in <page> and <waetresult> nodes.
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Wed, 19 Apr 2017 10:58:33 +0100 |
parents | a13adc8f8d3d |
children | 9d31ddedae2b |
comparison
equal
deleted
inserted
replaced
2732:d999a8fc26ea | 2733:f2bb15d5f5c9 |
---|---|
387 // Clear the window.onbeforeunload | 387 // Clear the window.onbeforeunload |
388 window.onbeforeunload = null; | 388 window.onbeforeunload = null; |
389 // Save the data from interface into XML and send to destURL | 389 // Save the data from interface into XML and send to destURL |
390 // If destURL is null then download XML in client | 390 // If destURL is null then download XML in client |
391 // Now time to render file locally | 391 // Now time to render file locally |
392 var xmlDoc = interfaceXMLSave(); | 392 var xmlDoc = storage.finish(); |
393 var parent = document.createElement("div"); | 393 var parent = document.createElement("div"); |
394 parent.appendChild(xmlDoc); | 394 parent.appendChild(xmlDoc); |
395 var file = [parent.innerHTML]; | 395 var file = [parent.innerHTML]; |
396 if (destURL == "local") { | 396 if (destURL == "local") { |
397 var bb = new Blob(file, { | 397 var bb = new Blob(file, { |
3391 this.globalPostTest = null; | 3391 this.globalPostTest = null; |
3392 this.testPages = []; | 3392 this.testPages = []; |
3393 this.document = null; | 3393 this.document = null; |
3394 this.root = null; | 3394 this.root = null; |
3395 this.state = 0; | 3395 this.state = 0; |
3396 var pFilenamePrefix = ""; | 3396 var pFilenamePrefix = "save"; |
3397 | 3397 |
3398 this.initialise = function (existingStore) { | 3398 this.initialise = function (existingStore) { |
3399 if (existingStore === undefined) { | 3399 if (existingStore === undefined) { |
3400 // We need to get the sessionKey | 3400 // We need to get the sessionKey |
3401 this.SessionKey.requestKey(); | 3401 this.SessionKey.requestKey(); |
3502 // Final upload to complete the test | 3502 // Final upload to complete the test |
3503 this.parent.finish(); | 3503 this.parent.finish(); |
3504 var hold = document.createElement("div"); | 3504 var hold = document.createElement("div"); |
3505 var clone = this.parent.root.cloneNode(true); | 3505 var clone = this.parent.root.cloneNode(true); |
3506 hold.appendChild(clone); | 3506 hold.appendChild(clone); |
3507 var saveURL = specification.returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix="; | |
3508 if (this.parent.filenamePrefix.length == 0) { | |
3509 saveURL += "save"; | |
3510 } else { | |
3511 saveURL += this.parent.filenamePrefix; | |
3512 } | |
3507 return new Promise(function (resolve, reject) { | 3513 return new Promise(function (resolve, reject) { |
3508 var saveURL = specification.returnURL + "php/save.php?key=" + this.key + "&saveFilenamePrefix=" + this.parent.filenamePrefix; | |
3509 var xmlhttp = new XMLHttpRequest(); | 3514 var xmlhttp = new XMLHttpRequest(); |
3510 xmlhttp.open("POST", saveURL); | 3515 xmlhttp.open("POST", saveURL); |
3511 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); | 3516 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); |
3512 xmlhttp.onerror = function () { | 3517 xmlhttp.onerror = function () { |
3513 console.log('Error updating file to server!'); | 3518 console.log('Error updating file to server!'); |