annotate test_create/test_create.html @ 1406:a2a0a3a6f36d

Specification Node is same across project.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 07 Dec 2015 09:47:26 +0000
parents a9f1b91b6335
children 67c6048d920f
rev   line source
nickjillings@1404 1 <!DOCTYPE html>
nickjillings@1404 2 <html lang="en">
nickjillings@1404 3 <head>
nickjillings@1404 4 <meta charset="utf-8">
nickjillings@1404 5
nickjillings@1404 6 <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
nickjillings@1404 7 Remove this if you use the .htaccess -->
nickjillings@1404 8 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
nickjillings@1404 9
nickjillings@1404 10 <title>WAET: Test Creator</title>
nickjillings@1404 11
nickjillings@1404 12 <meta name="viewport" content="width=device-width; initial-scale=1.0">
nickjillings@1404 13 <script type="text/javascript">
nickjillings@1404 14
nickjillings@1404 15 var APEInterfaceOptions = [["playhead","page-count"],["Show the playhead/scrubber bar", "Show test page count"]];
nickjillings@1404 16 var APEInterfaceChecks = [["fragmentPlayed","fragmentFullPlayback","fragmentMoved","fragmentComments"],["All Fragments Played","All Fragments Played in entirety","All sliders moved","All fragments have comments"]];
nickjillings@1404 17 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"]];
nickjillings@1404 18 var MUSHRAInterfaceOptions = [[],[]];
nickjillings@1404 19 var MUSHRAInterfaceChecks = [["fragmentPlayed","fragmentMoved","fragmentComments"],["All Fragments Played","All sliders moved","All fragments have comments"]];
nickjillings@1404 20 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"]];
nickjillings@1404 21 var popupInstance;
nickjillings@1404 22 var specificationNode;
nickjillings@1404 23 var audioContext;
nickjillings@1404 24 var audioObjects = [];
nickjillings@1404 25 window.onload = function()
nickjillings@1404 26 {
nickjillings@1404 27 var AudioContext = window.AudioContext || window.webkitAudioContext;
nickjillings@1404 28 audioContext = new AudioContext;
nickjillings@1404 29 popupInstance = new popup();
nickjillings@1404 30 popupInstance.advanceState();
nickjillings@1404 31 specificationNode = new Specification();
nickjillings@1404 32 specificationNode.projectReturn = "null";
nickjillings@1404 33 };
nickjillings@1404 34
nickjillings@1404 35 function popup()
nickjillings@1404 36 {
nickjillings@1404 37 var x = window.innerWidth;
nickjillings@1404 38 var y = window.innerHeight;
nickjillings@1404 39 this.popupHolder = document.createElement('div');
nickjillings@1404 40 this.popupHolder.style.visibility = 'hidden';
nickjillings@1404 41 this.popupContent = document.createElement('div');
nickjillings@1404 42 this.popupTitle = document.createElement('div');
nickjillings@1404 43 this.popupBody = document.createElement('div');
nickjillings@1404 44 this.popupFooter = document.createElement('div');
nickjillings@1404 45 this.popupTitleText = document.createElement('span');
nickjillings@1404 46 this.popupTitle.appendChild(this.popupTitleText);
nickjillings@1404 47
nickjillings@1404 48 this.popupHolder.className = "popup";
nickjillings@1404 49 this.popupHolder.style.left = (x-500)/2 +'px';
nickjillings@1404 50 this.popupHolder.style.top = (y-400)/2 + 'px';
nickjillings@1404 51 this.popupContent.style.padding = "20px";
nickjillings@1404 52 this.popupHolder.appendChild(this.popupContent);
nickjillings@1404 53
nickjillings@1404 54 this.popupTitle.style.width = "100%";
nickjillings@1404 55 this.popupTitle.style.height = "50px";
nickjillings@1404 56 this.popupTitle.style.fontSize = "xx-large";
nickjillings@1404 57 this.popupContent.appendChild(this.popupTitle);
nickjillings@1404 58
nickjillings@1404 59 this.popupBody.style.width = "100%";
nickjillings@1404 60 this.popupBody.style.height = "280px";
nickjillings@1404 61 this.popupContent.appendChild(this.popupBody);
nickjillings@1404 62
nickjillings@1404 63 this.popupFooter.style.width = "100%";
nickjillings@1404 64 this.popupFooter.style.height = "30px";
nickjillings@1404 65 this.popupContent.appendChild(this.popupFooter);
nickjillings@1404 66 var body = document.getElementsByTagName('body')[0];
nickjillings@1404 67 body.appendChild(this.popupHolder);
nickjillings@1404 68
nickjillings@1404 69 this.pageBlank = document.createElement('div');
nickjillings@1404 70 body.appendChild(this.pageBlank);
nickjillings@1404 71 this.pageBlank.style.width = "100%";
nickjillings@1404 72 this.pageBlank.style.height = "100%";
nickjillings@1404 73 this.pageBlank.style.position = "absolute";
nickjillings@1404 74 this.pageBlank.style.left = "0px";
nickjillings@1404 75 this.pageBlank.style.top = "0px";
nickjillings@1404 76 this.pageBlank.style.backgroundColor = "rgba(0,0,0,0.5)";
nickjillings@1404 77 this.pageBlank.style.visibility = 'hidden';
nickjillings@1404 78
nickjillings@1404 79 this.state = 0;
nickjillings@1404 80 this.dataTransfer = null;
nickjillings@1404 81
nickjillings@1404 82 this.showPopup = function()
nickjillings@1404 83 {
nickjillings@1404 84 this.popupHolder.style.visibility = 'visible';
nickjillings@1404 85 this.popupHolder.style.zIndex = "3";
nickjillings@1404 86 this.pageBlank.style.visibility = 'visible';
nickjillings@1404 87 this.pageBlank.style.zIndex = "2";
nickjillings@1404 88 };
nickjillings@1404 89
nickjillings@1404 90 this.hidePopup = function()
nickjillings@1404 91 {
nickjillings@1404 92 this.popupHolder.style.visibility = 'hidden';
nickjillings@1404 93 this.popupHolder.style.zIndex = "-1";
nickjillings@1404 94 this.pageBlank.style.visibility = 'hidden';
nickjillings@1404 95 this.pageBlank.style.zIndex = "-2";
nickjillings@1404 96 };
nickjillings@1404 97
nickjillings@1404 98 this.init = function()
nickjillings@1404 99 {
nickjillings@1404 100 this.popupTitleText.textContent = "Welcome";
nickjillings@1404 101 var text = document.createElement('span');
nickjillings@1404 102 text.textContent = "Thank you for downloading the Web Audio Evaluation Toolbox. This page will help guide you through creating the documents required to run a test. If you have an existing XML file you wish to edit, please drag and drop it into the box below";
nickjillings@1404 103 var dnd = document.createElement('div');
nickjillings@1404 104 dnd.style.width = "100%";
nickjillings@1404 105 dnd.style.height = "50px";
nickjillings@1404 106 dnd.className = "dragndrop";
nickjillings@1404 107 dnd.ondragover = function(e) {
nickjillings@1404 108 e.stopPropagation();
nickjillings@1404 109 e.preventDefault();
nickjillings@1404 110 };
nickjillings@1404 111 dnd.ondragenter = function(e) {
nickjillings@1404 112 e.stopPropagation();
nickjillings@1404 113 e.preventDefault();
nickjillings@1404 114 this.style.backgroundColor = '#AAFFAA';
nickjillings@1404 115 };
nickjillings@1404 116 dnd.ondragleave = function(e) {
nickjillings@1404 117 e.stopPropagation();
nickjillings@1404 118 e.preventDefault();
nickjillings@1404 119 this.style.backgroundColor = "#FFFFFF";
nickjillings@1404 120 };
nickjillings@1404 121 dnd.ondrop = function(e) {
nickjillings@1404 122 e.stopPropagation();
nickjillings@1404 123 e.preventDefault();
nickjillings@1404 124
nickjillings@1404 125 var file = e.dataTransfer.files[0];
nickjillings@1404 126
nickjillings@1404 127 // Uses HTML5 FileAPI - https://w3c.github.io/FileAPI/#filereader-interface
nickjillings@1404 128 var reader = new FileReader();
nickjillings@1404 129 reader.onload = function() {
nickjillings@1404 130 var parse = new DOMParser();
nickjillings@1404 131 var xml = parse.parseFromString(reader.result,'text/xml');
nickjillings@1404 132 specificationNode.decode(xml);
nickjillings@1404 133 popupInstance.hidePopup();
nickjillings@1404 134 SpecificationToHTML();
nickjillings@1404 135 };
nickjillings@1404 136 reader.readAsText(file);
nickjillings@1404 137
nickjillings@1404 138 };
nickjillings@1404 139 this.popupBody.appendChild(text);
nickjillings@1404 140 this.popupBody.appendChild(dnd);
nickjillings@1404 141 this.showPopup();
nickjillings@1404 142
nickjillings@1404 143 var button = document.createElement('button');
nickjillings@1404 144 button.className = "popupButton";
nickjillings@1404 145 button.textContent = "New File";
nickjillings@1404 146 button.onclick = function(event) {
nickjillings@1404 147 popupInstance.advanceState();
nickjillings@1404 148 };
nickjillings@1404 149 this.popupFooter.appendChild(button);
nickjillings@1404 150 };
nickjillings@1404 151
nickjillings@1404 152 this.advanceState = function()
nickjillings@1404 153 {
nickjillings@1404 154 this.popupBody.innerHTML = null;
nickjillings@1404 155 this.popupFooter.innerHTML = null;
nickjillings@1404 156 this.popupTitleText.textContent = null;
nickjillings@1404 157 switch(this.state)
nickjillings@1404 158 {
nickjillings@1404 159 case 0:
nickjillings@1404 160 this.init();
nickjillings@1404 161 break;
nickjillings@1404 162 case 1:
nickjillings@1404 163 this.popupTitleText.textContent = "Test Type";
nickjillings@1404 164 var text = document.createElement("span");
nickjillings@1404 165 text.textContent = "What type of test would you like to use. Currently APE (Audio Perceptual Evaluation) and MUSHRA style interfaces are available";
nickjillings@1404 166 this.popupBody.appendChild(text);
nickjillings@1404 167 var select = document.createElement("select");
nickjillings@1404 168 select.id="interface-select";
nickjillings@1404 169 var opt1 = document.createElement("option");
nickjillings@1404 170 opt1.value = "APE";
nickjillings@1404 171 opt1.textContent = "APE";
nickjillings@1404 172 select.appendChild(opt1);
nickjillings@1404 173 var opt2 = document.createElement("option");
nickjillings@1404 174 opt2.value = "MUSHRA";
nickjillings@1404 175 opt2.textContent = "MUSHRA";
nickjillings@1404 176 select.appendChild(opt2);
nickjillings@1404 177 this.popupBody.appendChild(select);
nickjillings@1404 178
nickjillings@1404 179 var button = document.createElement('button');
nickjillings@1404 180 button.className = "popupButton";
nickjillings@1404 181 button.textContent = "Submit";
nickjillings@1404 182 button.onclick = function(event) {
nickjillings@1404 183 var select = document.getElementById("interface-select");
nickjillings@1404 184 specificationNode.interfaceType = select.value;
nickjillings@1404 185 specificationNode.collectMetrics = true;
nickjillings@1404 186 popupInstance.advanceState();
nickjillings@1404 187 };
nickjillings@1404 188 this.popupFooter.appendChild(button);
nickjillings@1404 189 break;
nickjillings@1404 190 case 2:
nickjillings@1404 191 this.popupTitleText.textContent = "Test Options";
nickjillings@1404 192 var holder = document.createElement('div');
nickjillings@1404 193 holder.style.margin = "5px";
nickjillings@1404 194 var checkbox = document.createElement('input');
nickjillings@1404 195 checkbox.type = 'checkbox';
nickjillings@1404 196 checkbox.id = "Randomise-Page";
nickjillings@1404 197 var text = document.createElement('span');
nickjillings@1404 198 text.textContent = "Randomise Page Order";
nickjillings@1404 199 holder.appendChild(checkbox);
nickjillings@1404 200 holder.appendChild(text);
nickjillings@1404 201 this.popupBody.appendChild(holder);
nickjillings@1404 202 switch(specificationNode.interfaceType)
nickjillings@1404 203 {
nickjillings@1404 204 case "APE":
nickjillings@1404 205 for (var i=0; i<APEInterfaceOptions[0].length; i++)
nickjillings@1404 206 {
nickjillings@1404 207 holder = document.createElement('div');
nickjillings@1404 208 holder.style.margin = "5px";
nickjillings@1404 209 checkbox = document.createElement('input');
nickjillings@1404 210 checkbox.type = 'checkbox';
nickjillings@1404 211 checkbox.setAttribute("name","option");
nickjillings@1404 212 checkbox.id = APEInterfaceOptions[0][i];
nickjillings@1404 213 text = document.createElement('span');
nickjillings@1404 214 text.textContent = APEInterfaceOptions[1][i];
nickjillings@1404 215 holder.appendChild(checkbox);
nickjillings@1404 216 holder.appendChild(text);
nickjillings@1404 217 this.popupBody.appendChild(holder);
nickjillings@1404 218 }
nickjillings@1404 219 for (var i=0; i<APEInterfaceChecks[0].length; i++)
nickjillings@1404 220 {
nickjillings@1404 221 holder = document.createElement('div');
nickjillings@1404 222 holder.style.margin = "5px";
nickjillings@1404 223 checkbox = document.createElement('input');
nickjillings@1404 224 checkbox.type = 'checkbox';
nickjillings@1404 225 checkbox.setAttribute("name","check");
nickjillings@1404 226 checkbox.id = APEInterfaceChecks[0][i];
nickjillings@1404 227 text = document.createElement('span');
nickjillings@1404 228 text.textContent = APEInterfaceChecks[1][i];
nickjillings@1404 229 holder.appendChild(checkbox);
nickjillings@1404 230 holder.appendChild(text);
nickjillings@1404 231 this.popupBody.appendChild(holder);
nickjillings@1404 232 }
nickjillings@1404 233 break;
nickjillings@1404 234 case "MUSHRA":
nickjillings@1404 235 for (var i=0; i<MUSHRAInterfaceOptions[0].length; i++)
nickjillings@1404 236 {
nickjillings@1404 237 holder = document.createElement('div');
nickjillings@1404 238 holder.style.margin = "5px";
nickjillings@1404 239 checkbox = document.createElement('input');
nickjillings@1404 240 checkbox.type = 'checkbox';
nickjillings@1404 241 checkbox.setAttribute("name","option");
nickjillings@1404 242 checkbox.id = MUSHRAInterfaceOptions[0][i];
nickjillings@1404 243 text = document.createElement('span');
nickjillings@1404 244 text.textContent = MUSHRAInterfaceOptions[1][i];
nickjillings@1404 245 holder.appendChild(checkbox);
nickjillings@1404 246 holder.appendChild(text);
nickjillings@1404 247 this.popupBody.appendChild(holder);
nickjillings@1404 248 }
nickjillings@1404 249 for (var i=0; i<MUSHRAInterfaceChecks[0].length; i++)
nickjillings@1404 250 {
nickjillings@1404 251 holder = document.createElement('div');
nickjillings@1404 252 holder.style.margin = "5px";
nickjillings@1404 253 checkbox = document.createElement('input');
nickjillings@1404 254 checkbox.type = 'checkbox';
nickjillings@1404 255 checkbox.setAttribute("name","check");
nickjillings@1404 256 checkbox.id = MUSHRAInterfaceChecks[0][i];
nickjillings@1404 257 text = document.createElement('span');
nickjillings@1404 258 text.textContent = MUSHRAInterfaceChecks[1][i];
nickjillings@1404 259 holder.appendChild(checkbox);
nickjillings@1404 260 holder.appendChild(text);
nickjillings@1404 261 this.popupBody.appendChild(holder);
nickjillings@1404 262 }
nickjillings@1404 263 }
nickjillings@1404 264 var button = document.createElement('button');
nickjillings@1404 265 button.className = "popupButton";
nickjillings@1404 266 button.textContent = "Submit";
nickjillings@1404 267 button.onclick = function(event) {
nickjillings@1404 268 var optHold = popupInstance.popupBody;
nickjillings@1404 269 var opt = optHold.firstChild;
nickjillings@1404 270 var input = opt.getElementsByTagName('input')[0];
nickjillings@1404 271 specificationNode.randomiseOrder = input.checked;
nickjillings@1404 272 while(opt.nextSibling != null)
nickjillings@1404 273 {
nickjillings@1404 274 opt = opt.nextSibling;
nickjillings@1404 275 input = opt.getElementsByTagName('input')[0];
nickjillings@1404 276 if (input.checked)
nickjillings@1404 277 {
nickjillings@1404 278 specificationNode.commonInterface.options.push(new specificationNode.commonInterface.optionNode(input));
nickjillings@1404 279 }
nickjillings@1404 280
nickjillings@1404 281 }
nickjillings@1404 282 popupInstance.advanceState();
nickjillings@1404 283 };
nickjillings@1404 284 this.popupFooter.appendChild(button);
nickjillings@1404 285 break;
nickjillings@1404 286 case 3:
nickjillings@1404 287 audioObjects = [];
nickjillings@1404 288 this.popupTitleText.textContent = "Test Page";
nickjillings@1404 289 var span = document.createElement('span');
nickjillings@1404 290 span.textContent = "Drag and drop your audio files into the box below to add them to a test page";
nickjillings@1404 291 this.popupBody.appendChild(span);
nickjillings@1404 292 var dnd = document.createElement('div');
nickjillings@1404 293 dnd.id = "audio-holder-drop";
nickjillings@1404 294 dnd.style.width = "100%";
nickjillings@1404 295 dnd.style.minHeight = "50px";
nickjillings@1404 296 dnd.style.maxHeight = "220px";
nickjillings@1404 297 dnd.style.overflow = 'auto';
nickjillings@1404 298 dnd.className = "dragndrop";
nickjillings@1404 299 dnd.ondragover = function(e) {
nickjillings@1404 300 if(e.preventDefault) {e.preventDefault();}
nickjillings@1404 301 return false;
nickjillings@1404 302 };
nickjillings@1404 303 dnd.ondragenter = function(e) {
nickjillings@1404 304 if(e.preventDefault) {e.preventDefault();}
nickjillings@1404 305 return false;
nickjillings@1404 306 };
nickjillings@1404 307 dnd.ondrop = function(e) {
nickjillings@1404 308 if(e.preventDefault) {e.preventDefault();}
nickjillings@1404 309 var dt = e.dataTransfer;
nickjillings@1404 310 var body = document.getElementById("audio-holder-drop");
nickjillings@1404 311 var files = dt.files;
nickjillings@1404 312 for (var i = 0, f; f = files[i]; i++)
nickjillings@1404 313 {
nickjillings@1404 314 var ao = new audioObject();
nickjillings@1404 315 ao.constructTrack(f);
nickjillings@1404 316 audioObjects.push(ao);
nickjillings@1404 317 var dndHeader = document.createElement('div');
nickjillings@1404 318 dndHeader.style.width = "100%";
nickjillings@1404 319 dndHeader.style.height = "20px";
nickjillings@1404 320 dndHeader.style.borderBottom = "#DDD";
nickjillings@1404 321 dndHeader.style.borderBottomWidth = "1px";
nickjillings@1404 322 dndHeader.style.borderBottomStyle = "solid";
nickjillings@1404 323 dndHeader.setAttribute('aoID',audioObjects.length-1);
nickjillings@1404 324 var dndHInclude = document.createElement('div');
nickjillings@1404 325 dndHInclude.style.width = "30px";
nickjillings@1404 326 dndHInclude.className = "dndheaderelement";
nickjillings@1404 327 var includeCheck = document.createElement('input');
nickjillings@1404 328 includeCheck.type = "checkbox";
nickjillings@1404 329 includeCheck.name = "include-check";
nickjillings@1404 330 includeCheck.checked = true;
nickjillings@1404 331 includeCheck.onchange = function()
nickjillings@1404 332 {
nickjillings@1404 333 var i = event.currentTarget.parentElement.parentElement.getAttribute('aoID');
nickjillings@1404 334 audioObjects[i].include = event.currentTarget.checked;
nickjillings@1404 335 };
nickjillings@1404 336 dndHInclude.appendChild(includeCheck);
nickjillings@1404 337 dndHeader.appendChild(dndHInclude);
nickjillings@1404 338 var dndHTitle = document.createElement('div');
nickjillings@1404 339 dndHTitle.style.width = "180px";
nickjillings@1404 340 dndHTitle.className = "dndheaderelement";
nickjillings@1404 341 var text = document.createElement('span');
nickjillings@1404 342 text.textContent = f.name;
nickjillings@1404 343 dndHTitle.appendChild(text);
nickjillings@1404 344 dndHeader.appendChild(dndHTitle);
nickjillings@1404 345 var dndHID = document.createElement('div');
nickjillings@1404 346 dndHID.style.width = "100px";
nickjillings@1404 347 dndHID.className = "dndheaderelement";
nickjillings@1404 348 var IDInput = document.createElement('input');
nickjillings@1404 349 IDInput.name = "audio-fragment-ID";
nickjillings@1404 350 IDInput.value = f.name.split('.')[0];
nickjillings@1404 351 IDInput.onchange = function()
nickjillings@1404 352 {
nickjillings@1404 353 var allIDInput = document.getElementsByName("audio-fragment-ID");
nickjillings@1404 354 var isCopy = new Array(allIDInput.length);
nickjillings@1404 355 isCopy.fill(0,0,this.length);
nickjillings@1404 356 if (allIDInput.length > 1)
nickjillings@1404 357 {
nickjillings@1404 358 for (var j=0; j<allIDInput.length; j++)
nickjillings@1404 359 {
nickjillings@1404 360 var textCompare1 = allIDInput[j].value;
nickjillings@1404 361 for (var k=j+1; k<allIDInput.length; k++)
nickjillings@1404 362 {
nickjillings@1404 363 var textCompare2 = allIDInput[k].value;
nickjillings@1404 364 if (textCompare1 == textCompare2)
nickjillings@1404 365 {
nickjillings@1404 366 isCopy[j] = 1;
nickjillings@1404 367 isCopy[k] = 1;
nickjillings@1404 368 }
nickjillings@1404 369 }
nickjillings@1404 370 }
nickjillings@1404 371 }
nickjillings@1404 372 var button = document.getElementById('submit');
nickjillings@1404 373 button.disabled = false;
nickjillings@1404 374 for (var j=0; j<allIDInput.length; j++)
nickjillings@1404 375 {
nickjillings@1404 376 if (isCopy[j] == 1)
nickjillings@1404 377 {
nickjillings@1404 378 allIDInput[j].style.backgroundColor = '#F22';
nickjillings@1404 379 button.disabled = true;
nickjillings@1404 380 }
nickjillings@1404 381 else
nickjillings@1404 382 {
nickjillings@1404 383 allIDInput[j].style.backgroundColor = '#FFF';
nickjillings@1404 384 audioObjects[j].id = allIDInput[j].value;
nickjillings@1404 385 }
nickjillings@1404 386 }
nickjillings@1404 387 };
nickjillings@1404 388 IDInput.style.width = "96px";
nickjillings@1404 389 dndHID.appendChild(IDInput);
nickjillings@1404 390 dndHeader.appendChild(dndHID);
nickjillings@1404 391 var dndHPlay = document.createElement('div');
nickjillings@1404 392 dndHPlay.style.width = "100px";
nickjillings@1404 393 dndHPlay.className = "dndheaderelement";
nickjillings@1404 394 var audio = document.createElement('button');
nickjillings@1404 395 audio.textContent = 'Play';
nickjillings@1404 396 audio.className = "popupButton";
nickjillings@1404 397 audio.style.height = "inherit";
nickjillings@1404 398 audio.onclick = function()
nickjillings@1404 399 {
nickjillings@1404 400 var i = event.currentTarget.parentElement.parentElement.getAttribute('aoID');
nickjillings@1404 401 audioObjects[i].play();
nickjillings@1404 402 };
nickjillings@1404 403 dndHPlay.appendChild(audio);
nickjillings@1404 404 dndHeader.appendChild(dndHPlay);
nickjillings@1404 405 dnd.appendChild(dndHeader);
nickjillings@1404 406 IDInput.onchange();
nickjillings@1404 407 }
nickjillings@1404 408 };
nickjillings@1404 409 var dndHeader = document.createElement('div');
nickjillings@1404 410 dndHeader.style.width = "100%";
nickjillings@1404 411 dndHeader.style.height = "15px";
nickjillings@1404 412 dndHeader.style.borderBottom = "#DDD";
nickjillings@1404 413 dndHeader.style.borderBottomWidth = "1px";
nickjillings@1404 414 dndHeader.style.borderBottomStyle = "solid";
nickjillings@1404 415 var dndHInclude = document.createElement('div');
nickjillings@1404 416 dndHInclude.style.width = "30px";
nickjillings@1404 417 dndHInclude.className = "dndheaderelement";
nickjillings@1404 418 var text = document.createElement('span');
nickjillings@1404 419 text.textContent = "Inc.";
nickjillings@1404 420 dndHInclude.appendChild(text);
nickjillings@1404 421 dndHeader.appendChild(dndHInclude);
nickjillings@1404 422 var dndHTitle = document.createElement('div');
nickjillings@1404 423 dndHTitle.style.width = "180px";
nickjillings@1404 424 dndHTitle.className = "dndheaderelement";
nickjillings@1404 425 text = document.createElement('span');
nickjillings@1404 426 text.textContent = "File Name";
nickjillings@1404 427 dndHTitle.appendChild(text);
nickjillings@1404 428 dndHeader.appendChild(dndHTitle);
nickjillings@1404 429 var dndHID = document.createElement('div');
nickjillings@1404 430 dndHID.style.width = "100px";
nickjillings@1404 431 dndHID.className = "dndheaderelement";
nickjillings@1404 432 text = document.createElement('span');
nickjillings@1404 433 text.textContent = "ID";
nickjillings@1404 434 dndHID.appendChild(text);
nickjillings@1404 435 dndHeader.appendChild(dndHID);
nickjillings@1404 436 var dndHPlay = document.createElement('div');
nickjillings@1404 437 dndHPlay.style.width = "100px";
nickjillings@1404 438 dndHPlay.className = "dndheaderelement";
nickjillings@1404 439 text = document.createElement('span');
nickjillings@1404 440 text.textContent = "Sample";
nickjillings@1404 441 dndHPlay.appendChild(text);
nickjillings@1404 442 dndHeader.appendChild(dndHPlay);
nickjillings@1404 443 dnd.appendChild(dndHeader);
nickjillings@1404 444 this.popupBody.appendChild(dnd);
nickjillings@1404 445 var button = document.createElement('button');
nickjillings@1404 446 button.id = 'submit';
nickjillings@1404 447 button.className = "popupButton";
nickjillings@1404 448 button.textContent = "Submit";
nickjillings@1404 449 button.onclick = function(event)
nickjillings@1404 450 {
nickjillings@1404 451 // Construct the audio-holder nodes;
nickjillings@1404 452 for (var i=0; i<audioObjects.length; i++)
nickjillings@1404 453 {
nickjillings@1404 454 if (!audioObjects[i].include)
nickjillings@1404 455 {
nickjillings@1404 456 audioObjects.pop(audioObjects[i]);
nickjillings@1404 457 }
nickjillings@1404 458 }
nickjillings@1404 459 if (audioObjects.length != 0)
nickjillings@1404 460 {
nickjillings@1404 461 popupInstance.advanceState();
nickjillings@1404 462 }
nickjillings@1404 463 };
nickjillings@1404 464 this.popupFooter.appendChild(button);
nickjillings@1404 465 break;
nickjillings@1404 466 case 4:
nickjillings@1404 467 this.popupTitleText.textContent = "Test Page - Options";
nickjillings@1404 468 var span = document.createElement('span');
nickjillings@1404 469 span.textContent = "Set your test page options here";
nickjillings@1404 470 this.popupBody.appendChild(span);
nickjillings@1404 471 var pair = document.createElement('div');
nickjillings@1404 472 pair.style.margin = '5px';
nickjillings@1404 473 var text = document.createElement('span');
nickjillings@1404 474 text.textContent = "Page ID:";
nickjillings@1404 475 var input = document.createElement('input');
nickjillings@1404 476 input.value = specificationNode.audioHolders.length;
nickjillings@1404 477 input.id = "id";
nickjillings@1404 478 pair.appendChild(text);
nickjillings@1404 479 pair.appendChild(input);
nickjillings@1404 480 this.popupBody.appendChild(pair);
nickjillings@1404 481 pair = document.createElement('div');
nickjillings@1404 482 pair.style.margin = '5px';
nickjillings@1404 483 text = document.createElement('span');
nickjillings@1404 484 text.textContent = "Randomise Fragment Order";
nickjillings@1404 485 input = document.createElement('input');
nickjillings@1404 486 input.type = "checkbox";
nickjillings@1404 487 input.id = "randomiseOrder";
nickjillings@1404 488 pair.appendChild(input);
nickjillings@1404 489 pair.appendChild(text);
nickjillings@1404 490 this.popupBody.appendChild(pair);
nickjillings@1404 491 pair = document.createElement('div');
nickjillings@1404 492 pair.style.margin = '5px';
nickjillings@1404 493 text = document.createElement('span');
nickjillings@1404 494 text.textContent = "Loop Fragment Playback";
nickjillings@1404 495 input = document.createElement('input');
nickjillings@1404 496 input.type = "checkbox";
nickjillings@1404 497 input.id = "loop";
nickjillings@1404 498 pair.appendChild(input);
nickjillings@1404 499 pair.appendChild(text);
nickjillings@1404 500 this.popupBody.appendChild(pair);
nickjillings@1404 501 pair = document.createElement('div');
nickjillings@1404 502 pair.style.margin = '5px';
nickjillings@1404 503 text = document.createElement('span');
nickjillings@1404 504 text.textContent = "Show fragment comment boxes";
nickjillings@1404 505 input = document.createElement('input');
nickjillings@1404 506 input.type = "checkbox";
nickjillings@1404 507 input.id = "elementComments";
nickjillings@1404 508 pair.appendChild(input);
nickjillings@1404 509 pair.appendChild(text);
nickjillings@1404 510 this.popupBody.appendChild(pair);
nickjillings@1404 511 var button = document.createElement('button');
nickjillings@1404 512 button.id = 'submit';
nickjillings@1404 513 button.className = "popupButton";
nickjillings@1404 514 button.textContent = "Next";
nickjillings@1404 515 button.onclick = function(event)
nickjillings@1404 516 {
nickjillings@1404 517 var ah = new specificationNode.audioHolderNode(specificationNode);
nickjillings@1404 518 ah.id = document.getElementById('id').value;
nickjillings@1404 519 ah.presentedId = specificationNode.audioHolders.length;
nickjillings@1404 520 ah.hostURL = ah.id+'/';
nickjillings@1404 521 ah.randomiseOrder = document.getElementById('randomiseOrder').checked;
nickjillings@1404 522 ah.loop = document.getElementById('loop').checked;
nickjillings@1404 523 ah.elementComments = document.getElementById('elementComments').checked;
nickjillings@1404 524 for (var i=0; i<audioObjects.length; i++)
nickjillings@1404 525 {
nickjillings@1404 526 ah.audioElements.push(new ah.audioElementNode(ah,audioObjects[i]));
nickjillings@1404 527 }
nickjillings@1404 528 specificationNode.audioHolders.push(ah);
nickjillings@1404 529 popupInstance.advanceState();
nickjillings@1404 530 };
nickjillings@1404 531 this.popupFooter.appendChild(button);
nickjillings@1404 532 break;
nickjillings@1404 533 case 5:
nickjillings@1404 534 this.dataTransfer = null;
nickjillings@1404 535 this.popupTitleText.textContent = "Test Page - Pre/Post Survey";
nickjillings@1404 536 var span = document.createElement('span');
nickjillings@1404 537 span.textContent = "Add your pre test page options here";
nickjillings@1404 538 this.popupBody.appendChild(span);
nickjillings@1404 539 var preHolder = document.createElement('div');
nickjillings@1404 540 preHolder.id = "preHolder";
nickjillings@1404 541 preHolder.style.width = "460px";
nickjillings@1404 542 preHolder.style.minHeight = "100px";
nickjillings@1404 543 preHolder.style.maxHeight = "220px";
nickjillings@1404 544 preHolder.style.overflow = 'auto';
nickjillings@1404 545 preHolder.style.border = "black";
nickjillings@1404 546 preHolder.style.borderStyle = "solid";
nickjillings@1404 547 preHolder.style.borderWidth = "1px";
nickjillings@1404 548 this.popupBody.appendChild(preHolder);
nickjillings@1404 549 var audioHolder = specificationNode.audioHolders[specificationNode.audioHolders.length-1];
nickjillings@1404 550 var preHeaderHolder = document.createElement('div');
nickjillings@1404 551 preHeaderHolder.style.width = "456px";
nickjillings@1404 552 preHeaderHolder.style.height= "20px";
nickjillings@1404 553 preHeaderHolder.style.margin= "2px";
nickjillings@1404 554 preHeaderHolder.style.borderBottom = "#DDD";
nickjillings@1404 555 preHeaderHolder.style.borderBottomWidth = "1px";
nickjillings@1404 556 preHeaderHolder.style.borderBottomStyle = "solid";
nickjillings@1404 557 var mvH = document.createElement('div');
nickjillings@1404 558 mvH.className = "dndheaderelement";
nickjillings@1404 559 mvH.style.width = "50px";
nickjillings@1404 560 var text = document.createElement('span');
nickjillings@1404 561 text.textContent = "Order";
nickjillings@1404 562 mvH.appendChild(text);
nickjillings@1404 563 preHeaderHolder.appendChild(mvH);
nickjillings@1404 564 var idH = document.createElement('div');
nickjillings@1404 565 idH.className = "dndheaderelement";
nickjillings@1404 566 idH.style.width = "150px";
nickjillings@1404 567 text = document.createElement('span');
nickjillings@1404 568 text.textContent = "ID";
nickjillings@1404 569 idH.appendChild(text);
nickjillings@1404 570 preHeaderHolder.appendChild(idH);
nickjillings@1404 571 var tH = document.createElement('div');
nickjillings@1404 572 tH.className = "dndheaderelement";
nickjillings@1404 573 tH.style.width = "150px";
nickjillings@1404 574 text = document.createElement('span');
nickjillings@1404 575 text.textContent = "Type";
nickjillings@1404 576 tH.appendChild(text);
nickjillings@1404 577 preHeaderHolder.appendChild(tH);
nickjillings@1404 578 var editH = document.createElement('div');
nickjillings@1404 579 editH.className = "dndheaderelement";
nickjillings@1404 580 editH.style.width = "50px";
nickjillings@1404 581 text = document.createElement('span');
nickjillings@1404 582 text.textContent = "Edit";
nickjillings@1404 583 editH.appendChild(text);
nickjillings@1404 584 preHeaderHolder.appendChild(editH);
nickjillings@1404 585 var deleteH = document.createElement('div');
nickjillings@1404 586 deleteH.className = "dndheaderelement";
nickjillings@1404 587 deleteH.style.width = "50px";
nickjillings@1404 588 text = document.createElement('span');
nickjillings@1404 589 text.textContent = "Delete";
nickjillings@1404 590 deleteH.appendChild(text);
nickjillings@1404 591 preHeaderHolder.appendChild(deleteH);
nickjillings@1404 592 preHolder.appendChild(preHeaderHolder);
nickjillings@1404 593
nickjillings@1404 594
nickjillings@1404 595 for (var i=0; i<audioHolder.preTest.options.length; i++)
nickjillings@1404 596 {
nickjillings@1404 597 var optionNode = audioHolder.preTest.options[i];
nickjillings@1404 598 var entry = document.createElement('div');
nickjillings@1404 599 entry.style.width = "456px";
nickjillings@1404 600 entry.style.height= "20px";
nickjillings@1404 601 entry.style.margin= "2px";
nickjillings@1404 602 entry.style.borderBottom = "#DDD";
nickjillings@1404 603 entry.style.borderBottomWidth = "1px";
nickjillings@1404 604 entry.style.borderBottomStyle = "solid";
nickjillings@1404 605 entry.setAttribute("node-id",i);
nickjillings@1404 606 var node = audioHolder.preTest.options[i];
nickjillings@1404 607 var mvH = document.createElement('div');
nickjillings@1404 608 mvH.className = "dndheaderelement";
nickjillings@1404 609 mvH.style.width = "50px";
nickjillings@1404 610 var mvup = document.createElement("button");
nickjillings@1404 611 mvup.textContent = "Up";
nickjillings@1404 612 mvup.style.width = "25px";
nickjillings@1404 613 mvup.style.padding = "1px 0px";
nickjillings@1404 614 mvup.onclick = function()
nickjillings@1404 615 {
nickjillings@1404 616 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 617 if (i != 0)
nickjillings@1404 618 {
nickjillings@1404 619 var next = audioHolder.preTest.options[i-1];
nickjillings@1404 620 var cur = audioHolder.preTest.options[i];
nickjillings@1404 621 audioHolder.preTest.options[i-1] = cur;
nickjillings@1404 622 audioHolder.preTest.options[i] = next;
nickjillings@1404 623 popupInstance.state = 5;
nickjillings@1404 624 popupInstance.advanceState();
nickjillings@1404 625 }
nickjillings@1404 626 };
nickjillings@1404 627 mvH.appendChild(mvup);
nickjillings@1404 628 var mvdn = document.createElement("button");
nickjillings@1404 629 mvdn.textContent = "Dn";
nickjillings@1404 630 mvdn.style.width = "25px";
nickjillings@1404 631 mvdn.style.padding = "1px 0px";
nickjillings@1404 632 mvdn.onclick = function()
nickjillings@1404 633 {
nickjillings@1404 634 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 635 if (i != audioHolder.preTest.options.length-1)
nickjillings@1404 636 {
nickjillings@1404 637 var next = audioHolder.preTest.options[i+1];
nickjillings@1404 638 var cur = audioHolder.preTest.options[i];
nickjillings@1404 639 audioHolder.preTest.options[i+1] = cur;
nickjillings@1404 640 audioHolder.preTest.options[i] = next;
nickjillings@1404 641 popupInstance.state = 5;
nickjillings@1404 642 popupInstance.advanceState();
nickjillings@1404 643 }
nickjillings@1404 644 };
nickjillings@1404 645 mvH.appendChild(mvdn);
nickjillings@1404 646 entry.appendChild(mvH);
nickjillings@1404 647 var idH = document.createElement('div');
nickjillings@1404 648 idH.className = "dndheaderelement";
nickjillings@1404 649 idH.style.width = "150px";
nickjillings@1404 650 if (optionNode.type != "statement")
nickjillings@1404 651 {
nickjillings@1404 652 var span = document.createElement('span');
nickjillings@1404 653 span.textContent = optionNode.id;
nickjillings@1404 654 idH.appendChild(span);
nickjillings@1404 655 }
nickjillings@1404 656 entry.appendChild(idH);
nickjillings@1404 657 var typeH = document.createElement('div');
nickjillings@1404 658 typeH.className = "dndheaderelement";
nickjillings@1404 659 typeH.style.width = "150px";
nickjillings@1404 660 var span = document.createElement('span');
nickjillings@1404 661 span.textContent = optionNode.type;
nickjillings@1404 662 typeH.appendChild(span);
nickjillings@1404 663 entry.appendChild(typeH);
nickjillings@1404 664 var editH = document.createElement('div');
nickjillings@1404 665 editH.className = "dndheaderelement";
nickjillings@1404 666 editH.style.width = "50px";
nickjillings@1404 667 var editButton = document.createElement("button");
nickjillings@1404 668 editButton.textContent = "Edit";
nickjillings@1404 669 editButton.style.width = "48px";
nickjillings@1404 670 editButton.style.padding = "1px 0px";
nickjillings@1404 671 editButton.onclick = function()
nickjillings@1404 672 {
nickjillings@1404 673 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 674 popupInstance.dataTransfer = new function() {
nickjillings@1404 675 this.title = "Edit Test Node";
nickjillings@1404 676 this.parent = specificationNode.audioHolders[specificationNode.audioHolders.length-1].preTest;
nickjillings@1404 677 this.node = this.parent.options[i];
nickjillings@1404 678 this.previousState = 5;
nickjillings@1404 679 };
nickjillings@1404 680 popupInstance.advanceState();
nickjillings@1404 681 };
nickjillings@1404 682 editH.appendChild(editButton);
nickjillings@1404 683 entry.appendChild(editH);
nickjillings@1404 684 var deleteH = document.createElement('div');
nickjillings@1404 685 deleteH.className = "dndheaderelement";
nickjillings@1404 686 deleteH.style.width = "50px";
nickjillings@1404 687 var deleteButton = document.createElement("button");
nickjillings@1404 688 deleteButton.textContent = "Del";
nickjillings@1404 689 deleteButton.style.width = "48px";
nickjillings@1404 690 deleteButton.style.padding = "1px 0px";
nickjillings@1404 691 deleteButton.onclick = function()
nickjillings@1404 692 {
nickjillings@1404 693 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 694 var j = i+1;
nickjillings@1404 695 while(j < audioHolder.preTest.options.length)
nickjillings@1404 696 {
nickjillings@1404 697 audioHolder.preTest.options[i] = audioHolder.preTest.options[j];
nickjillings@1404 698 j++;
nickjillings@1404 699 i++;
nickjillings@1404 700 }
nickjillings@1404 701 audioHolder.preTest.options.pop();
nickjillings@1404 702 popupInstance.state = 5;
nickjillings@1404 703 popupInstance.advanceState();
nickjillings@1404 704 };
nickjillings@1404 705 deleteH.appendChild(deleteButton);
nickjillings@1404 706 entry.appendChild(deleteH);
nickjillings@1404 707 preHolder.appendChild(entry);
nickjillings@1404 708 }
nickjillings@1404 709 var entry = document.createElement('div');
nickjillings@1404 710 entry.style.width = "456px";
nickjillings@1404 711 entry.style.height= "20px";
nickjillings@1404 712 entry.style.margin= "2px";
nickjillings@1404 713 entry.style.borderBottom = "#DDD";
nickjillings@1404 714 entry.style.borderBottomWidth = "1px";
nickjillings@1404 715 entry.style.borderBottomStyle = "solid";
nickjillings@1404 716 entry.align = "center";
nickjillings@1404 717 var addPre = document.createElement('button');
nickjillings@1404 718 addPre.className = "popupButton";
nickjillings@1404 719 addPre.textContent = "Add New Entry";
nickjillings@1404 720 addPre.style.height = "20px";
nickjillings@1404 721 addPre.onclick = function()
nickjillings@1404 722 {
nickjillings@1404 723 popupInstance.dataTransfer = new function() {
nickjillings@1404 724 this.title = "New Pre Test Node";
nickjillings@1404 725 this.parent = specificationNode.audioHolders[specificationNode.audioHolders.length-1].preTest;
nickjillings@1404 726 this.node = null;
nickjillings@1404 727 this.previousState = 5;
nickjillings@1404 728 };
nickjillings@1404 729 popupInstance.advanceState();
nickjillings@1404 730 };
nickjillings@1404 731 entry.appendChild(addPre);
nickjillings@1404 732 preHolder.appendChild(entry);
nickjillings@1404 733
nickjillings@1404 734 var span = document.createElement('span');
nickjillings@1404 735 span.textContent = "Add your post test page options here";
nickjillings@1404 736 this.popupBody.appendChild(span);
nickjillings@1404 737 var postHolder = document.createElement('div');
nickjillings@1404 738 postHolder.id = "preHolder";
nickjillings@1404 739 postHolder.style.width = "100%";
nickjillings@1404 740 postHolder.style.minHeight = "100px";
nickjillings@1404 741 postHolder.style.maxHeight = "220px";
nickjillings@1404 742 postHolder.style.overflow = 'auto';
nickjillings@1404 743 postHolder.style.border = "black";
nickjillings@1404 744 postHolder.style.borderStyle = "solid";
nickjillings@1404 745 postHolder.style.borderWidth = "1px";
nickjillings@1404 746 this.popupBody.appendChild(postHolder);
nickjillings@1404 747 var postHeaderHolder = document.createElement('div');
nickjillings@1404 748 postHeaderHolder.style.width = "456px";
nickjillings@1404 749 postHeaderHolder.style.height= "20px";
nickjillings@1404 750 postHeaderHolder.style.margin= "2px";
nickjillings@1404 751 postHeaderHolder.style.borderBottom = "#DDD";
nickjillings@1404 752 postHeaderHolder.style.borderBottomWidth = "1px";
nickjillings@1404 753 postHeaderHolder.style.borderBottomStyle = "solid";
nickjillings@1404 754 var mvH = document.createElement('div');
nickjillings@1404 755 mvH.className = "dndheaderelement";
nickjillings@1404 756 mvH.style.width = "50px";
nickjillings@1404 757 var text = document.createElement('span');
nickjillings@1404 758 text.textContent = "Order";
nickjillings@1404 759 mvH.appendChild(text);
nickjillings@1404 760 postHeaderHolder.appendChild(mvH);
nickjillings@1404 761 var idH = document.createElement('div');
nickjillings@1404 762 idH.className = "dndheaderelement";
nickjillings@1404 763 idH.style.width = "150px";
nickjillings@1404 764 text = document.createElement('span');
nickjillings@1404 765 text.textContent = "ID";
nickjillings@1404 766 idH.appendChild(text);
nickjillings@1404 767 postHeaderHolder.appendChild(idH);
nickjillings@1404 768 var tH = document.createElement('div');
nickjillings@1404 769 tH.className = "dndheaderelement";
nickjillings@1404 770 tH.style.width = "150px";
nickjillings@1404 771 text = document.createElement('span');
nickjillings@1404 772 text.textContent = "Type";
nickjillings@1404 773 tH.appendChild(text);
nickjillings@1404 774 postHeaderHolder.appendChild(tH);
nickjillings@1404 775 var editH = document.createElement('div');
nickjillings@1404 776 editH.className = "dndheaderelement";
nickjillings@1404 777 editH.style.width = "50px";
nickjillings@1404 778 text = document.createElement('span');
nickjillings@1404 779 text.textContent = "Edit";
nickjillings@1404 780 editH.appendChild(text);
nickjillings@1404 781 postHeaderHolder.appendChild(editH);
nickjillings@1404 782 var deleteH = document.createElement('div');
nickjillings@1404 783 deleteH.className = "dndheaderelement";
nickjillings@1404 784 deleteH.style.width = "50px";
nickjillings@1404 785 text = document.createElement('span');
nickjillings@1404 786 text.textContent = "Delete";
nickjillings@1404 787 deleteH.appendChild(text);
nickjillings@1404 788 postHeaderHolder.appendChild(deleteH);
nickjillings@1404 789 postHolder.appendChild(postHeaderHolder);
nickjillings@1404 790
nickjillings@1404 791 for (var i=0; i<audioHolder.postTest.options.length; i++)
nickjillings@1404 792 {
nickjillings@1404 793 var optionNode = audioHolder.postTest.options[i];
nickjillings@1404 794 var entry = document.createElement('div');
nickjillings@1404 795 entry.style.width = "456px";
nickjillings@1404 796 entry.style.height= "20px";
nickjillings@1404 797 entry.style.margin= "2px";
nickjillings@1404 798 entry.style.borderBottom = "#DDD";
nickjillings@1404 799 entry.style.borderBottomWidth = "1px";
nickjillings@1404 800 entry.style.borderBottomStyle = "solid";
nickjillings@1404 801 entry.setAttribute("node-id",i);
nickjillings@1404 802 var node = audioHolder.postTest.options[i];
nickjillings@1404 803 var mvH = document.createElement('div');
nickjillings@1404 804 mvH.className = "dndheaderelement";
nickjillings@1404 805 mvH.style.width = "50px";
nickjillings@1404 806 var mvup = document.createElement("button");
nickjillings@1404 807 mvup.textContent = "Up";
nickjillings@1404 808 mvup.style.width = "25px";
nickjillings@1404 809 mvup.style.padding = "1px 0px";
nickjillings@1404 810 mvup.onclick = function()
nickjillings@1404 811 {
nickjillings@1404 812 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 813 if (i != 0)
nickjillings@1404 814 {
nickjillings@1404 815 var next = audioHolder.postTest.options[i-1];
nickjillings@1404 816 var cur = audioHolder.postTest.options[i];
nickjillings@1404 817 audioHolder.postTest.options[i-1] = cur;
nickjillings@1404 818 audioHolder.postTest.options[i] = next;
nickjillings@1404 819 popupInstance.state = 5;
nickjillings@1404 820 popupInstance.advanceState();
nickjillings@1404 821 }
nickjillings@1404 822 };
nickjillings@1404 823 mvH.appendChild(mvup);
nickjillings@1404 824 var mvdn = document.createElement("button");
nickjillings@1404 825 mvdn.textContent = "Dn";
nickjillings@1404 826 mvdn.style.width = "25px";
nickjillings@1404 827 mvdn.style.padding = "1px 0px";
nickjillings@1404 828 mvdn.onclick = function()
nickjillings@1404 829 {
nickjillings@1404 830 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 831 if (i != audioHolder.postTest.options.length-1)
nickjillings@1404 832 {
nickjillings@1404 833 var next = audioHolder.postTest.options[i+1];
nickjillings@1404 834 var cur = audioHolder.postTest.options[i];
nickjillings@1404 835 audioHolder.postTest.options[i+1] = cur;
nickjillings@1404 836 audioHolder.postTest.options[i] = next;
nickjillings@1404 837 popupInstance.state = 5;
nickjillings@1404 838 popupInstance.advanceState();
nickjillings@1404 839 }
nickjillings@1404 840 };
nickjillings@1404 841 mvH.appendChild(mvdn);
nickjillings@1404 842 entry.appendChild(mvH);
nickjillings@1404 843 var idH = document.createElement('div');
nickjillings@1404 844 idH.className = "dndheaderelement";
nickjillings@1404 845 idH.style.width = "150px";
nickjillings@1404 846 if (optionNode.type != "statement")
nickjillings@1404 847 {
nickjillings@1404 848 var span = document.createElement('span');
nickjillings@1404 849 span.textContent = optionNode.id;
nickjillings@1404 850 idH.appendChild(span);
nickjillings@1404 851 }
nickjillings@1404 852 entry.appendChild(idH);
nickjillings@1404 853 var typeH = document.createElement('div');
nickjillings@1404 854 typeH.className = "dndheaderelement";
nickjillings@1404 855 typeH.style.width = "150px";
nickjillings@1404 856 var span = document.createElement('span');
nickjillings@1404 857 span.textContent = optionNode.type;
nickjillings@1404 858 typeH.appendChild(span);
nickjillings@1404 859 entry.appendChild(typeH);
nickjillings@1404 860 var editH = document.createElement('div');
nickjillings@1404 861 editH.className = "dndheaderelement";
nickjillings@1404 862 editH.style.width = "50px";
nickjillings@1404 863 var editButton = document.createElement("button");
nickjillings@1404 864 editButton.textContent = "Edit";
nickjillings@1404 865 editButton.style.width = "48px";
nickjillings@1404 866 editButton.style.padding = "1px 0px";
nickjillings@1404 867 editButton.onclick = function()
nickjillings@1404 868 {
nickjillings@1404 869 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 870 popupInstance.dataTransfer = new function() {
nickjillings@1404 871 this.title = "Edit Test Node";
nickjillings@1404 872 this.parent = specificationNode.audioHolders[specificationNode.audioHolders.length-1].postTest;
nickjillings@1404 873 this.node = this.parent.options[i];
nickjillings@1404 874 this.previousState = 5;
nickjillings@1404 875 };
nickjillings@1404 876 popupInstance.advanceState();
nickjillings@1404 877 };
nickjillings@1404 878 editH.appendChild(editButton);
nickjillings@1404 879 entry.appendChild(editH);
nickjillings@1404 880 var deleteH = document.createElement('div');
nickjillings@1404 881 deleteH.className = "dndheaderelement";
nickjillings@1404 882 deleteH.style.width = "50px";
nickjillings@1404 883 var deleteButton = document.createElement("button");
nickjillings@1404 884 deleteButton.textContent = "Del";
nickjillings@1404 885 deleteButton.style.width = "48px";
nickjillings@1404 886 deleteButton.style.padding = "1px 0px";
nickjillings@1404 887 deleteButton.onclick = function()
nickjillings@1404 888 {
nickjillings@1404 889 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 890 var j = i+1;
nickjillings@1404 891 while(j < audioHolder.postTest.options.length)
nickjillings@1404 892 {
nickjillings@1404 893 audioHolder.postTest.options[i] = audioHolder.postTest.options[j];
nickjillings@1404 894 j++;
nickjillings@1404 895 i++;
nickjillings@1404 896 }
nickjillings@1404 897 audioHolder.postTest.options.pop();
nickjillings@1404 898 popupInstance.state = 5;
nickjillings@1404 899 popupInstance.advanceState();
nickjillings@1404 900 };
nickjillings@1404 901 deleteH.appendChild(deleteButton);
nickjillings@1404 902 entry.appendChild(deleteH);
nickjillings@1404 903 postHolder.appendChild(entry);
nickjillings@1404 904 }
nickjillings@1404 905
nickjillings@1404 906 var entry = document.createElement('div');
nickjillings@1404 907 entry.style.width = "456px";
nickjillings@1404 908 entry.style.height= "20px";
nickjillings@1404 909 entry.style.margin= "2px";
nickjillings@1404 910 entry.style.borderBottom = "#DDD";
nickjillings@1404 911 entry.style.borderBottomWidth = "1px";
nickjillings@1404 912 entry.style.borderBottomStyle = "solid";
nickjillings@1404 913 entry.align = "center";
nickjillings@1404 914 var addPost = document.createElement('button');
nickjillings@1404 915 addPost.className = "popupButton";
nickjillings@1404 916 addPost.textContent = "Add New Entry";
nickjillings@1404 917 addPost.style.height = "20px";
nickjillings@1404 918 addPost.onclick = function()
nickjillings@1404 919 {
nickjillings@1404 920 popupInstance.dataTransfer = new function() {
nickjillings@1404 921 this.title = "New Pre Test Node";
nickjillings@1404 922 this.parent = specificationNode.audioHolders[specificationNode.audioHolders.length-1].postTest;
nickjillings@1404 923 this.node = null;
nickjillings@1404 924 this.previousState = 5;
nickjillings@1404 925 };
nickjillings@1404 926 popupInstance.advanceState();
nickjillings@1404 927 };
nickjillings@1404 928 entry.appendChild(addPost);
nickjillings@1404 929 postHolder.appendChild(entry);
nickjillings@1404 930
nickjillings@1404 931 var button = document.createElement('button');
nickjillings@1404 932 button.id = 'submit';
nickjillings@1404 933 button.className = "popupButton";
nickjillings@1404 934 button.textContent = "Finish";
nickjillings@1404 935 button.onclick = function(event)
nickjillings@1404 936 {
nickjillings@1404 937 popupInstance.state = 7;
nickjillings@1404 938 popupInstance.advanceState();
nickjillings@1404 939 };
nickjillings@1404 940 this.popupFooter.appendChild(button);
nickjillings@1404 941 button = document.createElement('button');
nickjillings@1404 942 button.id = 'submit';
nickjillings@1404 943 button.className = "popupButton";
nickjillings@1404 944 button.textContent = "Add Another Page";
nickjillings@1404 945 button.onclick = function(event)
nickjillings@1404 946 {
nickjillings@1404 947 popupInstance.state = 3;
nickjillings@1404 948 popupInstance.advanceState();
nickjillings@1404 949 };
nickjillings@1404 950 this.popupFooter.appendChild(button);
nickjillings@1404 951 break;
nickjillings@1404 952 case 6:
nickjillings@1404 953 this.popupTitleText.textContent = this.dataTransfer.title;
nickjillings@1404 954 var span = document.createElement('span');
nickjillings@1404 955 span.textContent = "Select survey settings here";
nickjillings@1404 956 this.popupBody.appendChild(span);
nickjillings@1404 957 var div = document.createElement('div');
nickjillings@1404 958 span = document.createElement("span");
nickjillings@1404 959 span.textContent = "Survey Type";
nickjillings@1404 960 var select = document.createElement("select");
nickjillings@1404 961 select.id="survey-select";
nickjillings@1404 962 var option = document.createElement('option');
nickjillings@1404 963 option.textContent = "Statement";
nickjillings@1404 964 option.value = "statement";
nickjillings@1404 965 select.appendChild(option);
nickjillings@1404 966 option = document.createElement('option');
nickjillings@1404 967 option.textContent = "Question";
nickjillings@1404 968 option.value = "question";
nickjillings@1404 969 select.appendChild(option);
nickjillings@1404 970 option = document.createElement('option');
nickjillings@1404 971 option.textContent = "Number";
nickjillings@1404 972 option.value = "number";
nickjillings@1404 973 select.appendChild(option);
nickjillings@1404 974 option = document.createElement('option');
nickjillings@1404 975 option.textContent = "Radio";
nickjillings@1404 976 option.value = "radio";
nickjillings@1404 977 select.appendChild(option);
nickjillings@1404 978 option = document.createElement('option');
nickjillings@1404 979 option.textContent = "Checkbox";
nickjillings@1404 980 option.value = "checkbox";
nickjillings@1404 981 select.appendChild(option);
nickjillings@1404 982 this.popupBody.appendChild(select);
nickjillings@1404 983 var options = document.createElement('div');
nickjillings@1404 984 options.id = "survey-options";
nickjillings@1404 985 this.popupBody.appendChild(options);
nickjillings@1404 986 var button = document.createElement('button');
nickjillings@1404 987 button.id = 'submit';
nickjillings@1404 988 button.className = "popupButton";
nickjillings@1404 989 button.textContent = "Add";
nickjillings@1404 990 button.onclick = function(event)
nickjillings@1404 991 {
nickjillings@1404 992 var parent = popupInstance.dataTransfer.parent;
nickjillings@1404 993 if (popupInstance.dataTransfer.node == null)
nickjillings@1404 994 {
nickjillings@1404 995 var node = new parent.OptionNode();
nickjillings@1404 996 } else
nickjillings@1404 997 {
nickjillings@1404 998 var node = popupInstance.dataTransfer.node;
nickjillings@1404 999 }
nickjillings@1404 1000 node.type = document.getElementById("survey-select").value;
nickjillings@1404 1001 switch(node.type)
nickjillings@1404 1002 {
nickjillings@1404 1003 case "statement":
nickjillings@1404 1004 node.statement = document.getElementById("statement").value;
nickjillings@1404 1005 break;
nickjillings@1404 1006 case "question":
nickjillings@1404 1007 node.question = document.getElementById("question").value;
nickjillings@1404 1008 node.id = document.getElementById("ID").value;
nickjillings@1404 1009 node.mandatory = document.getElementById("mandatory").checked;
nickjillings@1404 1010 node.boxsize = document.getElementById("boxsize").value;
nickjillings@1404 1011 break;
nickjillings@1404 1012 }
nickjillings@1404 1013 if (popupInstance.dataTransfer.node == null)
nickjillings@1404 1014 {parent.options.push(node);}
nickjillings@1404 1015 popupInstance.state = popupInstance.dataTransfer.previousState;
nickjillings@1404 1016 popupInstance.advanceState();
nickjillings@1404 1017 };
nickjillings@1404 1018 this.popupFooter.appendChild(button);
nickjillings@1404 1019 select.onchange = function()
nickjillings@1404 1020 {
nickjillings@1404 1021 var options = document.getElementById("survey-options");
nickjillings@1404 1022 options.innerHTML = null;
nickjillings@1404 1023 switch(this.value)
nickjillings@1404 1024 {
nickjillings@1404 1025 case "statement":
nickjillings@1404 1026 var span = document.createElement('span');
nickjillings@1404 1027 span.textContent = "Enter Statement";
nickjillings@1404 1028 var tA = document.createElement('textarea');
nickjillings@1404 1029 tA.id = "statement";
nickjillings@1404 1030 tA.style.width = "460px";
nickjillings@1404 1031 tA.style.height = "96px";
nickjillings@1404 1032 if (popupInstance.dataTransfer.node != null)
nickjillings@1404 1033 {tA.value = this.dataTransfer.node.statement;}
nickjillings@1404 1034 options.appendChild(span);
nickjillings@1404 1035 options.appendChild(tA);
nickjillings@1404 1036 break;
nickjillings@1404 1037 case "question":
nickjillings@1404 1038 var span = document.createElement('span');
nickjillings@1404 1039 span.textContent = "Enter Question";
nickjillings@1404 1040 var tA = document.createElement('textarea');
nickjillings@1404 1041 tA.style.width = "460px";
nickjillings@1404 1042 tA.style.height = "54px";
nickjillings@1404 1043 tA.id = "question";
nickjillings@1404 1044 options.appendChild(span);
nickjillings@1404 1045 options.appendChild(tA);
nickjillings@1404 1046 var div = document.createElement('div');
nickjillings@1404 1047 var input = document.createElement('input');
nickjillings@1404 1048 input.id = "ID";
nickjillings@1404 1049 span = document.createElement('span');
nickjillings@1404 1050 span.textContent = "ID:";
nickjillings@1404 1051 div.appendChild(span);
nickjillings@1404 1052 div.appendChild(input);
nickjillings@1404 1053 options.appendChild(div);
nickjillings@1404 1054 div = document.createElement('div');
nickjillings@1404 1055 input = document.createElement('input');
nickjillings@1404 1056 input.type = "checkbox";
nickjillings@1404 1057 input.id = "mandatory";
nickjillings@1404 1058 span = document.createElement('span');
nickjillings@1404 1059 span.textContent = "Mandatory";
nickjillings@1404 1060 div.appendChild(span);
nickjillings@1404 1061 div.appendChild(input);
nickjillings@1404 1062 options.appendChild(div);
nickjillings@1404 1063 div = document.createElement('div');
nickjillings@1404 1064 var boxsize = document.createElement("select");
nickjillings@1404 1065 boxsize.id = "boxsize";
nickjillings@1404 1066 var selOpt = document.createElement("option");
nickjillings@1404 1067 selOpt.value = "normal";
nickjillings@1404 1068 selOpt.textContent = "Normal";
nickjillings@1404 1069 boxsize.appendChild(selOpt);
nickjillings@1404 1070 selOpt = document.createElement("option");
nickjillings@1404 1071 selOpt.value = "small";
nickjillings@1404 1072 selOpt.textContent = "Small";
nickjillings@1404 1073 boxsize.appendChild(selOpt);
nickjillings@1404 1074 selOpt = document.createElement("option");
nickjillings@1404 1075 selOpt.value = "large";
nickjillings@1404 1076 selOpt.textContent = "Large";
nickjillings@1404 1077 boxsize.appendChild(selOpt);
nickjillings@1404 1078 selOpt = document.createElement("option");
nickjillings@1404 1079 selOpt.value = "huge";
nickjillings@1404 1080 selOpt.textContent = "Huge";
nickjillings@1404 1081 boxsize.appendChild(selOpt);
nickjillings@1404 1082 span = document.createElement('span');
nickjillings@1404 1083 span.textContent = "Response Text Area";
nickjillings@1404 1084 div.appendChild(span);
nickjillings@1404 1085 div.appendChild(boxsize);
nickjillings@1404 1086 options.appendChild(div);
nickjillings@1404 1087 if (popupInstance.dataTransfer.node != null)
nickjillings@1404 1088 {
nickjillings@1404 1089 tA.value = popupInstance.dataTransfer.node.question;
nickjillings@1404 1090 document.getElementById("ID").value = popupInstance.dataTransfer.node.id;
nickjillings@1404 1091 document.getElementById("mandatory").value = popupInstance.dataTransfer.node.mandatory;
nickjillings@1404 1092 document.getElementById("boxsize").value = popupInstance.dataTransfer.node.boxsize;
nickjillings@1404 1093 }
nickjillings@1404 1094 break;
nickjillings@1404 1095 case "number":
nickjillings@1404 1096 var span = document.createElement('span');
nickjillings@1404 1097 span.textContent = "Enter Question";
nickjillings@1404 1098 var tA = document.createElement('textarea');
nickjillings@1404 1099 tA.style.width = "460px";
nickjillings@1404 1100 tA.style.height = "54px";
nickjillings@1404 1101 tA.id = "question";
nickjillings@1404 1102 options.appendChild(span);
nickjillings@1404 1103 options.appendChild(tA);
nickjillings@1404 1104 var div = document.createElement('div');
nickjillings@1404 1105 var input = document.createElement('input');
nickjillings@1404 1106 input.id = "ID";
nickjillings@1404 1107 span = document.createElement('span');
nickjillings@1404 1108 span.textContent = "ID:";
nickjillings@1404 1109 div.appendChild(span);
nickjillings@1404 1110 div.appendChild(input);
nickjillings@1404 1111 options.appendChild(div);
nickjillings@1404 1112 div = document.createElement('div');
nickjillings@1404 1113 input = document.createElement('input');
nickjillings@1404 1114 input.type = "checkbox";
nickjillings@1404 1115 input.id = "mandatory";
nickjillings@1404 1116 span = document.createElement('span');
nickjillings@1404 1117 span.textContent = "Mandatory";
nickjillings@1404 1118 div.appendChild(span);
nickjillings@1404 1119 div.appendChild(input);
nickjillings@1404 1120 options.appendChild(div);
nickjillings@1404 1121 div = document.createElement('div');
nickjillings@1404 1122 break;
nickjillings@1404 1123 }
nickjillings@1404 1124 };
nickjillings@1404 1125 if (this.dataTransfer.node != null)
nickjillings@1404 1126 {
nickjillings@1404 1127 select.value = this.dataTransfer.node.type;
nickjillings@1404 1128 }
nickjillings@1404 1129 select.onchange();
nickjillings@1404 1130 break;
nickjillings@1404 1131 case 7:
nickjillings@1404 1132 this.dataTransfer = null;
nickjillings@1404 1133 this.popupTitleText.textContent = "Test Session - Pre/Post Survey";
nickjillings@1404 1134 var span = document.createElement('span');
nickjillings@1404 1135 span.textContent = "Add your pre test session and post test session survey options here";
nickjillings@1404 1136 this.popupBody.appendChild(span);
nickjillings@1404 1137 var preHolder = document.createElement('div');
nickjillings@1404 1138 preHolder.id = "preHolder";
nickjillings@1404 1139 preHolder.style.width = "460px";
nickjillings@1404 1140 preHolder.style.minHeight = "100px";
nickjillings@1404 1141 preHolder.style.maxHeight = "220px";
nickjillings@1404 1142 preHolder.style.overflow = 'auto';
nickjillings@1404 1143 preHolder.style.border = "black";
nickjillings@1404 1144 preHolder.style.borderStyle = "solid";
nickjillings@1404 1145 preHolder.style.borderWidth = "1px";
nickjillings@1404 1146 this.popupBody.appendChild(preHolder);
nickjillings@1404 1147 var preHeaderHolder = document.createElement('div');
nickjillings@1404 1148 preHeaderHolder.style.width = "456px";
nickjillings@1404 1149 preHeaderHolder.style.height= "20px";
nickjillings@1404 1150 preHeaderHolder.style.margin= "2px";
nickjillings@1404 1151 preHeaderHolder.style.borderBottom = "#DDD";
nickjillings@1404 1152 preHeaderHolder.style.borderBottomWidth = "1px";
nickjillings@1404 1153 preHeaderHolder.style.borderBottomStyle = "solid";
nickjillings@1404 1154 var mvH = document.createElement('div');
nickjillings@1404 1155 mvH.className = "dndheaderelement";
nickjillings@1404 1156 mvH.style.width = "50px";
nickjillings@1404 1157 var text = document.createElement('span');
nickjillings@1404 1158 text.textContent = "Order";
nickjillings@1404 1159 mvH.appendChild(text);
nickjillings@1404 1160 preHeaderHolder.appendChild(mvH);
nickjillings@1404 1161 var idH = document.createElement('div');
nickjillings@1404 1162 idH.className = "dndheaderelement";
nickjillings@1404 1163 idH.style.width = "150px";
nickjillings@1404 1164 text = document.createElement('span');
nickjillings@1404 1165 text.textContent = "ID";
nickjillings@1404 1166 idH.appendChild(text);
nickjillings@1404 1167 preHeaderHolder.appendChild(idH);
nickjillings@1404 1168 var tH = document.createElement('div');
nickjillings@1404 1169 tH.className = "dndheaderelement";
nickjillings@1404 1170 tH.style.width = "150px";
nickjillings@1404 1171 text = document.createElement('span');
nickjillings@1404 1172 text.textContent = "Type";
nickjillings@1404 1173 tH.appendChild(text);
nickjillings@1404 1174 preHeaderHolder.appendChild(tH);
nickjillings@1404 1175 var editH = document.createElement('div');
nickjillings@1404 1176 editH.className = "dndheaderelement";
nickjillings@1404 1177 editH.style.width = "50px";
nickjillings@1404 1178 text = document.createElement('span');
nickjillings@1404 1179 text.textContent = "Edit";
nickjillings@1404 1180 editH.appendChild(text);
nickjillings@1404 1181 preHeaderHolder.appendChild(editH);
nickjillings@1404 1182 var deleteH = document.createElement('div');
nickjillings@1404 1183 deleteH.className = "dndheaderelement";
nickjillings@1404 1184 deleteH.style.width = "50px";
nickjillings@1404 1185 text = document.createElement('span');
nickjillings@1404 1186 text.textContent = "Delete";
nickjillings@1404 1187 deleteH.appendChild(text);
nickjillings@1404 1188 preHeaderHolder.appendChild(deleteH);
nickjillings@1404 1189 preHolder.appendChild(preHeaderHolder);
nickjillings@1404 1190
nickjillings@1404 1191
nickjillings@1404 1192 for (var i=0; i<specificationNode.preTest.options.length; i++)
nickjillings@1404 1193 {
nickjillings@1404 1194 var optionNode = specificationNode.preTest.options[i];
nickjillings@1404 1195 var entry = document.createElement('div');
nickjillings@1404 1196 entry.style.width = "456px";
nickjillings@1404 1197 entry.style.height= "20px";
nickjillings@1404 1198 entry.style.margin= "2px";
nickjillings@1404 1199 entry.style.borderBottom = "#DDD";
nickjillings@1404 1200 entry.style.borderBottomWidth = "1px";
nickjillings@1404 1201 entry.style.borderBottomStyle = "solid";
nickjillings@1404 1202 entry.setAttribute("node-id",i);
nickjillings@1404 1203 var node = specificationNode.preTest.options[i];
nickjillings@1404 1204 var mvH = document.createElement('div');
nickjillings@1404 1205 mvH.className = "dndheaderelement";
nickjillings@1404 1206 mvH.style.width = "50px";
nickjillings@1404 1207 var mvup = document.createElement("button");
nickjillings@1404 1208 mvup.textContent = "Up";
nickjillings@1404 1209 mvup.style.width = "25px";
nickjillings@1404 1210 mvup.style.padding = "1px 0px";
nickjillings@1404 1211 mvup.onclick = function()
nickjillings@1404 1212 {
nickjillings@1404 1213 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1214 if (i != 0)
nickjillings@1404 1215 {
nickjillings@1404 1216 var next = specificationNode.preTest.options[i-1];
nickjillings@1404 1217 var cur = specificationNode.preTest.options[i];
nickjillings@1404 1218 specificationNode.preTest.options[i-1] = cur;
nickjillings@1404 1219 specificationNode.preTest.options[i] = next;
nickjillings@1404 1220 popupInstance.state = 7;
nickjillings@1404 1221 popupInstance.advanceState();
nickjillings@1404 1222 }
nickjillings@1404 1223 };
nickjillings@1404 1224 mvH.appendChild(mvup);
nickjillings@1404 1225 var mvdn = document.createElement("button");
nickjillings@1404 1226 mvdn.textContent = "Dn";
nickjillings@1404 1227 mvdn.style.width = "25px";
nickjillings@1404 1228 mvdn.style.padding = "1px 0px";
nickjillings@1404 1229 mvdn.onclick = function()
nickjillings@1404 1230 {
nickjillings@1404 1231 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1232 if (i != specificationNode.preTest.options.length-1)
nickjillings@1404 1233 {
nickjillings@1404 1234 var next = specificationNode.preTest.options[i+1];
nickjillings@1404 1235 var cur = specificationNode.preTest.options[i];
nickjillings@1404 1236 specificationNode.preTest.options[i+1] = cur;
nickjillings@1404 1237 specificationNode.preTest.options[i] = next;
nickjillings@1404 1238 popupInstance.state = 7;
nickjillings@1404 1239 popupInstance.advanceState();
nickjillings@1404 1240 }
nickjillings@1404 1241 };
nickjillings@1404 1242 mvH.appendChild(mvdn);
nickjillings@1404 1243 entry.appendChild(mvH);
nickjillings@1404 1244 var idH = document.createElement('div');
nickjillings@1404 1245 idH.className = "dndheaderelement";
nickjillings@1404 1246 idH.style.width = "150px";
nickjillings@1404 1247 if (optionNode.type != "statement")
nickjillings@1404 1248 {
nickjillings@1404 1249 var span = document.createElement('span');
nickjillings@1404 1250 span.textContent = optionNode.id;
nickjillings@1404 1251 idH.appendChild(span);
nickjillings@1404 1252 }
nickjillings@1404 1253 entry.appendChild(idH);
nickjillings@1404 1254 var typeH = document.createElement('div');
nickjillings@1404 1255 typeH.className = "dndheaderelement";
nickjillings@1404 1256 typeH.style.width = "150px";
nickjillings@1404 1257 var span = document.createElement('span');
nickjillings@1404 1258 span.textContent = optionNode.type;
nickjillings@1404 1259 typeH.appendChild(span);
nickjillings@1404 1260 entry.appendChild(typeH);
nickjillings@1404 1261 var editH = document.createElement('div');
nickjillings@1404 1262 editH.className = "dndheaderelement";
nickjillings@1404 1263 editH.style.width = "50px";
nickjillings@1404 1264 var editButton = document.createElement("button");
nickjillings@1404 1265 editButton.textContent = "Edit";
nickjillings@1404 1266 editButton.style.width = "48px";
nickjillings@1404 1267 editButton.style.padding = "1px 0px";
nickjillings@1404 1268 editButton.onclick = function()
nickjillings@1404 1269 {
nickjillings@1404 1270 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1271 popupInstance.dataTransfer = new function() {
nickjillings@1404 1272 this.title = "Edit Test Node";
nickjillings@1404 1273 this.parent = specificationNode.preTest;
nickjillings@1404 1274 this.node = this.parent.options[i];
nickjillings@1404 1275 this.previousState = 7;
nickjillings@1404 1276 };
nickjillings@1404 1277 popupInstace.state = 6;
nickjillings@1404 1278 popupInstance.advanceState();
nickjillings@1404 1279 };
nickjillings@1404 1280 editH.appendChild(editButton);
nickjillings@1404 1281 entry.appendChild(editH);
nickjillings@1404 1282 var deleteH = document.createElement('div');
nickjillings@1404 1283 deleteH.className = "dndheaderelement";
nickjillings@1404 1284 deleteH.style.width = "50px";
nickjillings@1404 1285 var deleteButton = document.createElement("button");
nickjillings@1404 1286 deleteButton.textContent = "Del";
nickjillings@1404 1287 deleteButton.style.width = "48px";
nickjillings@1404 1288 deleteButton.style.padding = "1px 0px";
nickjillings@1404 1289 deleteButton.onclick = function()
nickjillings@1404 1290 {
nickjillings@1404 1291 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1292 var j = i+1;
nickjillings@1404 1293 while(j < specificationNode.preTest.options.length)
nickjillings@1404 1294 {
nickjillings@1404 1295 specificationNode.preTest.options[i] = specificationNode.preTest.options[j];
nickjillings@1404 1296 j++;
nickjillings@1404 1297 i++;
nickjillings@1404 1298 }
nickjillings@1404 1299 specificationNode.preTest.options.pop();
nickjillings@1404 1300 popupInstance.state = 7;
nickjillings@1404 1301 popupInstance.advanceState();
nickjillings@1404 1302 };
nickjillings@1404 1303 deleteH.appendChild(deleteButton);
nickjillings@1404 1304 entry.appendChild(deleteH);
nickjillings@1404 1305 preHolder.appendChild(entry);
nickjillings@1404 1306 }
nickjillings@1404 1307 var entry = document.createElement('div');
nickjillings@1404 1308 entry.style.width = "456px";
nickjillings@1404 1309 entry.style.height= "20px";
nickjillings@1404 1310 entry.style.margin= "2px";
nickjillings@1404 1311 entry.style.borderBottom = "#DDD";
nickjillings@1404 1312 entry.style.borderBottomWidth = "1px";
nickjillings@1404 1313 entry.style.borderBottomStyle = "solid";
nickjillings@1404 1314 entry.align = "center";
nickjillings@1404 1315 var addPre = document.createElement('button');
nickjillings@1404 1316 addPre.className = "popupButton";
nickjillings@1404 1317 addPre.textContent = "Add New Entry";
nickjillings@1404 1318 addPre.style.height = "20px";
nickjillings@1404 1319 addPre.onclick = function()
nickjillings@1404 1320 {
nickjillings@1404 1321 popupInstance.dataTransfer = new function() {
nickjillings@1404 1322 this.title = "New Pre Test Node";
nickjillings@1404 1323 this.parent = specificationNode.preTest;
nickjillings@1404 1324 this.node = null;
nickjillings@1404 1325 this.previousState = 7;
nickjillings@1404 1326 };
nickjillings@1404 1327 popupInstance.state = 6;
nickjillings@1404 1328 popupInstance.advanceState();
nickjillings@1404 1329 };
nickjillings@1404 1330 entry.appendChild(addPre);
nickjillings@1404 1331 preHolder.appendChild(entry);
nickjillings@1404 1332
nickjillings@1404 1333 var span = document.createElement('span');
nickjillings@1404 1334 span.textContent = "Add your post test page options here";
nickjillings@1404 1335 this.popupBody.appendChild(span);
nickjillings@1404 1336 var postHolder = document.createElement('div');
nickjillings@1404 1337 postHolder.id = "preHolder";
nickjillings@1404 1338 postHolder.style.width = "100%";
nickjillings@1404 1339 postHolder.style.minHeight = "100px";
nickjillings@1404 1340 postHolder.style.maxHeight = "220px";
nickjillings@1404 1341 postHolder.style.overflow = 'auto';
nickjillings@1404 1342 postHolder.style.border = "black";
nickjillings@1404 1343 postHolder.style.borderStyle = "solid";
nickjillings@1404 1344 postHolder.style.borderWidth = "1px";
nickjillings@1404 1345 this.popupBody.appendChild(postHolder);
nickjillings@1404 1346 var postHeaderHolder = document.createElement('div');
nickjillings@1404 1347 postHeaderHolder.style.width = "456px";
nickjillings@1404 1348 postHeaderHolder.style.height= "20px";
nickjillings@1404 1349 postHeaderHolder.style.margin= "2px";
nickjillings@1404 1350 postHeaderHolder.style.borderBottom = "#DDD";
nickjillings@1404 1351 postHeaderHolder.style.borderBottomWidth = "1px";
nickjillings@1404 1352 postHeaderHolder.style.borderBottomStyle = "solid";
nickjillings@1404 1353 var mvH = document.createElement('div');
nickjillings@1404 1354 mvH.className = "dndheaderelement";
nickjillings@1404 1355 mvH.style.width = "50px";
nickjillings@1404 1356 var text = document.createElement('span');
nickjillings@1404 1357 text.textContent = "Order";
nickjillings@1404 1358 mvH.appendChild(text);
nickjillings@1404 1359 postHeaderHolder.appendChild(mvH);
nickjillings@1404 1360 var idH = document.createElement('div');
nickjillings@1404 1361 idH.className = "dndheaderelement";
nickjillings@1404 1362 idH.style.width = "150px";
nickjillings@1404 1363 text = document.createElement('span');
nickjillings@1404 1364 text.textContent = "ID";
nickjillings@1404 1365 idH.appendChild(text);
nickjillings@1404 1366 postHeaderHolder.appendChild(idH);
nickjillings@1404 1367 var tH = document.createElement('div');
nickjillings@1404 1368 tH.className = "dndheaderelement";
nickjillings@1404 1369 tH.style.width = "150px";
nickjillings@1404 1370 text = document.createElement('span');
nickjillings@1404 1371 text.textContent = "Type";
nickjillings@1404 1372 tH.appendChild(text);
nickjillings@1404 1373 postHeaderHolder.appendChild(tH);
nickjillings@1404 1374 var editH = document.createElement('div');
nickjillings@1404 1375 editH.className = "dndheaderelement";
nickjillings@1404 1376 editH.style.width = "50px";
nickjillings@1404 1377 text = document.createElement('span');
nickjillings@1404 1378 text.textContent = "Edit";
nickjillings@1404 1379 editH.appendChild(text);
nickjillings@1404 1380 postHeaderHolder.appendChild(editH);
nickjillings@1404 1381 var deleteH = document.createElement('div');
nickjillings@1404 1382 deleteH.className = "dndheaderelement";
nickjillings@1404 1383 deleteH.style.width = "50px";
nickjillings@1404 1384 text = document.createElement('span');
nickjillings@1404 1385 text.textContent = "Delete";
nickjillings@1404 1386 deleteH.appendChild(text);
nickjillings@1404 1387 postHeaderHolder.appendChild(deleteH);
nickjillings@1404 1388 postHolder.appendChild(postHeaderHolder);
nickjillings@1404 1389
nickjillings@1404 1390 for (var i=0; i<specificationNode.postTest.options.length; i++)
nickjillings@1404 1391 {
nickjillings@1404 1392 var optionNode = specificationNode.postTest.options[i];
nickjillings@1404 1393 var entry = document.createElement('div');
nickjillings@1404 1394 entry.style.width = "456px";
nickjillings@1404 1395 entry.style.height= "20px";
nickjillings@1404 1396 entry.style.margin= "2px";
nickjillings@1404 1397 entry.style.borderBottom = "#DDD";
nickjillings@1404 1398 entry.style.borderBottomWidth = "1px";
nickjillings@1404 1399 entry.style.borderBottomStyle = "solid";
nickjillings@1404 1400 entry.setAttribute("node-id",i);
nickjillings@1404 1401 var node = specificationNode.postTest.options[i];
nickjillings@1404 1402 var mvH = document.createElement('div');
nickjillings@1404 1403 mvH.className = "dndheaderelement";
nickjillings@1404 1404 mvH.style.width = "50px";
nickjillings@1404 1405 var mvup = document.createElement("button");
nickjillings@1404 1406 mvup.textContent = "Up";
nickjillings@1404 1407 mvup.style.width = "25px";
nickjillings@1404 1408 mvup.style.padding = "1px 0px";
nickjillings@1404 1409 mvup.onclick = function()
nickjillings@1404 1410 {
nickjillings@1404 1411 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1412 if (i != 0)
nickjillings@1404 1413 {
nickjillings@1404 1414 var next = specificationNode.postTest.options[i-1];
nickjillings@1404 1415 var cur = specificationNode.postTest.options[i];
nickjillings@1404 1416 specificationNode.postTest.options[i-1] = cur;
nickjillings@1404 1417 specificationNode.postTest.options[i] = next;
nickjillings@1404 1418 popupInstance.state = 7;
nickjillings@1404 1419 popupInstance.advanceState();
nickjillings@1404 1420 }
nickjillings@1404 1421 };
nickjillings@1404 1422 mvH.appendChild(mvup);
nickjillings@1404 1423 var mvdn = document.createElement("button");
nickjillings@1404 1424 mvdn.textContent = "Dn";
nickjillings@1404 1425 mvdn.style.width = "25px";
nickjillings@1404 1426 mvdn.style.padding = "1px 0px";
nickjillings@1404 1427 mvdn.onclick = function()
nickjillings@1404 1428 {
nickjillings@1404 1429 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1430 if (i != specificationNode.postTest.options.length-1)
nickjillings@1404 1431 {
nickjillings@1404 1432 var next = specificationNode.postTest.options[i+1];
nickjillings@1404 1433 var cur = specificationNode.postTest.options[i];
nickjillings@1404 1434 specificationNode.postTest.options[i+1] = cur;
nickjillings@1404 1435 specificationNode.postTest.options[i] = next;
nickjillings@1404 1436 popupInstance.state = 7;
nickjillings@1404 1437 popupInstance.advanceState();
nickjillings@1404 1438 }
nickjillings@1404 1439 };
nickjillings@1404 1440 mvH.appendChild(mvdn);
nickjillings@1404 1441 entry.appendChild(mvH);
nickjillings@1404 1442 var idH = document.createElement('div');
nickjillings@1404 1443 idH.className = "dndheaderelement";
nickjillings@1404 1444 idH.style.width = "150px";
nickjillings@1404 1445 if (optionNode.type != "statement")
nickjillings@1404 1446 {
nickjillings@1404 1447 var span = document.createElement('span');
nickjillings@1404 1448 span.textContent = optionNode.id;
nickjillings@1404 1449 idH.appendChild(span);
nickjillings@1404 1450 }
nickjillings@1404 1451 entry.appendChild(idH);
nickjillings@1404 1452 var typeH = document.createElement('div');
nickjillings@1404 1453 typeH.className = "dndheaderelement";
nickjillings@1404 1454 typeH.style.width = "150px";
nickjillings@1404 1455 var span = document.createElement('span');
nickjillings@1404 1456 span.textContent = optionNode.type;
nickjillings@1404 1457 typeH.appendChild(span);
nickjillings@1404 1458 entry.appendChild(typeH);
nickjillings@1404 1459 var editH = document.createElement('div');
nickjillings@1404 1460 editH.className = "dndheaderelement";
nickjillings@1404 1461 editH.style.width = "50px";
nickjillings@1404 1462 var editButton = document.createElement("button");
nickjillings@1404 1463 editButton.textContent = "Edit";
nickjillings@1404 1464 editButton.style.width = "48px";
nickjillings@1404 1465 editButton.style.padding = "1px 0px";
nickjillings@1404 1466 editButton.onclick = function()
nickjillings@1404 1467 {
nickjillings@1404 1468 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1469 popupInstance.dataTransfer = new function() {
nickjillings@1404 1470 this.title = "Edit Test Node";
nickjillings@1404 1471 this.parent = specificationNode.postTest;
nickjillings@1404 1472 this.node = this.parent.options[i];
nickjillings@1404 1473 this.previousState = 7;
nickjillings@1404 1474 };
nickjillings@1404 1475 popupInstance.state = 6;
nickjillings@1404 1476 popupInstance.advanceState();
nickjillings@1404 1477 };
nickjillings@1404 1478 editH.appendChild(editButton);
nickjillings@1404 1479 entry.appendChild(editH);
nickjillings@1404 1480 var deleteH = document.createElement('div');
nickjillings@1404 1481 deleteH.className = "dndheaderelement";
nickjillings@1404 1482 deleteH.style.width = "50px";
nickjillings@1404 1483 var deleteButton = document.createElement("button");
nickjillings@1404 1484 deleteButton.textContent = "Del";
nickjillings@1404 1485 deleteButton.style.width = "48px";
nickjillings@1404 1486 deleteButton.style.padding = "1px 0px";
nickjillings@1404 1487 deleteButton.onclick = function()
nickjillings@1404 1488 {
nickjillings@1404 1489 var i = Number(event.currentTarget.parentElement.parentElement.getAttribute("node-id"));
nickjillings@1404 1490 var j = i+1;
nickjillings@1404 1491 while(j < specificationNode.postTest.options.length)
nickjillings@1404 1492 {
nickjillings@1404 1493 specificationNode.postTest.options[i] = specificationNode.postTest.options[j];
nickjillings@1404 1494 j++;
nickjillings@1404 1495 i++;
nickjillings@1404 1496 }
nickjillings@1404 1497 audioHolder.postTest.options.pop();
nickjillings@1404 1498 popupInstance.state = 7;
nickjillings@1404 1499 popupInstance.advanceState();
nickjillings@1404 1500 };
nickjillings@1404 1501 deleteH.appendChild(deleteButton);
nickjillings@1404 1502 entry.appendChild(deleteH);
nickjillings@1404 1503 postHolder.appendChild(entry);
nickjillings@1404 1504 }
nickjillings@1404 1505
nickjillings@1404 1506 var entry = document.createElement('div');
nickjillings@1404 1507 entry.style.width = "456px";
nickjillings@1404 1508 entry.style.height= "20px";
nickjillings@1404 1509 entry.style.margin= "2px";
nickjillings@1404 1510 entry.style.borderBottom = "#DDD";
nickjillings@1404 1511 entry.style.borderBottomWidth = "1px";
nickjillings@1404 1512 entry.style.borderBottomStyle = "solid";
nickjillings@1404 1513 entry.align = "center";
nickjillings@1404 1514 var addPost = document.createElement('button');
nickjillings@1404 1515 addPost.className = "popupButton";
nickjillings@1404 1516 addPost.textContent = "Add New Entry";
nickjillings@1404 1517 addPost.style.height = "20px";
nickjillings@1404 1518 addPost.onclick = function()
nickjillings@1404 1519 {
nickjillings@1404 1520 popupInstance.dataTransfer = new function() {
nickjillings@1404 1521 this.title = "New Pre Test Node";
nickjillings@1404 1522 this.parent = specificationNode.postTest;
nickjillings@1404 1523 this.node = null;
nickjillings@1404 1524 this.previousState = 7;
nickjillings@1404 1525 };
nickjillings@1404 1526 popupInstance.state = 6;
nickjillings@1404 1527 popupInstance.advanceState();
nickjillings@1404 1528 };
nickjillings@1404 1529 entry.appendChild(addPost);
nickjillings@1404 1530 postHolder.appendChild(entry);
nickjillings@1404 1531
nickjillings@1404 1532 var button = document.createElement('button');
nickjillings@1404 1533 button.id = 'submit';
nickjillings@1404 1534 button.className = "popupButton";
nickjillings@1404 1535 button.textContent = "Finish";
nickjillings@1404 1536 button.onclick = function(event)
nickjillings@1404 1537 {
nickjillings@1404 1538 popupInstance.state = 8;
nickjillings@1404 1539 popupInstance.advanceState();
nickjillings@1404 1540 };
nickjillings@1404 1541 this.popupFooter.appendChild(button);
nickjillings@1404 1542 break;
nickjillings@1404 1543 case 8:
nickjillings@1404 1544 this.hidePopup();
nickjillings@1404 1545 this.state = 0;
nickjillings@1404 1546 SpecificationToHTML ();
nickjillings@1404 1547 }
nickjillings@1404 1548 this.state++;
nickjillings@1404 1549 };
nickjillings@1404 1550 };
nickjillings@1404 1551
nickjillings@1404 1552 function audioObject()
nickjillings@1404 1553 {
nickjillings@1404 1554 // Used to hold audio information in buffers for quick playback
nickjillings@1404 1555 this.bufferObject;
nickjillings@1404 1556 this.bufferNode = undefined;
nickjillings@1404 1557 this.state = 0;
nickjillings@1404 1558 this.gain = audioContext.createGain();
nickjillings@1404 1559 this.gain.connect(audioContext.destination);
nickjillings@1404 1560 this.include = true;
nickjillings@1404 1561 this.id = undefined;
nickjillings@1404 1562 this.file = undefined;
nickjillings@1404 1563
nickjillings@1404 1564 this.play = function()
nickjillings@1404 1565 {
nickjillings@1404 1566 if (this.bufferNode != undefined)
nickjillings@1404 1567 {
nickjillings@1404 1568 this.bufferNode.stop(0);
nickjillings@1404 1569 this.bufferNode = undefined;
nickjillings@1404 1570 }
nickjillings@1404 1571 if(this.state == 1)
nickjillings@1404 1572 {
nickjillings@1404 1573 this.bufferNode = audioContext.createBufferSource();
nickjillings@1404 1574 this.bufferNode.connect(this.gain);
nickjillings@1404 1575 this.bufferNode.buffer = this.bufferObject;
nickjillings@1404 1576 this.bufferNode.onended = function(event) {
nickjillings@1404 1577 // Safari does not like using 'this' to reference the calling object!
nickjillings@1404 1578 event.currentTarget = undefined;
nickjillings@1404 1579 };
nickjillings@1404 1580 this.bufferNode.start(audioContext.currentTime);
nickjillings@1404 1581 this.bufferNode.stop(audioContext.currentTime+3);
nickjillings@1404 1582 }
nickjillings@1404 1583 };
nickjillings@1404 1584
nickjillings@1404 1585 this.constructTrack = function(file) {
nickjillings@1404 1586 var reader = new FileReader();
nickjillings@1404 1587 this.file = file;
nickjillings@1404 1588 var audioObj = this;
nickjillings@1404 1589 // Create callback to decode the data asynchronously
nickjillings@1404 1590 reader.onloadend = function() {
nickjillings@1404 1591 audioContext.decodeAudioData(reader.result, function(decodedData) {
nickjillings@1404 1592 audioObj.bufferObject = decodedData;
nickjillings@1404 1593 audioObj.state = 1;
nickjillings@1404 1594 }, function(){});
nickjillings@1404 1595 };
nickjillings@1404 1596 reader.readAsArrayBuffer(file);
nickjillings@1404 1597 };
nickjillings@1404 1598 };
nickjillings@1404 1599
nickjillings@1404 1600 function Specification() {
nickjillings@1404 1601 // Handles the decoding of the project specification XML into a simple JavaScript Object.
nickjillings@1404 1602
nickjillings@1404 1603 this.interfaceType = null;
nickjillings@1404 1604 this.commonInterface = new function()
nickjillings@1404 1605 {
nickjillings@1404 1606 this.options = [];
nickjillings@1404 1607 this.optionNode = function(input)
nickjillings@1404 1608 {
nickjillings@1404 1609 var name = input.getAttribute('name');
nickjillings@1404 1610 this.type = name;
nickjillings@1404 1611 if(this.type == "option")
nickjillings@1404 1612 {
nickjillings@1404 1613 this.name = input.id;
nickjillings@1404 1614 } else if (this.type == "check")
nickjillings@1404 1615 {
nickjillings@1404 1616 this.check = input.id;
nickjillings@1404 1617 }
nickjillings@1404 1618 };
nickjillings@1404 1619 };
nickjillings@1404 1620 this.projectReturn = null;
nickjillings@1404 1621 this.randomiseOrder = null;
nickjillings@1404 1622 this.collectMetrics = null;
nickjillings@1404 1623 this.testPages = null;
nickjillings@1404 1624 this.audioHolders = [];
nickjillings@1404 1625 this.metrics = [];
nickjillings@1404 1626
nickjillings@1404 1627 this.decode = function(projectXML) {
nickjillings@1404 1628 // projectXML - DOM Parsed document
nickjillings@1404 1629 this.projectXML = projectXML.childNodes[0];
nickjillings@1404 1630 var setupNode = projectXML.getElementsByTagName('setup')[0];
nickjillings@1404 1631 this.interfaceType = setupNode.getAttribute('interface');
nickjillings@1404 1632 this.projectReturn = setupNode.getAttribute('projectReturn');
nickjillings@1404 1633 this.testPages = setupNode.getAttribute('testPages');
nickjillings@1404 1634 if (setupNode.getAttribute('randomiseOrder') == "true") {
nickjillings@1404 1635 this.randomiseOrder = true;
nickjillings@1404 1636 } else {this.randomiseOrder = false;}
nickjillings@1404 1637 if (setupNode.getAttribute('collectMetrics') == "true") {
nickjillings@1404 1638 this.collectMetrics = true;
nickjillings@1404 1639 } else {this.collectMetrics = false;}
nickjillings@1404 1640 if (isNaN(Number(this.testPages)) || this.testPages == undefined)
nickjillings@1404 1641 {
nickjillings@1404 1642 this.testPages = null;
nickjillings@1404 1643 } else {
nickjillings@1404 1644 this.testPages = Number(this.testPages);
nickjillings@1404 1645 if (this.testPages == 0) {this.testPages = null;}
nickjillings@1404 1646 }
nickjillings@1404 1647 var metricCollection = setupNode.getElementsByTagName('Metric');
nickjillings@1404 1648
nickjillings@1404 1649 var setupPreTestNode = setupNode.getElementsByTagName('PreTest');
nickjillings@1404 1650 if (setupPreTestNode.length != 0)
nickjillings@1404 1651 {
nickjillings@1404 1652 setupPreTestNode = setupPreTestNode[0];
nickjillings@1404 1653 this.preTest.construct(setupPreTestNode);
nickjillings@1404 1654 }
nickjillings@1404 1655
nickjillings@1404 1656 var setupPostTestNode = setupNode.getElementsByTagName('PostTest');
nickjillings@1404 1657 if (setupPostTestNode.length != 0)
nickjillings@1404 1658 {
nickjillings@1404 1659 setupPostTestNode = setupPostTestNode[0];
nickjillings@1404 1660 this.postTest.construct(setupPostTestNode);
nickjillings@1404 1661 }
nickjillings@1404 1662
nickjillings@1404 1663 if (metricCollection.length > 0) {
nickjillings@1404 1664 metricCollection = metricCollection[0].getElementsByTagName('metricEnable');
nickjillings@1404 1665 for (var i=0; i<metricCollection.length; i++) {
nickjillings@1404 1666 this.metrics.push(new this.metricNode(metricCollection[i].textContent));
nickjillings@1404 1667 }
nickjillings@1404 1668 }
nickjillings@1404 1669
nickjillings@1404 1670 var commonInterfaceNode = setupNode.getElementsByTagName('interface');
nickjillings@1404 1671 if (commonInterfaceNode.length > 0) {
nickjillings@1404 1672 commonInterfaceNode = commonInterfaceNode[0];
nickjillings@1404 1673 } else {
nickjillings@1404 1674 commonInterfaceNode = undefined;
nickjillings@1404 1675 }
nickjillings@1404 1676
nickjillings@1404 1677 this.commonInterface = new function() {
nickjillings@1404 1678 this.OptionNode = function(child) {
nickjillings@1404 1679 this.type = child.nodeName;
nickjillings@1404 1680 if (this.type == 'option')
nickjillings@1404 1681 {
nickjillings@1404 1682 this.name = child.getAttribute('name');
nickjillings@1404 1683 }
nickjillings@1404 1684 else if (this.type == 'check') {
nickjillings@1404 1685 this.check = child.getAttribute('name');
nickjillings@1404 1686 if (this.check == 'scalerange') {
nickjillings@1404 1687 this.min = child.getAttribute('min');
nickjillings@1404 1688 this.max = child.getAttribute('max');
nickjillings@1404 1689 if (this.min == null) {this.min = 1;}
nickjillings@1404 1690 else if (Number(this.min) > 1 && this.min != null) {
nickjillings@1404 1691 this.min = Number(this.min)/100;
nickjillings@1404 1692 } else {
nickjillings@1404 1693 this.min = Number(this.min);
nickjillings@1404 1694 }
nickjillings@1404 1695 if (this.max == null) {this.max = 0;}
nickjillings@1404 1696 else if (Number(this.max) > 1 && this.max != null) {
nickjillings@1404 1697 this.max = Number(this.max)/100;
nickjillings@1404 1698 } else {
nickjillings@1404 1699 this.max = Number(this.max);
nickjillings@1404 1700 }
nickjillings@1404 1701 }
nickjillings@1404 1702 } else if (this.type == 'anchor' || this.type == 'reference') {
nickjillings@1404 1703 this.value = Number(child.textContent);
nickjillings@1404 1704 this.enforce = child.getAttribute('enforce');
nickjillings@1404 1705 if (this.enforce == 'true') {this.enforce = true;}
nickjillings@1404 1706 else {this.enforce = false;}
nickjillings@1404 1707 }
nickjillings@1404 1708 };
nickjillings@1404 1709 this.options = [];
nickjillings@1404 1710 if (commonInterfaceNode != undefined) {
nickjillings@1404 1711 var child = commonInterfaceNode.firstElementChild;
nickjillings@1404 1712 while (child != undefined) {
nickjillings@1404 1713 this.options.push(new this.OptionNode(child));
nickjillings@1404 1714 child = child.nextElementSibling;
nickjillings@1404 1715 }
nickjillings@1404 1716 }
nickjillings@1404 1717 };
nickjillings@1404 1718
nickjillings@1404 1719 var audioHolders = projectXML.getElementsByTagName('audioHolder');
nickjillings@1404 1720 for (var i=0; i<audioHolders.length; i++) {
nickjillings@1404 1721 var node = new this.audioHolderNode(this);
nickjillings@1404 1722 node.decode(this,audioHolders[i]);
nickjillings@1404 1723 this.audioHolders.push(node);
nickjillings@1404 1724 }
nickjillings@1404 1725
nickjillings@1404 1726 // New check if we need to randomise the test order
nickjillings@1404 1727 if (this.randomiseOrder)
nickjillings@1404 1728 {
nickjillings@1404 1729 this.audioHolders = randomiseOrder(this.audioHolders);
nickjillings@1404 1730 for (var i=0; i<this.audioHolders.length; i++)
nickjillings@1404 1731 {
nickjillings@1404 1732 this.audioHolders[i].presentedId = i;
nickjillings@1404 1733 }
nickjillings@1404 1734 }
nickjillings@1404 1735
nickjillings@1404 1736 if (this.testPages != null || this.testPages != undefined)
nickjillings@1404 1737 {
nickjillings@1404 1738 if (this.testPages > audioHolders.length)
nickjillings@1404 1739 {
nickjillings@1404 1740 console.log('Warning: You have specified '+audioHolders.length+' tests but requested '+this.testPages+' be completed!');
nickjillings@1404 1741 this.testPages = audioHolders.length;
nickjillings@1404 1742 }
nickjillings@1404 1743 var aH = this.audioHolders;
nickjillings@1404 1744 this.audioHolders = [];
nickjillings@1404 1745 for (var i=0; i<this.testPages; i++)
nickjillings@1404 1746 {
nickjillings@1404 1747 this.audioHolders.push(aH[i]);
nickjillings@1404 1748 }
nickjillings@1404 1749 }
nickjillings@1404 1750 };
nickjillings@1404 1751
nickjillings@1404 1752 this.encode = function()
nickjillings@1404 1753 {
nickjillings@1404 1754 var root = document.implementation.createDocument(null,"BrowserEvalProjectDocument");
nickjillings@1404 1755 // First get all the <setup> tag compiled
nickjillings@1404 1756 var setupNode = root.createElement("setup");
nickjillings@1404 1757 setupNode.setAttribute('interface',this.interfaceType);
nickjillings@1404 1758 setupNode.setAttribute('projectReturn',this.projectReturn);
nickjillings@1404 1759 setupNode.setAttribute('randomiseOrder',this.randomiseOrder);
nickjillings@1404 1760 setupNode.setAttribute('collectMetrics',this.collectMetrics);
nickjillings@1404 1761 setupNode.setAttribute('testPages',this.testPages);
nickjillings@1404 1762
nickjillings@1404 1763 var setupPreTest = root.createElement("PreTest");
nickjillings@1404 1764 for (var i=0; i<this.preTest.options.length; i++)
nickjillings@1404 1765 {
nickjillings@1404 1766 setupPreTest.appendChild(this.preTest.options[i].exportXML(root));
nickjillings@1404 1767 }
nickjillings@1404 1768
nickjillings@1404 1769 var setupPostTest = root.createElement("PostTest");
nickjillings@1404 1770 for (var i=0; i<this.postTest.options.length; i++)
nickjillings@1404 1771 {
nickjillings@1404 1772 setupPostTest.appendChild(this.postTest.options[i].exportXML(root));
nickjillings@1404 1773 }
nickjillings@1404 1774
nickjillings@1404 1775 setupNode.appendChild(setupPreTest);
nickjillings@1404 1776 setupNode.appendChild(setupPostTest);
nickjillings@1404 1777
nickjillings@1404 1778 // <Metric> tag
nickjillings@1404 1779 var Metric = root.createElement("Metric");
nickjillings@1404 1780 for (var i=0; i<this.metrics.length; i++)
nickjillings@1404 1781 {
nickjillings@1404 1782 var metricEnable = root.createElement("metricEnable");
nickjillings@1404 1783 metricEnable.textContent = this.metrics[i].enabled;
nickjillings@1404 1784 Metric.appendChild(metricEnable);
nickjillings@1404 1785 }
nickjillings@1404 1786 setupNode.appendChild(Metric);
nickjillings@1404 1787
nickjillings@1404 1788 // <interface> tag
nickjillings@1404 1789 var CommonInterface = root.createElement("interface");
nickjillings@1404 1790 for (var i=0; i<this.commonInterface.options.length; i++)
nickjillings@1404 1791 {
nickjillings@1404 1792 var CIObj = this.commonInterface.options[i];
nickjillings@1404 1793 var CINode = root.createElement(CIObj.type);
nickjillings@1404 1794 if (CIObj.type == "check") {CINode.setAttribute("name",CIObj.check);}
nickjillings@1404 1795 else {CINode.setAttribute("name",CIObj.name);}
nickjillings@1404 1796 CommonInterface.appendChild(CINode);
nickjillings@1404 1797 }
nickjillings@1404 1798 setupNode.appendChild(CommonInterface);
nickjillings@1404 1799
nickjillings@1404 1800 root.getElementsByTagName("BrowserEvalProjectDocument")[0].appendChild(setupNode);
nickjillings@1404 1801 // Time for the <audioHolder> tags
nickjillings@1404 1802 for (var ahIndex = 0; ahIndex < this.audioHolders.length; ahIndex++)
nickjillings@1404 1803 {
nickjillings@1404 1804 var node = this.audioHolders[ahIndex].encode(root);
nickjillings@1404 1805 root.getElementsByTagName("BrowserEvalProjectDocument")[0].appendChild(node);
nickjillings@1404 1806 }
nickjillings@1404 1807 return root;
nickjillings@1404 1808 };
nickjillings@1404 1809
nickjillings@1404 1810 this.prepostNode = function(type) {
nickjillings@1404 1811 this.type = type;
nickjillings@1404 1812 this.options = [];
nickjillings@1404 1813
nickjillings@1404 1814 this.OptionNode = function() {
nickjillings@1404 1815
nickjillings@1404 1816 this.childOption = function() {
nickjillings@1404 1817 this.type = 'option';
nickjillings@1404 1818 this.id = null;
nickjillings@1404 1819 this.name = undefined;
nickjillings@1404 1820 this.text = null;
nickjillings@1404 1821 };
nickjillings@1404 1822
nickjillings@1404 1823 this.type = undefined;
nickjillings@1404 1824 this.id = undefined;
nickjillings@1404 1825 this.mandatory = undefined;
nickjillings@1404 1826 this.question = undefined;
nickjillings@1404 1827 this.statement = undefined;
nickjillings@1404 1828 this.boxsize = undefined;
nickjillings@1404 1829 this.options = [];
nickjillings@1404 1830 this.min = undefined;
nickjillings@1404 1831 this.max = undefined;
nickjillings@1404 1832 this.step = undefined;
nickjillings@1404 1833
nickjillings@1404 1834 this.decode = function(child)
nickjillings@1404 1835 {
nickjillings@1404 1836 this.type = child.nodeName;
nickjillings@1404 1837 if (child.nodeName == "question") {
nickjillings@1404 1838 this.id = child.id;
nickjillings@1404 1839 this.mandatory;
nickjillings@1404 1840 if (child.getAttribute('mandatory') == "true") {this.mandatory = true;}
nickjillings@1404 1841 else {this.mandatory = false;}
nickjillings@1404 1842 this.question = child.textContent;
nickjillings@1404 1843 if (child.getAttribute('boxsize') == null) {
nickjillings@1404 1844 this.boxsize = 'normal';
nickjillings@1404 1845 } else {
nickjillings@1404 1846 this.boxsize = child.getAttribute('boxsize');
nickjillings@1404 1847 }
nickjillings@1404 1848 } else if (child.nodeName == "statement") {
nickjillings@1404 1849 this.statement = child.textContent;
nickjillings@1404 1850 } else if (child.nodeName == "checkbox" || child.nodeName == "radio") {
nickjillings@1404 1851 var element = child.firstElementChild;
nickjillings@1404 1852 this.id = child.id;
nickjillings@1404 1853 if (element == null) {
nickjillings@1404 1854 console.log('Malformed' +child.nodeName+ 'entry');
nickjillings@1404 1855 this.statement = 'Malformed' +child.nodeName+ 'entry';
nickjillings@1404 1856 this.type = 'statement';
nickjillings@1404 1857 } else {
nickjillings@1404 1858 this.options = [];
nickjillings@1404 1859 while (element != null) {
nickjillings@1404 1860 if (element.nodeName == 'statement' && this.statement == undefined){
nickjillings@1404 1861 this.statement = element.textContent;
nickjillings@1404 1862 } else if (element.nodeName == 'option') {
nickjillings@1404 1863 var node = new this.childOption();
nickjillings@1404 1864 node.id = element.id;
nickjillings@1404 1865 node.name = element.getAttribute('name');
nickjillings@1404 1866 node.text = element.textContent;
nickjillings@1404 1867 this.options.push(node);
nickjillings@1404 1868 }
nickjillings@1404 1869 element = element.nextElementSibling;
nickjillings@1404 1870 }
nickjillings@1404 1871 }
nickjillings@1404 1872 } else if (child.nodeName == "number") {
nickjillings@1404 1873 this.statement = child.textContent;
nickjillings@1404 1874 this.id = child.id;
nickjillings@1404 1875 this.min = child.getAttribute('min');
nickjillings@1404 1876 this.max = child.getAttribute('max');
nickjillings@1404 1877 this.step = child.getAttribute('step');
nickjillings@1404 1878 }
nickjillings@1404 1879 };
nickjillings@1404 1880
nickjillings@1404 1881 this.exportXML = function(root)
nickjillings@1404 1882 {
nickjillings@1404 1883 var node = root.createElement(this.type);
nickjillings@1404 1884 switch(this.type)
nickjillings@1404 1885 {
nickjillings@1404 1886 case "statement":
nickjillings@1404 1887 node.textContent = this.statement;
nickjillings@1404 1888 break;
nickjillings@1404 1889 case "question":
nickjillings@1404 1890 node.id = this.id;
nickjillings@1404 1891 node.setAttribute("mandatory",this.mandatory);
nickjillings@1404 1892 node.setAttribute("boxsize",this.boxsize);
nickjillings@1404 1893 node.textContent = this.question;
nickjillings@1404 1894 break;
nickjillings@1404 1895 case "number":
nickjillings@1404 1896 node.id = this.id;
nickjillings@1404 1897 node.setAttribute("mandatory",this.mandatory);
nickjillings@1404 1898 node.setAttribute("min", this.min);
nickjillings@1404 1899 node.setAttribute("max", this.max);
nickjillings@1404 1900 node.setAttribute("step", this.step);
nickjillings@1405 1901 node.textContent = this.statement;
nickjillings@1404 1902 break;
nickjillings@1404 1903 case "checkbox":
nickjillings@1404 1904 node.id = this.id;
nickjillings@1404 1905 var statement = root.createElement("statement");
nickjillings@1404 1906 statement.textContent = this.statement;
nickjillings@1404 1907 node.appendChild(statement);
nickjillings@1404 1908 for (var i=0; i<this.options.length; i++)
nickjillings@1404 1909 {
nickjillings@1404 1910 var option = this.options[i];
nickjillings@1404 1911 var optionNode = root.createElement("option");
nickjillings@1404 1912 optionNode.id = option.id;
nickjillings@1404 1913 optionNode.textContent = option.text;
nickjillings@1404 1914 node.appendChild(optionNode);
nickjillings@1404 1915 }
nickjillings@1404 1916 break;
nickjillings@1404 1917 case "radio":
nickjillings@1404 1918 node.id = this.id;
nickjillings@1404 1919 var statement = root.createElement("statement");
nickjillings@1404 1920 statement.textContent = this.statement;
nickjillings@1404 1921 node.appendChild(statement);
nickjillings@1404 1922 for (var i=0; i<this.options.length; i++)
nickjillings@1404 1923 {
nickjillings@1404 1924 var option = this.options[i];
nickjillings@1404 1925 var optionNode = root.createElement("option");
nickjillings@1404 1926 optionNode.setAttribute("name",option.name);
nickjillings@1404 1927 optionNode.textContent = option.text;
nickjillings@1404 1928 node.appendChild(optionNode);
nickjillings@1404 1929 }
nickjillings@1404 1930 break;
nickjillings@1404 1931 }
nickjillings@1404 1932 return node;
nickjillings@1404 1933 };
nickjillings@1404 1934 };
nickjillings@1404 1935 this.construct = function(Collection)
nickjillings@1404 1936 {
nickjillings@1404 1937 if (Collection.childElementCount != 0) {
nickjillings@1404 1938 var child = Collection.firstElementChild;
nickjillings@1404 1939 var node = new this.OptionNode();
nickjillings@1404 1940 node.decode(child);
nickjillings@1404 1941 this.options.push(node);
nickjillings@1404 1942 while (child.nextElementSibling != null) {
nickjillings@1404 1943 child = child.nextElementSibling;
nickjillings@1404 1944 node = new this.OptionNode();
nickjillings@1404 1945 node.decode(child);
nickjillings@1404 1946 this.options.push(node);
nickjillings@1404 1947 }
nickjillings@1404 1948 }
nickjillings@1404 1949 };
nickjillings@1404 1950 };
nickjillings@1404 1951 this.preTest = new this.prepostNode("pretest");
nickjillings@1404 1952 this.postTest = new this.prepostNode("posttest");
nickjillings@1404 1953
nickjillings@1404 1954 this.metricNode = function(name) {
nickjillings@1404 1955 this.enabled = name;
nickjillings@1404 1956 };
nickjillings@1404 1957
nickjillings@1404 1958 this.audioHolderNode = function(parent) {
nickjillings@1404 1959 this.type = 'audioHolder';
nickjillings@1404 1960 this.presentedId = undefined;
nickjillings@1404 1961 this.id = undefined;
nickjillings@1404 1962 this.hostURL = undefined;
nickjillings@1404 1963 this.sampleRate = undefined;
nickjillings@1404 1964 this.randomiseOrder = undefined;
nickjillings@1404 1965 this.loop = undefined;
nickjillings@1404 1966 this.elementComments = undefined;
nickjillings@1404 1967 this.outsideReference = null;
nickjillings@1404 1968 this.preTest = new parent.prepostNode("pretest");
nickjillings@1404 1969 this.postTest = new parent.prepostNode("pretest");
nickjillings@1404 1970 this.interfaces = [];
nickjillings@1404 1971 this.commentBoxPrefix = "Comment on track";
nickjillings@1404 1972 this.audioElements = [];
nickjillings@1404 1973 this.commentQuestions = [];
nickjillings@1404 1974
nickjillings@1404 1975 this.decode = function(parent,xml)
nickjillings@1404 1976 {
nickjillings@1404 1977 this.presentedId = parent.audioHolders.length;
nickjillings@1404 1978 this.id = xml.id;
nickjillings@1404 1979 this.hostURL = xml.getAttribute('hostURL');
nickjillings@1404 1980 this.sampleRate = xml.getAttribute('sampleRate');
nickjillings@1404 1981 if (xml.getAttribute('randomiseOrder') == "true") {this.randomiseOrder = true;}
nickjillings@1404 1982 else {this.randomiseOrder = false;}
nickjillings@1404 1983 this.repeatCount = xml.getAttribute('repeatCount');
nickjillings@1404 1984 if (xml.getAttribute('loop') == 'true') {this.loop = true;}
nickjillings@1404 1985 else {this.loop == false;}
nickjillings@1404 1986 if (xml.getAttribute('elementComments') == "true") {this.elementComments = true;}
nickjillings@1404 1987 else {this.elementComments = false;}
nickjillings@1404 1988
nickjillings@1404 1989 var setupPreTestNode = xml.getElementsByTagName('PreTest');
nickjillings@1404 1990 if (setupPreTestNode.length != 0)
nickjillings@1404 1991 {
nickjillings@1404 1992 setupPreTestNode = setupPreTestNode[0];
nickjillings@1404 1993 this.preTest.construct(setupPreTestNode);
nickjillings@1404 1994 }
nickjillings@1404 1995
nickjillings@1404 1996 var setupPostTestNode = xml.getElementsByTagName('PostTest');
nickjillings@1404 1997 if (setupPostTestNode.length != 0)
nickjillings@1404 1998 {
nickjillings@1404 1999 setupPostTestNode = setupPostTestNode[0];
nickjillings@1404 2000 this.postTest.construct(setupPostTestNode);
nickjillings@1404 2001 }
nickjillings@1404 2002
nickjillings@1404 2003 var interfaceDOM = xml.getElementsByTagName('interface');
nickjillings@1404 2004 for (var i=0; i<interfaceDOM.length; i++) {
nickjillings@1404 2005 var node = new this.interfaceNode();
nickjillings@1404 2006 node.decode(interfaceDOM[i]);
nickjillings@1404 2007 this.interfaces.push(node);
nickjillings@1404 2008 }
nickjillings@1404 2009 this.commentBoxPrefix = xml.getElementsByTagName('commentBoxPrefix');
nickjillings@1404 2010 if (this.commentBoxPrefix.length != 0) {
nickjillings@1404 2011 this.commentBoxPrefix = this.commentBoxPrefix[0].textContent;
nickjillings@1404 2012 } else {
nickjillings@1404 2013 this.commentBoxPrefix = "Comment on track";
nickjillings@1404 2014 }
nickjillings@1404 2015 var audioElementsDOM = xml.getElementsByTagName('audioElements');
nickjillings@1404 2016 for (var i=0; i<audioElementsDOM.length; i++) {
nickjillings@1404 2017 var node = new this.audioElementNode();
nickjillings@1406 2018 node.decode(this,audioElementsDOM[i]);
nickjillings@1404 2019 if (audioElementsDOM[i].getAttribute('type') == 'outsidereference') {
nickjillings@1404 2020 if (this.outsideReference == null) {
nickjillings@1406 2021 this.outsideReference = node;
nickjillings@1404 2022 } else {
nickjillings@1404 2023 console.log('Error only one audioelement can be of type outsidereference per audioholder');
nickjillings@1404 2024 this.audioElements.push(node);
nickjillings@1404 2025 console.log('Element id '+audioElementsDOM[i].id+' made into normal node');
nickjillings@1404 2026 }
nickjillings@1404 2027 } else {
nickjillings@1404 2028 this.audioElements.push(node);
nickjillings@1404 2029 }
nickjillings@1404 2030 }
nickjillings@1404 2031
nickjillings@1404 2032 var commentQuestionsDOM = xml.getElementsByTagName('CommentQuestion');
nickjillings@1404 2033 for (var i=0; i<commentQuestionsDOM.length; i++) {
nickjillings@1404 2034 var node = new this.commentQuestionNode();
nickjillings@1404 2035 node.decode(commentQuestionsDOM[i]);
nickjillings@1404 2036 this.commentQuestions.push(node);
nickjillings@1404 2037 }
nickjillings@1404 2038 };
nickjillings@1404 2039
nickjillings@1404 2040 this.encode = function(root)
nickjillings@1404 2041 {
nickjillings@1404 2042 var AHNode = root.createElement("audioHolder");
nickjillings@1404 2043 AHNode.id = this.id;
nickjillings@1404 2044 AHNode.setAttribute("hostURL",this.hostURL);
nickjillings@1404 2045 AHNode.setAttribute("sampleRate",this.sampleRate);
nickjillings@1404 2046 AHNode.setAttribute("randomiseOrder",this.randomiseOrder);
nickjillings@1404 2047 AHNode.setAttribute("repeatCount",this.repeatCount);
nickjillings@1404 2048 AHNode.setAttribute("loop",this.loop);
nickjillings@1404 2049 AHNode.setAttribute("elementComments",this.elementComments);
nickjillings@1404 2050
nickjillings@1404 2051 for (var i=0; i<this.interfaces.length; i++)
nickjillings@1404 2052 {
nickjillings@1404 2053 AHNode.appendChild(this.interfaces[i].encode(root));
nickjillings@1404 2054 }
nickjillings@1404 2055
nickjillings@1404 2056 for (var i=0; i<this.audioElements.length; i++) {
nickjillings@1404 2057 AHNode.appendChild(this.audioElements[i].encode(root));
nickjillings@1404 2058 }
nickjillings@1404 2059 // Create <CommentQuestion>
nickjillings@1404 2060 for (var i=0; i<this.commentQuestions.length; i++)
nickjillings@1404 2061 {
nickjillings@1404 2062 AHNode.appendChild(this.commentQuestions[i].exportXML(root));
nickjillings@1404 2063 }
nickjillings@1404 2064
nickjillings@1404 2065 // Create <PreTest>
nickjillings@1404 2066 var AHPreTest = root.createElement("PreTest");
nickjillings@1404 2067 for (var i=0; i<this.preTest.options.length; i++)
nickjillings@1404 2068 {
nickjillings@1404 2069 AHPreTest.appendChild(this.preTest.options[i].exportXML(root));
nickjillings@1404 2070 }
nickjillings@1404 2071
nickjillings@1404 2072 var AHPostTest = root.createElement("PostTest");
nickjillings@1404 2073 for (var i=0; i<this.postTest.options.length; i++)
nickjillings@1404 2074 {
nickjillings@1404 2075 AHPostTest.appendChild(this.postTest.options[i].exportXML(root));
nickjillings@1404 2076 }
nickjillings@1404 2077 AHNode.appendChild(AHPreTest);
nickjillings@1404 2078 AHNode.appendChild(AHPostTest);
nickjillings@1404 2079 return AHNode;
nickjillings@1404 2080 };
nickjillings@1404 2081
nickjillings@1404 2082 this.interfaceNode = function() {
nickjillings@1404 2083 this.title = undefined;
nickjillings@1404 2084 this.options = [];
nickjillings@1404 2085 this.scale = [];
nickjillings@1404 2086 this.decode = function(DOM)
nickjillings@1404 2087 {
nickjillings@1404 2088 var title = DOM.getElementsByTagName('title');
nickjillings@1404 2089 if (title.length == 0) {this.title = null;}
nickjillings@1404 2090 else {this.title = title[0].textContent;}
nickjillings@1404 2091 this.options = parent.commonInterface.options;
nickjillings@1404 2092 var scale = DOM.getElementsByTagName('scale');
nickjillings@1404 2093 this.scale = [];
nickjillings@1404 2094 for (var i=0; i<scale.length; i++) {
nickjillings@1404 2095 var arr = [null, null];
nickjillings@1404 2096 arr[0] = scale[i].getAttribute('position');
nickjillings@1404 2097 arr[1] = scale[i].textContent;
nickjillings@1404 2098 this.scale.push(arr);
nickjillings@1404 2099 }
nickjillings@1404 2100 };
nickjillings@1404 2101 this.encode = function(root)
nickjillings@1404 2102 {
nickjillings@1404 2103 var node = root.createElement("interface");
nickjillings@1404 2104 if (this.title != undefined)
nickjillings@1404 2105 {
nickjillings@1404 2106 var title = root.createElement("title");
nickjillings@1404 2107 title.textContent = this.title;
nickjillings@1404 2108 node.appendChild(title);
nickjillings@1404 2109 }
nickjillings@1404 2110 for (var i=0; i<this.options.length; i++)
nickjillings@1404 2111 {
nickjillings@1404 2112 var optionNode = root.createElement(this.options[i].type);
nickjillings@1404 2113 if (this.options[i].type == "option")
nickjillings@1404 2114 {
nickjillings@1404 2115 optionNode.setAttribute("name",this.options[i].name);
nickjillings@1404 2116 } else if (this.options[i].type == "check") {
nickjillings@1404 2117 optionNode.setAttribute("check",this.options[i].check);
nickjillings@1404 2118 } else if (this.options[i].type == "scalerange") {
nickjillings@1404 2119 optionNode.setAttribute("min",this.options[i].min*100);
nickjillings@1404 2120 optionNode.setAttribute("max",this.options[i].max*100);
nickjillings@1404 2121 }
nickjillings@1404 2122 node.appendChild(optionNode);
nickjillings@1404 2123 }
nickjillings@1404 2124 for (var i=0; i<this.scale.length; i++) {
nickjillings@1404 2125 var scale = root.createElement("scale");
nickjillings@1404 2126 scale.setAttribute("position",this.scale[i][0]);
nickjillings@1404 2127 scale.textContent = this.scale[i][1];
nickjillings@1404 2128 node.appendChild(scale);
nickjillings@1404 2129 }
nickjillings@1404 2130 return node;
nickjillings@1404 2131 };
nickjillings@1404 2132 };
nickjillings@1404 2133
nickjillings@1404 2134 this.audioElementNode = function() {
nickjillings@1404 2135 this.url = null;
nickjillings@1404 2136 this.id = null;
nickjillings@1404 2137 this.parent = null;
nickjillings@1404 2138 this.type = "normal";
nickjillings@1404 2139 this.marker = false;
nickjillings@1404 2140 this.enforce = false;
nickjillings@1404 2141 this.decode = function(parent,xml)
nickjillings@1404 2142 {
nickjillings@1404 2143 this.url = xml.getAttribute('url');
nickjillings@1404 2144 this.id = xml.id;
nickjillings@1404 2145 this.parent = parent;
nickjillings@1404 2146 this.type = xml.getAttribute('type');
nickjillings@1404 2147 if (this.type == null) {this.type = "normal";}
nickjillings@1404 2148 if (this.type == 'anchor') {this.anchor = true;}
nickjillings@1404 2149 else {this.anchor = false;}
nickjillings@1404 2150 if (this.type == 'reference') {this.reference = true;}
nickjillings@1404 2151 else {this.reference = false;}
nickjillings@1404 2152
nickjillings@1404 2153 if (this.anchor == true || this.reference == true)
nickjillings@1404 2154 {
nickjillings@1404 2155 this.marker = xml.getAttribute('marker');
nickjillings@1404 2156 if (this.marker != undefined)
nickjillings@1404 2157 {
nickjillings@1404 2158 this.marker = Number(this.marker);
nickjillings@1404 2159 if (isNaN(this.marker) == false)
nickjillings@1404 2160 {
nickjillings@1404 2161 if (this.marker > 1)
nickjillings@1404 2162 { this.marker /= 100.0;}
nickjillings@1404 2163 if (this.marker >= 0 && this.marker <= 1)
nickjillings@1404 2164 {
nickjillings@1404 2165 this.enforce = true;
nickjillings@1404 2166 return;
nickjillings@1404 2167 } else {
nickjillings@1404 2168 console.log("ERROR - Marker of audioElement "+this.id+" is not between 0 and 1 (float) or 0 and 100 (integer)!");
nickjillings@1404 2169 console.log("ERROR - Marker not enforced!");
nickjillings@1404 2170 }
nickjillings@1404 2171 } else {
nickjillings@1404 2172 console.log("ERROR - Marker of audioElement "+this.id+" is not a number!");
nickjillings@1404 2173 console.log("ERROR - Marker not enforced!");
nickjillings@1404 2174 }
nickjillings@1404 2175 }
nickjillings@1404 2176 }
nickjillings@1404 2177 };
nickjillings@1404 2178 this.encode = function(root)
nickjillings@1404 2179 {
nickjillings@1404 2180 var AENode = root.createElement("audioElements");
nickjillings@1404 2181 AENode.id = this.id;
nickjillings@1404 2182 AENode.setAttribute("url",this.url);
nickjillings@1404 2183 AENode.setAttribute("type",this.type);
nickjillings@1404 2184 if (this.marker != false)
nickjillings@1404 2185 {
nickjillings@1404 2186 AENode.setAttribute("marker",this.marker*100);
nickjillings@1404 2187 }
nickjillings@1404 2188 return AENode;
nickjillings@1404 2189 };
nickjillings@1404 2190 };
nickjillings@1404 2191
nickjillings@1404 2192 this.commentQuestionNode = function(xml) {
nickjillings@1404 2193 this.id = null;
nickjillings@1404 2194 this.type = undefined;
nickjillings@1404 2195 this.question = undefined;
nickjillings@1404 2196 this.options = [];
nickjillings@1404 2197 this.statement = undefined;
nickjillings@1404 2198
nickjillings@1404 2199 this.childOption = function() {
nickjillings@1404 2200 this.type = 'option';
nickjillings@1404 2201 this.name = null;
nickjillings@1404 2202 this.text = null;
nickjillings@1404 2203 };
nickjillings@1404 2204 this.exportXML = function(root)
nickjillings@1404 2205 {
nickjillings@1404 2206 var CQNode = root.createElement("CommentQuestion");
nickjillings@1404 2207 CQNode.id = this.id;
nickjillings@1404 2208 CQNode.setAttribute("type",this.type);
nickjillings@1404 2209 switch(this.type)
nickjillings@1404 2210 {
nickjillings@1404 2211 case "text":
nickjillings@1404 2212 CQNode.textContent = this.question;
nickjillings@1404 2213 break;
nickjillings@1405 2214 case "radio":
nickjillings@1405 2215 var statement = root.createElement("statement");
nickjillings@1405 2216 statement.textContent = this.statement;
nickjillings@1405 2217 CQNode.appendChild(statement);
nickjillings@1405 2218 for (var i=0; i<this.options.length; i++)
nickjillings@1405 2219 {
nickjillings@1405 2220 var optionNode = root.createElement("option");
nickjillings@1405 2221 optionNode.setAttribute("name",this.options[i].name);
nickjillings@1405 2222 optionNode.textContent = this.options[i].text;
nickjillings@1405 2223 CQNode.appendChild(optionNode);
nickjillings@1405 2224 }
nickjillings@1405 2225 break;
nickjillings@1405 2226 case "checkbox":
nickjillings@1404 2227 var statement = root.createElement("statement");
nickjillings@1404 2228 statement.textContent = this.statement;
nickjillings@1404 2229 CQNode.appendChild(statement);
nickjillings@1404 2230 for (var i=0; i<this.options.length; i++)
nickjillings@1404 2231 {
nickjillings@1404 2232 var optionNode = root.createElement("option");
nickjillings@1404 2233 optionNode.setAttribute("name",this.options[i].name);
nickjillings@1404 2234 optionNode.textContent = this.options[i].text;
nickjillings@1404 2235 CQNode.appendChild(optionNode);
nickjillings@1404 2236 }
nickjillings@1404 2237 break;
nickjillings@1404 2238 }
nickjillings@1404 2239 return CQNode;
nickjillings@1404 2240 };
nickjillings@1404 2241 this.decode = function(xml) {
nickjillings@1404 2242 this.id = xml.id;
nickjillings@1404 2243 if (xml.getAttribute('mandatory') == 'true') {this.mandatory = true;}
nickjillings@1404 2244 else {this.mandatory = false;}
nickjillings@1404 2245 this.type = xml.getAttribute('type');
nickjillings@1404 2246 if (this.type == undefined) {this.type = 'text';}
nickjillings@1404 2247 switch (this.type) {
nickjillings@1404 2248 case 'text':
nickjillings@1404 2249 this.question = xml.textContent;
nickjillings@1404 2250 break;
nickjillings@1404 2251 case 'radio':
nickjillings@1404 2252 var child = xml.firstElementChild;
nickjillings@1404 2253 this.options = [];
nickjillings@1404 2254 while (child != undefined) {
nickjillings@1404 2255 if (child.nodeName == 'statement' && this.statement == undefined) {
nickjillings@1404 2256 this.statement = child.textContent;
nickjillings@1404 2257 } else if (child.nodeName == 'option') {
nickjillings@1404 2258 var node = new this.childOption();
nickjillings@1404 2259 node.name = child.getAttribute('name');
nickjillings@1404 2260 node.text = child.textContent;
nickjillings@1404 2261 this.options.push(node);
nickjillings@1404 2262 }
nickjillings@1404 2263 child = child.nextElementSibling;
nickjillings@1404 2264 }
nickjillings@1404 2265 break;
nickjillings@1404 2266 case 'checkbox':
nickjillings@1404 2267 var child = xml.firstElementChild;
nickjillings@1404 2268 this.options = [];
nickjillings@1404 2269 while (child != undefined) {
nickjillings@1404 2270 if (child.nodeName == 'statement' && this.statement == undefined) {
nickjillings@1404 2271 this.statement = child.textContent;
nickjillings@1404 2272 } else if (child.nodeName == 'option') {
nickjillings@1404 2273 var node = new this.childOption();
nickjillings@1404 2274 node.name = child.getAttribute('name');
nickjillings@1404 2275 node.text = child.textContent;
nickjillings@1404 2276 this.options.push(node);
nickjillings@1404 2277 }
nickjillings@1404 2278 child = child.nextElementSibling;
nickjillings@1404 2279 }
nickjillings@1404 2280 break;
nickjillings@1404 2281 }
nickjillings@1404 2282 };
nickjillings@1404 2283 };
nickjillings@1404 2284 };
nickjillings@1404 2285 }
nickjillings@1404 2286
nickjillings@1404 2287 function createDeleteNodeButton(node)
nickjillings@1404 2288 {
nickjillings@1404 2289 var button = document.createElement("button");
nickjillings@1404 2290 button.textContent = "Delete";
nickjillings@1404 2291 button.onclick = function(event)
nickjillings@1404 2292 {
nickjillings@1404 2293 var node = event.target.parentElement;
nickjillings@1404 2294 node.parentElement.removeChild(node);
nickjillings@1404 2295 };
nickjillings@1404 2296 return button;
nickjillings@1404 2297 }
nickjillings@1404 2298
nickjillings@1404 2299 function SpecificationToHTML()
nickjillings@1404 2300 {
nickjillings@1404 2301 // Take information from Specification Node and format it into an HTML layout
nickjillings@1404 2302 var destination = document.getElementById("content");
nickjillings@1404 2303 // Setup Header Node
nickjillings@1404 2304 var setupNode = document.createElement("div");
nickjillings@1404 2305 setupNode.className = "topLevel";
nickjillings@1404 2306 setupNode.name = "setup";
nickjillings@1404 2307 var title = document.createElement("h2");
nickjillings@1404 2308 title.textContent = "Setup";
nickjillings@1404 2309 setupNode.appendChild(title);
nickjillings@1404 2310 // Interface Type
nickjillings@1404 2311 var div = document.createElement("div");
nickjillings@1404 2312 div.name = "attributes";
nickjillings@1404 2313 div.style.margin = "5px";
nickjillings@1404 2314 var select = document.createElement("select");
nickjillings@1404 2315 select.id = "interfaceSelect";
nickjillings@1404 2316 select.style.margin = "5px";
nickjillings@1404 2317 var option = document.createElement("option");
nickjillings@1404 2318 option.value = "APE";
nickjillings@1404 2319 option.textContent = "APE";
nickjillings@1404 2320 select.appendChild(option);
nickjillings@1404 2321 option = document.createElement("option");
nickjillings@1404 2322 option.value = "MUSHRA";
nickjillings@1404 2323 option.textContent = "MUSHRA";
nickjillings@1404 2324 select.appendChild(option);
nickjillings@1404 2325 select.value = specificationNode.interfaceType;
nickjillings@1404 2326 select.onchange = function(event)
nickjillings@1404 2327 {
nickjillings@1404 2328 specificationNode.interfaceType = event.currentTarget.value;
nickjillings@1404 2329 };
nickjillings@1404 2330 var span = document.createElement("span");
nickjillings@1404 2331 span.textContent = "Interface Type";
nickjillings@1404 2332 div.appendChild(span);
nickjillings@1404 2333 div.appendChild(select);
nickjillings@1404 2334 // Project Return Attribute
nickjillings@1404 2335 span = document.createElement("span");
nickjillings@1404 2336 span.style.margin = "5px";
nickjillings@1404 2337 span.textContent = "Project Return";
nickjillings@1404 2338 var input = document.createElement("input");
nickjillings@1404 2339 input.value = specificationNode.projectReturn;
nickjillings@1404 2340 input.id = "projectReturn";
nickjillings@1404 2341 input.style.margin = "5px";
nickjillings@1404 2342 input.onchange = function(event) {
nickjillings@1404 2343 specificationNode.projectReturn = event.currentTarget.value;
nickjillings@1404 2344 };
nickjillings@1404 2345 div.appendChild(span);
nickjillings@1404 2346 div.appendChild(input);
nickjillings@1404 2347 // Randomise Order
nickjillings@1404 2348 span = document.createElement("span");
nickjillings@1404 2349 span.textContent = "Randomise Order";
nickjillings@1404 2350 input = document.createElement("input");
nickjillings@1404 2351 input.id = "randomiseOrder";
nickjillings@1404 2352 input.style.margin = "5px";
nickjillings@1404 2353 input.type = "checkbox";
nickjillings@1404 2354 input.checked = specificationNode.randomiseOrder;
nickjillings@1404 2355 input.onchange = function(event) {
nickjillings@1404 2356 specificationNode.randomiseOrder = event.currentTarget.checked;
nickjillings@1404 2357 };
nickjillings@1404 2358 div.appendChild(span);
nickjillings@1404 2359 div.appendChild(input);
nickjillings@1404 2360 setupNode.appendChild(div);
nickjillings@1404 2361
nickjillings@1404 2362 // Now create the common Interface Node
nickjillings@1404 2363 var commonInterface = document.createElement("div");
nickjillings@1404 2364 commonInterface.id = "interface";
nickjillings@1404 2365 commonInterface.className = "SecondLevel";
nickjillings@1404 2366 var title = document.createElement("h3");
nickjillings@1404 2367 title.textContent = "Common Interface";
nickjillings@1404 2368 commonInterface.appendChild(title);
nickjillings@1404 2369 var div = document.createElement("div");
nickjillings@1404 2370 div.name = "attributes";
nickjillings@1404 2371 var interfaceOptions;
nickjillings@1404 2372 var interfaceChecks;
nickjillings@1404 2373 switch(select.value)
nickjillings@1404 2374 {
nickjillings@1404 2375 case "APE":
nickjillings@1404 2376 interfaceOptions = APEInterfaceOptions;
nickjillings@1404 2377 interfaceChecks = APEInterfaceChecks;
nickjillings@1404 2378 break;
nickjillings@1404 2379 case "MUSHRA":
nickjillings@1404 2380 interfaceOptions = MUSHRAInterfaceOptions;
nickjillings@1404 2381 interfaceChecks = MUSHRAInterfaceChecks;
nickjillings@1404 2382 break;
nickjillings@1404 2383 }
nickjillings@1404 2384 for (var i=0; i<interfaceOptions[0].length; i++)
nickjillings@1404 2385 {
nickjillings@1404 2386 var span = document.createElement("span");
nickjillings@1404 2387 span.textContent = interfaceOptions[1][i];
nickjillings@1404 2388 var input = document.createElement("input");
nickjillings@1404 2389 input.type = "checkbox";
nickjillings@1404 2390 input.id = interfaceOptions[0][i];
nickjillings@1404 2391 input.setAttribute("name", "option");
nickjillings@1404 2392 div.appendChild(input);
nickjillings@1404 2393 div.appendChild(span);
nickjillings@1404 2394 commonInterface.appendChild(div);
nickjillings@1404 2395 for (var j=0; j<specificationNode.commonInterface.options.length; j++)
nickjillings@1404 2396 {
nickjillings@1404 2397 if (specificationNode.commonInterface.options[j].name == interfaceOptions[0][i])
nickjillings@1404 2398 {
nickjillings@1404 2399 input.checked = true;
nickjillings@1404 2400 break;
nickjillings@1404 2401 }
nickjillings@1404 2402 }
nickjillings@1404 2403 input.onchange = function(event) {
nickjillings@1404 2404 var id = event.currentTarget.id;
nickjillings@1404 2405 if (event.currentTarget.checked) {
nickjillings@1404 2406 specificationNode.commonInterface.options.push(new specificationNode.commonInterface.optionNode(event.currentTarget));
nickjillings@1404 2407 } else {
nickjillings@1404 2408 for (var j=0; j<specificationNode.commonInterface.options.length; j++)
nickjillings@1404 2409 {
nickjillings@1404 2410 if (specificationNode.commonInterface.options[j].name == event.currentTarget.id)
nickjillings@1404 2411 {
nickjillings@1404 2412 specificationNode.commonInterface.options.splice(j,1);
nickjillings@1404 2413 break;
nickjillings@1404 2414 }
nickjillings@1404 2415 }
nickjillings@1404 2416 }
nickjillings@1404 2417 };
nickjillings@1404 2418 }
nickjillings@1404 2419 for (var i=0; i<interfaceChecks[0].length; i++)
nickjillings@1404 2420 {
nickjillings@1404 2421 var span = document.createElement("span");
nickjillings@1404 2422 span.textContent = interfaceChecks[1][i];
nickjillings@1404 2423 var input = document.createElement("input");
nickjillings@1404 2424 input.type = "checkbox";
nickjillings@1404 2425 input.id = interfaceChecks[0][i];
nickjillings@1404 2426 input.setAttribute("name", "check");
nickjillings@1404 2427 div.appendChild(input);
nickjillings@1404 2428 div.appendChild(span);
nickjillings@1404 2429 commonInterface.appendChild(div);
nickjillings@1404 2430 for (var j=0; j<specificationNode.commonInterface.options.length; j++)
nickjillings@1404 2431 {
nickjillings@1404 2432 if (specificationNode.commonInterface.options[j].check == interfaceChecks[0][i])
nickjillings@1404 2433 {
nickjillings@1404 2434 input.checked = true;
nickjillings@1404 2435 break;
nickjillings@1404 2436 }
nickjillings@1404 2437 }
nickjillings@1404 2438 input.onchange = function(event) {
nickjillings@1404 2439 var id = event.currentTarget.id;
nickjillings@1404 2440 if (event.currentTarget.checked) {
nickjillings@1404 2441 specificationNode.commonInterface.options.push(new specificationNode.commonInterface.optionNode(event.currentTarget));
nickjillings@1404 2442 } else {
nickjillings@1404 2443 for (var j=0; j<specificationNode.commonInterface.options.length; j++)
nickjillings@1404 2444 {
nickjillings@1404 2445 if (specificationNode.commonInterface.options[j].name == event.currentTarget.id)
nickjillings@1404 2446 {
nickjillings@1404 2447 specificationNode.commonInterface.options.splice(j,1);
nickjillings@1404 2448 break;
nickjillings@1404 2449 }
nickjillings@1404 2450 }
nickjillings@1404 2451 }
nickjillings@1404 2452 };
nickjillings@1404 2453 }
nickjillings@1404 2454 setupNode.appendChild(commonInterface);
nickjillings@1404 2455 // Now the Metric Node
nickjillings@1404 2456 var metrics = document.createElement("div");
nickjillings@1404 2457 metrics.id = "metrics";
nickjillings@1404 2458 metrics.className = "SecondLevel";
nickjillings@1404 2459 var title = document.createElement("h3");
nickjillings@1404 2460 title.textContent = "Metric Collections";
nickjillings@1404 2461 metrics.appendChild(title);
nickjillings@1404 2462 var div = document.createElement("div");
nickjillings@1404 2463 div.name = "attributes";
nickjillings@1404 2464 metrics.appendChild(div);
nickjillings@1404 2465 var supportedMetrics;
nickjillings@1404 2466 switch(select.value)
nickjillings@1404 2467 {
nickjillings@1404 2468 case "APE":
nickjillings@1404 2469 supportedMetrics = APEInterfaceMetrics;
nickjillings@1404 2470 break;
nickjillings@1404 2471 case "MUSHRA":
nickjillings@1404 2472 supportedMetrics = MUSHRAInterfaceMetrics;
nickjillings@1404 2473 break;
nickjillings@1404 2474 }
nickjillings@1404 2475
nickjillings@1404 2476 for (var i=0; i<supportedMetrics[0].length; i++)
nickjillings@1404 2477 {
nickjillings@1404 2478 var span = document.createElement("span");
nickjillings@1404 2479 span.textContent = supportedMetrics[1][i];
nickjillings@1404 2480 var input = document.createElement("input");
nickjillings@1404 2481 input.type = "checkbox";
nickjillings@1404 2482 input.id = supportedMetrics[0][i];
nickjillings@1404 2483 div.appendChild(input);
nickjillings@1404 2484 div.appendChild(span);
nickjillings@1404 2485 for (var j=0; j<specificationNode.metrics.length; j++)
nickjillings@1404 2486 {
nickjillings@1404 2487 if (specificationNode.metrics[j].enabled == supportedMetrics[0][i])
nickjillings@1404 2488 {
nickjillings@1404 2489 input.checked = true;
nickjillings@1404 2490 }
nickjillings@1404 2491 }
nickjillings@1404 2492 input.onchange = function(event)
nickjillings@1404 2493 {
nickjillings@1404 2494 if (event.currentTarget.checked) {
nickjillings@1404 2495 specificationNode.metrics.push(new specificationNode.metricNode(event.currentTarget.id));
nickjillings@1404 2496 } else {
nickjillings@1404 2497 for (var j=0; j<specificationNode.metrics.length; j++)
nickjillings@1404 2498 {
nickjillings@1404 2499 if (specificationNode.metrics[j].enabled == event.currentTarget.id)
nickjillings@1404 2500 {
nickjillings@1404 2501 specificationNode.metrics.splice(j,1);
nickjillings@1404 2502 break;
nickjillings@1404 2503 }
nickjillings@1404 2504 }
nickjillings@1404 2505 }
nickjillings@1404 2506 };
nickjillings@1404 2507 }
nickjillings@1404 2508
nickjillings@1404 2509 setupNode.appendChild(metrics);
nickjillings@1404 2510
nickjillings@1404 2511 // Test Session Pre Test
nickjillings@1404 2512 var preTest = document.createElement("div");
nickjillings@1404 2513 preTest.id = "preTest";
nickjillings@1404 2514 preTest.className = "SecondLevel";
nickjillings@1404 2515 var title = document.createElement("h3");
nickjillings@1404 2516 title.textContent = "Pre test Survey";
nickjillings@1404 2517 preTest.appendChild(title);
nickjillings@1404 2518 var div = document.createElement("div");
nickjillings@1404 2519 div.name = "attributes";
nickjillings@1404 2520 for (var j=0; j<specificationNode.preTest.options.length; j++)
nickjillings@1404 2521 {
nickjillings@1404 2522 var node = PPSurveyToHTML(specificationNode.preTest.options[j]);
nickjillings@1404 2523 node.className = "SecondLevel";
nickjillings@1404 2524 node.id = preTest.id+"-"+j;
nickjillings@1404 2525 var del_button = document.createElement("button");
nickjillings@1404 2526 del_button.textContent = "Delete";
nickjillings@1404 2527 del_button.onclick = function(event) {
nickjillings@1404 2528 var node = event.currentTarget.parentElement;
nickjillings@1404 2529 var id = node.id.split("-")[1];
nickjillings@1404 2530 specificationNode.preTest.options.splice(id,1);
nickjillings@1404 2531 node.parentElement.removeChild(node);
nickjillings@1404 2532 };
nickjillings@1404 2533 node.appendChild(del_button);
nickjillings@1404 2534 preTest.appendChild(node);
nickjillings@1404 2535 }
nickjillings@1404 2536 setupNode.appendChild(preTest);
nickjillings@1404 2537
nickjillings@1404 2538 // Test Session Post Test
nickjillings@1404 2539 var postTest = document.createElement("div");
nickjillings@1404 2540 postTest.id = "postTest";
nickjillings@1404 2541 postTest.className = "SecondLevel";
nickjillings@1404 2542 var title = document.createElement("h3");
nickjillings@1404 2543 title.textContent = "Post test Survey";
nickjillings@1404 2544 postTest.appendChild(title);
nickjillings@1404 2545 var div = document.createElement("div");
nickjillings@1404 2546 div.name = "attributes";
nickjillings@1404 2547
nickjillings@1404 2548 for (var j=0; j<specificationNode.postTest.options.length; j++)
nickjillings@1404 2549 {
nickjillings@1404 2550 var node = PPSurveyToHTML(specificationNode.postTest.options[j]);
nickjillings@1404 2551 node.className = "SecondLevel";
nickjillings@1404 2552 node.id = postTest.id+"-"+j;
nickjillings@1404 2553 var del_button = document.createElement("button");
nickjillings@1404 2554 del_button.textContent = "Delete";
nickjillings@1404 2555 del_button.onclick = function(event) {
nickjillings@1404 2556 var node = event.currentTarget.parentElement;
nickjillings@1404 2557 var id = node.id.split("-")[1];
nickjillings@1404 2558 specificationNode.postTest.options.splice(id,1);
nickjillings@1404 2559 node.parentElement.removeChild(node);
nickjillings@1404 2560 };
nickjillings@1404 2561 node.appendChild(del_button);
nickjillings@1404 2562 postTest.appendChild(node);
nickjillings@1404 2563 }
nickjillings@1404 2564
nickjillings@1404 2565 setupNode.appendChild(postTest);
nickjillings@1404 2566
nickjillings@1404 2567 destination.appendChild(setupNode);
nickjillings@1404 2568
nickjillings@1404 2569 // Now we step through the AudioHolders
nickjillings@1404 2570 for (var i=0; i<specificationNode.audioHolders.length; i++)
nickjillings@1404 2571 {
nickjillings@1404 2572 var aH = specificationNode.audioHolders[i];
nickjillings@1404 2573 var aHTML = document.createElement("div");
nickjillings@1404 2574 aHTML.name = "audioHolder";
nickjillings@1404 2575 aHTML.id = "audioHolder-"+i;
nickjillings@1404 2576 aHTML.className = "topLevel";
nickjillings@1404 2577 aHTML.appendChild(createDeleteNodeButton());
nickjillings@1404 2578 destination.appendChild(aHTML);
nickjillings@1404 2579 var title = document.createElement("h2");
nickjillings@1404 2580 title.textContent = "Audio Holder "+aH.id;
nickjillings@1404 2581 aHTML.appendChild(title);
nickjillings@1404 2582 var attributes = document.createElement("div");
nickjillings@1404 2583 attributes.name = "attributes";
nickjillings@1404 2584 aHTML.appendChild(attributes);
nickjillings@1404 2585 var text = document.createElement("span");
nickjillings@1404 2586 text.textContent = "ID: ";
nickjillings@1404 2587 var input = document.createElement("input");
nickjillings@1404 2588 input.id = aHTML.id+"-id";
nickjillings@1404 2589 input.value = aH.id;
nickjillings@1404 2590 input.onchange = function()
nickjillings@1404 2591 {
nickjillings@1404 2592 var IDSplit = event.currentTarget.id.split('-');
nickjillings@1404 2593 var aholderID = IDSplit[0]+"-"+IDSplit[1];
nickjillings@1404 2594 var aholder = document.getElementById(aholderID);
nickjillings@1404 2595 title = aholder.getElementsByTagName("h2")[0];
nickjillings@1404 2596 title.textContent = "Audio Holder "+event.currentTarget.value;
nickjillings@1404 2597 specificationNode.audioHolders[IDSplit[1]].id = event.currentTarget.value;
nickjillings@1404 2598 };
nickjillings@1404 2599 text.style.margin = "5px";
nickjillings@1404 2600 input.style.margin = "5px";
nickjillings@1404 2601 attributes.appendChild(text);
nickjillings@1404 2602 attributes.appendChild(input);
nickjillings@1404 2603 text = document.createElement("span");
nickjillings@1404 2604 text.textContent = "Host URL: ";
nickjillings@1404 2605 input = document.createElement("input");
nickjillings@1404 2606 input.id = aHTML.id+"-hostURL";
nickjillings@1404 2607 input.value = aH.hostURL;
nickjillings@1404 2608 input.onchange = function()
nickjillings@1404 2609 {
nickjillings@1404 2610 var IDSplit = event.currentTarget.id.split('-');
nickjillings@1404 2611 specificationNode.audioHolders[IDSplit[1]].hostURL = event.currentTarget.value;
nickjillings@1404 2612 };
nickjillings@1404 2613 text.style.margin = "5px";
nickjillings@1404 2614 input.style.margin = "5px";
nickjillings@1404 2615 attributes.appendChild(text);
nickjillings@1404 2616 attributes.appendChild(input);
nickjillings@1404 2617 text = document.createElement("span");
nickjillings@1404 2618 text.textContent = "Loop Fragments: ";
nickjillings@1404 2619 input = document.createElement("input");
nickjillings@1404 2620 input.id = aHTML.id+"-loop";
nickjillings@1404 2621 input.type = "checkbox";
nickjillings@1404 2622 input.checked = aH.loop;
nickjillings@1404 2623 input.onchange = function()
nickjillings@1404 2624 {
nickjillings@1404 2625 var IDSplit = event.currentTarget.id.split('-');
nickjillings@1404 2626 specificationNode.audioHolders[IDSplit[1]].loop = event.currentTarget.checked;
nickjillings@1404 2627 };
nickjillings@1404 2628 text.style.margin = "5px";
nickjillings@1404 2629 input.style.margin = "5px";
nickjillings@1404 2630 attributes.appendChild(text);
nickjillings@1404 2631 attributes.appendChild(input);
nickjillings@1404 2632 text = document.createElement("span");
nickjillings@1404 2633 text.textContent = "Randomise Order: ";
nickjillings@1404 2634 input = document.createElement("input");
nickjillings@1404 2635 input.id = aHTML.id+"-randomiseOrder";
nickjillings@1404 2636 input.type = "checkbox";
nickjillings@1404 2637 input.checked = aH.randomiseOrder;
nickjillings@1404 2638 input.onchange = function()
nickjillings@1404 2639 {
nickjillings@1404 2640 var IDSplit = event.currentTarget.id.split('-');
nickjillings@1404 2641 specificationNode.audioHolders[IDSplit[1]].randomiseOrder = event.currentTarget.checked;
nickjillings@1404 2642 };
nickjillings@1404 2643 text.style.margin = "5px";
nickjillings@1404 2644 input.style.margin = "5px";
nickjillings@1404 2645 attributes.appendChild(text);
nickjillings@1404 2646 attributes.appendChild(input);
nickjillings@1404 2647 text = document.createElement("span");
nickjillings@1404 2648 text.textContent = "Show Fragment Comments";
nickjillings@1404 2649 input = document.createElement("input");
nickjillings@1404 2650 input.id = aHTML.id+"-elementComments";
nickjillings@1404 2651 input.type = "checkbox";
nickjillings@1404 2652 input.checked = aH.elementComments;
nickjillings@1404 2653 input.onchange = function()
nickjillings@1404 2654 {
nickjillings@1404 2655 var IDSplit = event.currentTarget.id.split('-');
nickjillings@1404 2656 specificationNode.audioHolders[IDSplit[1]].elementComments = event.currentTarget.checked;
nickjillings@1404 2657 };
nickjillings@1404 2658 text.style.margin = "5px";
nickjillings@1404 2659 input.style.margin = "5px";
nickjillings@1404 2660 attributes.appendChild(text);
nickjillings@1404 2661 attributes.appendChild(input);
nickjillings@1404 2662
nickjillings@1404 2663 // Test Session Pre Test
nickjillings@1404 2664 var preTest = document.createElement("div");
nickjillings@1404 2665 preTest.id = aHTML.id+"-pretest";
nickjillings@1404 2666 preTest.className = "SecondLevel";
nickjillings@1404 2667 var title = document.createElement("h3");
nickjillings@1404 2668 title.textContent = "Pre test Survey";
nickjillings@1404 2669 preTest.appendChild(title);
nickjillings@1404 2670 var div = document.createElement("div");
nickjillings@1404 2671 div.name = "attributes";
nickjillings@1404 2672
nickjillings@1404 2673 for (var j=0; j<aH.preTest.options.length; j++)
nickjillings@1404 2674 {
nickjillings@1404 2675 var node = PPSurveyToHTML(aH.preTest.options[j]);
nickjillings@1404 2676 node.className = "SecondLevel";
nickjillings@1404 2677 node.id = preTest.id+"-"+j;
nickjillings@1404 2678 var button_delete = document.createElement("button");
nickjillings@1404 2679 button_delete.textContent = "Delete";
nickjillings@1404 2680 button_delete.onclick = function(event)
nickjillings@1404 2681 {
nickjillings@1404 2682 var node = event.currentTarget.parentElement;
nickjillings@1404 2683 var IDSplit = node.id.split("-");
nickjillings@1404 2684 var preTest = specificationNode.audioHolders[IDSplit[1]].preTest;
nickjillings@1404 2685 preTest.options.splice(IDSplit[3],1);
nickjillings@1404 2686 node.parentElement.removeChild(node);
nickjillings@1404 2687 };
nickjillings@1404 2688 node.appendChild(button_delete);
nickjillings@1404 2689 preTest.appendChild(node);
nickjillings@1404 2690 }
nickjillings@1404 2691
nickjillings@1404 2692 aHTML.appendChild(preTest);
nickjillings@1404 2693
nickjillings@1404 2694 // Test Session Post Test
nickjillings@1404 2695 var postTest = document.createElement("div");
nickjillings@1404 2696 postTest.id = aHTML.id+"-postTest";
nickjillings@1404 2697 postTest.className = "SecondLevel";
nickjillings@1404 2698 var title = document.createElement("h3");
nickjillings@1404 2699 title.textContent = "Post test Survey";
nickjillings@1404 2700 postTest.appendChild(title);
nickjillings@1404 2701 var div = document.createElement("div");
nickjillings@1404 2702 div.name = "attributes";
nickjillings@1404 2703
nickjillings@1404 2704 for (var j=0; j<aH.postTest.options.length; j++)
nickjillings@1404 2705 {
nickjillings@1404 2706 var node = PPSurveyToHTML(aH.postTest.options[j]);
nickjillings@1404 2707 node.className = "SecondLevel";
nickjillings@1404 2708 node.id = postTest.id+"-"+j;
nickjillings@1404 2709 var button_delete = document.createElement("button");
nickjillings@1404 2710 button_delete.textContent = "Delete";
nickjillings@1404 2711 button_delete.onclick = function(event)
nickjillings@1404 2712 {
nickjillings@1404 2713 var node = event.currentTarget.parentElement;
nickjillings@1404 2714 var IDSplit = node.id.split("-");
nickjillings@1404 2715 var postTest = specificationNode.audioHolders[IDSplit[1]].postTest;
nickjillings@1404 2716 postTest.options.splice(IDSplit[3],1);
nickjillings@1404 2717 node.parentElement.removeChild(node);
nickjillings@1404 2718 };
nickjillings@1404 2719 node.appendChild(button_delete);
nickjillings@1404 2720 postTest.appendChild(node);
nickjillings@1404 2721 }
nickjillings@1404 2722
nickjillings@1404 2723 aHTML.appendChild(postTest);
nickjillings@1404 2724
nickjillings@1404 2725 //Audio Elements
nickjillings@1404 2726 var audioElems = document.createElement("div");
nickjillings@1404 2727 audioElems.id = aHTML.id+"-audioElements";
nickjillings@1404 2728 audioElems.className = "SecondLevel";
nickjillings@1404 2729 var title = document.createElement("h3");
nickjillings@1404 2730 title.textContent = "Audio Elements";
nickjillings@1404 2731 audioElems.appendChild(title);
nickjillings@1404 2732 for (var i=0; i<aH.audioElements.length; i++)
nickjillings@1404 2733 {
nickjillings@1404 2734 var entry = document.createElement("div");
nickjillings@1404 2735 entry.className = "SecondLevel";
nickjillings@1404 2736 entry.id = audioElems.id+"-"+aH.audioElements[i].id;
nickjillings@1404 2737 var text = document.createElement("span");
nickjillings@1404 2738 text.textContent = "ID:";
nickjillings@1404 2739 var input = document.createElement("input");
nickjillings@1404 2740 input.id = entry.id+"-id";
nickjillings@1404 2741 input.value = aH.audioElements[i].id;
nickjillings@1404 2742 input.onchange = function() {
nickjillings@1404 2743 var IDSplit = event.currentTarget.id.split("-");
nickjillings@1404 2744 var ahNode = specificationNode.audioHolders[IDSplit[1]];
nickjillings@1404 2745 ahNode.audioElements[IDSplit[3]].id = event.currentTarget.value;
nickjillings@1404 2746 };
nickjillings@1404 2747 text.style.margin = "5px";
nickjillings@1404 2748 input.style.margin = "5px";
nickjillings@1404 2749 entry.appendChild(text);
nickjillings@1404 2750 entry.appendChild(input);
nickjillings@1404 2751 text = document.createElement("span");
nickjillings@1404 2752 text.textContent = "URL:";
nickjillings@1404 2753 input = document.createElement("input");
nickjillings@1404 2754 input.id = entry.id+"-URL";
nickjillings@1404 2755 input.value = aH.audioElements[i].url;
nickjillings@1404 2756 input.onchange = function() {
nickjillings@1404 2757 var IDSplit = event.currentTarget.id.split("-");
nickjillings@1404 2758 var ahNode = specificationNode.audioHolders[IDSplit[1]];
nickjillings@1404 2759 ahNode.audioElements[IDSplit[3]].url = event.currentTarget.value;
nickjillings@1404 2760 };
nickjillings@1404 2761 text.style.margin = "5px";
nickjillings@1404 2762 input.style.margin = "5px";
nickjillings@1404 2763 entry.appendChild(text);
nickjillings@1404 2764 entry.appendChild(input);
nickjillings@1404 2765 var button_delete = document.createElement("button");
nickjillings@1404 2766 button_delete.textContent = "Delete";
nickjillings@1404 2767 button_delete.onclick = function() {
nickjillings@1404 2768 var node = event.currentTarget.parentElement;
nickjillings@1404 2769 var IDSplit = node.id.split("-");
nickjillings@1404 2770 var ahNode = specificationNode.audioHolders[IDSplit[1]];
nickjillings@1404 2771 ahNode.audioElements.splice(IDSplit[3],1);
nickjillings@1404 2772 node.parentElement.removeChild(node);
nickjillings@1404 2773 };
nickjillings@1404 2774 entry.appendChild(button_delete);
nickjillings@1404 2775 audioElems.appendChild(entry);
nickjillings@1404 2776 }
nickjillings@1404 2777 aHTML.appendChild(audioElems);
nickjillings@1404 2778 }
nickjillings@1404 2779
nickjillings@1404 2780 function PPSurveyToHTML(node)
nickjillings@1404 2781 {
nickjillings@1404 2782 var holder = document.createElement("div");
nickjillings@1404 2783 var title = document.createElement("h4");
nickjillings@1404 2784 holder.appendChild(title);
nickjillings@1404 2785 var attributes = document.createElement("div");
nickjillings@1404 2786 holder.appendChild(attributes);
nickjillings@1404 2787 switch(node.type)
nickjillings@1404 2788 {
nickjillings@1404 2789 case "statement":
nickjillings@1404 2790 title.textContent = "Statement";
nickjillings@1404 2791 var tA = document.createElement("textarea");
nickjillings@1404 2792 attributes.style.height = "150px";
nickjillings@1404 2793 tA.style.width = "500px";
nickjillings@1404 2794 tA.style.height = "100px";
nickjillings@1404 2795 tA.value = node.statement;
nickjillings@1404 2796 attributes.appendChild(tA);
nickjillings@1404 2797 break;
nickjillings@1404 2798 case "question":
nickjillings@1404 2799 title.textContent = "Question";
nickjillings@1404 2800 var text = document.createElement("span");
nickjillings@1404 2801 text.textContent = "ID :";
nickjillings@1404 2802 var input = document.createElement("input");
nickjillings@1404 2803 input.name = "id";
nickjillings@1404 2804 input.value = node.id;
nickjillings@1404 2805 text.style.margin = "5px";
nickjillings@1404 2806 input.style.margin = "5px";
nickjillings@1404 2807 attributes.appendChild(text);
nickjillings@1404 2808 attributes.appendChild(input);
nickjillings@1404 2809 text = document.createElement("span");
nickjillings@1404 2810 text.textContent = "Question";
nickjillings@1404 2811 input = document.createElement("input");
nickjillings@1404 2812 input.name = "question";
nickjillings@1404 2813 input.style.width = "400px";
nickjillings@1404 2814 input.value = node.question;
nickjillings@1404 2815 text.style.margin = "5px";
nickjillings@1404 2816 input.style.margin = "5px";
nickjillings@1404 2817 attributes.appendChild(text);
nickjillings@1404 2818 attributes.appendChild(input);
nickjillings@1404 2819 text = document.createElement("span");
nickjillings@1404 2820 text.textContent = "Mandatory";
nickjillings@1404 2821 input = document.createElement("input");
nickjillings@1404 2822 input.name = "mandatory";
nickjillings@1404 2823 input.type = "checkbox";
nickjillings@1404 2824 input.checked = node.mandatory;
nickjillings@1404 2825 text.style.margin = "5px";
nickjillings@1404 2826 input.style.margin = "5px";
nickjillings@1404 2827 attributes.appendChild(text);
nickjillings@1404 2828 attributes.appendChild(input);
nickjillings@1404 2829 text = document.createElement("span");
nickjillings@1404 2830 text.textContent = "Reply box size";
nickjillings@1404 2831 input = document.createElement("select");
nickjillings@1404 2832 input.name = "boxsize";
nickjillings@1404 2833 var option = document.createElement("option");
nickjillings@1404 2834 option.textContent = "Normal";
nickjillings@1404 2835 option.value = "normal";
nickjillings@1404 2836 input.appendChild(option);
nickjillings@1404 2837 option = document.createElement("option");
nickjillings@1404 2838 option.textContent = "Large";
nickjillings@1404 2839 option.value = "large";
nickjillings@1404 2840 input.appendChild(option);
nickjillings@1404 2841 option = document.createElement("option");
nickjillings@1404 2842 option.textContent = "Small";
nickjillings@1404 2843 option.value = "small";
nickjillings@1404 2844 input.appendChild(option);
nickjillings@1404 2845 option = document.createElement("option");
nickjillings@1404 2846 option.textContent = "Huge";
nickjillings@1404 2847 option.value = "huge";
nickjillings@1404 2848 input.appendChild(option);
nickjillings@1404 2849 text.style.margin = "5px";
nickjillings@1404 2850 input.style.margin = "5px";
nickjillings@1404 2851 attributes.appendChild(text);
nickjillings@1404 2852 attributes.appendChild(input);
nickjillings@1404 2853 input.value = node.boxsize;
nickjillings@1404 2854 break;
nickjillings@1404 2855 }
nickjillings@1404 2856 return holder;
nickjillings@1404 2857 }
nickjillings@1404 2858 }
nickjillings@1404 2859 function exportToXML()
nickjillings@1404 2860 {
nickjillings@1404 2861 var xmlDoc = specificationNode.encode();
nickjillings@1404 2862 var oSerializer = new XMLSerializer();
nickjillings@1404 2863 xmlDoc = oSerializer.serializeToString(xmlDoc);
nickjillings@1404 2864 var parent = document.createElement("div");
nickjillings@1404 2865 var file = [xmlDoc];
nickjillings@1404 2866 var bb = new Blob(file,{type : 'application/xml'});
nickjillings@1404 2867 var dnlk = window.URL.createObjectURL(bb);
nickjillings@1404 2868 var a = document.createElement("a");
nickjillings@1404 2869 a.hidden = '';
nickjillings@1404 2870 a.href = dnlk;
nickjillings@1404 2871 a.download = "save.xml";
nickjillings@1404 2872 a.textContent = "Save File";
nickjillings@1404 2873
nickjillings@1404 2874 popupInstance.showPopup();
nickjillings@1404 2875 popupInstance.popupBody.innerHTML = null;
nickjillings@1404 2876 var body = document.createElement("span");
nickjillings@1404 2877 body.textContent = "Right click and save the file using the link below. Place this file in your WAET directory as 'project.xml' in the example_eval/ directory. Place your media files in the location specified by the Host URL entries. If you wish to review this XML or edit it, refresh this tool and drag your XML document into the page on the welcome screen.";
nickjillings@1404 2878 popupInstance.popupBody.appendChild(body);
nickjillings@1404 2879 popupInstance.popupBody.appendChild(a);
nickjillings@1404 2880 popupInstance.popupTitle.innerHTML = "<span>Thank You</span>";
nickjillings@1404 2881 }
nickjillings@1404 2882 </script>
nickjillings@1404 2883 <style>
nickjillings@1404 2884 div.popup {
nickjillings@1404 2885 width: 500px;
nickjillings@1404 2886 position: absolute;
nickjillings@1404 2887 height: 400px;
nickjillings@1404 2888 background-color: #fff;
nickjillings@1404 2889 border-radius: 10px;
nickjillings@1404 2890 box-shadow: 0px 0px 50px #000;
nickjillings@1404 2891 z-index: 2;
nickjillings@1404 2892 }
nickjillings@1404 2893
nickjillings@1404 2894 button.popupButton {
nickjillings@1404 2895 /* Button for popup window
nickjillings@1404 2896 */
nickjillings@1404 2897 min-width: 50px;
nickjillings@1404 2898 height: 25px;
nickjillings@1404 2899 position: relative;
nickjillings@1404 2900 border-radius: 5px;
nickjillings@1404 2901 border: #444;
nickjillings@1404 2902 border-width: 1px;
nickjillings@1404 2903 border-style: solid;
nickjillings@1404 2904 background-color: #fff;
nickjillings@1404 2905 }
nickjillings@1404 2906
nickjillings@1404 2907 div.dragndrop {
nickjillings@1404 2908 margin-top: 10px;
nickjillings@1404 2909 border:#000000;
nickjillings@1404 2910 border-style: dashed;
nickjillings@1404 2911 border-width: 2px;
nickjillings@1404 2912 }
nickjillings@1404 2913 div.dndheaderelement {
nickjillings@1404 2914 float: left;
nickjillings@1404 2915 height: 100%;
nickjillings@1404 2916 border-right: #DDDDDD;
nickjillings@1404 2917 border-right-width: 1px;
nickjillings@1404 2918 border-right-style: solid;
nickjillings@1404 2919 }
nickjillings@1404 2920 div.dndheaderelement span{
nickjillings@1404 2921 padding-left: 5px;
nickjillings@1404 2922 }
nickjillings@1404 2923
nickjillings@1404 2924 div.topLevel {
nickjillings@1404 2925 border: #000;
nickjillings@1404 2926 border-style: solid;
nickjillings@1404 2927 border-width: 5px;
nickjillings@1404 2928 padding: 10px;
nickjillings@1404 2929 margin: 10px;
nickjillings@1404 2930 }
nickjillings@1404 2931
nickjillings@1404 2932 div.SecondLevel {
nickjillings@1404 2933 border: #000;
nickjillings@1404 2934 border-style: solid;
nickjillings@1404 2935 border-width: 1px;
nickjillings@1404 2936 padding: 10px;
nickjillings@1404 2937 margin: 10px;
nickjillings@1404 2938 }
nickjillings@1404 2939 </style>
nickjillings@1404 2940 </head>
nickjillings@1404 2941
nickjillings@1404 2942 <body>
nickjillings@1404 2943 <div id="export">
nickjillings@1404 2944 <button id="exportToXML" onclick="exportToXML();">Export XML</button>
nickjillings@1404 2945 </div>
nickjillings@1404 2946 <div id="content"></div>
nickjillings@1404 2947 </body>
nickjillings@1404 2948 </html>