changeset 958:39e56b863075

If projectReturn is specified as a url it will return to that server. Currently only tested using the localHost server on port 8000, as per the python2.py server included
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Tue, 26 May 2015 18:47:59 +0100
parents 96dc339fb382
children d6303bdef165
files core.js example_eval/project.xml
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Tue May 26 18:43:30 2015 +0100
+++ b/core.js	Tue May 26 18:47:59 2015 +0100
@@ -270,10 +270,10 @@
 	// If destURL is null then download XML in client
 	// Now time to render file locally
 	var xmlDoc = interfaceXMLSave();
+	var parent = document.createElement("div");
+	parent.appendChild(xmlDoc);
+	var file = [parent.innerHTML];
 	if (destURL == "null" || destURL == undefined) {
-		var parent = document.createElement("div");
-		parent.appendChild(xmlDoc);
-		var file = [parent.innerHTML];
 		var bb = new Blob(file,{type : 'application/xml'});
 		var dnlk = window.URL.createObjectURL(bb);
 		var a = document.createElement("a");
@@ -287,6 +287,11 @@
 		popup.showPopup();
 		popup.popupContent.innerHTML = null;
 		popup.popupContent.appendChild(submitDiv)
+	} else {
+		var xmlhttp = new XMLHttpRequest;
+		xmlhttp.open("POST",destURL,true);
+		xmlhttp.setRequestHeader('Content-Type', 'text/xml');
+		xmlhttp.send(file);
 	}
 	return submitDiv;
 }
--- a/example_eval/project.xml	Tue May 26 18:43:30 2015 +0100
+++ b/example_eval/project.xml	Tue May 26 18:47:59 2015 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <BrowserEvalProjectDocument>
-	<setup interface="APE" projectReturn="null" randomiseOrder='true' collectMetrics='true'>
+	<setup interface="APE" projectReturn="http://127.0.0.1:8000/save" randomiseOrder='true' collectMetrics='true'>
 		<PreTest>
 			<question id="Location" mandatory="true">Please enter your location.</question>
 			<statement>Please listen to all mixes</statement>