Mercurial > hg > webaudioevaluationtool
diff ape.js @ 23:c4c7ddaec6fc
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 | a87846fba882 |
children | b826d3640725 |
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; }