changeset 2313:70bb8e542741

#14 fix. APE now saves <error> messages to the <page> node.
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Fri, 29 Apr 2016 15:20:25 +0100
parents 483bd6573747
children cbc26d0f104a a7e50a52a896
files interfaces/ape.js
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/ape.js	Fri Apr 29 14:49:23 2016 +0100
+++ b/interfaces/ape.js	Fri Apr 29 15:20:25 2016 +0100
@@ -25,7 +25,7 @@
 		hasBeenPlayed = audioEngineContext.checkAllPlayed();
 		if (hasBeenPlayed.length > 0) // if a fragment has not been played yet
 	    {
-	    	str = "";
+	    	var str = "";
 	    	if (hasBeenPlayed.length > 1) {
 		    	for (var i=0; i<hasBeenPlayed.length; i++) {
                     var ao_id = audioEngineContext.audioObjects[hasBeenPlayed[i]].interfaceDOM.getPresentedId();
@@ -36,10 +36,12 @@
 		    			str += " or ";
 		    		}
 		    	}
-		    	alert('You have not played fragments ' + str + ' yet. Please listen, rate and comment all samples before submitting.');
+                str = 'You have not played fragments ' + str + ' yet. Please listen, rate and comment all samples before submitting.';
 	       } else {
-	       		alert('You have not played fragment ' + (audioEngineContext.audioObjects[hasBeenPlayed[0]].interfaceDOM.getPresentedId()) + ' yet. Please listen, rate and comment all samples before submitting.');
-	       }
+               str = 'You have not played fragment ' + (audioEngineContext.audioObjects[hasBeenPlayed[0]].interfaceDOM.getPresentedId()) + ' yet. Please listen, rate and comment all samples before submitting.';
+           }
+            this.storeErrorNode(str);
+            alert(str);
 	        return false;
 	    }
 	    return true;
@@ -84,6 +86,7 @@
 		}
 		if (state != true)
 		{
+            this.storeErrorNode(str);
 			alert(str);
 			console.log(str);
 		}
@@ -104,8 +107,9 @@
 				}
 			}
 			if (state == false) {
+                var str = "";
 				if (strNums.length > 1) {
-					var str = "";
+					
 			    	for (var i=0; i<strNums.length; i++) {
                         var ao_id = audioEngineContext.audioObjects[strNums[i]].interfaceDOM.getPresentedId();
 			    		str = str + (ao_id); // start from 1
@@ -115,10 +119,13 @@
 			    			str += " or ";
 			    		}
 			    	}
-			    	alert('You have not commented on fragments ' + str + ' yet. Please listen, rate and comment all samples before submitting.');
+                    str = 'You have not commented on fragments ' + str + ' yet. Please listen, rate and comment all samples before submitting.';
 		       } else {
-		       		alert('You have not commented on fragment ' + (audioEngineContext.audioObjects[strNums[0]].interfaceDOM.getPresentedId()) + ' yet. Please listen, rate and comment all samples before submitting.');
+                   str = 'You have not commented on fragment ' + (audioEngineContext.audioObjects[strNums[0]].interfaceDOM.getPresentedId()) + ' yet. Please listen, rate and comment all samples before submitting.';
 		       }
+                this.storeErrorNode(str);
+                alert(str);
+                console.log(str);
 			}
 		}
 		return state;
@@ -164,6 +171,7 @@
 		}
 		if (state != true)
 		{
+            this.storeErrorNode(str);
 			alert(str);
 			console.log(str);
 		}