annotate test_create/test_create.html @ 1400:8147e19de61b

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