# HG changeset patch # User Nicholas Jillings # Date 1505221439 -3600 # Node ID 8bcba5c956560f482487ad2f1b4201b72c68032c # Parent b2dcdd55721d0da878432c3c12b5c897874beff1# Parent 03c166698eab6051fd1976222e4d3d241b3b63a9 Merge branch 'hot_fix' diff -r b2dcdd55721d -r 8bcba5c95656 interfaces/ABX.js --- a/interfaces/ABX.js Tue Sep 12 12:06:44 2017 +0100 +++ b/interfaces/ABX.js Tue Sep 12 14:03:59 2017 +0100 @@ -271,10 +271,7 @@ }; this.updateLoading = function (progress) { // progress is a value from 0 to 100 indicating the current download state of media files - if (label == "X" || label == "x") { - this.playback.textContent = "Play"; - } - if (progress != 100) { + if (progress != 100 && label.toLowerCase() != "x") { progress = String(progress); progress = progress.split('.')[0]; this.playback.textContent = progress + '%'; @@ -301,8 +298,8 @@ }; this.stopPlayback = function () { if (this.playback.getAttribute("playstate") == "playing") { - $('.comparator-button').text('Listen'); - $('.comparator-button').removeAttr("disabled"); + $(this.playback).text('Listen'); + $(this.playback).removeAttr("disabled"); this.playback.setAttribute("playstate", "ready"); } var box = interfaceContext.commentBoxes.boxes.find(function (a) { @@ -372,15 +369,22 @@ this.boxHolders = document.getElementById('box-holders'); var node; page.audioElements.forEach(function (element, index) { - if (element.type != 'normal') { - console.log("WARNING - ABX can only have normal elements. Page " + page.id + ", Element " + element.id); + if (element.type != 'normal' && element.type != "reference") { + console.log("WARNING - ABX can only have normal or reference elements. Page " + page.id + ", Element " + element.id); element.type = "normal"; } node = buildElement.call(this, index, audioEngineContext.newTrack(element)); this.pair.push(node); this.boxHolders.appendChild(node.box); }, this); - var elementId = Math.floor(Math.random() * 2); //Randomly pick A or B to be X + // var elementId = Math.floor(Math.random() * 2); //Randomly pick A or B to be X + var elementId = page.audioElements.findIndex(function (a) { + return a.type == "reference"; + }); + if (elementId == -1) { + elementId = Math.floor(Math.random() * 2); + console.log("No defined 'X' given. Selecting element id " + page.audioElements[elementId].id); + } var element = page.addAudioElement(); for (var atr in page.audioElements[elementId]) { element[atr] = page.audioElements[elementId][atr]; diff -r b2dcdd55721d -r 8bcba5c95656 php/test.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/php/test.html Tue Sep 12 14:03:59 2017 +0100 @@ -0,0 +1,105 @@ + + + + + + + + + + Web Audio Evaluation Tool + + + + + + + + + + + + + + + + + + +
+

WAET PHP Server Tests

+

This page will test your PHP server for any implementation issues.

+

Make sure your saves directory is clean before testing and that you empty it afterwards as intermediary files will be made there.

+ +
+
+ + + diff -r b2dcdd55721d -r 8bcba5c95656 php/test_write.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/php/test_write.php Tue Sep 12 14:03:59 2017 +0100 @@ -0,0 +1,10 @@ +"); +if ($state == FALSE) { + echo "Could not open file"; +} else { + unlink($file) or die("Could not open file"); + echo "OK"; +} +?> diff -r b2dcdd55721d -r 8bcba5c95656 python/pythonServer.py --- a/python/pythonServer.py Tue Sep 12 12:06:44 2017 +0100 +++ b/python/pythonServer.py Tue Sep 12 14:03:59 2017 +0100 @@ -129,7 +129,7 @@ elif sys.version_info[0] == 3: s.wfile.write(bytes(reply, "utf-8")) file = open("../saves/save-"+key+".xml",'w') - file.write("") + file.write("") file.close() @@ -173,6 +173,35 @@ self.wfile.write(bytes(reply, "utf-8")) curSaveIndex += 1 curFileName = 'test-'+str(curSaveIndex)+'.xml' + +def testSave(self): + self.send_response(200) + self.send_header("Content-type", "text/xml") + self.end_headers() + filename = "../saves/test-save.xml" + file = open(filename,'wb') + if sys.version_info[0] == 2: + file.write("") + elif sys.version_info[0] == 3: + file.write(bytes("", "utf-8")) + file.close() + message = "" + try: + wbytes = os.path.getsize(filename) + except OSError: + message = 'Could not open file'; + if sys.version_info[0] == 2: + self.wfile.write(message) + elif sys.version_info[0] == 3: + self.wfile.write(bytes(message, "utf-8")) + return + os.remove(filename) + message = 'OK'; + if sys.version_info[0] == 2: + self.wfile.write(message) + elif sys.version_info[0] == 3: + self.wfile.write(bytes(message, "utf-8")) + def poolXML(s): pool = ET.parse('../tests/pool.xml') @@ -243,6 +272,8 @@ requestKey(request); elif (request.path.split('?',1)[0] == "/php/pool.php"): poolXML(request); + elif (request.path.split('?',1)[0] == "/php/test_write.php"): + testSave(request); else: request.path = request.path.split('?',1)[0] if (request.path == '/'):