comparison ape.js @ 193:b0d683510881

Feature #1208: Added radio box option to page 'commentQuestion'. Also commentQuestion nodes are now common to core.js.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 08 Jun 2015 11:00:15 +0100
parents b33a22cb6e98
children 13946f91f0a3 06b253e9b394
comparison
equal deleted inserted replaced
192:566fc4fa2bea 193:b0d683510881
290 }); 290 });
291 if (commentShow) { 291 if (commentShow) {
292 interfaceContext.showCommentBoxes(feedbackHolder,true); 292 interfaceContext.showCommentBoxes(feedbackHolder,true);
293 } 293 }
294 294
295 // Append any commentQuestion boxes
296 $(audioHolderObject.commentQuestions).each(function(index,element) { 295 $(audioHolderObject.commentQuestions).each(function(index,element) {
297 // Create document objects to hold the comment boxes 296 var node = interfaceContext.createCommentQuestion(element);
298 var trackComment = document.createElement('div'); 297 feedbackHolder.appendChild(node.holder);
299 trackComment.className = 'comment-div commentQuestion';
300 trackComment.id = element.id;
301 // Create a string next to each comment asking for a comment
302 var trackString = document.createElement('span');
303 trackString.innerHTML = element.question;
304 // Create the HTML5 comment box 'textarea'
305 var trackCommentBox = document.createElement('textarea');
306 trackCommentBox.rows = '4';
307 trackCommentBox.cols = '100';
308 trackCommentBox.name = 'commentQuestion'+index;
309 trackCommentBox.className = 'trackComment';
310 var br = document.createElement('br');
311 // Add to the holder.
312 trackComment.appendChild(trackString);
313 trackComment.appendChild(br);
314 trackComment.appendChild(trackCommentBox);
315 feedbackHolder.appendChild(trackComment);
316 }); 298 });
317 299
318 300
319 testWaitIndicator(); 301 testWaitIndicator();
320 } 302 }
482 for (var i=0; i<audioObjects.length; i++) 464 for (var i=0; i<audioObjects.length; i++)
483 { 465 {
484 var audioElement = audioEngineContext.audioObjects[i].exportXMLDOM(); 466 var audioElement = audioEngineContext.audioObjects[i].exportXMLDOM();
485 xmlDoc.appendChild(audioElement); 467 xmlDoc.appendChild(audioElement);
486 } 468 }
487 var commentQuestion = document.getElementsByClassName('commentQuestion'); 469
488 for (var i=0; i<commentQuestion.length; i++) 470 $(interfaceContext.commentQuestions).each(function(index,element){
489 { 471 var node = element.exportXMLDOM();
490 var cqHolder = document.createElement('CommentQuestion'); 472 xmlDoc.appendChild(node);
491 var comment = document.createElement('comment'); 473 });
492 var question = document.createElement('question');
493 cqHolder.id = commentQuestion[i].id;
494 comment.textContent = commentQuestion[i].children[2].value;
495 question.textContent = commentQuestion[i].children[0].textContent;
496 console.log('Question ' + i + ': ' + commentQuestion[i].children[2].value); // DEBUG/SAFETY
497 cqHolder.appendChild(question);
498 cqHolder.appendChild(comment);
499 xmlDoc.appendChild(cqHolder);
500 }
501 store = xmlDoc; 474 store = xmlDoc;
502 } 475 }