changeset 2286:1448b446d6b3

Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author www-data <www-data@sucuk.dcs.qmul.ac.uk>
date Fri, 22 Apr 2016 10:21:00 +0100
parents ace330a89910 (current diff) e59327ebdb15 (diff)
children 878ef0a69d5d
files
diffstat 8 files changed, 29 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/css/core.css	Wed Apr 20 21:21:01 2016 +0100
+++ b/css/core.css	Fri Apr 22 10:21:00 2016 +0100
@@ -50,12 +50,13 @@
     margin-bottom: 35px;
 }
 
-div#popupTitle {
+div#popupTitleHolder {
     width: inherit;
     min-height: 25px;
     max-height: 250px;
     overflow: auto;
     margin-bottom: 5px;
+    text-align: center;
 }
 
 div#popupResponse {
--- a/index.html	Wed Apr 20 21:21:01 2016 +0100
+++ b/index.html	Fri Apr 22 10:21:00 2016 +0100
@@ -68,7 +68,7 @@
 		</div>
         <div id="popupHolder" class="popupHolder" style="visibility: hidden; z-index: -1">
             <div id="popupContent">
-                <div id="popupTitleHolder" style="text-align: center">
+                <div id="popupTitleHolder">
                     <span id="popupTitle"></span>
                 </div>
                 <div id="popupResponse"></div>
--- a/interfaces/ape.js	Wed Apr 20 21:21:01 2016 +0100
+++ b/interfaces/ape.js	Fri Apr 22 10:21:00 2016 +0100
@@ -28,7 +28,8 @@
 	    	str = "";
 	    	if (hasBeenPlayed.length > 1) {
 		    	for (var i=0; i<hasBeenPlayed.length; i++) {
-		    		str = str + (hasBeenPlayed[i]+1); // start from 1
+                    var ao_id = audioEngineContext.audioObjects[hasBeenPlayed[i]].interfaceDOM.getPresentedId();
+		    		str = str + ao_id; // start from 1
 		    		if (i < hasBeenPlayed.length-2){
 		    			str += ", ";
 		    		} else if (i == hasBeenPlayed.length-2) {
@@ -37,7 +38,7 @@
 		    	}
 		    	alert('You have not played fragments ' + str + ' yet. Please listen, rate and comment all samples before submitting.');
 	       } else {
-	       		alert('You have not played fragment ' + (hasBeenPlayed[0]+1) + ' yet. Please listen, rate and comment all samples before submitting.');
+	       		alert('You have not played fragment ' + (audioEngineContext.audioObjects[hasBeenPlayed[0]].interfaceDOM.getPresentedId()) + ' yet. Please listen, rate and comment all samples before submitting.');
 	       }
 	        return false;
 	    }
@@ -52,7 +53,8 @@
 			var interfaceTID = [];
 			for (var j=0; j<this.interfaceSliders[i].metrics.length; j++)
 			{
-				if (this.interfaceSliders[i].metrics[j].wasMoved == false)
+                var ao_id = this.interfaceSliders[i].sliders[j].getAttribute("trackIndex");
+				if (this.interfaceSliders[i].metrics[j].wasMoved == false && audioEngineContext.audioObjects[ao_id].interfaceDOM.canMove())
 				{
 					state = false;
 					interfaceTID.push(j);
@@ -68,15 +70,15 @@
 				}
 				if (interfaceTID.length == 1)
 				{
-					str += 'slider '+(interfaceTID[0]+1)+'. '; // start from 1
+					str += 'slider '+(audioEngineContext.audioObjects[interfaceTID[0]].interfaceDOM.getPresentedId())+'. '; // start from 1
 				}
 				else {
 					str += 'sliders ';
 					for (var k=0; k<interfaceTID.length-1; k++)
 					{
-						str += (interfaceTID[k]+1)+', '; // start from 1
+						str += (audioEngineContext.audioObjects[interfaceTID[k]].interfaceDOM.getPresentedId())+', '; // start from 1
 					}
-					str += (interfaceTID[interfaceTID.length-1]+1) +'. ';
+					str += (audioEngineContext.audioObjects[interfaceTID[interfaceTID.length-1]].interfaceDOM.getPresentedId()) +'. ';
 				}
 			}
 		}
