# HG changeset patch # User Nicholas Jillings # Date 1505221538 -3600 # Node ID 03b0e5dc57e62a7a3cfce05ec09486cc4cfa1549 # Parent f5bfac0557bbfab905493fdf3ae3cd16329e7e7e# Parent 209532a650dad40494b8167b8d0ce6873d579843 Merge branch 'vnext' into Dev_main # Conflicts: # python/pythonServer.py diff -r f5bfac0557bb -r 03b0e5dc57e6 css/core.css --- a/css/core.css Mon Sep 11 21:58:05 2017 +0100 +++ b/css/core.css Tue Sep 12 14:05:38 2017 +0100 @@ -65,9 +65,6 @@ padding: 8px; text-align: center; } -#popupTitle { - white-space: pre-line; -} div#popupResponse { width: inherit; min-height: 50px; diff -r f5bfac0557bb -r 03b0e5dc57e6 interfaces/ABX.js --- a/interfaces/ABX.js Mon Sep 11 21:58:05 2017 +0100 +++ b/interfaces/ABX.js Tue Sep 12 14:05:38 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 f5bfac0557bb -r 03b0e5dc57e6 php/test.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/php/test.html Tue Sep 12 14:05:38 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 f5bfac0557bb -r 03b0e5dc57e6 php/test_write.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/php/test_write.php Tue Sep 12 14:05:38 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 f5bfac0557bb -r 03b0e5dc57e6 python/pythonServer.py --- a/python/pythonServer.py Mon Sep 11 21:58:05 2017 +0100 +++ b/python/pythonServer.py Tue Sep 12 14:05:38 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() @@ -180,6 +180,34 @@ curFileName = 'test-'+str(curSaveIndex)+'.xml' if update == False: os.remove("../saves/update-"+filename) + +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') @@ -250,6 +278,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 == '/'): diff -r f5bfac0557bb -r 03b0e5dc57e6 tests/examples/ABX_example.xml --- a/tests/examples/ABX_example.xml Mon Sep 11 21:58:05 2017 +0100 +++ b/tests/examples/ABX_example.xml Tue Sep 12 14:05:38 2017 +0100 @@ -2,38 +2,38 @@ - + Please enter your name. - - + + Please select with which activities you have any experience (example checkbox question) - - + + This is an example of an 'ABX'-style test, with two pages, using the test stimuli in 'example_eval/'. - + - + Please enter your location. (example mandatory text question) - - + + Please enter your age (example non-mandatory number question) - - + + Please rate this interface (example radio button question) - - + + Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder. - + testTimer diff -r f5bfac0557bb -r 03b0e5dc57e6 tests/examples/APE_example.xml --- a/tests/examples/APE_example.xml Mon Sep 11 21:58:05 2017 +0100 +++ b/tests/examples/APE_example.xml Tue Sep 12 14:05:38 2017 +0100 @@ -22,22 +22,22 @@ - + Please enter your location. (example mandatory text question) - - + + Please enter your age (example non-mandatory number question) - - + + Please rate this interface (example radio button question) - - + + Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder. - + testTimer diff -r f5bfac0557bb -r 03b0e5dc57e6 tests/examples/mushra_example.xml --- a/tests/examples/mushra_example.xml Mon Sep 11 21:58:05 2017 +0100 +++ b/tests/examples/mushra_example.xml Tue Sep 12 14:05:38 2017 +0100 @@ -3,38 +3,38 @@ Thank you for looking at WAET. You can modify the successful completion text as well! - + Please enter your name. - - + + Please select with which activities you have any experience (example checkbox question) - - + + This is an example of an 'MUSHRA'-style test, with two pages, using the test stimuli in 'example_eval/'. - + - + Please enter your location. (example mandatory text question) - - + + Please enter your age (example non-mandatory number question) - - + + Please rate this interface (example radio button question) - - + + Thank you for taking this listening test. Please click 'submit' and your results will appear in the 'saves/' folder. - + testTimer