# HG changeset patch # User Nicholas Jillings # Date 1428572653 -3600 # Node ID c4c7ddaec6fc05e59e789a026f21e6bdfe48bf65 # Parent a87846fba882548bbf12d7a52af458a4dd2c6bb3 Completed Linking for pre-Test questions. Need some formatting on layout. diff -r a87846fba882 -r c4c7ddaec6fc 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 a87846fba882 -r c4c7ddaec6fc 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 a87846fba882 -r c4c7ddaec6fc 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 a87846fba882 -r c4c7ddaec6fc 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