annotate test_create/test_create.html @ 815:3b0770e1e616

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