@@ -105,7 +107,8 @@
 				if (strNums.length > 1) {
 					var str = "";
 			    	for (var i=0; i<strNums.length; i++) {
-			    		str = str + (strNums[i]+1); // start from 1
+                        var ao_id = audioEngineContext.audioObjects[strNums[i]].interfaceDOM.getPresentedId();
+			    		str = str + (ao_id); // start from 1
 			    		if (i < strNums.length-2){
 			    			str += ", ";
 			    		} else if (i == strNums.length-2) {
@@ -114,7 +117,7 @@
 			    	}
 			    	alert('You have not commented on fragments ' + str + ' yet. Please listen, rate and comment all samples before submitting.');
 		       } else {
-		       		alert('You have not commented on fragment ' + (strNums[0]+1) + ' yet. Please listen, rate and comment all samples before submitting.');
+		       		alert('You have not commented on fragment ' + (audioEngineContext.audioObjects[strNums[0]].interfaceDOM.getPresentedId()) + ' yet. Please listen, rate and comment all samples before submitting.');
 		       }
 			}
 		}
--- a/php/get_filtered_count.php	Wed Apr 20 21:21:01 2016 +0100
+++ b/php/get_filtered_count.php	Fri Apr 22 10:21:00 2016 +0100
@@ -1,33 +1,6 @@
 <?php
 //http://stackoverflow.com/questions/4444475/transfrom-relative-path-into-absolute-url-using-php
-function rel2abs($rel, $base)
-{
-    /* return if already absolute URL */
-    if (parse_url($rel, PHP_URL_SCHEME) != '' || substr($rel, 0, 2) == '//') return $rel;
-
-    /* queries and anchors */
-    if ($rel[0]=='#' || $rel[0]=='?') return $base.$rel;
-
-    /* parse base URL and convert to local variables:
-     $scheme, $host, $path */
-    extract(parse_url($base));
-
-    /* remove non-directory element from path */
-    $path = preg_replace('#/[^/]*$#', '', $path);
-
-    /* destroy path if relative url points to root */
-    if ($rel[0] == '/') $path = '';
-
-    /* dirty absolute URL */
-    $abs = "$host$path/$rel";
-
-    /* replace '//' or '/./' or '/foo/../' with '/' */
-    $re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#');
-    for($n=1; $n>0; $abs=preg_replace($re, '/', $abs, -1, $n)) {}
-
-    /* absolute URL is ready! */
-    return $scheme.'://'.$abs;
-}
+include "rel2abs.php";
 
 /*
     This looks for files that pass the filtering response
@@ -38,25 +11,25 @@
         max - Maximum Inclusive
         exclude-# - exclude, followed by a number to uniquely add, (will create a triple [], ignore the third as random)
 */
-$keys = [];
+$keys = array();
 $waet_url = null;
 foreach ($_GET as $key => $value) {
     $key = explode("-",$key);
     if ($key[0] == "url") {
         $waet_url = $value;
     } else {
-        $v_pair = [$key[1],$value];
+        $v_pair = array($key[1],$value);
         if(array_key_exists($key[0],$keys)) {
             // We have some data
             array_push($keys[$key[0]],$v_pair);
         } else {
             // Create new key data
-            $keys[$key[0]] = [$v_pair];
+            $keys[$key[0]] = array($v_pair);
         }
     }
 }
 
