Mercurial > hg > webaudioevaluationtool
changeset 2303:e4a2a39838db
Implementation for #38 in master
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 28 Apr 2016 10:13:20 +0100 |
parents | f7604317ac27 |
children | b74241682c17 064b99859511 |
files | js/core.js js/specification.js test_create/attributes.json tests/examples/radio_example.xml xml/test-schema.xsd |
diffstat | 5 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/js/core.js Thu Apr 28 09:57:21 2016 +0100 +++ b/js/core.js Thu Apr 28 10:13:20 2016 +0100 @@ -430,9 +430,14 @@ var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml"); var response = xmlDoc.getElementsByTagName('response')[0]; if (response.getAttribute("state") == "OK") { + window.onbeforeunload = undefined; var file = response.getElementsByTagName("file")[0]; console.log("Save: OK, written "+file.getAttribute("bytes")+"B"); - popup.popupContent.textContent = specification.exitText; + if (typeof specification.returnURL == "string") { + window.location = returnURL; + } else { + popup.popupContent.textContent = specification.exitText; + } } else { var message = response.getElementsByTagName("message"); console.log("Save: Error! "+message.textContent);
--- a/js/specification.js Thu Apr 28 09:57:21 2016 +0100 +++ b/js/specification.js Thu Apr 28 10:13:20 2016 +0100 @@ -2,7 +2,8 @@ // Handles the decoding of the project specification XML into a simple JavaScript Object. this.interface = null; - this.projectReturn = "null"; + this.projectReturn = null; + this.returnURL = null; this.randomiseOrder = null; this.testPages = null; this.pages = [];
--- a/test_create/attributes.json Thu Apr 28 09:57:21 2016 +0100 +++ b/test_create/attributes.json Thu Apr 28 10:13:20 2016 +0100 @@ -3,7 +3,8 @@ "mandatory": "Mandatory", "name": "Name", "interface": "Interface Module", - "projectReturn": "Save URL", + "projectReturn": "Save Return URL", + "returnURL": "On complete redirect URL", "randomiseOrder": "Randomise Order", "testPages": "Test Pages", "loudness": "Target Loudness (LUFS)",
--- a/tests/examples/radio_example.xml Thu Apr 28 09:57:21 2016 +0100 +++ b/tests/examples/radio_example.xml Thu Apr 28 10:13:20 2016 +0100 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd"> - <setup interface="likert" projectReturn="save.php" crossFade="3.0"> + <setup interface="likert" projectReturn="save.php" crossFade="3.0"> <metric> <metricenable>testTimer</metricenable> <metricenable>elementTimer</metricenable>
--- a/xml/test-schema.xsd Thu Apr 28 09:57:21 2016 +0100 +++ b/xml/test-schema.xsd Thu Apr 28 10:13:20 2016 +0100 @@ -47,6 +47,7 @@ </xs:sequence> <xs:attribute name="interface" type="xs:string" use="required" /> <xs:attribute name="projectReturn" type="xs:string" use="optional" default="" /> + <xs:attribute name="returnURL" type="xs:string" use="optional" default="" /> <xs:attribute name="randomiseOrder" type="xs:boolean" default="false" /> <xs:attribute ref="poolSize" /> <xs:attribute name="loudness" type="xs:nonPositiveInteger" use="optional" />