# HG changeset patch # User Nicholas Jillings # Date 1444252566 -3600 # Node ID bc6c35b0a49da19d1d2cfcd8286ed248407ac2d9 # Parent 9c579fc05a0940b5fa1ca060eb7e143f8fb6d532 More test_creators diff -r 9c579fc05a09 -r bc6c35b0a49d test_create/test_create.html --- a/test_create/test_create.html Wed Sep 23 11:42:11 2015 +0100 +++ b/test_create/test_create.html Wed Oct 07 22:16:06 2015 +0100 @@ -14,11 +14,14 @@ var APEInterfaceOptions = [["playhead","page-count"],["Show the playhead/scrubber bar", "Show test page count"]]; var APEInterfaceChecks = [["fragmentPlayed","fragmentFullPlayback","fragmentMoved","fragmentComments"],["All Fragments Played","All Fragments Played in entirety","All sliders moved","All fragments have comments"]]; + var APEInterfaceMetrics = [["testTimer","elementTimer","elementTracker","elementTrackerFull","elementFlagListenedTo","elementFlagMoved","elementFlagComments"],["Test Duration","Total time each fragment was listened to","Return initialised position of marker","Fragment movement tracker with timestamps","Flag if fragment listened to","Flag if fragment moved","Flag if fragment has comments"]]; var MUSHRAInterfaceOptions = [[],[]]; var MUSHRAInterfaceChecks = [["fragmentPlayed","fragmentMoved","fragmentComments"],["All Fragments Played","All sliders moved","All fragments have comments"]]; + var MUSHRAInterfaceMetrics = [["testTimer","elementTimer","elementTracker","elementTrackerFull","elementFlagListenedTo","elementFlagMoved","elementFlagComments"],["Test Duration","Total time each fragment was listened to","Return initialised position of marker","Fragment movement tracker with timestamps","Flag if fragment listened to","Flag if fragment moved","Flag if fragment has comments"]]; var popupInstance; var specificationNode; var audioContext; + var audioObjects = []; window.onload = function() { var AudioContext = window.AudioContext || window.webkitAudioContext; @@ -73,6 +76,7 @@ this.pageBlank.style.visibility = 'hidden'; this.state = 0; + this.dataTransfer = null; this.showPopup = function() { @@ -247,6 +251,7 @@ this.popupFooter.appendChild(button); break; case 3: + audioObjects = []; this.popupTitleText.textContent = "Test Page"; var span = document.createElement('span'); span.textContent = "Drag and drop your audio files into the box below to add them to a test page"; @@ -273,12 +278,16 @@ var files = dt.files; for (var i = 0, f; f = files[i]; i++) { + var ao = new audioObject(); + ao.constructTrack(f); + audioObjects.push(ao); var dndHeader = document.createElement('div'); dndHeader.style.width = "100%"; dndHeader.style.height = "20px"; dndHeader.style.borderBottom = "#DDD"; dndHeader.style.borderBottomWidth = "1px"; dndHeader.style.borderBottomStyle = "solid"; + dndHeader.setAttribute('aoID',audioObjects.length-1); var dndHInclude = document.createElement('div'); dndHInclude.style.width = "30px"; dndHInclude.className = "dndheaderelement"; @@ -286,6 +295,11 @@ includeCheck.type = "checkbox"; includeCheck.name = "include-check"; includeCheck.checked = true; + includeCheck.onchange = function() + { + var i = event.currentTarget.parentElement.parentElement.getAttribute('aoID'); + audioObjects[i].include = event.currentTarget.checked; + }; dndHInclude.appendChild(includeCheck); dndHeader.appendChild(dndHInclude); var dndHTitle = document.createElement('div'); @@ -299,19 +313,64 @@ dndHID.style.width = "100px"; dndHID.className = "dndheaderelement"; var IDInput = document.createElement('input'); - IDInput.name = "ID"; + IDInput.name = "audio-fragment-ID"; IDInput.value = f.name.split('.')[0]; + IDInput.onchange = function() + { + var allIDInput = document.getElementsByName("audio-fragment-ID"); + var isCopy = new Array(allIDInput.length); + isCopy.fill(0,0,this.length); + if (allIDInput.length > 1) + { + for (var j=0; j 1) {this.marker /= 100;} - } + this.marker = undefined; }; this.commentQuestionNode = function(xml) { @@ -665,135 +1815,402 @@ break; } }; + }; + + this.preTest = new this.prepostNode("pretest"); + this.postTest = new this.prepostNode("posttest"); + } + function SpecficationToHTML() + { + // Take information from Specification Node and format it into an HTML layout + var destination = document.getElementById("content"); + // Setup Header Node + var setupNode = document.createElement("div"); + setupNode.className = "topLevel"; + setupNode.name = "setup"; + var title = document.createElement("h2"); + title.textContent = "Setup"; + setupNode.appendChild(title); + // Interface Type + var div = document.createElement("div"); + div.name = "attributes"; + div.style.margin = "5px"; + var select = document.createElement("select"); + select.id = "interfaceSelect"; + select.style.margin = "5px"; + var option = document.createElement("option"); + option.value = "APE"; + option.textContent = "APE"; + select.appendChild(option); + option = document.createElement("option"); + option.value = "MUSHRA"; + option.textContent = "MUSHRA"; + select.appendChild(option); + select.value = specificationNode.interfaceType; + var span = document.createElement("span"); + span.textContent = "Interface Type"; + div.appendChild(span); + div.appendChild(select); + // Project Return Attribute + span = document.createElement("span"); + span.style.margin = "5px"; + span.textContent = "Project Return"; + var input = document.createElement("input"); + input.value = specificationNode.projectReturn; + input.id = "projectReturn"; + input.style.margin = "5px"; + div.appendChild(span); + div.appendChild(input); + // Randomise Order + span = document.createElement("span"); + span.textContent = "Randomise Order"; + input = document.createElement("input"); + input.id = "randomiseOrder"; + input.style.margin = "5px"; + input.type = "checkbox"; + input.value = specificationNode.projectReturn; + div.appendChild(span); + div.appendChild(input); + setupNode.appendChild(div); + + // Now create the common Interface Node + var commonInterface = document.createElement("div"); + commonInterface.id = "interface"; + commonInterface.className = "SecondLevel"; + var title = document.createElement("h3"); + title.textContent = "Common Interface"; + commonInterface.appendChild(title); + var div = document.createElement("div"); + div.name = "attributes"; + var interfaceOptions; + var interfaceChecks; + switch(select.value) + { + case "APE": + interfaceOptions = APEInterfaceOptions; + interfaceChecks = APEInterfaceChecks; + break; + case "MUSHRA": + interfaceOptions = MUSHRAInterfaceOptions; + interfaceChecks = MUSHRAInterfaceChecks; + break; + } + for (var i=0; i 1 && anchor < 100) {anchor /= 100.0;} + aHTML.appendChild(postTest); + + //Audio Elements + var audioElems = document.createElement("div"); + audioElems.id = aHTML.id+"-audioElements"; + audioElems.className = "SecondLevel"; + var title = document.createElement("h3"); + title.textContent = "Audio Elements"; + audioElems.appendChild(title); + for (var i=0; i 1 && reference < 100) {reference /= 100.0;} + aHTML.appendChild(audioElems); + } + + function PPSurveyToHTML(node) + { + var holder = document.createElement("div"); + var title = document.createElement("h4"); + holder.appendChild(title); + var attributes = document.createElement("div"); + holder.appendChild(attributes); + switch(node.type) + { + case "statement": + title.textContent = "Statement"; + var tA = document.createElement("textarea"); + attributes.style.height = "150px"; + tA.style.width = "500px"; + tA.style.height = "100px"; + tA.value = node.statement; + attributes.appendChild(tA); + break; + case "question": + title.textContent = "Question"; + var text = document.createElement("span"); + text.textContent = "ID :"; + var input = document.createElement("input"); + input.name = "id"; + input.value = node.id; + text.style.margin = "5px"; + input.style.margin = "5px"; + attributes.appendChild(text); + attributes.appendChild(input); + text = document.createElement("span"); + text.textContent = "Question"; + input = document.createElement("input"); + input.name = "question"; + input.value = node.question; + text.style.margin = "5px"; + input.style.margin = "5px"; + attributes.appendChild(text); + attributes.appendChild(input); + text = document.createElement("span"); + text.textContent = "Mandatory"; + input = document.createElement("input"); + input.name = "mandatory"; + input.type = "checkbox"; + input.checked = node.mandatory; + text.style.margin = "5px"; + input.style.margin = "5px"; + attributes.appendChild(text); + attributes.appendChild(input); + break; } - - this.preTest = new parent.prepostNode('pretest',xml.getElementsByTagName('PreTest')); - this.postTest = new parent.prepostNode('posttest',xml.getElementsByTagName('PostTest')); - - this.interfaces = []; - var interfaceDOM = xml.getElementsByTagName('interface'); - for (var i=0; i 1) { - console.log('Error - cannot have more than one anchor!'); - console.log('Each anchor node will be a normal mode to continue the test'); - for (var i=0; i 1) { - console.log('Error - cannot have more than one anchor!'); - console.log('Each anchor node will be a normal mode to continue the test'); - for (var i=0; i