annotate test_create/test_core.js @ 1173:d4348ae0bc02

Drag and drop area defined for updating a project file in test creator.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 10 Feb 2016 16:33:41 +0000
parents 2cd9f09455a5
children cf55f9ee9446
rev   line source
n@1170 1 var interfaceSpecs;
n@1170 2 var xmlHttp;
n@1170 3 var popupObject;
n@1170 4 var popupStateNodes;
n@1170 5 var specification;
n@1170 6 var convert;
n@1170 7 var attributeText;
n@1170 8
n@1170 9 // Firefox does not have an XMLDocument.prototype.getElementsByName
n@1170 10 // and there is no searchAll style command, this custom function will
n@1170 11 // search all children recusrively for the name. Used for XSD where all
n@1170 12 // element nodes must have a name and therefore can pull the schema node
n@1170 13 XMLDocument.prototype.getAllElementsByName = function(name)
n@1170 14 {
n@1170 15 name = String(name);
n@1170 16 var selected = this.documentElement.getAllElementsByName(name);
n@1170 17 return selected;
n@1170 18 }
n@1170 19
n@1170 20 Element.prototype.getAllElementsByName = function(name)
n@1170 21 {
n@1170 22 name = String(name);
n@1170 23 var selected = [];
n@1170 24 var node = this.firstElementChild;
n@1170 25 while(node != null)
n@1170 26 {
n@1170 27 if (node.getAttribute('name') == name)
n@1170 28 {
n@1170 29 selected.push(node);
n@1170 30 }
n@1170 31 if (node.childElementCount > 0)
n@1170 32 {
n@1170 33 selected = selected.concat(node.getAllElementsByName(name));
n@1170 34 }
n@1170 35 node = node.nextElementSibling;
n@1170 36 }
n@1170 37 return selected;
n@1170 38 }
n@1170 39
n@1170 40 XMLDocument.prototype.getAllElementsByTagName = function(name)
n@1170 41 {
n@1170 42 name = String(name);
n@1170 43 var selected = this.documentElement.getAllElementsByTagName(name);
n@1170 44 return selected;
n@1170 45 }
n@1170 46
n@1170 47 Element.prototype.getAllElementsByTagName = function(name)
n@1170 48 {
n@1170 49 name = String(name);
n@1170 50 var selected = [];
n@1170 51 var node = this.firstElementChild;
n@1170 52 while(node != null)
n@1170 53 {
n@1170 54 if (node.nodeName == name)
n@1170 55 {
n@1170 56 selected.push(node);
n@1170 57 }
n@1170 58 if (node.childElementCount > 0)
n@1170 59 {
n@1170 60 selected = selected.concat(node.getAllElementsByTagName(name));
n@1170 61 }
n@1170 62 node = node.nextElementSibling;
n@1170 63 }
n@1170 64 return selected;
n@1170 65 }
n@1170 66
n@1170 67 // Firefox does not have an XMLDocument.prototype.getElementsByName
n@1170 68 if (typeof XMLDocument.prototype.getElementsByName != "function") {
n@1170 69 XMLDocument.prototype.getElementsByName = function(name)
n@1170 70 {
n@1170 71 name = String(name);
n@1170 72 var node = this.documentElement.firstElementChild;
n@1170 73 var selected = [];
n@1170 74 while(node != null)
n@1170 75 {
n@1170 76 if (node.getAttribute('name') == name)
n@1170 77 {
n@1170 78 selected.push(node);
n@1170 79 }
n@1170 80 node = node.nextElementSibling;
n@1170 81 }
n@1170 82 return selected;
n@1170 83 }
n@1170 84 }
n@1170 85
n@1170 86 window.onload = function()
n@1170 87 {
n@1170 88 specification = new Specification();
n@1170 89 convert = new SpecificationToHTML();
n@1170 90 xmlHttp = new XMLHttpRequest();
n@1170 91 xmlHttp.open("GET","./interface-specs.xml",true);
n@1170 92 xmlHttp.onload = function()
n@1170 93 {
n@1170 94 var parse = new DOMParser();
n@1170 95 interfaceSpecs = parse.parseFromString(xmlHttp.response,'text/xml');
n@1170 96 buildPage();
n@1170 97 popupObject.postNode(popupStateNodes.state[0])
n@1170 98 }
n@1170 99 xmlHttp.send();
n@1170 100
n@1170 101 var xsdGet = new XMLHttpRequest();
n@1170 102 xsdGet.open("GET","../test-schema.xsd",true);
n@1170 103 xsdGet.onload = function()
n@1170 104 {
n@1170 105 var parse = new DOMParser();
n@1170 106 specification.schema = parse.parseFromString(xsdGet.response,'text/xml');;
n@1170 107 }
n@1170 108 xsdGet.send();
n@1170 109
n@1170 110 var jsonAttribute = new XMLHttpRequest();
n@1170 111 jsonAttribute.open("GET","./attributes.json",true);
n@1170 112 jsonAttribute.onload = function()
n@1170 113 {
n@1170 114 attributeText = JSON.parse(jsonAttribute.response)
n@1170 115 }
n@1170 116 jsonAttribute.send();
n@1170 117 }
n@1170 118
n@1170 119 function buildPage()
n@1170 120 {
n@1170 121 popupObject = new function() {
n@1170 122 this.object = document.getElementById("popupHolder");
n@1170 123 this.blanket = document.getElementById("blanket");
n@1170 124
n@1170 125 this.popupTitle = document.createElement("div");
n@1170 126 this.popupTitle.id = "popup-title-holder";
n@1170 127 this.popupTitle.align = "center";
n@1170 128 this.titleDOM = document.createElement("span");
n@1170 129 this.titleDOM.id = "popup-title";
n@1170 130 this.popupTitle.appendChild(this.titleDOM);
n@1170 131 this.object.appendChild(this.popupTitle);
n@1170 132
n@1170 133 this.popupContent = document.createElement("div");
n@1170 134 this.popupContent.id = "popup-content";
n@1170 135 this.object.appendChild(this.popupContent);
n@1170 136
n@1170 137 this.proceedButton = document.createElement("button");
n@1170 138 this.proceedButton.id = "popup-proceed";
n@1170 139 this.proceedButton.textContent = "Next";
n@1170 140 this.proceedButton.onclick = function()
n@1170 141 {
n@1170 142 popupObject.popupContent.innerHTML = null;
n@1170 143 popupObject.shownObject.continue();
n@1170 144 };
n@1170 145 this.object.appendChild(this.proceedButton);
n@1170 146
n@1170 147 this.shownObject;
n@1170 148
n@1170 149 this.resize = function()
n@1170 150 {
n@1170 151 var w = window.innerWidth;
n@1170 152 var h = window.innerHeight;
n@1170 153 this.object.style.left = Math.floor((w-750)/2) + 'px';
n@1170 154 this.object.style.top = Math.floor((h-500)/2) + 'px';
n@1170 155 }
n@1170 156
n@1170 157 this.show = function()
n@1170 158 {
n@1170 159 this.object.style.visibility = "visible";
n@1170 160 this.blanket.style.visibility = "visible";
n@1170 161 }
n@1170 162
n@1170 163 this.hide = function()
n@1170 164 {
n@1170 165 this.object.style.visibility = "hidden";
n@1170 166 this.blanket.style.visibility = "hidden";
n@1170 167 }
n@1170 168
n@1170 169 this.postNode = function(postObject)
n@1170 170 {
n@1170 171 this.show();
n@1170 172 //Passed object must have the following:
n@1170 173 // Title: text to show in the title
n@1170 174 // Content: HTML DOM to show on the page
n@1170 175 // On complete this HTML DOM is destroyed so make sure it is referenced elsewhere for processing
n@1170 176 this.titleDOM.textContent = postObject.title;
n@1170 177 this.popupContent.appendChild(postObject.content);
n@1170 178 this.shownObject = postObject;
n@1170 179 }
n@1170 180
n@1170 181 this.resize();
n@1170 182 this.hide();
n@1170 183 };
n@1170 184
n@1170 185 popupStateNodes = new function()
n@1170 186 {
n@1170 187 // This defines the several popup states wanted
n@1170 188 this.state = [];
n@1170 189 this.state[0] = new function()
n@1170 190 {
n@1170 191 this.title = "Welcome";
n@1170 192 this.content = document.createElement("div");
n@1170 193 this.content.id = "state-0";
n@1170 194 var span = document.createElement("span");
n@1170 195 span.textContent = "Welcome to the WAET test creator tool. This will allow you to create a new test from scratch to suit your testing needs. If you wish to update a test file, please drag and drop the XML document into the area below for processing, otherwise press 'Next' to start a new test. This tool generates files for the WAET 1.2.0 version."
n@1170 196 this.content.appendChild(span);
n@1170 197 this.dragArea = document.createElement("div");
n@1173 198 this.dragArea.className = "drag-area";
n@1173 199 this.dragArea.id = "project-drop";
n@1170 200 this.content.appendChild(this.dragArea);
n@1173 201
n@1173 202 this.dragArea.addEventListener('dragenter',function(e){
n@1173 203 e.stopPropagation();
n@1173 204 e.preventDefault();
n@1173 205 e.dataTransfer.dropEffect = 'copy';
n@1173 206 e.currentTarget.className = "drag-area drag-over";
n@1173 207 });
n@1173 208
n@1173 209 this.dragArea.addEventListener('dragexit',function(e){
n@1173 210 e.stopPropagation();
n@1173 211 e.preventDefault();
n@1173 212 e.dataTransfer.dropEffect = 'copy';
n@1173 213 e.currentTarget.className = "drag-area";
n@1173 214 });
n@1173 215
n@1173 216 this.dragArea.addEventListener('drop',function(e){
n@1173 217 e.stopPropagation();
n@1173 218 e.preventDefault();
n@1173 219 e.currentTarget.className = "drag-area drag-dropped";
n@1173 220 var files = e.dataTransfer.files[0];
n@1173 221
n@1173 222 });
n@1173 223
n@1170 224
n@1170 225 this.continue = function()
n@1170 226 {
n@1170 227 popupObject.postNode(popupStateNodes.state[1]);
n@1170 228 }
n@1170 229 }
n@1170 230 this.state[1] = new function()
n@1170 231 {
n@1170 232 this.title = "Select your interface";
n@1170 233 this.content = document.createElement("div");
n@1170 234 this.content.id = "state-1";
n@1170 235 var spnH = document.createElement('div');
n@1170 236 var span = document.createElement("span");
n@1170 237 span.textContent = "Please select your interface from the list shown below. This will define the various options which are available. This can later be changed.";
n@1170 238 spnH.appendChild(span);
n@1170 239 this.content.appendChild(spnH);
n@1170 240 this.select = document.createElement("select");
n@1170 241 this.testsXML = interfaceSpecs.getElementsByTagName('tests')[0].children;
n@1170 242 for (var i=0; i<this.testsXML.length; i++)
n@1170 243 {
n@1170 244 var option = document.createElement('option');
n@1170 245 option.value = this.testsXML[i].getAttribute('name');
n@1170 246 option.textContent = this.testsXML[i].getAttribute('name');
n@1170 247 this.select.appendChild(option);
n@1170 248 }
n@1170 249 this.content.appendChild(this.select);
n@1170 250 this.continue = function()
n@1170 251 {
n@1170 252 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(this.select.value)[0];
n@1170 253 specification.interface = testXML.getAttribute("interface");
n@1170 254 popupStateNodes.state[2].generate();
n@1170 255 popupObject.postNode(popupStateNodes.state[2]);
n@1170 256 }
n@1170 257 }
n@1170 258 this.state[2] = new function()
n@1170 259 {
n@1170 260 this.title = "Test Checks & Restrictions";
n@1170 261 this.content = document.createElement("div");
n@1170 262 this.content.id = "state-1";
n@1170 263 var spnH = document.createElement('div');
n@1170 264 var span = document.createElement("span");
n@1170 265 span.textContent = "Select your test checks and restrictions. Greyed out items are fixed by the test/interface and cannot be changed";
n@1170 266 spnH.appendChild(span);
n@1170 267 this.content.appendChild(spnH);
n@1170 268 var holder = document.createElement("div");
n@1170 269 this.options = [];
n@1170 270 this.testXML = null;
n@1170 271 this.interfaceXML = null;
n@1170 272 this.generate = function()
n@1170 273 {
n@1170 274 var interfaceName = popupStateNodes.state[1].select.value;
n@1170 275 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("checks")[0];
n@1170 276 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
n@1170 277 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("checks")[0];
n@1170 278 this.testXML = this.testXML.getAllElementsByTagName("checks");
n@1170 279 for (var i=0; i<this.interfaceXML.children.length; i++)
n@1170 280 {
n@1170 281 var interfaceNode = this.interfaceXML.children[i];
n@1170 282 var checkName = interfaceNode.getAttribute('name');
n@1170 283 var testNode
n@1170 284 if (this.testXML.length > 0)
n@1170 285 {
n@1170 286 testNode = this.testXML[0].getAllElementsByName(checkName);
n@1170 287 if(testNode.length != 0) {testNode = testNode[0];}
n@1170 288 else {testNode = undefined;}
n@1170 289 } else {
n@1170 290 testNode = undefined;
n@1170 291 }
n@1170 292 var optH = document.createElement('div');
n@1170 293 optH.className = "popup-checkbox";
n@1170 294 var checkbox = document.createElement('input');
n@1170 295 checkbox.type = "checkbox";
n@1170 296 var text = document.createElement('span');
n@1170 297 checkbox.setAttribute('name',checkName);
n@1170 298 if (interfaceNode.getAttribute('default') == 'on')
n@1170 299 {
n@1170 300 checkbox.checked = true;
n@1170 301 }
n@1170 302 if (interfaceNode.getAttribute('support') == "none")
n@1170 303 {
n@1170 304 checkbox.disabled = true;
n@1170 305 checkbox.checked = false;
n@1170 306 optH.className = "popup-checkbox disabled";
n@1170 307 } else if (interfaceNode.getAttribute('support') == "mandatory")
n@1170 308 {
n@1170 309 checkbox.disabled = true;
n@1170 310 checkbox.checked = true;
n@1170 311 optH.className = "popup-checkbox disabled";
n@1170 312 }
n@1170 313 if(testNode != undefined)
n@1170 314 {
n@1170 315 if (interfaceNode.getAttribute('default') == 'on')
n@1170 316 {
n@1170 317 checkbox.checked = true;
n@1170 318 }
n@1170 319 if (testNode.getAttribute('support') == "none")
n@1170 320 {
n@1170 321 checkbox.disabled = true;
n@1170 322 checkbox.checked = false;
n@1170 323 optH.className = "popup-checkbox disabled";
n@1170 324 }else if (interfaceNode.getAttribute('support') == "mandatory")
n@1170 325 {
n@1170 326 checkbox.disabled = true;
n@1170 327 checkbox.checked = true;
n@1170 328 optH.className = "popup-checkbox disabled";
n@1170 329 }
n@1170 330 }
n@1170 331 text.textContent = popupStateNodes.state[2].checkText.getAllElementsByName(checkName)[0].textContent;
n@1170 332 optH.appendChild(checkbox);
n@1170 333 optH.appendChild(text);
n@1170 334 this.options.push(optH);
n@1170 335 this.content.appendChild(optH);
n@1170 336 }
n@1170 337 }
n@1170 338 this.continue = function()
n@1170 339 {
n@1170 340 if (specification.interfaces == null)
n@1170 341 {
n@1170 342 specification.interfaces = new specification.interfaceNode();
n@1170 343 }
n@1170 344 for (var object of this.options)
n@1170 345 {
n@1170 346 var checkbox = object.children[0];
n@1170 347 if (checkbox.checked)
n@1170 348 {
n@1170 349 var option = {
n@1170 350 type: "check",
n@1170 351 name: checkbox.getAttribute('name')
n@1170 352 };
n@1170 353 specification.interfaces.options.push(option);
n@1170 354 }
n@1170 355 }
n@1170 356 popupStateNodes.state[3].generate();
n@1170 357 popupObject.postNode(popupStateNodes.state[3]);
n@1170 358 }
n@1170 359 }
n@1170 360 this.state[3] = new function()
n@1170 361 {
n@1170 362 this.title = "Test Metrics";
n@1170 363 this.content = document.createElement("div");
n@1170 364 this.content.id = "state-1";
n@1170 365 var spnH = document.createElement('div');
n@1170 366 var span = document.createElement("span");
n@1170 367 span.textContent = "Select which data points to include in the exported results XML. Some of this is required for certain post script analysis. See the documentation for further details";
n@1170 368 spnH.appendChild(span);
n@1170 369 this.content.appendChild(spnH);
n@1170 370 this.options = [];
n@1170 371 this.checkText;
n@1170 372 this.testXML;
n@1170 373 this.interfaceXML;
n@1170 374 this.generate = function()
n@1170 375 {
n@1170 376 var interfaceName = popupStateNodes.state[1].select.value;
n@1170 377 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("metrics")[0];
n@1170 378 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
n@1170 379 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("metrics")[0];
n@1170 380 this.testXML = this.testXML.getAllElementsByTagName("metrics");
n@1170 381 for (var i=0; i<this.interfaceXML.children.length; i++)
n@1170 382 {
n@1170 383 var interfaceNode = this.interfaceXML.children[i];
n@1170 384 var checkName = interfaceNode.getAttribute('name');
n@1170 385 var testNode
n@1170 386 if (this.testXML.length > 0)
n@1170 387 {
n@1170 388 testNode = this.testXML[0].getAllElementsByName(checkName);
n@1170 389 if(testNode.length != 0) {testNode = testNode[0];}
n@1170 390 else {testNode = undefined;}
n@1170 391 } else {
n@1170 392 testNode = undefined;
n@1170 393 }
n@1170 394 var optH = document.createElement('div');
n@1170 395 optH.className = "popup-checkbox";
n@1170 396 var checkbox = document.createElement('input');
n@1170 397 checkbox.type = "checkbox";
n@1170 398 var text = document.createElement('span');
n@1170 399 checkbox.setAttribute('name',checkName);
n@1170 400 if (interfaceNode.getAttribute('default') == 'on')
n@1170 401 {
n@1170 402 checkbox.checked = true;
n@1170 403 }
n@1170 404 if (interfaceNode.getAttribute('support') == "none")
n@1170 405 {
n@1170 406 checkbox.disabled = true;
n@1170 407 checkbox.checked = false;
n@1170 408 optH.className = "popup-checkbox disabled";
n@1170 409 } else if (interfaceNode.getAttribute('support') == "mandatory")
n@1170 410 {
n@1170 411 checkbox.disabled = true;
n@1170 412 checkbox.checked = true;
n@1170 413 optH.className = "popup-checkbox disabled";
n@1170 414 }
n@1170 415 if(testNode != undefined)
n@1170 416 {
n@1170 417 if (interfaceNode.getAttribute('default') == 'on')
n@1170 418 {
n@1170 419 checkbox.checked = true;
n@1170 420 }
n@1170 421 if (testNode.getAttribute('support') == "none")
n@1170 422 {
n@1170 423 checkbox.disabled = true;
n@1170 424 checkbox.checked = false;
n@1170 425 optH.className = "popup-checkbox disabled";
n@1170 426 }else if (interfaceNode.getAttribute('support') == "mandatory")
n@1170 427 {
n@1170 428 checkbox.disabled = true;
n@1170 429 checkbox.checked = true;
n@1170 430 optH.className = "popup-checkbox disabled";
n@1170 431 }
n@1170 432 }
n@1170 433 text.textContent = popupStateNodes.state[3].checkText.getAllElementsByName(checkName)[0].textContent;
n@1170 434 optH.appendChild(checkbox);
n@1170 435 optH.appendChild(text);
n@1170 436 this.options.push(optH);
n@1170 437 this.content.appendChild(optH);
n@1170 438 }
n@1170 439 }
n@1170 440 this.continue = function()
n@1170 441 {
n@1170 442 if (specification.metrics == null) {
n@1170 443 specification.metrics = new specification.metricNode();
n@1170 444 }
n@1170 445 for (var object of this.options)
n@1170 446 {
n@1170 447 var checkbox = object.children[0];
n@1170 448 if (checkbox.checked)
n@1170 449 {
n@1170 450 specification.metrics.enabled.push(checkbox.getAttribute('name'));
n@1170 451 }
n@1170 452 }
n@1170 453 popupStateNodes.state[4].generate();
n@1170 454 popupObject.postNode(popupStateNodes.state[4]);
n@1170 455 }
n@1170 456 }
n@1170 457 this.state[4] = new function()
n@1170 458 {
n@1170 459 this.title = "Test Visuals";
n@1170 460 this.content = document.createElement("div");
n@1170 461 this.content.id = "state-1";
n@1170 462 var spnH = document.createElement('div');
n@1170 463 var span = document.createElement("span");
n@1170 464 span.textContent = "You can display extra visual content with your interface for the test user to interact with. Select from the available options below. Greyed out options are unavailable for your selected interface";
n@1170 465 spnH.appendChild(span);
n@1170 466 this.content.appendChild(spnH);
n@1170 467 this.options = [];
n@1170 468 this.checkText;
n@1170 469 this.testXML;
n@1170 470 this.interfaceXML;
n@1170 471 this.generate = function()
n@1170 472 {
n@1170 473 var interfaceName = popupStateNodes.state[1].select.value;
n@1170 474 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("show")[0];
n@1170 475 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
n@1170 476 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("show")[0];
n@1170 477 this.testXML = this.testXML.getAllElementsByTagName("metrics");
n@1170 478 for (var i=0; i<this.interfaceXML.children.length; i++)
n@1170 479 {
n@1170 480 var interfaceNode = this.interfaceXML.children[i];
n@1170 481 var checkName = interfaceNode.getAttribute('name');
n@1170 482 var testNode
n@1170 483 if (this.testXML.length > 0)
n@1170 484 {
n@1170 485 testNode = this.testXML[0].getAllElementsByName(checkName);
n@1170 486 if(testNode.length != 0) {testNode = testNode[0];}
n@1170 487 else {testNode = undefined;}
n@1170 488 } else {
n@1170 489 testNode = undefined;
n@1170 490 }
n@1170 491 var optH = document.createElement('div');
n@1170 492 optH.className = "popup-checkbox";
n@1170 493 var checkbox = document.createElement('input');
n@1170 494 checkbox.type = "checkbox";
n@1170 495 var text = document.createElement('span');
n@1170 496 checkbox.setAttribute('name',checkName);
n@1170 497 if (interfaceNode.getAttribute('default') == 'on')
n@1170 498 {
n@1170 499 checkbox.checked = true;
n@1170 500 }
n@1170 501 if (interfaceNode.getAttribute('support') == "none")
n@1170 502 {
n@1170 503 checkbox.disabled = true;
n@1170 504 checkbox.checked = false;
n@1170 505 optH.className = "popup-checkbox disabled";
n@1170 506 } else if (interfaceNode.getAttribute('support') == "mandatory")
n@1170 507 {
n@1170 508 checkbox.disabled = true;
n@1170 509 checkbox.checked = true;
n@1170 510 optH.className = "popup-checkbox disabled";
n@1170 511 }
n@1170 512 if(testNode != undefined)
n@1170 513 {
n@1170 514 if (interfaceNode.getAttribute('default') == 'on')
n@1170 515 {
n@1170 516 checkbox.checked = true;
n@1170 517 }
n@1170 518 if (testNode.getAttribute('support') == "none")
n@1170 519 {
n@1170 520 checkbox.disabled = true;
n@1170 521 checkbox.checked = false;
n@1170 522 optH.className = "popup-checkbox disabled";
n@1170 523 }else if (interfaceNode.getAttribute('support') == "mandatory")
n@1170 524 {
n@1170 525 checkbox.disabled = true;
n@1170 526 checkbox.checked = true;
n@1170 527 optH.className = "popup-checkbox disabled";
n@1170 528 }
n@1170 529 }
n@1170 530 text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
n@1170 531 optH.appendChild(checkbox);
n@1170 532 optH.appendChild(text);
n@1170 533 this.options.push(optH);
n@1170 534 this.content.appendChild(optH);
n@1170 535 }
n@1170 536 }
n@1170 537 this.continue = function()
n@1170 538 {
n@1170 539 if (specification.interfaces == null)
n@1170 540 {
n@1170 541 specification.interfaces = new specification.interfaceNode();
n@1170 542 }
n@1170 543 for (var object of this.options)
n@1170 544 {
n@1170 545 var checkbox = object.children[0];
n@1170 546 if (checkbox.checked)
n@1170 547 {
n@1170 548 var option = {
n@1170 549 type: "show",
n@1170 550 name: checkbox.getAttribute('name')
n@1170 551 };
n@1170 552 specification.interfaces.options.push(option);
n@1170 553 }
n@1170 554 }
n@1170 555 popupObject.hide();
n@1170 556 convert.convert(document.getElementById('content'));
n@1170 557 }
n@1170 558 }
n@1170 559 this.state[5] = new function() {
n@1170 560 this.title = "Add/Edit Survey Element";
n@1170 561 this.content = document.createElement("div");
n@1170 562 this.content.id = "state-1";
n@1170 563 var spnH = document.createElement('div');
n@1170 564 var span = document.createElement("span");
n@1170 565 span.textContent = "You can configure your survey element here. Press 'Continue' to complete your changes.";
n@1170 566 spnH.appendChild(span);
n@1170 567 this.content.appendChild(spnH);
n@1170 568 this.dynamic = document.createElement("div");
n@1170 569 this.option = null;
n@1170 570 this.parent = null;
n@1170 571 var select = document.createElement("select");
n@1170 572 select.setAttribute("name","type");
n@1170 573 select.addEventListener("change",this,false);
n@1170 574 this.content.appendChild(select);
n@1170 575 this.content.appendChild(this.dynamic);
n@1170 576 this.generate = function(option, parent)
n@1170 577 {
n@1170 578 this.option = option;
n@1170 579 this.parent = parent;
n@1170 580 var optionList = specification.schema.getAllElementsByName("survey")[0].getAllElementsByName("type")[0].getAllElementsByTagName("xs:enumeration");
n@1170 581 for (var i=0; i<optionList.length; i++)
n@1170 582 {
n@1170 583 var selectOption = document.createElement("option");
n@1170 584 selectOption.value = optionList[i].getAttribute("value");
n@1170 585 selectOption.textContent = selectOption.value;
n@1170 586 select.appendChild(selectOption);
n@1170 587 }
n@1170 588 if (this.option.type != undefined){
n@1170 589 select.value = this.option.type
n@1170 590 } else {
n@1170 591 select.value = "statement";
n@1170 592 this.option.type = "statement";
n@1170 593 }
n@1170 594
n@1170 595 this.dynamic.innerHTML = null;
n@1170 596 var statement = document.createElement("div");
n@1170 597 var statementText = document.createElement("span");
n@1170 598 var statementEntry = document.createElement("textarea");
n@1170 599 statement.appendChild(statementText);
n@1170 600 statement.appendChild(statementEntry);
n@1170 601 statementText.textContent = "Statement/Question";
n@1170 602 statementEntry.addEventListener("change",this,false);
n@1170 603 statementEntry.setAttribute("name","statement");
n@1170 604 statementEntry.value = this.option.statement;
n@1170 605 this.dynamic.appendChild(statement);
n@1170 606 switch(this.option.type)
n@1170 607 {
n@1170 608 case "statement":
n@1170 609 break;
n@1170 610 case "question":
n@1170 611 var boxsizeSelect = document.createElement("select");
n@1170 612 var optionList = specification.schema.getAllElementsByName("survey")[0].getAllElementsByName("boxsize")[0].getAllElementsByTagName("xs:enumeration");
n@1170 613 for (var i=0; i<optionList.length; i++)
n@1170 614 {
n@1170 615 var selectOption = document.createElement("option");
n@1170 616 selectOption.value = optionList[i].getAttribute("value");
n@1170 617 selectOption.textContent = selectOption.value;
n@1170 618 boxsizeSelect.appendChild(selectOption);
n@1170 619 }
n@1170 620 if(this.option.boxsize != undefined) {
n@1170 621 boxsizeSelect.value = this.option.boxsize;
n@1170 622 } else {
n@1170 623 boxsizeSelect.value = "normal";
n@1170 624 this.option.boxsize = "normal";
n@1170 625 }
n@1170 626 boxsizeSelect.setAttribute("name","boxsize");
n@1170 627 boxsizeSelect.addEventListener("change",this,false);
n@1170 628 var boxsize = document.createElement("div");
n@1170 629 var boxsizeText = document.createElement("span");
n@1170 630 boxsizeText.textContent = "Entry Size: ";
n@1170 631 boxsize.appendChild(boxsizeText);
n@1170 632 boxsize.appendChild(boxsizeSelect);
n@1170 633 this.dynamic.appendChild(boxsize);
n@1170 634
n@1170 635 var mandatory = document.createElement("div");
n@1170 636 var mandatoryInput = document.createElement("input");
n@1170 637 var mandatoryText = document.createElement("span");
n@1170 638 mandatoryText.textContent = "Mandatory: ";
n@1170 639 mandatory.appendChild(mandatoryText);
n@1170 640 mandatory.appendChild(mandatoryInput);
n@1170 641 mandatoryInput.type = "checkbox";
n@1170 642 if (this.option.mandatory) {mandatoryInput.checked = true;} else {mandatoryInput.checked = false;}
n@1170 643 mandatoryInput.setAttribute("name","mandatory");
n@1170 644 mandatoryInput.addEventListener("change",this,false);
n@1170 645 mandatory.appendChild(mandatoryText);
n@1170 646 mandatory.appendChild(mandatoryInput);
n@1170 647 this.dynamic.appendChild(mandatory);
n@1170 648 break;
n@1170 649 }
n@1170 650 }
n@1170 651 this.handleEvent = function()
n@1170 652 {
n@1170 653 var name = event.currentTarget.getAttribute("name");
n@1170 654 switch(name) {
n@1170 655 case "type":
n@1170 656 // If type has changed, we may need to rebuild the entire state node
n@1170 657 if (event.currentTarget.value != this.option.name)
n@1170 658 {
n@1170 659 this.option.type = event.currentTarget.value;
n@1170 660 this.generate(this.option,this.parent);
n@1170 661 }
n@1170 662 break;
n@1170 663 case "mandatory":
n@1170 664 this.option.mandatory = event.currentTarget.checked;
n@1170 665 break;
n@1170 666 case "boxsize":
n@1170 667 this.option.boxsize = event.currentTarget.value;
n@1170 668 break;
n@1170 669 case "statement":
n@1170 670 this.option.statement = event.currentTarget.value;
n@1170 671 break;
n@1170 672 }
n@1170 673 }
n@1170 674 this.continue = function()
n@1170 675 {
n@1170 676 var newNode = new this.parent.surveyEntryNode(this.parent,this.option);
n@1170 677 this.parent.children.push(newNode);
n@1170 678 this.parent.childrenDOM.appendChild(newNode.rootDOM);
n@1170 679 popupObject.hide();
n@1170 680 }
n@1170 681 }
n@1170 682 }
n@1170 683 }
n@1170 684
n@1170 685 function SpecificationToHTML()
n@1170 686 {
n@1170 687 // This takes the specification node and converts it to an on-page HTML object
n@1170 688 // Each Specification Node is given its own JS object which listens to the XSD for instant verification
n@1170 689 // Once generated, it directly binds into the specification object to update with changes
n@1170 690 // Fixed DOM entries
n@1170 691 this.injectDOM;
n@1170 692 this.setupDOM;
n@1170 693 this.pages = [];
n@1170 694
n@1170 695 // Self-contained generators
n@1170 696 this.createGeneralNodeDOM = function(name,id,parent)
n@1170 697 {
n@1170 698 var root = document.createElement('div');
n@1170 699 root.id = id;
n@1170 700 root.className = "node";
n@1170 701
n@1170 702 var titleDiv = document.createElement('div');
n@1170 703 titleDiv.className = "node-title";
n@1170 704 var title = document.createElement('span');
n@1170 705 title.className = "node-title";
n@1170 706 title.textContent = name;
n@1170 707 titleDiv.appendChild(title);
n@1170 708
n@1170 709 var attributeDiv = document.createElement('div');
n@1170 710 attributeDiv.className = "node-attributes";
n@1170 711
n@1170 712 var childrenDiv = document.createElement('div');
n@1170 713 childrenDiv.className = "node-children";
n@1170 714
n@1170 715 var buttonsDiv = document.createElement('div');
n@1170 716 buttonsDiv.className = "node-buttons";
n@1170 717
n@1170 718 root.appendChild(titleDiv);
n@1170 719 root.appendChild(attributeDiv);
n@1170 720 root.appendChild(childrenDiv);
n@1170 721 root.appendChild(buttonsDiv);
n@1170 722
n@1170 723 var obj = {
n@1170 724 rootDOM: root,
n@1170 725 titleDOM: title,
n@1170 726 attributeDOM: attributeDiv,
n@1170 727 attributes: [],
n@1170 728 childrenDOM: childrenDiv,
n@1170 729 children: [],
n@1170 730 buttonDOM: buttonsDiv,
n@1170 731 parent: parent
n@1170 732 }
n@1170 733 return obj;
n@1170 734 }
n@1170 735
n@1170 736 this.convertAttributeToDOM = function(node,schema)
n@1170 737 {
n@1170 738 // This takes an attribute schema node and returns an object with the input node and any bindings
n@1170 739 if (schema.getAttribute('name') == undefined && schema.getAttribute('ref') != undefined)
n@1170 740 {
n@1170 741 schema = specification.schema.getAllElementsByName(schema.getAttribute('ref'))[0];
n@1170 742 }
n@1170 743 var obj = new function()
n@1170 744 {
n@1170 745 this.input;
n@1170 746 this.name;
n@1170 747 this.owner;
n@1170 748 this.holder;
n@1170 749
n@1170 750 this.name = schema.getAttribute('name');
n@1170 751 this.default = schema.getAttribute('default');
n@1170 752 this.dataType = schema.getAttribute('type');
n@1170 753 if (typeof this.dataType == "string") { this.dataType = this.dataType.substr(3);}
n@1170 754 else {this.dataType = "string";}
n@1170 755 var minVar = undefined;
n@1170 756 var maxVar = undefined;
n@1170 757 switch(this.dataType)
n@1170 758 {
n@1170 759 case "negativeInteger":
n@1170 760 maxVar = -1;
n@1170 761 break;
n@1170 762 case "positiveInteger":
n@1170 763 minVar = 1;
n@1170 764 break;
n@1170 765 case "nonNegativeInteger":
n@1170 766 minVar = 0;
n@1170 767 break;
n@1170 768 case "nonPositiveInteger":
n@1170 769 maxVar = 0;
n@1170 770 break;
n@1170 771 case "byte":
n@1170 772 minVar = 0;
n@1170 773 maxVar = 256;
n@1170 774 break;
n@1170 775 case "short":
n@1170 776 minVar = 0;
n@1170 777 maxVar = 65536;
n@1170 778 break;
n@1170 779 default:
n@1170 780 break;
n@1170 781 }
n@1170 782
n@1170 783 this.input = document.createElement('input');
n@1170 784 switch(this.dataType)
n@1170 785 {
n@1170 786 case "boolean":
n@1170 787 this.input.type = "checkbox";
n@1170 788 break;
n@1170 789 case "negativeInteger":
n@1170 790 case "positiveInteger":
n@1170 791 case "nonNegativeInteger":
n@1170 792 case "nonPositiveInteger":
n@1170 793 case "integer":
n@1170 794 case "short":
n@1170 795 case "byte":
n@1170 796 this.input.step = 1;
n@1170 797 case "decimal":
n@1170 798 this.input.type = "number";
n@1170 799 this.input.min = minVar;
n@1170 800 this.input.max = maxVar;
n@1170 801 break;
n@1170 802 default:
n@1170 803 break;
n@1170 804 }
n@1170 805 var value;
n@1173 806 eval("value = node."+this.name)
n@1170 807 if (value != undefined)
n@1170 808 {
n@1170 809 this.input.value = value;
n@1170 810 } else if (this.default != undefined)
n@1170 811 {
n@1170 812 this.input.value = this.default;
n@1170 813 }
n@1170 814 this.handleEvent = function(event)
n@1170 815 {
n@1170 816 var value;
n@1170 817 switch(this.input.type)
n@1170 818 {
n@1170 819 case "checkbox":
n@1170 820 value = event.currentTarget.checked;
n@1170 821 break;
n@1170 822 case "number":
n@1170 823 value = Number(event.currentTarget.value);
n@1170 824 break;
n@1170 825 default:
n@1170 826 value = event.currentTarget.value;
n@1170 827 break;
n@1170 828 }
n@1170 829 eval("this.owner."+this.name+" = value");
n@1170 830 }
n@1170 831 this.holder = document.createElement('div');
n@1170 832 this.holder.className = "attribute";
n@1170 833 this.holder.setAttribute('name',this.name);
n@1170 834 var text = document.createElement('span');
n@1170 835 eval("text.textContent = attributeText."+this.name+"+': '");
n@1170 836 this.holder.appendChild(text);
n@1170 837 this.holder.appendChild(this.input);
n@1170 838 this.owner = node;
n@1170 839 this.input.addEventListener("change",this,false);
n@1170 840 }
n@1170 841 if (obj.attribute != null)
n@1170 842 {
n@1170 843 obj.input.value = obj.attribute;
n@1170 844 }
n@1170 845 return obj;
n@1170 846 }
n@1170 847
n@1170 848 this.convert = function(root)
n@1170 849 {
n@1170 850 //Performs the actual conversion using the given root DOM as the root
n@1170 851 this.injectDOM = root;
n@1170 852
n@1173 853 // Build the export button
n@1173 854 var exportButton = document.createElement("button");
n@1173 855 exportButton.textContent = "Export to XML";
n@1173 856 exportButton.onclick = function()
n@1173 857 {
n@1173 858 var doc = specification.encode();
n@1173 859 var obj = {};
n@1173 860 obj.title = "Export";
n@1173 861 obj.content = document.createElement("div");
n@1173 862 obj.content.id = "finish";
n@1173 863 var span = document.createElement("span");
n@1173 864 span.textContent = "Your XML document is linked below. On most browsers, simply right click on the link and select 'Save As'. Or clicking on the link may download the file directly."
n@1173 865 obj.content.appendChild(span);
n@1173 866 var link = document.createElement("div");
n@1173 867 link.appendChild(doc.children[0]);
n@1173 868 var file = [link.innerHTML];
n@1173 869 var bb = new Blob(file,{type : 'application/xml'});
n@1173 870 var dnlk = window.URL.createObjectURL(bb);
n@1173 871 var a = document.createElement("a");
n@1173 872 a.hidden = '';
n@1173 873 a.href = dnlk;
n@1173 874 a.download = "project-specification.xml";
n@1173 875 a.textContent = "Save File";
n@1173 876 obj.content.appendChild(a);
n@1173 877 popupObject.show();
n@1173 878 popupObject.postNode(obj);
n@1173 879 }
n@1173 880 this.injectDOM.appendChild(exportButton);
n@1173 881
n@1170 882 // First perform the setupNode;
n@1170 883 var setupSchema = specification.schema.getAllElementsByName('setup')[0];
n@1170 884 this.setupDOM = new this.createGeneralNodeDOM('setup','setup',null);
n@1170 885 this.injectDOM.appendChild(this.setupDOM.rootDOM);
n@1170 886 var setupAttributes = setupSchema.getAllElementsByTagName('xs:attribute');
n@1170 887 for (var i=0; i<setupAttributes.length; i++)
n@1170 888 {
n@1170 889 var attributeName = setupAttributes[i].getAttribute('name');
n@1170 890 var attrObject = this.convertAttributeToDOM(specification,setupAttributes[i]);
n@1170 891 this.setupDOM.attributeDOM.appendChild(attrObject.holder);
n@1170 892 this.setupDOM.attributes.push(attrObject);
n@1170 893 }
n@1170 894
n@1170 895 // Now we must build the interface Node
n@1170 896 this.interfaceDOM = new this.interfaceNode(this,specification.interfaces);
n@1170 897 this.interfaceDOM.build("Interface","setup-interface",this.setupDOM.rootDOM);
n@1170 898
n@1170 899 // Now build the Metrics selection node
n@1170 900 var metric = this.createGeneralNodeDOM("metrics","setup-metric",this.setupDOM);
n@1170 901 metric.rootDOM.removeChild(metric.attributeDOM);
n@1170 902 this.setupDOM.children.push(metric);
n@1170 903 this.setupDOM.childrenDOM.appendChild(metric.rootDOM);
n@1170 904 var interfaceName = popupStateNodes.state[1].select.value;
n@1170 905 var checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("metrics")[0];
n@1170 906 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
n@1170 907 var interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(testXML.getAttribute("interface"))[0].getAllElementsByTagName("metrics")[0];
n@1170 908 testXML = testXML.getAllElementsByTagName("metrics");
n@1170 909 for (var i=0; i<interfaceXML.children.length; i++)
n@1170 910 {
n@1170 911 var obj = {
n@1170 912 input: document.createElement('input'),
n@1170 913 root: document.createElement('div'),
n@1170 914 text: document.createElement('span'),
n@1170 915 specification: specification.metrics.enabled,
n@1170 916 name: interfaceXML.children[i].getAttribute("name"),
n@1170 917 handleEvent: function()
n@1170 918 {
n@1170 919 for (var i=0; i<this.specification.length; i++)
n@1170 920 {
n@1170 921 if (this.specification[i] == this.name)
n@1170 922 {
n@1170 923 var options = this.specification;
n@1170 924 if (this.input.checked == false) {
n@1170 925 if (i == options.length)
n@1170 926 {options = options.slice(0,i);}
n@1170 927 else {
n@1170 928 options = options.slice(0,i).concat(options.slice(i+1));
n@1170 929 }
n@1170 930 } else {
n@1170 931 return;
n@1170 932 }
n@1170 933 this.specification = options;
n@1170 934 break;
n@1170 935 }
n@1170 936 }
n@1170 937 if (this.input.checked) {
n@1170 938 this.specification.push(this.name);
n@1170 939 }
n@1170 940 }
n@1170 941 };
n@1170 942 obj.root.className = "attribute";
n@1170 943 obj.input.type = "checkbox";
n@1170 944 obj.root.appendChild(obj.text);
n@1170 945 obj.root.appendChild(obj.input);
n@1170 946 obj.text.textContent = checkText.children[i].textContent;
n@1170 947 metric.children.push(obj);
n@1170 948 metric.childrenDOM.appendChild(obj.root);
n@1170 949 for (var i=0; i<specification.metrics.enabled.length; i++)
n@1170 950 {
n@1170 951 if (specification.metrics.enabled[i] == obj.name)
n@1170 952 {
n@1170 953 obj.input.checked = true;
n@1170 954 break;
n@1170 955 }
n@1170 956 }
n@1170 957 }
n@1170 958
n@1170 959 // Now both before and after surveys
n@1170 960 if (specification.preTest == undefined){
n@1170 961 specification.preTest = new specification.surveyNode();
n@1170 962 specification.preTest.location = "pre";
n@1170 963 }
n@1170 964 if (specification.postTest == undefined){
n@1170 965 specification.postTest = new specification.surveyNode();
n@1170 966 specification.postTest.location = "post";
n@1170 967 }
n@1170 968 var surveyBefore = new this.surveyNode(this,specification.preTest,"Pre");
n@1170 969 var surveyAfter = new this.surveyNode(this,specification.postTest,"Post");
n@1170 970 this.setupDOM.children.push(surveyBefore);
n@1170 971 this.setupDOM.children.push(surveyAfter);
n@1170 972 this.setupDOM.childrenDOM.appendChild(surveyBefore.rootDOM);
n@1170 973 this.setupDOM.childrenDOM.appendChild(surveyAfter.rootDOM);
n@1170 974
n@1170 975 // Add in the page creator button
n@1170 976 this.addPage = {
n@1170 977 root: document.createElement("button"),
n@1170 978 parent: this,
n@1170 979 handleEvent: function()
n@1170 980 {
n@1170 981 var pageObj = new specification.page();
n@1170 982 specification.pages.push(pageObj);
n@1170 983 var newPage = new this.parent.pageNode(this.parent,pageObj);
n@1170 984 this.parent.injectDOM.appendChild(newPage.rootDOM);
n@1170 985 this.parent.pages.push(newPage);
n@1170 986 }
n@1170 987 }
n@1170 988 this.addPage.root.textContent = "Add Page";
n@1170 989 this.addPage.root.addEventListener("click",this.addPage,false);
n@1170 990 this.injectDOM.appendChild(this.addPage.root);
n@1170 991 }
n@1170 992
n@1170 993 this.interfaceNode = function(parent,rootObject)
n@1170 994 {
n@1170 995 this.rootDOM;
n@1170 996 this.titleDOM;
n@1170 997 this.attributeDOM;
n@1170 998 this.attributes = [];
n@1170 999 this.childrenDOM;
n@1170 1000 this.children = [];
n@1170 1001 this.buttonDOM;
n@1170 1002 this.parent = parent;
n@1170 1003 this.HTMLPoint;
n@1170 1004 this.specification = rootObject;
n@1170 1005 this.schema = specification.schema.getAllElementsByName("interface")[1];
n@1170 1006
n@1170 1007 this.createIOasAttr = function(name,specification,parent,type) {
n@1170 1008 this.root = document.createElement('div');
n@1170 1009 this.input = document.createElement("input");
n@1170 1010 this.name = name;
n@1170 1011 this.type = type;
n@1170 1012 this.parent = parent;
n@1170 1013 this.specification = specification;
n@1170 1014 this.handleEvent = function(event) {
n@1170 1015 for (var i=0; i<this.specification.options.length; i++)
n@1170 1016 {
n@1170 1017 if (this.specification.options[i].name == this.name)
n@1170 1018 {
n@1170 1019 var options = this.specification.options;
n@1170 1020 if (this.input.checked == false) {
n@1170 1021 if (i == options.length)
n@1170 1022 {options = options.slice(0,i);}
n@1170 1023 else {
n@1170 1024 options = options.slice(0,i).concat(options.slice(i+1));
n@1170 1025 }
n@1170 1026 } else {
n@1170 1027 return;
n@1170 1028 }
n@1170 1029 this.specification.options = options;
n@1170 1030 break;
n@1170 1031 }
n@1170 1032 }
n@1170 1033 if (this.input.checked) {
n@1170 1034 var obj = {
n@1170 1035 name: this.name,
n@1170 1036 type: this.type
n@1170 1037 };
n@1170 1038 this.specification.options.push(obj);
n@1170 1039 }
n@1170 1040 if (this.parent.HTMLPoint.id == "setup")
n@1170 1041 {
n@1170 1042 // We've changed a global setting, must update all child 'interfaces' and disable them
n@1170 1043 for (pages of convert.pages)
n@1170 1044 {
n@1170 1045 for (interface of pages.interfaces)
n@1170 1046 {
n@1170 1047 if (this.type == "check")
n@1170 1048 {
n@1170 1049 for (node of interface.children[0].attributes)
n@1170 1050 {
n@1170 1051 if (node.name == this.name) {
n@1170 1052 if (this.input.checked) {
n@1170 1053 node.input.disabled = true;
n@1170 1054 node.input.checked = false;
n@1170 1055 } else {
n@1170 1056 node.input.disabled = false;
n@1170 1057 }
n@1170 1058 break;
n@1170 1059 }
n@1170 1060 }
n@1170 1061 } else if (this.type == "show")
n@1170 1062 {
n@1170 1063 for (node of interface.children[1].attributes)
n@1170 1064 {
n@1170 1065 if (node.name == this.name) {
n@1170 1066 if (this.input.checked) {
n@1170 1067 node.input.disabled = true;
n@1170 1068 } else {
n@1170 1069 node.input.disabled = false;
n@1170 1070 }
n@1170 1071 break;
n@1170 1072 }
n@1170 1073 }
n@1170 1074 }
n@1170 1075 }
n@1170 1076 }
n@1170 1077 }
n@1170 1078 };
n@1170 1079 this.findIndex = function(element,index,array){
n@1170 1080 if (element.name == this.name)
n@1170 1081 return true;
n@1170 1082 else
n@1170 1083 return false;
n@1170 1084 };
n@1170 1085 this.findNode = function(element,index,array){
n@1170 1086 if (element.name == this.name)
n@1170 1087 return true;
n@1170 1088 else
n@1170 1089 return false;
n@1170 1090 };
n@1170 1091 this.input.type = "checkbox";
n@1170 1092 this.input.setAttribute("name",name);
n@1170 1093 this.input.addEventListener("change",this,false);
n@1170 1094 this.root.appendChild(this.input);
n@1170 1095 this.root.className = "attribute";
n@1170 1096 return this;
n@1170 1097 }
n@1170 1098
n@1170 1099 this.build = function(name,id,parent)
n@1170 1100 {
n@1170 1101 var obj = this.parent.createGeneralNodeDOM(name,id,parent);
n@1170 1102
n@1170 1103 this.rootDOM = obj.rootDOM;
n@1170 1104 this.titleDOM = obj.titleDOM;
n@1170 1105 this.attributeDOM = obj.attributeDOM;
n@1170 1106 this.childrenDOM = obj.childrenDOM;
n@1170 1107 this.buttonDOM = obj.buttonsDOM;
n@1170 1108 this.HTMLPoint = parent;
n@1170 1109 this.rootDOM.removeChild(this.attributeDOM);
n@1170 1110 // Put in the check / show options as individual children
n@1170 1111 var checks = this.parent.createGeneralNodeDOM("Checks","setup-interface-checks",this);
n@1170 1112
n@1170 1113 var interfaceName = popupStateNodes.state[1].select.value;
n@1170 1114 var checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("checks")[0];
n@1170 1115 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
n@1170 1116 var interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(testXML.getAttribute("interface"))[0].getAllElementsByTagName("checks")[0];
n@1170 1117 testXML = testXML.getAllElementsByTagName("checks");
n@1170 1118 for (var i=0; i<interfaceXML.children.length; i++)
n@1170 1119 {
n@1170 1120 var obj = new this.createIOasAttr(interfaceXML.children[i].getAttribute("name"),this.specification,this,"check");
n@1170 1121 for (var option of this.specification.options)
n@1170 1122 {
n@1170 1123 if (option.name == obj.name)
n@1170 1124 {
n@1170 1125 obj.input.checked = true;
n@1170 1126 break;
n@1170 1127 }
n@1170 1128 }
n@1170 1129 if (parent.id != "setup") {
n@1170 1130 var node = convert.interfaceDOM.children[0].attributes.find(obj.findNode,obj);
n@1170 1131 if (node.input.checked) {
n@1170 1132 obj.input.checked = false;
n@1170 1133 obj.input.disable = true;
n@1170 1134 }
n@1170 1135 }
n@1170 1136 var text = document.createElement('span');
n@1170 1137 text.textContent = checkText.children[i].textContent;
n@1170 1138 obj.root.appendChild(text);
n@1170 1139 checks.attributeDOM.appendChild(obj.root);
n@1170 1140 checks.attributes.push(obj);
n@1170 1141 }
n@1170 1142 this.children.push(checks);
n@1170 1143 this.childrenDOM.appendChild(checks.rootDOM);
n@1170 1144
n@1170 1145 var show = this.parent.createGeneralNodeDOM("Show","setup-interface-show",this);
n@1170 1146 interfaceName = popupStateNodes.state[1].select.value;
n@1170 1147 checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("show")[0];
n@1170 1148 testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
n@1170 1149 interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(testXML.getAttribute("interface"))[0].getAllElementsByTagName("show")[0];
n@1170 1150 testXML = testXML.getAllElementsByTagName("show");
n@1170 1151 for (var i=0; i<interfaceXML.children.length; i++)
n@1170 1152 {
n@1170 1153 var obj = new this.createIOasAttr(interfaceXML.children[i].getAttribute("name"),this.specification,this,"show");
n@1170 1154 for (var option of this.specification.options)
n@1170 1155 {
n@1170 1156 if (option.name == obj.name)
n@1170 1157 {
n@1170 1158 obj.input.checked = true;
n@1170 1159 break;
n@1170 1160 }
n@1170 1161 }
n@1170 1162 if (parent.id != "setup") {
n@1170 1163 var node = convert.interfaceDOM.children[0].attributes.find(obj.findNode,obj);
n@1170 1164 if (node.input.checked) {
n@1170 1165 obj.input.checked = false;
n@1170 1166 obj.input.disable = true;
n@1170 1167 }
n@1170 1168 }
n@1170 1169 var text = document.createElement('span');
n@1170 1170 text.textContent = checkText.children[i].textContent;
n@1170 1171 obj.root.appendChild(text);
n@1170 1172 show.attributeDOM.appendChild(obj.root);
n@1170 1173 show.attributes.push(obj);
n@1170 1174 }
n@1170 1175 this.children.push(show);
n@1170 1176 this.childrenDOM.appendChild(show.rootDOM);
n@1170 1177
n@1170 1178 if (parent.id == "setup")
n@1170 1179 {
n@1170 1180 } else {
n@1170 1181 var nameAttr = this.parent.convertAttributeToDOM(this,specification.schema.getAllElementsByName("name")[0]);
n@1170 1182 this.attributeDOM.appendChild(nameAttr.holder);
n@1170 1183 this.attributes.push(nameAttr);
n@1170 1184 }
n@1170 1185 if (parent != undefined)
n@1170 1186 {
n@1170 1187 parent.appendChild(this.rootDOM);
n@1170 1188 }
n@1170 1189 }
n@1170 1190 }
n@1170 1191
n@1170 1192 this.surveyNode = function(parent,rootObject,location)
n@1170 1193 {
n@1170 1194 this.rootDOM = document.createElement("div");
n@1170 1195 this.titleDOM = document.createElement("span");
n@1170 1196 this.attributeDOM = document.createElement("div");
n@1170 1197 this.attributes = [];
n@1170 1198 this.childrenDOM = document.createElement("div");
n@1170 1199 this.children = [];
n@1170 1200 this.buttonDOM = document.createElement("div");
n@1170 1201 this.parent = parent;
n@1170 1202 this.specification = rootObject;
n@1170 1203 this.schema = specification.schema.getAllElementsByName("survey")[1];
n@1170 1204 this.rootDOM.className = "node";
n@1170 1205
n@1170 1206 var titleDiv = document.createElement('div');
n@1170 1207 titleDiv.className = "node-title";
n@1170 1208 this.titleDOM.className = "node-title";
n@1170 1209 this.titleDOM.textContent = "Survey";
n@1170 1210 titleDiv.appendChild(this.titleDOM);
n@1170 1211
n@1170 1212 this.attributeDOM.className = "node-attributes";
n@1170 1213 var locationAttr = document.createElement("span");
n@1170 1214 this.attributeDOM.appendChild(locationAttr);
n@1170 1215 if (location == "Pre" || location == "pre") {
n@1170 1216 locationAttr.textContent = "Location: Before";
n@1170 1217 } else {
n@1170 1218 locationAttr.textContent = "Location: After";
n@1170 1219 }
n@1170 1220 this.childrenDOM.className = "node-children";
n@1170 1221 this.buttonDOM.className = "node-buttons";
n@1170 1222
n@1170 1223 this.rootDOM.appendChild(titleDiv);
n@1170 1224 this.rootDOM.appendChild(this.attributeDOM);
n@1170 1225 this.rootDOM.appendChild(this.childrenDOM);
n@1170 1226 this.rootDOM.appendChild(this.buttonDOM);
n@1170 1227
n@1170 1228 this.surveyEntryNode = function(parent,rootObject)
n@1170 1229 {
n@1170 1230 this.rootDOM = document.createElement("div");
n@1170 1231 this.titleDOM = document.createElement("span");
n@1170 1232 this.attributeDOM = document.createElement("div");
n@1170 1233 this.attributes = [];
n@1170 1234 this.childrenDOM = document.createElement("div");
n@1170 1235 this.children = [];
n@1170 1236 this.buttonDOM = document.createElement("div");
n@1170 1237 this.parent = parent;
n@1170 1238 this.specification = rootObject;
n@1170 1239 this.schema = specification.schema.getAllElementsByName("surveyentry")[1];
n@1170 1240
n@1170 1241 this.rootDOM.id = id;
n@1170 1242 this.rootDOM.className = "node";
n@1170 1243 this.rootDOM.style.minWidth = "50%";
n@1170 1244
n@1170 1245 var titleDiv = document.createElement('div');
n@1170 1246 titleDiv.className = "node-title";
n@1170 1247 this.titleDOM.className = "node-title";
n@1170 1248 titleDiv.appendChild(this.titleDOM);
n@1170 1249
n@1170 1250 this.attributeDOM.className = "node-attributes";
n@1170 1251 this.childrenDOM.className = "node-children";
n@1170 1252 this.buttonDOM.className = "node-buttons";
n@1170 1253
n@1170 1254 this.rootDOM.appendChild(titleDiv);
n@1170 1255 this.rootDOM.appendChild(this.attributeDOM);
n@1170 1256 this.rootDOM.appendChild(this.childrenDOM);
n@1170 1257 this.rootDOM.appendChild(this.buttonDOM);
n@1170 1258
n@1170 1259 var statement = {};
n@1170 1260 statement.rootDOM = document.createElement("div");
n@1170 1261 statement.titleDOM = document.createElement("span");
n@1170 1262 statement.titleDOM.textContent = "Statement/Question";
n@1170 1263 statement.input = document.createElement("textarea");
n@1170 1264 statement.input.value = this.specification.statement;
n@1170 1265 statement.specification = this.specification;
n@1170 1266 statement.handleEvent = function() {
n@1170 1267 this.specification.statement = this.input.value;
n@1170 1268 }
n@1170 1269 statement.input.addEventListener("change",statement,false);
n@1170 1270 statement.rootDOM.appendChild(statement.titleDOM);
n@1170 1271 statement.rootDOM.appendChild(statement.input);
n@1170 1272 this.children.push(statement);
n@1170 1273 this.childrenDOM.appendChild(statement.rootDOM);
n@1170 1274 switch(this.specification.type)
n@1170 1275 {
n@1170 1276 case "statement":
n@1170 1277 this.titleDOM.textContent = "Statement";
n@1170 1278 this.rootDOM.removeChild(this.attributeDOM);
n@1170 1279 break;
n@1170 1280 case "question":
n@1170 1281 var id = convert.convertAttributeToDOM(this.specification.id,specification.schema.getAllElementsByName("id")[0]);
n@1170 1282 var mandatory = convert.convertAttributeToDOM(this.specification.mandatory,specification.schema.getAllElementsByName("id")[0]);
n@1170 1283 var boxsize = convert.convertAttributeToDOM(this.specification.mandatory,specification.schema.getAllElementsByName("boxsize")[0]);
n@1170 1284 break;
n@1170 1285 }
n@1170 1286
n@1170 1287 this.editNode = {
n@1170 1288 root: document.createElement("button"),
n@1170 1289 parent: this,
n@1170 1290 handleEvent: function()
n@1170 1291 {
n@1170 1292 popupObject.show();
n@1170 1293 popupStateNodes.state[5].generate(this,this.parent);
n@1170 1294 popupObject.postNode(popupStateNodes.state[5]);
n@1170 1295 }
n@1170 1296 }
n@1170 1297 this.editNode.root.textContent = "Edit Entry";
n@1170 1298 this.editNode.root.addEventListener("click",this.editNode,false);
n@1170 1299 this.buttonDOM.appendChild(this.editNode.root);
n@1170 1300
n@1170 1301 this.deleteNode = {
n@1170 1302 root: document.createElement("button"),
n@1170 1303 parent: this,
n@1170 1304 handleEvent: function()
n@1170 1305 {
n@1170 1306 var optionList = this.parent.parent.specification.options;
n@1170 1307 var childList = this.parent.parent.children;
n@1170 1308 for (var i=0; i <this.parent.parent.specification.options.length; i++)
n@1170 1309 {
n@1170 1310 var option = this.parent.parent.specification.options[i];
n@1170 1311 if (option == this.parent.specification)
n@1170 1312 {
n@1170 1313 this.parent.parent.childrenDOM.removeChild(this.parent.rootDOM);
n@1170 1314 if (i == this.parent.parent.specification.options.length-1)
n@1170 1315 {
n@1170 1316 optionList = optionList.slice(0,i);
n@1170 1317 childList = childList.slice(0,i);
n@1170 1318 }
n@1170 1319 else {
n@1170 1320 optionList = optionList.slice(0,i).concat(optionList.slice(i+1));
n@1170 1321 childList = childList.slice(0,i).concat(childList.slice(i+1));
n@1170 1322 }
n@1170 1323 this.parent.parent.specification.options = optionList;
n@1170 1324 this.parent.parent.children = childList;
n@1170 1325 }
n@1170 1326 }
n@1170 1327 }
n@1170 1328 }
n@1170 1329 this.deleteNode.root.textContent = "Delete Entry";
n@1170 1330 this.deleteNode.root.addEventListener("click",this.deleteNode,false);
n@1170 1331 this.buttonDOM.appendChild(this.deleteNode.root);
n@1170 1332 }
n@1170 1333 this.addNode = {
n@1170 1334 root: document.createElement("button"),
n@1170 1335 parent: this,
n@1170 1336 handleEvent: function()
n@1170 1337 {
n@1170 1338 var newNode = new this.parent.specification.OptionNode();
n@1170 1339 this.parent.specification.options.push(newNode);
n@1170 1340 popupObject.show();
n@1170 1341 popupStateNodes.state[5].generate(newNode,this.parent);
n@1170 1342 popupObject.postNode(popupStateNodes.state[5]);
n@1170 1343 }
n@1170 1344 }
n@1170 1345 this.addNode.root.textContent = "Add Survey Entry";
n@1170 1346 this.addNode.root.addEventListener("click",this.addNode,false);
n@1170 1347 this.buttonDOM.appendChild(this.addNode.root);
n@1170 1348
n@1170 1349 for (var option of this.specification.options)
n@1170 1350 {
n@1170 1351 var newNode = new this.surveyEntryNode(this,option);
n@1170 1352 this.children.push(newNode);
n@1170 1353 this.childrenDOM.appendChild(newNode.rootDOM);
n@1170 1354 }
n@1170 1355 }
n@1170 1356
n@1170 1357 this.pageNode = function(parent,rootObject)
n@1170 1358 {
n@1170 1359 this.rootDOM = document.createElement("div");
n@1170 1360 this.titleDOM = document.createElement("span");
n@1170 1361 this.attributeDOM = document.createElement("div");
n@1170 1362 this.attributes = [];
n@1170 1363 this.childrenDOM = document.createElement("div");
n@1170 1364 this.children = [];
n@1170 1365 this.buttonDOM = document.createElement("div");
n@1170 1366 this.parent = parent;
n@1170 1367 this.specification = rootObject;
n@1170 1368 this.schema = specification.schema.getAllElementsByName("page")[0];
n@1170 1369 this.rootDOM.className = "node";
n@1170 1370
n@1170 1371 var titleDiv = document.createElement('div');
n@1170 1372 titleDiv.className = "node-title";
n@1170 1373 this.titleDOM.className = "node-title";
n@1170 1374 this.titleDOM.textContent = "Test Page";
n@1170 1375 titleDiv.appendChild(this.titleDOM);
n@1170 1376
n@1170 1377 this.attributeDOM.className = "node-attributes";
n@1170 1378 this.childrenDOM.className = "node-children";
n@1170 1379 this.buttonDOM.className = "node-buttons";
n@1170 1380
n@1170 1381 this.rootDOM.appendChild(titleDiv);
n@1170 1382 this.rootDOM.appendChild(this.attributeDOM);
n@1170 1383 this.rootDOM.appendChild(this.childrenDOM);
n@1170 1384 this.rootDOM.appendChild(this.buttonDOM);
n@1170 1385
n@1170 1386 // Do the comment prefix node
n@1170 1387 var cpn = this.parent.createGeneralNodeDOM("Comment Prefix",""+this.specification.id+"-commentprefix",this.parent);
n@1170 1388 cpn.rootDOM.removeChild(cpn.attributeDOM);
n@1170 1389 var obj = {
n@1170 1390 root: document.createElement("div"),
n@1170 1391 input: document.createElement("input"),
n@1170 1392 parent: this,
n@1170 1393 handleEvent: function()
n@1170 1394 {
n@1170 1395 this.parent.specification.commentBoxPrefix = event.currentTarget.value;
n@1170 1396 }
n@1170 1397 }
n@1170 1398 cpn.children.push(obj);
n@1170 1399 cpn.childrenDOM.appendChild(obj.root);
n@1170 1400 obj.root.appendChild(obj.input);
n@1170 1401 obj.input.addEventListener("change",obj,false);
n@1170 1402 obj.input.value = this.specification.commentBoxPrefix;
n@1170 1403 this.childrenDOM.appendChild(cpn.rootDOM);
n@1170 1404 this.children.push(cpn);
n@1170 1405
n@1170 1406 // Now both before and after surveys
n@1170 1407 if (this.specification.preTest == undefined){
n@1170 1408 this.specification.preTest = new specification.surveyNode();
n@1170 1409 this.specification.preTest.location = "pre";
n@1170 1410 }
n@1170 1411 if (this.specification.postTest == undefined){
n@1170 1412 this.specification.postTest = new specification.surveyNode();
n@1170 1413 this.specification.postTest.location = "post";
n@1170 1414 }
n@1170 1415 var surveyBefore = new this.parent.surveyNode(this,this.specification.preTest,"Pre");
n@1170 1416 var surveyAfter = new this.parent.surveyNode(this,this.specification.postTest,"Post");
n@1170 1417 this.children.push(surveyBefore);
n@1170 1418 this.children.push(surveyAfter);
n@1170 1419 this.childrenDOM.appendChild(surveyBefore.rootDOM);
n@1170 1420 this.childrenDOM.appendChild(surveyAfter.rootDOM);
n@1170 1421
n@1170 1422 // Build the attributes
n@1170 1423 var attributeList = this.schema.getAllElementsByTagName("xs:attribute");
n@1170 1424 for (var i=0; i<attributeList.length; i++)
n@1170 1425 {
n@1170 1426 var attributeName = attributeList[i].getAttribute('name');
n@1170 1427 var attrObject = this.parent.convertAttributeToDOM(rootObject,attributeList[i]);
n@1170 1428 this.attributeDOM.appendChild(attrObject.holder);
n@1170 1429 this.attributes.push(attrObject);
n@1170 1430 }
n@1170 1431
n@1170 1432 this.interfaces = [];
n@1170 1433
n@1170 1434 this.audioElementNode = function(parent,rootObject)
n@1170 1435 {
n@1170 1436 this.rootDOM = document.createElement("div");
n@1170 1437 this.titleDOM = document.createElement("span");
n@1170 1438 this.attributeDOM = document.createElement("div");
n@1170 1439 this.attributes = [];
n@1170 1440 this.childrenDOM = document.createElement("div");
n@1170 1441 this.children = [];
n@1170 1442 this.buttonDOM = document.createElement("div");
n@1170 1443 this.parent = parent;
n@1170 1444 this.specification = rootObject;
n@1170 1445 this.schema = specification.schema.getAllElementsByName("audioelement")[0];
n@1170 1446 this.rootDOM.className = "node";
n@1170 1447
n@1170 1448 var titleDiv = document.createElement('div');
n@1170 1449 titleDiv.className = "node-title";
n@1170 1450 this.titleDOM.className = "node-title";
n@1170 1451 this.titleDOM.textContent = "Audio Element";
n@1170 1452 titleDiv.appendChild(this.titleDOM);
n@1170 1453
n@1170 1454 this.attributeDOM.className = "node-attributes";
n@1170 1455 this.childrenDOM.className = "node-children";
n@1170 1456 this.buttonDOM.className = "node-buttons";
n@1170 1457
n@1170 1458 this.rootDOM.appendChild(titleDiv);
n@1170 1459 this.rootDOM.appendChild(this.attributeDOM);
n@1170 1460 this.rootDOM.appendChild(this.childrenDOM);
n@1170 1461 this.rootDOM.appendChild(this.buttonDOM);
n@1170 1462
n@1170 1463 // Build the attributes
n@1170 1464 var attributeList = this.schema.getAllElementsByTagName("xs:attribute");
n@1170 1465 for (var i=0; i<attributeList.length; i++)
n@1170 1466 {
n@1170 1467 var attributeName = attributeList[i].getAttribute('name');
n@1170 1468 var attrObject = this.parent.parent.convertAttributeToDOM(rootObject,attributeList[i]);
n@1170 1469 this.attributeDOM.appendChild(attrObject.holder);
n@1170 1470 this.attributes.push(attrObject);
n@1170 1471 }
n@1170 1472
n@1170 1473 this.deleteNode = {
n@1170 1474 root: document.createElement("button"),
n@1170 1475 parent: this,
n@1170 1476 handleEvent: function()
n@1170 1477 {
n@1170 1478 var i = this.parent.parent.specification.audioElements.findIndex(this.findNode,this);
n@1170 1479 if (i >= 0) {
n@1170 1480 var aeList = this.parent.parent.specification.audioElements;
n@1170 1481 if (i < aeList.length-1) {
n@1170 1482 aeList = aeList.slice(0,i).concat(aeList.slice(i+1));
n@1170 1483 } else {
n@1170 1484 aeList = aeList.slice(0,i);
n@1170 1485 }
n@1170 1486 }
n@1170 1487 i = this.parent.parent.children.findIndex(function(element,index,array){
n@1170 1488 if (element == this.parent)
n@1170 1489 return true;
n@1170 1490 else
n@1170 1491 return false;
n@1170 1492 },this);
n@1170 1493 if (i >= 0) {
n@1170 1494 var childList = this.parent.children;
n@1170 1495 if (i < aeList.length-1) {
n@1170 1496 childList = childList.slice(0,i).concat(childList.slice(i+1));
n@1170 1497 } else {
n@1170 1498 childList = childList.slice(0,i);
n@1170 1499 }
n@1170 1500 this.parent.parent.childrenDOM.removeChild(this.parent.rootDOM);
n@1170 1501 }
n@1170 1502 },
n@1170 1503 findNode: function(element,index,array){
n@1170 1504 if (element == this.parent.specification)
n@1170 1505 return true;
n@1170 1506 else
n@1170 1507 return false;
n@1170 1508 }
n@1170 1509 }
n@1170 1510 this.deleteNode.root.textContent = "Delete Entry";
n@1170 1511 this.deleteNode.root.addEventListener("click",this.deleteNode,false);
n@1170 1512 this.buttonDOM.appendChild(this.deleteNode.root);
n@1170 1513 }
n@1170 1514
n@1170 1515 this.commentQuestionNode = function(parent,rootObject)
n@1170 1516 {
n@1170 1517 this.rootDOM = document.createElement("div");
n@1170 1518 this.titleDOM = document.createElement("span");
n@1170 1519 this.attributeDOM = document.createElement("div");
n@1170 1520 this.attributes = [];
n@1170 1521 this.childrenDOM = document.createElement("div");
n@1170 1522 this.children = [];
n@1170 1523 this.buttonDOM = document.createElement("div");
n@1170 1524 this.parent = parent;
n@1170 1525 this.specification = rootObject;
n@1170 1526 this.schema = specification.schema.getAllElementsByName("page")[0];
n@1170 1527 this.rootDOM.className = "node";
n@1170 1528
n@1170 1529 var titleDiv = document.createElement('div');
n@1170 1530 titleDiv.className = "node-title";
n@1170 1531 this.titleDOM.className = "node-title";
n@1170 1532 this.titleDOM.textContent = "Test Page";
n@1170 1533 titleDiv.appendChild(this.titleDOM);
n@1170 1534
n@1170 1535 this.attributeDOM.className = "node-attributes";
n@1170 1536 this.childrenDOM.className = "node-children";
n@1170 1537 this.buttonDOM.className = "node-buttons";
n@1170 1538
n@1170 1539 this.rootDOM.appendChild(titleDiv);
n@1170 1540 this.rootDOM.appendChild(this.attributeDOM);
n@1170 1541 this.rootDOM.appendChild(this.childrenDOM);
n@1170 1542 this.rootDOM.appendChild(this.buttonDOM);
n@1170 1543
n@1170 1544 }
n@1170 1545
n@1170 1546 this.addInterface = {
n@1170 1547 root: document.createElement("button"),
n@1170 1548 parent: this,
n@1170 1549 handleEvent: function() {
n@1170 1550 var InterfaceObj = new specification.interfaceNode();
n@1170 1551 var newInterface = new this.parent.parent.interfaceNode(this.parent.parent,InterfaceObj);
n@1170 1552 newInterface.build("Interface",""+this.parent.specification.id+"-interface",this.parent.childrenDOM);
n@1170 1553 this.parent.children.push(newInterface);
n@1170 1554 this.parent.specification.interfaces.push(InterfaceObj);
n@1170 1555 this.parent.interfaces.push(newInterface);
n@1170 1556 }
n@1170 1557 }
n@1170 1558 this.addInterface.root.textContent = "Add Interface";
n@1170 1559 this.addInterface.root.addEventListener("click",this.addInterface,false);
n@1170 1560 this.buttonDOM.appendChild(this.addInterface.root);
n@1170 1561
n@1170 1562 this.addAudioElement = {
n@1170 1563 root: document.createElement("button"),
n@1170 1564 parent: this,
n@1170 1565 handleEvent: function() {
n@1170 1566 var audioElementObject = new this.parent.specification.audioElementNode();
n@1170 1567 var audioElementDOM = new this.parent.audioElementNode(this.parent,audioElementObject);
n@1170 1568 this.parent.specification.audioElements.push(audioElementObject);
n@1170 1569 this.parent.children.push(audioElementDOM);
n@1170 1570 this.parent.childrenDOM.appendChild(audioElementDOM.rootDOM);
n@1170 1571 }
n@1170 1572 }
n@1170 1573 this.addAudioElement.root.textContent = "Add Audio Element";
n@1170 1574 this.addAudioElement.root.addEventListener("click",this.addAudioElement,false);
n@1170 1575 this.buttonDOM.appendChild(this.addAudioElement.root);
n@1170 1576 }
n@1170 1577 }