annotate test_create/test_create.html @ 813:f452455b5977

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