Mercurial > hg > webaudioevaluationtool
comparison ape.js @ 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 |
comparison
equal
deleted
inserted
replaced
706:542c613e31d6 | 707:f5de8699e2b6 |
---|---|
229 if (child.nodeName == 'statement') | 229 if (child.nodeName == 'statement') |
230 { | 230 { |
231 preTestOption.innerHTML = '<span>'+child.innerHTML+'</span>'; | 231 preTestOption.innerHTML = '<span>'+child.innerHTML+'</span>'; |
232 } else if (child.nodeName == 'question') | 232 } else if (child.nodeName == 'question') |
233 { | 233 { |
234 var questionId = child.attributes['id'].value; | |
234 var textHold = document.createElement('span'); | 235 var textHold = document.createElement('span'); |
235 textHold.innerHTML = child.innerHTML; | 236 textHold.innerHTML = child.innerHTML; |
237 textHold.id = questionId + 'response'; | |
236 var textEnter = document.createElement('textarea'); | 238 var textEnter = document.createElement('textarea'); |
237 preTestOption.appendChild(textHold); | 239 preTestOption.appendChild(textHold); |
238 preTestOption.appendChild(textEnter); | 240 preTestOption.appendChild(textEnter); |
239 } | 241 } |
240 var nextButton = document.createElement('button'); | 242 var nextButton = document.createElement('button'); |
245 nextButton.style.left = '450px'; | 247 nextButton.style.left = '450px'; |
246 nextButton.style.top = '175px'; | 248 nextButton.style.top = '175px'; |
247 nextButton.onclick = function() { | 249 nextButton.onclick = function() { |
248 // Need to find and parse preTest again! | 250 // Need to find and parse preTest again! |
249 var preTest = projectXML.find('PreTest')[0]; | 251 var preTest = projectXML.find('PreTest')[0]; |
252 // Check if current state is a question! | |
253 if (preTest.children[this.value-1].nodeName == 'question') { | |
254 var questionId = preTest.children[this.value-1].attributes['id'].value; | |
255 var questionHold = document.createElement('comment'); | |
256 var questionResponse = document.getElementById(questionId + 'response'); | |
257 questionHold.id = questionId; | |
258 questionHold.innerHTML = questionResponse.value; | |
259 preTestQuestions.appendChild(questionHold); | |
260 } | |
250 if (this.value < preTest.children.length) | 261 if (this.value < preTest.children.length) |
251 { | 262 { |
252 // More to process | 263 // More to process |
253 var child = preTest.children[this.value]; | 264 var child = preTest.children[this.value]; |
254 if (child.nodeName == 'statement') | 265 if (child.nodeName == 'statement') |
257 } else if (child.nodeName == 'question') | 268 } else if (child.nodeName == 'question') |
258 { | 269 { |
259 var textHold = document.createElement('span'); | 270 var textHold = document.createElement('span'); |
260 textHold.innerHTML = child.innerHTML; | 271 textHold.innerHTML = child.innerHTML; |
261 var textEnter = document.createElement('textarea'); | 272 var textEnter = document.createElement('textarea'); |
262 preTestOption.innerHTML = 'null'; | 273 textEnter.id = child.attributes['id'].value + 'response'; |
274 preTestOption.innerHTML = null; | |
263 preTestOption.appendChild(textHold); | 275 preTestOption.appendChild(textHold); |
264 preTestOption.appendChild(textEnter); | 276 preTestOption.appendChild(textEnter); |
265 } | 277 } |
266 } else { | 278 } else { |
267 // Time to clear | 279 // Time to clear |
315 trackObj.appendChild(slider); | 327 trackObj.appendChild(slider); |
316 trackObj.appendChild(comment); | 328 trackObj.appendChild(comment); |
317 xmlDoc.appendChild(trackObj); | 329 xmlDoc.appendChild(trackObj); |
318 } | 330 } |
319 | 331 |
332 // Append Pre/Post Questions | |
333 xmlDoc.appendChild(preTestQuestions); | |
334 xmlDoc.appendChild(postTestQuestions); | |
335 | |
320 return xmlDoc; | 336 return xmlDoc; |
321 } | 337 } |
322 | 338 |