comparison ape.js @ 65:7dccb9c6f852 Dev_main

Added commentQuestion object
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Tue, 21 Apr 2015 21:32:42 +0100
parents c943465de196
children 66475d1022ca
comparison
equal deleted inserted replaced
64:c943465de196 65:7dccb9c6f852
495 }; 495 };
496 496
497 canvas.appendChild(trackSliderObj); 497 canvas.appendChild(trackSliderObj);
498 }); 498 });
499 499
500 // Append any commentQuestion boxes
501 var commentQuestions = $(textXML).find('CommentQuestion');
502 $(commentQuestions).each(function(index,element) {
503 // Create document objects to hold the comment boxes
504 var trackComment = document.createElement('div');
505 trackComment.className = 'comment-div commentQuestion';
506 trackComment.id = element.attributes['id'].value;
507 // Create a string next to each comment asking for a comment
508 var trackString = document.createElement('span');
509 trackString.innerHTML = element.textContent;
510 // Create the HTML5 comment box 'textarea'
511 var trackCommentBox = document.createElement('textarea');
512 trackCommentBox.rows = '4';
513 trackCommentBox.cols = '100';
514 trackCommentBox.name = 'commentQuestion'+index;
515 trackCommentBox.className = 'trackComment';
516 var br = document.createElement('br');
517 // Add to the holder.
518 trackComment.appendChild(trackString);
519 trackComment.appendChild(br);
520 trackComment.appendChild(trackCommentBox);
521 feedbackHolder.appendChild(trackComment);
522 });
523
500 // Now process any pre-test commands 524 // Now process any pre-test commands
501 525
502 var preTest = $(testXMLSetups[id]).find('PreTest')[0]; 526 var preTest = $(testXMLSetups[id]).find('PreTest')[0];
503 if (preTest.children.length > 0) 527 if (preTest.children.length > 0)
504 { 528 {
861 metric.appendChild(flagComments); 885 metric.appendChild(flagComments);
862 } 886 }
863 audioElement.appendChild(metric); 887 audioElement.appendChild(metric);
864 xmlDoc.appendChild(audioElement); 888 xmlDoc.appendChild(audioElement);
865 } 889 }
890 var commentQuestion = document.getElementsByClassName('commentQuestion');
891 for (var i=0; i<commentQuestion.length; i++)
892 {
893 var cqHolder = document.createElement('CommentQuestion');
894 var comment = document.createElement('comment');
895 var question = document.createElement('question');
896 cqHolder.id = commentQuestion[i].id;
897 comment.textContent = commentQuestion[i].children[2].value;
898 question.textContent = commentQuestion[i].children[0].textContent;
899 cqHolder.appendChild(question);
900 cqHolder.appendChild(comment);
901 xmlDoc.appendChild(cqHolder);
902 }
866 testResultsHolders[testId] = xmlDoc; 903 testResultsHolders[testId] = xmlDoc;
867 } 904 }
868 905
869 // Only other global function which must be defined in the interface class. Determines how to create the XML document. 906 // Only other global function which must be defined in the interface class. Determines how to create the XML document.
870 function interfaceXMLSave(){ 907 function interfaceXMLSave(){