changeset 2321:472412fab354

Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author www-data <www-data@sucuk.dcs.qmul.ac.uk>
date Fri, 29 Apr 2016 17:21:06 +0100
parents fa52c9ea2486 (current diff) ae69e61a6b76 (diff)
children ff06a00a1c0a
files
diffstat 4 files changed, 25 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/index.html	Fri Apr 29 16:20:56 2016 +0100
+++ b/index.html	Fri Apr 29 17:21:06 2016 +0100
@@ -22,28 +22,6 @@
 		<script type="text/javascript" src='js/loudness.js'></script>
 		<script type="text/javascript" src='js/xmllint.js'></script>
         <script type="text/javascript" src='js/WAVE.js'></script>
-		<script type="text/javascript">
-			// SEARCH QUERY: By using the GET Request option ?url=loca/path/to/project.xml in the URL bar, you can load a project quickly
-			if (window.location.search.length != 0)
-			{
-				var search = window.location.search.split('?')[1];
-				// Now split the requests into pairs
-				var searchQueries = search.split('&');
-				for (var i in searchQueries)
-				{
-					// Split each request into
-					searchQueries[i] = searchQueries[i].split('=');
-					if (searchQueries[i][0] == "url")
-					{
-						url = decodeURI(searchQueries[i][1]);
-					}
-				}
-				loadProjectSpec(url);
-				window.onbeforeunload = function() {
-					return "Please only leave this page once you have completed the tests. Are you sure you have completed all testing?";
-				};
-			}
-		</script>
 	</head>
 
 	<body>
--- a/js/core.js	Fri Apr 29 16:20:56 2016 +0100
+++ b/js/core.js	Fri Apr 29 17:21:06 2016 +0100
@@ -140,6 +140,26 @@
 	storage = new Storage();
 	// Define window callbacks for interface
 	window.onresize = function(event){interfaceContext.resizeWindow(event);};
+    
+    if (window.location.search.length != 0)
+    {
+        var search = window.location.search.split('?')[1];
+        // Now split the requests into pairs
+        var searchQueries = search.split('&');
+        for (var i in searchQueries)
+        {
+            // Split each request into
+            searchQueries[i] = searchQueries[i].split('=');
+            if (searchQueries[i][0] == "url")
+            {
+                url = decodeURI(searchQueries[i][1]);
+            }
+        }
+        loadProjectSpec(url);
+        window.onbeforeunload = function() {
+            return "Please only leave this page once you have completed the tests. Are you sure you have completed all testing?";
+        };
+    }
 };
 
 function loadProjectSpec(url) {
--- a/php/save.php	Fri Apr 29 16:20:56 2016 +0100
+++ b/php/save.php	Fri Apr 29 17:21:06 2016 +0100
@@ -5,6 +5,11 @@
 	$postText = file_get_contents('php://input');
     $file_key = $_GET['key'];
     $filename = "../saves/save-".$file_key.".xml";
+    $doc = new DOMDocument;
+    $doc->preserveWhiteSpace = false;
+    $doc->formatOutput = true;
+    $doc->loadXML($postText);
+    $postText = $doc->saveXML();
 	$fileHandle = fopen($filename, 'w');
 	if ($fileHandle == FALSE)
 	{
--- a/test.html	Fri Apr 29 16:20:56 2016 +0100
+++ b/test.html	Fri Apr 29 17:21:06 2016 +0100
@@ -22,28 +22,6 @@
 		<script type="text/javascript" src='js/loudness.js'></script>
 		<script type="text/javascript" src='js/xmllint.js'></script>
         <script type="text/javascript" src='js/WAVE.js'></script>
-		<script type="text/javascript">
-			// SEARCH QUERY: By using the GET Request option ?url=loca/path/to/project.xml in the URL bar, you can load a project quickly
-			if (window.location.search.length != 0)
-			{
-				var search = window.location.search.split('?')[1];
-				// Now split the requests into pairs
-				var searchQueries = search.split('&');
-				for (var i in searchQueries)
-				{
-					// Split each request into
-					searchQueries[i] = searchQueries[i].split('=');
-					if (searchQueries[i][0] == "url")
-					{
-						url = decodeURI(searchQueries[i][1]);
-					}
-				}
-				loadProjectSpec(url);
-				window.onbeforeunload = function() {
-					return "Please only leave this page once you have completed the tests. Are you sure you have completed all testing?";
-				};
-			}
-		</script>
 	</head>
 
 	<body>