changeset 178:510dbc57e97e Dev_main

ape.js pageSaveXML uses view from audioObjects.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Thu, 04 Jun 2015 11:18:21 +0100
parents 25c296b254f8
children 8655b05c874f
files ape.js core.js
diffstat 2 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Thu Jun 04 11:01:19 2015 +0100
+++ b/ape.js	Thu Jun 04 11:18:21 2015 +0100
@@ -334,6 +334,7 @@
 		// Now load each audio sample. First create the new track by passing the full URL
 		var trackURL = hostURL + this.attributes['url'].value;
 		audioEngineContext.newTrack(trackURL);
+		audioEngineContext.audioObjects[index].id = this.attributes['id'].value;
 		
 		if (commentShow) {
 			// Create document objects to hold the comment boxes
@@ -355,7 +356,7 @@
 			trackComment.appendChild(br);
 			trackComment.appendChild(trackCommentBox);
 			feedbackHolder.appendChild(trackComment);
-			audioEngineContext.audioObjects[index].commentDOM = trackCommentBox;
+			audioEngineContext.audioObjects[index].commentDOM = trackComment;
 		}
 		
 		// Create a slider per track
@@ -561,22 +562,21 @@
 		metric.appendChild(testTime);
 	}
 	xmlDoc.appendChild(metric);
-	var trackSliderObjects = document.getElementsByClassName('track-slider');
-	var commentObjects = document.getElementsByClassName('comment-div');
-	for (var i=0; i<trackSliderObjects.length; i++) 
+	var audioObjects = audioEngineContext.audioObjects;
+	for (var i=0; i<audioObjects.length; i++) 
 	{
 		var audioElement = document.createElement('audioElement');
-		audioElement.id = currentTrackOrder[i].attributes['id'].value;
-		audioElement.setAttribute('url',currentTrackOrder[i].attributes['url'].value);
+		audioElement.id = audioObjects[i].id;
+		audioElement.setAttribute('url',audioObjects[i].url);
 		var value = document.createElement('value');
 		value.innerHTML = convSliderPosToRate(i);
 		if (commentShow) {
 			var comment = document.createElement("comment");
 			var question = document.createElement("question");
 			var response = document.createElement("response");
-			question.textContent = commentObjects[i].children[0].textContent;
-			response.textContent = commentObjects[i].children[2].value;
-            console.log('Comment ' + i + ': ' + commentObjects[i].children[2].value); // DEBUG/SAFETY
+			question.textContent = audioObjects[i].commentDOM.children[0].textContent;
+			response.textContent = audioObjects[i].commentDOM.children[2].value;
+            console.log('Comment ' + i + ': ' + response.textContent); // DEBUG/SAFETY
 			comment.appendChild(question);
 			comment.appendChild(response);
 			audioElement.appendChild(comment);
@@ -584,7 +584,7 @@
 		audioElement.appendChild(value);
 		// Check for any per element metrics
 		
-		audioElement.appendChild(audioEngineContext.audioObjects[i].metric.exportXMLDOM());
+		audioElement.appendChild(audioObjects[i].metric.exportXMLDOM());
 		xmlDoc.appendChild(audioElement);
 	}
 	var commentQuestion = document.getElementsByClassName('commentQuestion');
--- a/core.js	Thu Jun 04 11:01:19 2015 +0100
+++ b/core.js	Thu Jun 04 11:18:21 2015 +0100
@@ -694,7 +694,6 @@
 		};
 		request.send();
 	};
-	
 }
 
 function timer()