changeset 43:2fd137d891a7 Dev_main

Completed more pre-test/post-test popup functions. Presents save and locks test on completion
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 10 Apr 2015 15:30:44 +0100
parents b163842c6002
children c57aba852764
files ape.js core.js
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Fri Apr 10 15:21:49 2015 +0100
+++ b/ape.js	Fri Apr 10 15:30:44 2015 +0100
@@ -89,10 +89,7 @@
 	// Create Submit (save) button
 	var submit = document.createElement("button");
 	submit.innerHTML = 'Submit';
-	submit.onclick = function() {
-		// TODO: Update this for postTest tags
-		createProjectSave(projectReturn)
-	};
+	submit.onclick = buttonSubmitClick;
 	// Append the interface buttons into the interfaceButtons object.
 	interfaceButtons.appendChild(playback);
 	interfaceButtons.appendChild(submit);
@@ -330,7 +327,11 @@
 		var questionResponse = document.getElementById(questionId + 'response');
 		questionHold.id = questionId;
 		questionHold.innerHTML = questionResponse.value;
-		preTestQuestions.appendChild(questionHold);
+		if (currentState == 'preTest') {
+			preTestQuestions.appendChild(questionHold);
+		} else if (currentState = 'postTest') {  
+			postTestQuestions.appendChild(questionHold);
+		}
 	}
 	index++;
 	if (index < preTest.children.length)
@@ -355,9 +356,14 @@
 	} else {
 		// Time to clear
 		preTestOption.innerHTML = null;
-		hidePopup();
-		// Progress the state!
-		advanceState();
+		if (currentState != 'postTest') {
+			hidePopup();
+			// Progress the state!
+			advanceState();
+		} else {
+			a = createProjectSave(projectReturn);
+			preTestOption.appendChild(a);
+		}
 	}
 	return index;
 }
--- a/core.js	Fri Apr 10 15:21:49 2015 +0100
+++ b/core.js	Fri Apr 10 15:30:44 2015 +0100
@@ -100,6 +100,7 @@
 		var submitDiv = document.getElementById('download-point');
 		submitDiv.appendChild(a);
 	}
+	return submitDiv;
 }
 
 function AudioEngine() {