-$files = [];
+$files = array();
 $saves = glob("../saves/*.xml");
 if (is_array($saves))
 {
--- a/php/get_tests.php	Wed Apr 20 21:21:01 2016 +0100
+++ b/php/get_tests.php	Fri Apr 22 10:21:00 2016 +0100
@@ -5,38 +5,10 @@
     This script returns the XML test names available, plus the number of tests
 */
 
-//http://stackoverflow.com/questions/4444475/transfrom-relative-path-into-absolute-url-using-php
-function rel2abs($rel, $base)
-{
-    /* return if already absolute URL */
-    if (parse_url($rel, PHP_URL_SCHEME) != '' || substr($rel, 0, 2) == '//') return $rel;
-
-    /* queries and anchors */
-    if ($rel[0]=='#' || $rel[0]=='?') return $base.$rel;
-
-    /* parse base URL and convert to local variables:
-     $scheme, $host, $path */
-    extract(parse_url($base));
-
-    /* remove non-directory element from path */
-    $path = preg_replace('#/[^/]*$#', '', $path);
-
-    /* destroy path if relative url points to root */
-    if ($rel[0] == '/') $path = '';
-
-    /* dirty absolute URL */
-    $abs = "$host$path/$rel";
-
-    /* replace '//' or '/./' or '/foo/../' with '/' */
-    $re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#');
-    for($n=1; $n>0; $abs=preg_replace($re, '/', $abs, -1, $n)) {}
-
-    /* absolute URL is ready! */
-    return $scheme.'://'.$abs;
-}
+include "rel2abs.php";
 
 // XML Saves location - assumes it will be saves/
-$data = [];
+$data = array();
 $saves = glob("../saves/*.xml");
 if (is_array($saves))
 {
@@ -52,7 +24,7 @@
                 array_push($data[$testName],$filename);
             } else {
                 // Key does not exist
-                $data[$testName] = [$filename];
+                $data[$testName] = array($filename);
             }
         }
     }
--- a/php/pool.php	Wed Apr 20 21:21:01 2016 +0100
+++ b/php/pool.php	Fri Apr 22 10:21:00 2016 +0100
@@ -17,7 +17,7 @@
 // Note this is relative to the PHP location
 
 // First set up the store with all the test page key nodes
-$pages = [];
+$pages = array();
 $master_xml = simplexml_load_string(file_get_contents($master_file, FILE_TEXT));
 if ($master_xml) {
     if (!isset($master_xml->setup["poolSize"]))
@@ -72,12 +72,12 @@
 $root->appendChild($dom_setup);
 
 // We must now extract the number which have been performed the least
-$rot_pages = [];
+$rot_pages = array();
 foreach($pages as $key => $var)
     if(array_key_exists($var,$rot_pages)) {
         array_push($rot_pages[$var],$key);
     } else {
-        $rot_pages[$var] = [$key];
+        $rot_pages[$var] = array($key);
     }
 ksort($rot_pages);
 $Keys = array_keys($rot_pages);
--- a/test.html	Wed Apr 20 21:21:01 2016 +0100
+++ b/test.html	Fri Apr 22 10:21:00 2016 +0100
@@ -54,7 +54,7 @@
 		</div>
         <div id="popupHolder" class="popupHolder" style="visibility: hidden; z-index: -1">
             <div id="popupContent">
-                <div id="popupTitleHolder" style="text-align: center">
+                <div id="popupTitleHolder">
                     <span id="popupTitle"></span>
                 </div>
                 <div id="popupResponse"></div>
--- a/tests/examples/project.xml	Wed Apr 20 21:21:01 2016 +0100
+++ b/tests/examples/project.xml	Fri Apr 22 10:21:00 2016 +0100
@@ -46,6 +46,7 @@
 		</metric>
 		<interface>
 			<interfaceoption type="check" name="fragmentMoved"/>
+            <interfaceoption type="check" name="fragmentPlayed"/>
 			<interfaceoption type="check" name="scalerange" min="25" max="75"/>
 			<interfaceoption type="show" name='playhead'/>
 			<interfaceoption type="show" name="page-count"/>
@@ -54,6 +55,7 @@
 	<page id='test-0' hostURL="media/example/" randomiseOrder='true' repeatCount='0' loop='true' showElementComments='true' loudness="-12">
 		<commentboxprefix>Comment on fragment</commentboxprefix>
 		<interface name="preference">
+            <title>Preference</title>
 			<scales>
 				<scalelabel position="0">Min</scalelabel>
 				<scalelabel position="100">Max</scalelabel>
@@ -86,7 +88,7 @@
 			</surveyentry>
 		</survey>
 	</page>
-	<page id='test-1' hostURL="media/example/" randomiseOrder='true' repeatCount='0' loop='false' showElementComments='true' label="none">
+	<page id='test-1' hostURL="media/example/" randomiseOrder='true' repeatCount='0' loop='false' showElementComments='true' label="letter">
 		<commentboxprefix>Comment on fragment</commentboxprefix>
 		<interface name="preference">
 			<title>Example Test Question</title>