Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2302:f7604317ac27
Fix for #39. projectReturn is now used to determine which server to save the session to if using different servers for hosting and analysis
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 28 Apr 2016 09:57:21 +0100 |
parents | 18d390c66b47 |
children | e4a2a39838db |
comparison
equal
deleted
inserted
replaced
2301:18d390c66b47 | 2302:f7604317ac27 |
---|---|
406 popup.showPopup(); | 406 popup.showPopup(); |
407 popup.popupContent.innerHTML = "<span>Please save the file below to give to your test supervisor</span><br>"; | 407 popup.popupContent.innerHTML = "<span>Please save the file below to give to your test supervisor</span><br>"; |
408 popup.popupContent.appendChild(a); | 408 popup.popupContent.appendChild(a); |
409 } else { | 409 } else { |
410 var xmlhttp = new XMLHttpRequest; | 410 var xmlhttp = new XMLHttpRequest; |
411 xmlhttp.open("POST","php/save.php?key="+storage.SessionKey.key,true); | 411 var returnURL = ""; |
412 if (typeof specification.projectReturn == "string") { | |
413 if (specification.projectReturn.substr(0,4) == "http") { | |
414 returnURL = specification.projectReturn; | |
415 } | |
416 } | |
417 xmlhttp.open("POST",returnURL+"php/save.php?key="+storage.SessionKey.key,true); | |
412 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); | 418 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); |
413 xmlhttp.onerror = function(){ | 419 xmlhttp.onerror = function(){ |
414 console.log('Error saving file to server! Presenting download locally'); | 420 console.log('Error saving file to server! Presenting download locally'); |
415 createProjectSave("local"); | 421 createProjectSave("local"); |
416 }; | 422 }; |
2835 this.generateKey(); | 2841 this.generateKey(); |
2836 } | 2842 } |
2837 }, | 2843 }, |
2838 generateKey: function() { | 2844 generateKey: function() { |
2839 var temp_key = randomString(32); | 2845 var temp_key = randomString(32); |
2840 this.request.open("GET","php/keygen.php?key="+temp_key,true); | 2846 var returnURL = ""; |
2847 if (typeof specification.projectReturn == "string") { | |
2848 if (specification.projectReturn.substr(0,4) == "http") { | |
2849 returnURL = specification.projectReturn; | |
2850 } | |
2851 } | |
2852 this.request.open("GET",returnURL+"php/keygen.php?key="+temp_key,true); | |
2841 this.request.addEventListener("load",this); | 2853 this.request.addEventListener("load",this); |
2842 this.request.send(); | 2854 this.request.send(); |
2843 }, | 2855 }, |
2844 update: function() { | 2856 update: function() { |
2845 this.parent.root.setAttribute("state","update"); | 2857 this.parent.root.setAttribute("state","update"); |
2846 var xmlhttp = new XMLHttpRequest(); | 2858 var xmlhttp = new XMLHttpRequest(); |
2847 xmlhttp.open("POST","php/"+specification.projectReturn+"?key="+this.key); | 2859 var returnURL = ""; |
2860 if (typeof specification.projectReturn == "string") { | |
2861 if (specification.projectReturn.substr(0,4) == "http") { | |
2862 returnURL = specification.projectReturn; | |
2863 } | |
2864 } | |
2865 xmlhttp.open("POST",returnURL+"php/save.php?key="+this.key); | |
2848 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); | 2866 xmlhttp.setRequestHeader('Content-Type', 'text/xml'); |
2849 xmlhttp.onerror = function(){ | 2867 xmlhttp.onerror = function(){ |
2850 console.log('Error updating file to server!'); | 2868 console.log('Error updating file to server!'); |
2851 }; | 2869 }; |
2852 var hold = document.createElement("div"); | 2870 var hold = document.createElement("div"); |