changeset 687:f602b19b20fd

Added mandatory pre/post test questions
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Tue, 21 Apr 2015 21:15:12 +0100
parents fe18710dae70
children 8babb8c22d59
files ape.js apeTool.html
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Tue Apr 21 16:50:10 2015 +0100
+++ b/ape.js	Tue Apr 21 21:15:12 2015 +0100
@@ -583,6 +583,14 @@
 		var questionId = preTest.children[index].attributes['id'].value;
 		var questionHold = document.createElement('comment');
 		var questionResponse = document.getElementById(questionId + 'response');
+		var mandatory = preTest.children[index].attributes['mandatory'];
+		if (mandatory != undefined){
+			if (mandatory.value == 'true') {mandatory = true;}
+			else {mandatory = false;}
+		} else {mandatory = false;}
+		if (mandatory == true && questionResponse.value.length == 0) {
+			return index;
+		}
 		questionHold.id = questionId;
 		questionHold.innerHTML = questionResponse.value;
 		postPopupResponse(questionHold);
--- a/apeTool.html	Tue Apr 21 16:50:10 2015 +0100
+++ b/apeTool.html	Tue Apr 21 21:15:12 2015 +0100
@@ -33,7 +33,7 @@
 		</script>
 		<!-- Uncomment the following script for automatic loading of projects -->
 		<script>
-			url = 'example_eval/project2.xml'; //Project XML document location
+			url = 'example_eval/project.xml'; //Project XML document location
 			loadProjectSpec(url);
 		</script>