# HG changeset patch # User Nicholas Jillings # Date 1428572653 -3600 # Node ID f5de8699e2b6bd4cb13f88cc8795564c8c1b7162 # Parent 542c613e31d675752cf7708f9938364c4b84334b Completed Linking for pre-Test questions. Need some formatting on layout. diff -r 542c613e31d6 -r f5de8699e2b6 ape.js --- a/ape.js Thu Apr 09 10:10:21 2015 +0100 +++ b/ape.js Thu Apr 09 10:44:13 2015 +0100 @@ -231,8 +231,10 @@ preTestOption.innerHTML = ''+child.innerHTML+''; } else if (child.nodeName == 'question') { + var questionId = child.attributes['id'].value; var textHold = document.createElement('span'); textHold.innerHTML = child.innerHTML; + textHold.id = questionId + 'response'; var textEnter = document.createElement('textarea'); preTestOption.appendChild(textHold); preTestOption.appendChild(textEnter); @@ -247,6 +249,15 @@ nextButton.onclick = function() { // Need to find and parse preTest again! var preTest = projectXML.find('PreTest')[0]; + // Check if current state is a question! + if (preTest.children[this.value-1].nodeName == 'question') { + var questionId = preTest.children[this.value-1].attributes['id'].value; + var questionHold = document.createElement('comment'); + var questionResponse = document.getElementById(questionId + 'response'); + questionHold.id = questionId; + questionHold.innerHTML = questionResponse.value; + preTestQuestions.appendChild(questionHold); + } if (this.value < preTest.children.length) { // More to process @@ -259,7 +270,8 @@ var textHold = document.createElement('span'); textHold.innerHTML = child.innerHTML; var textEnter = document.createElement('textarea'); - preTestOption.innerHTML = 'null'; + textEnter.id = child.attributes['id'].value + 'response'; + preTestOption.innerHTML = null; preTestOption.appendChild(textHold); preTestOption.appendChild(textEnter); } @@ -317,6 +329,10 @@ xmlDoc.appendChild(trackObj); } + // Append Pre/Post Questions + xmlDoc.appendChild(preTestQuestions); + xmlDoc.appendChild(postTestQuestions); + return xmlDoc; } diff -r 542c613e31d6 -r f5de8699e2b6 core.js --- a/core.js Thu Apr 09 10:10:21 2015 +0100 +++ b/core.js Thu Apr 09 10:44:13 2015 +0100 @@ -10,6 +10,8 @@ var projectXML; var audioEngineContext; var projectReturn; +var preTestQuestions = document.createElement('PreTest'); +var postTestQuestions = document.createElement('PostTest'); window.onload = function() { // Function called once the browser has loaded all files. diff -r 542c613e31d6 -r f5de8699e2b6 docs/ProjectSpecificationDocument.tex --- a/docs/ProjectSpecificationDocument.tex Thu Apr 09 10:10:21 2015 +0100 +++ b/docs/ProjectSpecificationDocument.tex Thu Apr 09 10:44:13 2015 +0100 @@ -88,7 +88,7 @@ \subsubsection{Question} -This allows for a question to be asked pre/post the test. This is added to the response XML in the same location as the other common/global questions. The response includes both the question asked and the response. The optional attribute 'mandatory' defines whether the question can be blank or not, default is for optional. If mandatory, the next button is not available until something is entered. +This allows for a question to be asked pre/post the test. This is added to the response XML in the same location as the other common/global questions. The response includes both the question asked and the response. This takes two attributes, id and mandatory. ID is a mandatory field. The same ID will be used in the results so it is important it is properly entered. Mandatory is optional. True means the field must be entered before continuing. \subsubsection{Resource} diff -r 542c613e31d6 -r f5de8699e2b6 example_eval/project.xml --- a/example_eval/project.xml Thu Apr 09 10:10:21 2015 +0100 +++ b/example_eval/project.xml Thu Apr 09 10:44:13 2015 +0100 @@ -17,10 +17,10 @@ What is your mixing experiance Please listen to all mixes - Please enter your listening location + Please enter your listening location Thank you for taking this listening test. - Please enter your name. + Please enter your name. \ No newline at end of file