changeset 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 f0c74260c47d
files core.js
diffstat 1 files changed, 22 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Wed Feb 17 11:16:08 2016 +0000
+++ b/core.js	Wed Feb 17 12:29:22 2016 +0000
@@ -2394,15 +2394,13 @@
 		
 		this.exportXMLDOM = function() {
 			var root = document.createElement('comment');
-			if (this.audioObject.specification.parent.elementComments) {
-				var question = document.createElement('question');
-				question.textContent = this.trackString.textContent;
-				var response = document.createElement('response');
-				response.textContent = this.trackCommentBox.value;
-				console.log("Comment frag-"+this.id+": "+response.textContent);
-				root.appendChild(question);
-				root.appendChild(response);
-			}
+            var question = document.createElement('question');
+            question.textContent = this.trackString.textContent;
+            var response = document.createElement('response');
+            response.textContent = this.trackCommentBox.value;
+            console.log("Comment frag-"+this.id+": "+response.textContent);
+            root.appendChild(question);
+            root.appendChild(response);
 			return root;
 		};
 		this.resize = function()
@@ -2443,13 +2441,19 @@
 		this.holder.appendChild(br);
 		this.holder.appendChild(this.textArea);
 		
-		this.exportXMLDOM = function() {
-			var root = document.createElement('comment');
+		this.exportXMLDOM = function(storePoint) {
+			var root = storePoint.parent.document.createElement('comment');
 			root.id = this.specification.id;
 			root.setAttribute('type',this.specification.type);
-			root.textContent = this.textArea.value;
 			console.log("Question: "+this.string.textContent);
 			console.log("Response: "+root.textContent);
+            var question = storePoint.parent.document.createElement('question');
+            question.textContent = this.string.textContent;
+            var response = storePoint.parent.document.createElement('response');
+            response.textContent = this.textArea.value;
+            root.appendChild(question);
+            root.appendChild(response);
+            storePoint.XMLDOM.appendChild(root);
 			return root;
 		};
 		this.resize = function()
@@ -2519,8 +2523,8 @@
 		this.holder.appendChild(this.span);
 		this.holder.appendChild(this.inputs);
 		
-		this.exportXMLDOM = function() {
-			var root = document.createElement('comment');
+		this.exportXMLDOM = function(storePoint) {
+			var root = storePoint.parent.document.createElement('comment');
 			root.id = this.specification.id;
 			root.setAttribute('type',this.specification.type);
 			var question = document.createElement('question');
@@ -2543,6 +2547,7 @@
 			console.log('Response: '+response.textContent);
 			root.appendChild(question);
 			root.appendChild(response);
+            storePoint.XMLDOM.appendChild(root);
 			return root;
 		};
 		this.resize = function()
@@ -2630,8 +2635,8 @@
 		this.holder.appendChild(this.span);
 		this.holder.appendChild(this.inputs);
 		
-		this.exportXMLDOM = function() {
-			var root = document.createElement('comment');
+		this.exportXMLDOM = function(storePoint) {
+			var root = storePoint.parent.document.createElement('comment');
 			root.id = this.specification.id;
 			root.setAttribute('type',this.specification.type);
 			var question = document.createElement('question');
@@ -2645,6 +2650,7 @@
 				root.appendChild(response);
 				console.log('Response '+response.getAttribute('name') +': '+response.textContent);
 			}
+            storePoint.XMLDOM.appendChild(root);
 			return root;
 		};
 		this.resize = function()
@@ -3140,20 +3146,6 @@
 			this.XMLDOM.appendChild(aeNode);
 		}
 		
-		// Add any commentQuestions
-		for (var element of this.specification.commentQuestions)
-		{
-			var cqNode = this.parent.document.createElement('commentquestion');
-			cqNode.id = element.id;
-			cqNode.setAttribute('type',element.type);
-			var statement = this.parent.document.createElement('statement');
-			statement.textContent = cqNode.statement;
-			cqNode.appendChild(statement);
-			var response = this.parent.document.createElement('response');
-			cqNode.appendChild(response);
-			this.XMLDOM.appendChild(cqNode);
-		}
-		
 		this.parent.root.appendChild(this.XMLDOM);
 	};
 	this.finish = function()