# HG changeset patch # User Giulio Moro # Date 1462898661 -3600 # Node ID d347dbab980d0b2f00861e07d396a04fe41caced # Parent e22ec7b6cfbd28c8e68698983e3488abe5627ef1 Added support for saveFilenamePrefix= querystring , closed #56 diff -r e22ec7b6cfbd -r d347dbab980d js/core.js --- a/js/core.js Tue May 10 16:55:06 2016 +0100 +++ b/js/core.js Tue May 10 17:44:21 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 e22ec7b6cfbd -r d347dbab980d php/save.php --- a/php/save.php Tue May 10 16:55:06 2016 +0100 +++ b/php/save.php Tue May 10 17:44:21 2016 +0100 @@ -1,10 +1,11 @@ preserveWhiteSpace = false; $doc->formatOutput = true;