# HG changeset patch # User Nicholas Jillings # Date 1457629690 0 # Node ID ba6b9e1aaef55b3b60965ce851b279694fa43b35 # Parent fbdfdcc07f3a2b7e2c723c111d6a6d1150383b6b# Parent f04d8ababef750902ec892a51b81e9042f9c2e52 Merge diff -r f04d8ababef7 -r ba6b9e1aaef5 core.js --- a/core.js Wed Mar 09 15:00:19 2016 +0000 +++ b/core.js Thu Mar 10 17:08:10 2016 +0000 @@ -220,12 +220,51 @@ } else if (responseDocument.children[0].nodeName == "waetresult") { // document is a result - projectXML = responseDocument.getElementsByTagName('waet')[0]; + projectXML = document.implementation.createDocument(null,"waet"); + projectXML.children[0].appendChild(responseDocument.getElementsByTagName('waet')[0].getElementsByTagName("setup")[0].cloneNode(true)); + var child = responseDocument.children[0].children[0]; + while (child != null) { + if (child.nodeName == "survey") { + // One of the global survey elements + if (child.getAttribute("state") == "complete") { + // We need to remove this survey from + var location = child.getAttribute("location"); + var globalSurveys = projectXML.getElementsByTagName("setup")[0].getElementsByTagName("survey")[0]; + while(globalSurveys != null) { + if (location == "pre" || location == "before") { + if (globalSurveys.getAttribute("location") == "pre" || globalSurveys.getAttribute("location") == "before") { + projectXML.getElementsByTagName("setup")[0].removeChild(globalSurveys); + break; + } + } else { + if (globalSurveys.getAttribute("location") == "post" || globalSurveys.getAttribute("location") == "after") { + projectXML.getElementsByTagName("setup")[0].removeChild(globalSurveys); + break; + } + } + globalSurveys = globalSurveys.nextElementSibling; + } + } else { + // We need to complete this, so it must be regenerated by store + var copy = child; + child = child.previousElementSibling; + responseDocument.children[0].removeChild(copy); + } + } else if (child.nodeName == "page") { + if (child.getAttribute("state") == "empty") { + // We need to complete this page + projectXML.children[0].appendChild(responseDocument.getElementById(child.getAttribute("ref")).cloneNode(true)); + var copy = child; + child = child.previousElementSibling; + responseDocument.children[0].removeChild(copy); + } + } + child = child.nextElementSibling; + } // Build the specification specification.decode(projectXML); - // Use the session-key - var sessionKey = responseDocument.children[0].getAttribute(key); - storage.initialise(sessionKey); + // Use the original + storage.initialise(responseDocument); } /// CHECK FOR SAMPLE RATE COMPATIBILITY if (specification.sampleRate != undefined) { @@ -334,16 +373,17 @@ popup.popupContent.appendChild(a); } else { var xmlhttp = new XMLHttpRequest; - xmlhttp.open("POST",destURL,true); + xmlhttp.open("POST","\save.php?key="+storage.SessionKey.key,true); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.onerror = function(){ console.log('Error saving file to server! Presenting download locally'); - createProjectSave(null); + createProjectSave("local"); }; xmlhttp.onload = function() { console.log(xmlhttp); if (this.status >= 300) { console.log("WARNING - Could not update at this time"); + createProjectSave("local"); } else { var parser = new DOMParser(); var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml"); @@ -716,6 +756,7 @@ { this.store.postResult(node); } + this.store.complete(); advanceState(); } }; @@ -922,6 +963,7 @@ element.exportXMLDOM(storePoint); } pageXMLSave(storePoint.XMLDOM, this.currentStateMap); + storePoint.complete(); }; } @@ -1175,7 +1217,7 @@ var aeNodes = this.pageStore.XMLDOM.getElementsByTagName('audioelement'); for (var i=0; iDesigning or building audio hardware - + This is an example of an 'AB'-style test, with two pages, using the test stimuli in 'example_eval/'. @@ -31,7 +31,7 @@ - + Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder. @@ -60,7 +60,7 @@ - + A two way comparison using randomised element order, automatic loudness and synchronised looping. @@ -83,7 +83,7 @@ - + A 7 way comparison using randomised element order and synchronised looping. diff -r f04d8ababef7 -r ba6b9e1aaef5 example_eval/mushra_example.xml --- a/example_eval/mushra_example.xml Wed Mar 09 15:00:19 2016 +0000 +++ b/example_eval/mushra_example.xml Thu Mar 10 17:08:10 2016 +0000 @@ -13,7 +13,7 @@ - + This is an example of an 'APE'-style test, with two pages, using the test stimuli in 'example_eval/'. @@ -31,7 +31,7 @@ - + Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder. @@ -71,7 +71,7 @@ - + Example of a 'MUSHRA' style interface with hidden anchor 'zero' (which needs to be below 20%), looping of the samples, randomisation of marker labels, mandatory moving of every sample, and a forced scale usage of at least 25%-75% using a Comparison Category Rating Scale. @@ -118,7 +118,7 @@ - + Example of a 'MUSHRA' style interface with hidden anchor 'zero' (which needs to be below 20%), looping of the samples, randomisation of marker labels, mandatory moving of every sample, and a forced scale usage of at least 25%-75%. diff -r f04d8ababef7 -r ba6b9e1aaef5 example_eval/project.xml --- a/example_eval/project.xml Wed Mar 09 15:00:19 2016 +0000 +++ b/example_eval/project.xml Thu Mar 10 17:08:10 2016 +0000 @@ -13,7 +13,7 @@ - + This is an example of an 'APE'-style test, with two pages, using the test stimuli in 'example_eval/'. @@ -31,7 +31,7 @@ - + Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder. @@ -76,7 +76,7 @@ - + Example of an 'APE' style interface with hidden anchor 'zero' (which needs to be below 20%), looping of the samples, randomisation of marker labels, mandatory moving of every sample, and a forced scale usage of at least 25%-75%. @@ -86,7 +86,7 @@ - + Comment on fragment Example Test Question @@ -123,7 +123,7 @@ - + Example of an 'APE' style interface with hidden anchor 'zero' (which needs to be below 20%), looping of the samples, randomisation of marker labels, mandatory moving of every sample, and a forced scale usage of at least 25%-75%. diff -r f04d8ababef7 -r ba6b9e1aaef5 interfaces/AB.js --- a/interfaces/AB.js Wed Mar 09 15:00:19 2016 +0000 +++ b/interfaces/AB.js Thu Mar 10 17:08:10 2016 +0000 @@ -308,7 +308,22 @@ console.log("WARNING - AB cannot have fixed reference"); } var audioObject = audioEngineContext.newTrack(element); - var node = new this.comparatorBox(audioObject,index,String.fromCharCode(65 + index)); + var label; + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "number": + label = ""+index; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + default: + label = String.fromCharCode(65 + index); + break; + } + var node = new this.comparatorBox(audioObject,index,label); audioObject.bindInterface(node); this.comparators.push(node); this.boxHolders.appendChild(node.box); diff -r f04d8ababef7 -r ba6b9e1aaef5 interfaces/ape.css --- a/interfaces/ape.css Wed Mar 09 15:00:19 2016 +0000 +++ b/interfaces/ape.css Thu Mar 10 17:08:10 2016 +0000 @@ -64,6 +64,7 @@ -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; + border: 1px solid black; } div.outside-reference { diff -r f04d8ababef7 -r ba6b9e1aaef5 interfaces/ape.js --- a/interfaces/ape.js Wed Mar 09 15:00:19 2016 +0000 +++ b/interfaces/ape.js Thu Mar 10 17:08:10 2016 +0000 @@ -239,7 +239,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; // Append the interface buttons into the interfaceButtons object. @@ -535,7 +535,22 @@ this.canvas.appendChild(trackObj); this.sliders.push(trackObj); this.metrics.push(new metricTracker(this)); - trackObj.innerHTML = ''+(this.metrics.length-1)+''; + var label = document.createElement("label"); + switch(audioObject.specification.parent.label) { + case "letter": + label.textContent = String.fromCharCode(97 + this.metrics.length-1); + break; + case "capital": + label.textContent = String.fromCharCode(65 + this.metrics.length-1); + break; + case "none": + label.textContent = ""; + break; + default: + label.textContent = ""+this.metrics.length; + break; + } + trackObj.appendChild(label); this.metrics[this.metrics.length-1].initialise(convSliderPosToRate(trackObj)); return trackObj; }; diff -r f04d8ababef7 -r ba6b9e1aaef5 interfaces/discrete.js --- a/interfaces/discrete.js Wed Mar 09 15:00:19 2016 +0000 +++ b/interfaces/discrete.js Thu Mar 10 17:08:10 2016 +0000 @@ -55,7 +55,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; submit.style.float = 'left'; @@ -184,7 +184,7 @@ }); // Find all the audioElements from the audioHolder - var label = 0; + var index = 0; var interfaceScales = testState.currentStateMap.interfaces[0].scales; $(page.audioElements).each(function(index,element){ // Find URL of track @@ -198,11 +198,25 @@ audioObject.bindInterface(orNode); } else { // Create a slider per track + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + case "capital": + label = String.fromCharCode(65 + index); + break; + default: + label = ""+index; + break; + } var sliderObj = new discreteObject(audioObject,label,interfaceScales); sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); interfaceContext.commentBoxes.createCommentBox(audioObject); - label += 1; + index += 1; } }); diff -r f04d8ababef7 -r ba6b9e1aaef5 interfaces/horizontal-sliders.js --- a/interfaces/horizontal-sliders.js Wed Mar 09 15:00:19 2016 +0000 +++ b/interfaces/horizontal-sliders.js Thu Mar 10 17:08:10 2016 +0000 @@ -55,7 +55,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; submit.style.float = 'left'; @@ -185,7 +185,7 @@ }); // Find all the audioElements from the audioHolder - var label = 0; + var index = 0; $(page.audioElements).each(function(index,element){ // Find URL of track // In this jQuery loop, variable 'this' holds the current audioElement. @@ -198,6 +198,20 @@ audioObject.bindInterface(orNode); } else { // Create a slider per track + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + case "capital": + label = String.fromCharCode(65 + index); + break; + default: + label = ""+index; + break; + } var sliderObj = new sliderObject(audioObject,label); if (typeof page.initialPosition === "number") @@ -211,7 +225,7 @@ sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); interfaceContext.commentBoxes.createCommentBox(audioObject); - label += 1; + index += 1; } }); diff -r f04d8ababef7 -r ba6b9e1aaef5 interfaces/mushra.js --- a/interfaces/mushra.js Wed Mar 09 15:00:19 2016 +0000 +++ b/interfaces/mushra.js Thu Mar 10 17:08:10 2016 +0000 @@ -61,7 +61,7 @@ }; // Create Submit (save) button var submit = document.createElement("button"); - submit.innerHTML = 'Submit'; + submit.innerHTML = 'Next'; submit.onclick = buttonSubmitClick; submit.id = 'submit-button'; submit.style.float = 'left'; @@ -183,7 +183,7 @@ currentTestHolder.repeatCount = audioHolderObject.repeatCount; // Find all the audioElements from the audioHolder - var label = 0; + var index = 0; $(audioHolderObject.audioElements).each(function(index,element){ // Find URL of track // In this jQuery loop, variable 'this' holds the current audioElement. @@ -196,6 +196,20 @@ audioObject.bindInterface(orNode); } else { // Create a slider per track + switch(audioObject.specification.parent.label) { + case "none": + label = ""; + break; + case "letter": + label = String.fromCharCode(97 + index); + break; + case "capital": + label = String.fromCharCode(65 + index); + break; + default: + label = ""+index; + break; + } var sliderObj = new sliderObject(audioObject,label); if (typeof audioHolderObject.initialPosition === "number") @@ -209,7 +223,7 @@ sliderBox.appendChild(sliderObj.holder); audioObject.bindInterface(sliderObj); interfaceContext.commentBoxes.createCommentBox(audioObject); - label += 1; + index += 1; } }); diff -r f04d8ababef7 -r ba6b9e1aaef5 save.php --- a/save.php Wed Mar 09 15:00:19 2016 +0000 +++ b/save.php Thu Mar 10 17:08:10 2016 +0000 @@ -1,11 +1,5 @@ Could not write file "saves/'.$xmlfile.'"'; + $xml = 'Could not write file "'.$filename.'"'; echo $xml; return; } fclose($fileHandle); - // Return JSON confirmation data - $xml = 'OK"saves/'.$xmlfile.'"'; + // Return XML confirmation data + $xml = 'OK"'.$filename.'"'; echo $xml; -?> +?> \ No newline at end of file diff -r f04d8ababef7 -r ba6b9e1aaef5 test-schema.xsd --- a/test-schema.xsd Wed Mar 09 15:00:19 2016 +0000 +++ b/test-schema.xsd Thu Mar 10 17:08:10 2016 +0000 @@ -9,6 +9,21 @@ + + + + + + + + + + + + + + + @@ -23,6 +38,7 @@ + @@ -33,6 +49,9 @@ + + + @@ -51,8 +70,22 @@ + + + + + + + + + + + + + + @@ -136,6 +169,8 @@ + +