Mercurial > hg > webaudioevaluationtool
comparison core.js @ 1189:51d2bd596640
Hotfix: comments were not being stored from element comment boxes or comment question nodes.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Wed, 17 Feb 2016 12:29:22 +0000 |
parents | eef2d4ea18fb |
children | 3c25db9c8393 |
comparison
equal
deleted
inserted
replaced
1188:eef2d4ea18fb | 1189:51d2bd596640 |
---|---|
2392 this.trackComment.appendChild(br); | 2392 this.trackComment.appendChild(br); |
2393 this.trackComment.appendChild(this.trackCommentBox); | 2393 this.trackComment.appendChild(this.trackCommentBox); |
2394 | 2394 |
2395 this.exportXMLDOM = function() { | 2395 this.exportXMLDOM = function() { |
2396 var root = document.createElement('comment'); | 2396 var root = document.createElement('comment'); |
2397 if (this.audioObject.specification.parent.elementComments) { | 2397 var question = document.createElement('question'); |
2398 var question = document.createElement('question'); | 2398 question.textContent = this.trackString.textContent; |
2399 question.textContent = this.trackString.textContent; | 2399 var response = document.createElement('response'); |
2400 var response = document.createElement('response'); | 2400 response.textContent = this.trackCommentBox.value; |
2401 response.textContent = this.trackCommentBox.value; | 2401 console.log("Comment frag-"+this.id+": "+response.textContent); |
2402 console.log("Comment frag-"+this.id+": "+response.textContent); | 2402 root.appendChild(question); |
2403 root.appendChild(question); | 2403 root.appendChild(response); |
2404 root.appendChild(response); | |
2405 } | |
2406 return root; | 2404 return root; |
2407 }; | 2405 }; |
2408 this.resize = function() | 2406 this.resize = function() |
2409 { | 2407 { |
2410 var boxwidth = (window.innerWidth-100)/2; | 2408 var boxwidth = (window.innerWidth-100)/2; |
2441 // Add to the holder. | 2439 // Add to the holder. |
2442 this.holder.appendChild(this.string); | 2440 this.holder.appendChild(this.string); |
2443 this.holder.appendChild(br); | 2441 this.holder.appendChild(br); |
2444 this.holder.appendChild(this.textArea); | 2442 this.holder.appendChild(this.textArea); |
2445 | 2443 |
2446 this.exportXMLDOM = function() { | 2444 this.exportXMLDOM = function(storePoint) { |
2447 var root = document.createElement('comment'); | 2445 var root = storePoint.parent.document.createElement('comment'); |
2448 root.id = this.specification.id; | 2446 root.id = this.specification.id; |
2449 root.setAttribute('type',this.specification.type); | 2447 root.setAttribute('type',this.specification.type); |
2450 root.textContent = this.textArea.value; | |
2451 console.log("Question: "+this.string.textContent); | 2448 console.log("Question: "+this.string.textContent); |
2452 console.log("Response: "+root.textContent); | 2449 console.log("Response: "+root.textContent); |
2450 var question = storePoint.parent.document.createElement('question'); | |
2451 question.textContent = this.string.textContent; | |
2452 var response = storePoint.parent.document.createElement('response'); | |
2453 response.textContent = this.textArea.value; | |
2454 root.appendChild(question); | |
2455 root.appendChild(response); | |
2456 storePoint.XMLDOM.appendChild(root); | |
2453 return root; | 2457 return root; |
2454 }; | 2458 }; |
2455 this.resize = function() | 2459 this.resize = function() |
2456 { | 2460 { |
2457 var boxwidth = (window.innerWidth-100)/2; | 2461 var boxwidth = (window.innerWidth-100)/2; |
2517 this.options.push(input); | 2521 this.options.push(input); |
2518 } | 2522 } |
2519 this.holder.appendChild(this.span); | 2523 this.holder.appendChild(this.span); |
2520 this.holder.appendChild(this.inputs); | 2524 this.holder.appendChild(this.inputs); |
2521 | 2525 |
2522 this.exportXMLDOM = function() { | 2526 this.exportXMLDOM = function(storePoint) { |
2523 var root = document.createElement('comment'); | 2527 var root = storePoint.parent.document.createElement('comment'); |
2524 root.id = this.specification.id; | 2528 root.id = this.specification.id; |
2525 root.setAttribute('type',this.specification.type); | 2529 root.setAttribute('type',this.specification.type); |
2526 var question = document.createElement('question'); | 2530 var question = document.createElement('question'); |
2527 question.textContent = this.string.textContent; | 2531 question.textContent = this.string.textContent; |
2528 var response = document.createElement('response'); | 2532 var response = document.createElement('response'); |
2541 } | 2545 } |
2542 console.log('Comment: '+question.textContent); | 2546 console.log('Comment: '+question.textContent); |
2543 console.log('Response: '+response.textContent); | 2547 console.log('Response: '+response.textContent); |
2544 root.appendChild(question); | 2548 root.appendChild(question); |
2545 root.appendChild(response); | 2549 root.appendChild(response); |
2550 storePoint.XMLDOM.appendChild(root); | |
2546 return root; | 2551 return root; |
2547 }; | 2552 }; |
2548 this.resize = function() | 2553 this.resize = function() |
2549 { | 2554 { |
2550 var boxwidth = (window.innerWidth-100)/2; | 2555 var boxwidth = (window.innerWidth-100)/2; |
2628 this.options.push(input); | 2633 this.options.push(input); |
2629 } | 2634 } |
2630 this.holder.appendChild(this.span); | 2635 this.holder.appendChild(this.span); |
2631 this.holder.appendChild(this.inputs); | 2636 this.holder.appendChild(this.inputs); |
2632 | 2637 |
2633 this.exportXMLDOM = function() { | 2638 this.exportXMLDOM = function(storePoint) { |
2634 var root = document.createElement('comment'); | 2639 var root = storePoint.parent.document.createElement('comment'); |
2635 root.id = this.specification.id; | 2640 root.id = this.specification.id; |
2636 root.setAttribute('type',this.specification.type); | 2641 root.setAttribute('type',this.specification.type); |
2637 var question = document.createElement('question'); | 2642 var question = document.createElement('question'); |
2638 question.textContent = this.string.textContent; | 2643 question.textContent = this.string.textContent; |
2639 root.appendChild(question); | 2644 root.appendChild(question); |
2643 response.textContent = this.options[i].checked; | 2648 response.textContent = this.options[i].checked; |
2644 response.setAttribute('name',this.options[i].getAttribute('setvalue')); | 2649 response.setAttribute('name',this.options[i].getAttribute('setvalue')); |
2645 root.appendChild(response); | 2650 root.appendChild(response); |
2646 console.log('Response '+response.getAttribute('name') +': '+response.textContent); | 2651 console.log('Response '+response.getAttribute('name') +': '+response.textContent); |
2647 } | 2652 } |
2653 storePoint.XMLDOM.appendChild(root); | |
2648 return root; | 2654 return root; |
2649 }; | 2655 }; |
2650 this.resize = function() | 2656 this.resize = function() |
2651 { | 2657 { |
2652 var boxwidth = (window.innerWidth-100)/2; | 2658 var boxwidth = (window.innerWidth-100)/2; |
3138 var ae_metric = this.parent.document.createElement('metric'); | 3144 var ae_metric = this.parent.document.createElement('metric'); |
3139 aeNode.appendChild(ae_metric); | 3145 aeNode.appendChild(ae_metric); |
3140 this.XMLDOM.appendChild(aeNode); | 3146 this.XMLDOM.appendChild(aeNode); |
3141 } | 3147 } |
3142 | 3148 |
3143 // Add any commentQuestions | |
3144 for (var element of this.specification.commentQuestions) | |
3145 { | |
3146 var cqNode = this.parent.document.createElement('commentquestion'); | |
3147 cqNode.id = element.id; | |
3148 cqNode.setAttribute('type',element.type); | |
3149 var statement = this.parent.document.createElement('statement'); | |
3150 statement.textContent = cqNode.statement; | |
3151 cqNode.appendChild(statement); | |
3152 var response = this.parent.document.createElement('response'); | |
3153 cqNode.appendChild(response); | |
3154 this.XMLDOM.appendChild(cqNode); | |
3155 } | |
3156 | |
3157 this.parent.root.appendChild(this.XMLDOM); | 3149 this.parent.root.appendChild(this.XMLDOM); |
3158 }; | 3150 }; |
3159 this.finish = function() | 3151 this.finish = function() |
3160 { | 3152 { |
3161 if (this.state == 0) | 3153 if (this.state == 0) |