Mercurial > hg > webaudioevaluationtool
changeset 707:f5de8699e2b6
Completed Linking for pre-Test questions. Need some formatting on layout.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 09 Apr 2015 10:44:13 +0100 |
parents | 542c613e31d6 |
children | 8fd1f946f84e |
files | ape.js core.js docs/ProjectSpecificationDocument.tex example_eval/project.xml |
diffstat | 4 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 = '<span>'+child.innerHTML+'</span>'; } 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; }
--- 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.
--- 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}
--- 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 @@ <CommentQuestion>What is your mixing experiance</CommentQuestion> <PreTest> <statement>Please listen to all mixes</statement> - <question>Please enter your listening location</question> + <question id="location" mandatory="true">Please enter your listening location</question> </PreTest> <PostTest> <statement>Thank you for taking this listening test.</statement> - <question>Please enter your name.</question> + <question id="SessionID">Please enter your name.</question> </PostTest> </BrowserEvalProjectDocument> \ No newline at end of file