Mercurial > hg > webaudioevaluationtool
comparison core.js @ 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 | c3666ac704ba |
comparison
equal
deleted
inserted
replaced
1270:aebb9754d491 | 1271:2dd5f7071e3f |
---|---|
414 var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml"); | 414 var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml"); |
415 var response = xmlDoc.getElementsByTagName('response')[0]; | 415 var response = xmlDoc.getElementsByTagName('response')[0]; |
416 if (response.getAttribute("state") == "OK") { | 416 if (response.getAttribute("state") == "OK") { |
417 var file = response.getElementsByTagName("file")[0]; | 417 var file = response.getElementsByTagName("file")[0]; |
418 console.log("Save: OK, written "+file.getAttribute("bytes")+"B"); | 418 console.log("Save: OK, written "+file.getAttribute("bytes")+"B"); |
419 popup.popupContent.textContent = "Thank you. Your session has been saved."; | 419 popup.popupContent.textContent = specification.exitText; |
420 } else { | 420 } else { |
421 var message = response.getElementsByTagName("message"); | 421 var message = response.getElementsByTagName("message"); |
422 console.log("Save: Error! "+message.textContent); | 422 console.log("Save: Error! "+message.textContent); |
423 createProjectSave("local"); | 423 createProjectSave("local"); |
424 } | 424 } |
1774 this.metrics = null; | 1774 this.metrics = null; |
1775 this.interfaces = null; | 1775 this.interfaces = null; |
1776 this.loudness = null; | 1776 this.loudness = null; |
1777 this.errors = []; | 1777 this.errors = []; |
1778 this.schema = null; | 1778 this.schema = null; |
1779 this.exitText = "Thank you."; | |
1779 | 1780 |
1780 this.processAttribute = function(attribute,schema,schemaRoot) | 1781 this.processAttribute = function(attribute,schema,schemaRoot) |
1781 { | 1782 { |
1782 // attribute is the string returned from getAttribute on the XML | 1783 // attribute is the string returned from getAttribute on the XML |
1783 // schema is the <xs:attribute> node | 1784 // schema is the <xs:attribute> node |
1842 eval('this.'+attributeName+' = "'+projectAttr+'"'); | 1843 eval('this.'+attributeName+' = "'+projectAttr+'"'); |
1843 break; | 1844 break; |
1844 } | 1845 } |
1845 | 1846 |
1846 } | 1847 } |
1848 | |
1849 var exitTextNode = setupNode.getElementsByTagName('exitText'); | |
1850 if (exitTextNode.length == 1) { | |
1851 this.exitText = exitTextNode[0].textContent; | |
1852 } | |
1847 | 1853 |
1848 this.metrics = new this.metricNode(); | 1854 this.metrics = new this.metricNode(); |
1849 | 1855 |
1850 this.metrics.decode(this,setupNode.getElementsByTagName('metric')[0]); | 1856 this.metrics.decode(this,setupNode.getElementsByTagName('metric')[0]); |
1851 | 1857 |
1915 eval("setup.setAttribute('"+name+"',this."+name+")"); | 1921 eval("setup.setAttribute('"+name+"',this."+name+")"); |
1916 } | 1922 } |
1917 } | 1923 } |
1918 root.appendChild(setup); | 1924 root.appendChild(setup); |
1919 // Survey node | 1925 // Survey node |
1926 if (this.exitText != null) { | |
1927 var exitTextNode = RootDocument.createElement('exitText'); | |
1928 exitTextNode.textContent = this.exitText; | |
1929 setup.appendChild(exitTextNode); | |
1930 } | |
1920 setup.appendChild(this.preTest.encode(RootDocument)); | 1931 setup.appendChild(this.preTest.encode(RootDocument)); |
1921 setup.appendChild(this.postTest.encode(RootDocument)); | 1932 setup.appendChild(this.postTest.encode(RootDocument)); |
1922 setup.appendChild(this.metrics.encode(RootDocument)); | 1933 setup.appendChild(this.metrics.encode(RootDocument)); |
1923 setup.appendChild(this.interfaces.encode(RootDocument)); | 1934 setup.appendChild(this.interfaces.encode(RootDocument)); |
1924 for (var page of this.pages) | 1935 for (var page of this.pages) |