annotate test_create/test_create.html @ 1078:888292c88c33

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