# HG changeset patch # User www-data # Date 1462900867 -3600 # Node ID cb01bc04ab2c414f0d15b59e8d78dfa890ffc961 # Parent 1111763a695a761f13020c9587f0f23f182fa8a1# Parent d347dbab980d0b2f00861e07d396a04fe41caced Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool diff -r 1111763a695a -r cb01bc04ab2c js/core.js --- a/js/core.js Tue May 10 17:21:03 2016 +0100 +++ b/js/core.js Tue May 10 18:21:07 2016 +0100 @@ -17,6 +17,7 @@ var currentTrackOrder = []; // Hold the current XML tracks in their (randomised) order var audioEngineContext; // The custome AudioEngine object var gReturnURL; +var gSaveFilenamePrefix; // Add a prototype to the bufferSourceNode to reference to the audioObject holding it @@ -160,6 +161,9 @@ case "returnURL": gReturnURL = value; break; + case "saveFilenamePrefix": + gSaveFilenamePrefix = value; + break; } } loadProjectSpec(url); @@ -411,6 +415,9 @@ console.log("returnURL Overide from "+specification.returnURL+" to "+gReturnURL); specification.returnURL = gReturnURL; } + if (gSaveFilenamePrefix != undefined){ + specification.saveFilenamePrefix = gSaveFilenamePrefix; + } // Create the audio engine object audioEngineContext = new AudioEngine(specification); @@ -439,14 +446,20 @@ popup.popupContent.innerHTML = "Please save the file below to give to your test supervisor
"; popup.popupContent.appendChild(a); } else { + var saveUrlSuffix = ""; + var saveFilenamePrefix = specification.saveFilenamePrefix; + if(typeof(saveFilenamePrefix) === "string" && saveFilenamePrefix.length > 0){ + saveUrlSuffix = "&saveFilenamePrefix="+saveFilenamePrefix; + } + var projectReturn = ""; + if (typeof specification.projectReturn == "string") { + if (specification.projectReturn.substr(0,4) == "http") { + projectReturn = specification.projectReturn; + } + } + var saveURL = projectReturn+"php/save.php?key="+storage.SessionKey.key+saveUrlSuffix; var xmlhttp = new XMLHttpRequest; - var returnURL = ""; - if (typeof specification.projectReturn == "string") { - if (specification.projectReturn.substr(0,4) == "http") { - returnURL = specification.projectReturn; - } - } - xmlhttp.open("POST",returnURL+"php/save.php?key="+storage.SessionKey.key,true); + xmlhttp.open("POST", saveURL, true); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.onerror = function(){ console.log('Error saving file to server! Presenting download locally'); diff -r 1111763a695a -r cb01bc04ab2c php/save.php --- a/php/save.php Tue May 10 17:21:03 2016 +0100 +++ b/php/save.php Tue May 10 18:21:07 2016 +0100 @@ -1,10 +1,11 @@ preserveWhiteSpace = false; $doc->formatOutput = true;