annotate test_create/test_create.html @ 1118:3edcbbea168b

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