annotate test_create/test_create.html @ 1411:a32295e8a6a0

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