Mercurial > hg > webaudioevaluationtool
changeset 1271:2dd5f7071e3f
Implemented Bug/Feature #1649. Edit the exit text by modifying <exitText>, see mushra_example.xml for example.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Tue, 22 Mar 2016 13:44:59 +0000 |
parents | aebb9754d491 |
children | 6798b5afa2c9 |
files | core.js example_eval/mushra_example.xml test_create/test_core.js test_create/test_create.html |
diffstat | 4 files changed, 47 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Tue Mar 22 12:35:48 2016 +0000 +++ b/core.js Tue Mar 22 13:44:59 2016 +0000 @@ -416,7 +416,7 @@ if (response.getAttribute("state") == "OK") { var file = response.getElementsByTagName("file")[0]; console.log("Save: OK, written "+file.getAttribute("bytes")+"B"); - popup.popupContent.textContent = "Thank you. Your session has been saved."; + popup.popupContent.textContent = specification.exitText; } else { var message = response.getElementsByTagName("message"); console.log("Save: Error! "+message.textContent); @@ -1776,6 +1776,7 @@ this.loudness = null; this.errors = []; this.schema = null; + this.exitText = "Thank you."; this.processAttribute = function(attribute,schema,schemaRoot) { @@ -1844,6 +1845,11 @@ } } + + var exitTextNode = setupNode.getElementsByTagName('exitText'); + if (exitTextNode.length == 1) { + this.exitText = exitTextNode[0].textContent; + } this.metrics = new this.metricNode(); @@ -1917,6 +1923,11 @@ } root.appendChild(setup); // Survey node + if (this.exitText != null) { + var exitTextNode = RootDocument.createElement('exitText'); + exitTextNode.textContent = this.exitText; + setup.appendChild(exitTextNode); + } setup.appendChild(this.preTest.encode(RootDocument)); setup.appendChild(this.postTest.encode(RootDocument)); setup.appendChild(this.metrics.encode(RootDocument));
--- a/example_eval/mushra_example.xml Tue Mar 22 12:35:48 2016 +0000 +++ b/example_eval/mushra_example.xml Tue Mar 22 13:44:59 2016 +0000 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd"> <setup interface="MUSHRA" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100"> + <exitText>Thank you for looking at WAET. You can modify the successful completion text as well!</exitText> <survey location="before"> <surveyentry type="question" id="sessionId" mandatory="true"> <statement>Please enter your name.</statement>
--- a/test_create/test_core.js Tue Mar 22 12:35:48 2016 +0000 +++ b/test_create/test_core.js Tue Mar 22 13:44:59 2016 +0000 @@ -1336,6 +1336,29 @@ this.setupDOM.attributes.push(attrObject); } + // Build the exit Text node + var exitText = new this.createGeneralNodeDOM("Exit Text","exit-test",this.setupDOM); + exitText.rootDOM.removeChild(exitText.attributeDOM); + this.setupDOM.children.push(exitText); + this.setupDOM.childrenDOM.appendChild(exitText.rootDOM); + var obj = { + rootDOM: document.createElement("div"), + labelDOM: document.createElement("label"), + inputDOM: document.createElement("textarea"), + parent: exitText, + specification: specification, + handleEvent: function(event) { + this.specification.exitText = this.inputDOM.value; + } + } + obj.rootDOM.appendChild(obj.labelDOM); + obj.rootDOM.appendChild(obj.inputDOM); + obj.labelDOM.textContent = "Text: "; + obj.inputDOM.value = obj.specification.exitText; + obj.inputDOM.addEventListener("change",obj); + exitText.children.push(obj); + exitText.childrenDOM.appendChild(obj.rootDOM); + // Now we must build the interface Node this.interfaceDOM = new this.interfaceNode(this,specification.interfaces); this.interfaceDOM.build("Interface","setup-interface",this.setupDOM.rootDOM);
--- a/test_create/test_create.html Tue Mar 22 12:35:48 2016 +0000 +++ b/test_create/test_create.html Tue Mar 22 13:44:59 2016 +0000 @@ -19,6 +19,7 @@ this.loudness = null; this.errors = []; this.schema = null; + this.exitText = "Thank you."; this.processAttribute = function(attribute,schema,schemaRoot) { @@ -88,6 +89,11 @@ } + var exitTextNode = setupNode.getElementsByTagName('exitText'); + if (exitTextNode.length == 1) { + this.exitText = exitTextNode[0].textContent; + } + this.metrics = new this.metricNode(); this.metrics.decode(this,setupNode.getElementsByTagName('metric')[0]); @@ -160,6 +166,11 @@ } root.appendChild(setup); // Survey node + if (this.exitText != null) { + var exitTextNode = RootDocument.createElement('exitText'); + exitTextNode.textContent = this.exitText; + setup.appendChild(exitTextNode); + } setup.appendChild(this.preTest.encode(RootDocument)); setup.appendChild(this.postTest.encode(RootDocument)); setup.appendChild(this.metrics.encode(RootDocument));