comparison test_create/test_core.js @ 1841:e9c5646739c0

Bug #1588 Fixed.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 22 Feb 2016 14:06:37 +0000
parents 616c602a6a6e
children 5e2e3becc292
comparison
equal deleted inserted replaced
1840:658af90cb1c5 1841:e9c5646739c0
134 this.popupContent.id = "popup-content"; 134 this.popupContent.id = "popup-content";
135 this.object.appendChild(this.popupContent); 135 this.object.appendChild(this.popupContent);
136 136
137 this.proceedButton = document.createElement("button"); 137 this.proceedButton = document.createElement("button");
138 this.proceedButton.id = "popup-proceed"; 138 this.proceedButton.id = "popup-proceed";
139 this.proceedButton.className = "popup-button";
139 this.proceedButton.textContent = "Next"; 140 this.proceedButton.textContent = "Next";
140 this.proceedButton.onclick = function() 141 this.proceedButton.onclick = function()
141 { 142 {
142 popupObject.popupContent.innerHTML = null; 143 popupObject.popupContent.innerHTML = null;
143 popupObject.shownObject.continue(); 144 popupObject.shownObject.continue();
144 }; 145 };
145 this.object.appendChild(this.proceedButton); 146 this.object.appendChild(this.proceedButton);
146 147
148 this.backButton = document.createElement("button");
149 this.backButton.id = "popup-back";
150 this.backButton.className = "popup-button";
151 this.backButton.textContent = "Back";
152 this.backButton.onclick = function()
153 {
154 popupObject.popupContent.innerHTML = null;
155 popupObject.shownObject.back();
156 };
157 this.object.appendChild(this.backButton);
158
147 this.shownObject; 159 this.shownObject;
148 160
149 this.resize = function() 161 this.resize = function()
150 { 162 {
151 var w = window.innerWidth; 163 var w = window.innerWidth;
156 168
157 this.show = function() 169 this.show = function()
158 { 170 {
159 this.object.style.visibility = "visible"; 171 this.object.style.visibility = "visible";
160 this.blanket.style.visibility = "visible"; 172 this.blanket.style.visibility = "visible";
173 if (typeof this.shownObject.back == "function") {
174 this.backButton.style.visibility = "visible";
175 } else {
176 this.backButton.style.visibility = "hidden";
177 }
161 } 178 }
162 179
163 this.hide = function() 180 this.hide = function()
164 { 181 {
165 this.object.style.visibility = "hidden"; 182 this.object.style.visibility = "hidden";
166 this.blanket.style.visibility = "hidden"; 183 this.blanket.style.visibility = "hidden";
184 this.backButton.style.visibility = "hidden";
167 } 185 }
168 186
169 this.postNode = function(postObject) 187 this.postNode = function(postObject)
170 { 188 {
171 this.show();
172 //Passed object must have the following: 189 //Passed object must have the following:
173 // Title: text to show in the title 190 // Title: text to show in the title
174 // Content: HTML DOM to show on the page 191 // Content: HTML DOM to show on the page
175 // On complete this HTML DOM is destroyed so make sure it is referenced elsewhere for processing 192 // On complete this HTML DOM is destroyed so make sure it is referenced elsewhere for processing
176 this.titleDOM.textContent = postObject.title; 193 this.titleDOM.textContent = postObject.title;
177 this.popupContent.appendChild(postObject.content); 194 this.popupContent.appendChild(postObject.content);
178 this.shownObject = postObject; 195 this.shownObject = postObject;
196 if (typeof this.shownObject.back == "function") {
197 this.backButton.style.visibility = "visible";
198 } else {
199 this.backButton.style.visibility = "hidden";
200 }
201 this.show();
179 } 202 }
180 203
181 this.resize(); 204 this.resize();
182 this.hide(); 205 this.hide();
183 }; 206 };
257 this.content.appendChild(this.select); 280 this.content.appendChild(this.select);
258 this.continue = function() 281 this.continue = function()
259 { 282 {
260 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(this.select.value)[0]; 283 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(this.select.value)[0];
261 specification.interface = testXML.getAttribute("interface"); 284 specification.interface = testXML.getAttribute("interface");
285 if (specification.interfaces == null)
286 {
287 specification.interfaces = new specification.interfaceNode();
288 }
289 if (specification.metrics == null) {
290 specification.metrics = new specification.metricNode();
291 }
262 popupStateNodes.state[2].generate(); 292 popupStateNodes.state[2].generate();
263 popupObject.postNode(popupStateNodes.state[2]); 293 popupObject.postNode(popupStateNodes.state[2]);
294 }
295 this.back = function() {
296 popupObject.postNode(popupStateNodes.state[0]);
264 } 297 }
265 } 298 }
266 this.state[2] = new function() 299 this.state[2] = new function()
267 { 300 {
268 this.title = "Test Checks & Restrictions"; 301 this.title = "Test Checks & Restrictions";
275 this.content.appendChild(spnH); 308 this.content.appendChild(spnH);
276 var holder = document.createElement("div"); 309 var holder = document.createElement("div");
277 this.options = []; 310 this.options = [];
278 this.testXML = null; 311 this.testXML = null;
279 this.interfaceXML = null; 312 this.interfaceXML = null;
313 this.dynamicContent = document.createElement("div");
314 this.content.appendChild(this.dynamicContent);
280 this.generate = function() 315 this.generate = function()
281 { 316 {
317 this.options = [];
318 this.dynamicContent.innerHTML = null;
282 var interfaceName = popupStateNodes.state[1].select.value; 319 var interfaceName = popupStateNodes.state[1].select.value;
283 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("checks")[0]; 320 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("checks")[0];
284 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0]; 321 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
285 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("checks")[0]; 322 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("checks")[0];
286 this.testXML = this.testXML.getAllElementsByTagName("checks"); 323 this.testXML = this.testXML.getAllElementsByTagName("checks");
295 if(testNode.length != 0) {testNode = testNode[0];} 332 if(testNode.length != 0) {testNode = testNode[0];}
296 else {testNode = undefined;} 333 else {testNode = undefined;}
297 } else { 334 } else {
298 testNode = undefined; 335 testNode = undefined;
299 } 336 }
300 var optH = document.createElement('div'); 337 var obj = {
301 optH.className = "popup-checkbox"; 338 root: document.createElement("div"),
302 var checkbox = document.createElement('input'); 339 text: document.createElement("span"),
303 checkbox.type = "checkbox"; 340 input: document.createElement("input"),
304 var text = document.createElement('span'); 341 parent: this,
305 checkbox.setAttribute('name',checkName); 342 name: checkName,
306 if (interfaceNode.getAttribute('default') == 'on') 343 handleEvent: function(event) {
307 { 344 if (this.input.checked) {
308 checkbox.checked = true; 345 // Add to specification.interfaces.option
309 } 346 var included = specification.interfaces.options.find(function(element,index,array){
310 if (interfaceNode.getAttribute('support') == "none") 347 if (element.name == this.name) {return true;} else {return false;}
311 { 348 },this);
312 checkbox.disabled = true; 349 if (included == null) {
313 checkbox.checked = false; 350 specification.interfaces.options.push({type:"check",name:this.name});
314 optH.className = "popup-checkbox disabled"; 351 }
315 } else if (interfaceNode.getAttribute('support') == "mandatory") 352 } else {
316 { 353 // Remove from specification.interfaces.option
317 checkbox.disabled = true; 354 var position = specification.interfaces.options.findIndex(function(element,index,array){
318 checkbox.checked = true; 355 if (element.name == this.name) {return true;} else {return false;}
319 optH.className = "popup-checkbox disabled"; 356 },this);
320 } 357 if (position >= 0) {
358 specification.interfaces.options.splice(position,1);
359 }
360 }
361 }
362 }
363
364 obj.input.addEventListener("click",obj);
365 obj.root.className = "popup-checkbox";
366 obj.input.type = "checkbox";
367 obj.input.setAttribute('name',checkName);
368 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
369 obj.root.appendChild(obj.input);
370 obj.root.appendChild(obj.text);
321 if(testNode != undefined) 371 if(testNode != undefined)
322 { 372 {
373 if (testNode.getAttribute('default') == 'on')
374 {
375 obj.input.checked = true;
376 }
377 if (testNode.getAttribute('support') == "none")
378 {
379 obj.input.disabled = true;
380 obj.input.checked = false;
381 obj.root.className = "popup-checkbox disabled";
382 }else if (interfaceNode.getAttribute('support') == "mandatory")
383 {
384 obj.input.disabled = true;
385 obj.input.checked = true;
386 obj.root.className = "popup-checkbox disabled";
387 }
388 } else {
323 if (interfaceNode.getAttribute('default') == 'on') 389 if (interfaceNode.getAttribute('default') == 'on')
324 { 390 {
325 checkbox.checked = true; 391 obj.input.checked = true;
326 } 392 }
327 if (testNode.getAttribute('support') == "none") 393 if (interfaceNode.getAttribute('support') == "none")
328 { 394 {
329 checkbox.disabled = true; 395 obj.input.disabled = true;
330 checkbox.checked = false; 396 obj.input.checked = false;
331 optH.className = "popup-checkbox disabled"; 397 obj.root.className = "popup-checkbox disabled";
332 }else if (interfaceNode.getAttribute('support') == "mandatory") 398 } else if (interfaceNode.getAttribute('support') == "mandatory")
333 { 399 {
334 checkbox.disabled = true; 400 obj.input.disabled = true;
335 checkbox.checked = true; 401 obj.input.checked = true;
336 optH.className = "popup-checkbox disabled"; 402 obj.root.className = "popup-checkbox disabled";
337 } 403 }
338 } 404 }
339 text.textContent = popupStateNodes.state[2].checkText.getAllElementsByName(checkName)[0].textContent; 405 var included = specification.interfaces.options.find(function(element,index,array){
340 optH.appendChild(checkbox); 406 if (element.name == this.name) {return true;} else {return false;}
341 optH.appendChild(text); 407 },obj);
342 this.options.push(optH); 408 if (included != undefined) {
343 this.content.appendChild(optH); 409 obj.input.checked = true;
410 }
411 obj.handleEvent();
412 this.options.push(obj);
413 this.dynamicContent.appendChild(obj.root);
344 } 414 }
345 } 415 }
346 this.continue = function() 416 this.continue = function()
347 { 417 {
348 if (specification.interfaces == null)
349 {
350 specification.interfaces = new specification.interfaceNode();
351 }
352 for (var object of this.options)
353 {
354 var checkbox = object.children[0];
355 if (checkbox.checked)
356 {
357 var option = {
358 type: "check",
359 name: checkbox.getAttribute('name')
360 };
361 specification.interfaces.options.push(option);
362 }
363 }
364 popupStateNodes.state[3].generate(); 418 popupStateNodes.state[3].generate();
365 popupObject.postNode(popupStateNodes.state[3]); 419 popupObject.postNode(popupStateNodes.state[3]);
420 }
421 this.back = function() {
422 popupObject.postNode(popupStateNodes.state[1]);
366 } 423 }
367 } 424 }
368 this.state[3] = new function() 425 this.state[3] = new function()
369 { 426 {
370 this.title = "Test Metrics"; 427 this.title = "Test Metrics";
377 this.content.appendChild(spnH); 434 this.content.appendChild(spnH);
378 this.options = []; 435 this.options = [];
379 this.checkText; 436 this.checkText;
380 this.testXML; 437 this.testXML;
381 this.interfaceXML; 438 this.interfaceXML;
439 this.dynamicContent = document.createElement("div");
440 this.content.appendChild(this.dynamicContent);
382 this.generate = function() 441 this.generate = function()
383 { 442 {
443 this.options = [];
444 this.dynamicContent.innerHTML = null;
384 var interfaceName = popupStateNodes.state[1].select.value; 445 var interfaceName = popupStateNodes.state[1].select.value;
385 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("metrics")[0]; 446 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("metrics")[0];
386 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0]; 447 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
387 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("metrics")[0]; 448 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("metrics")[0];
388 this.testXML = this.testXML.getAllElementsByTagName("metrics"); 449 this.testXML = this.testXML.getAllElementsByTagName("metrics");
397 if(testNode.length != 0) {testNode = testNode[0];} 458 if(testNode.length != 0) {testNode = testNode[0];}
398 else {testNode = undefined;} 459 else {testNode = undefined;}
399 } else { 460 } else {
400 testNode = undefined; 461 testNode = undefined;
401 } 462 }
402 var optH = document.createElement('div'); 463 var obj = {
403 optH.className = "popup-checkbox"; 464 root: document.createElement("div"),
404 var checkbox = document.createElement('input'); 465 text: document.createElement("span"),
405 checkbox.type = "checkbox"; 466 input: document.createElement("input"),
406 var text = document.createElement('span'); 467 parent: this,
407 checkbox.setAttribute('name',checkName); 468 name: checkName,
408 if (interfaceNode.getAttribute('default') == 'on') 469 handleEvent: function(event) {
409 { 470 if (this.input.checked) {
410 checkbox.checked = true; 471 // Add to specification.interfaces.option
411 } 472 var included = specification.metrics.enabled.find(function(element,index,array){
412 if (interfaceNode.getAttribute('support') == "none") 473 if (element == this.name) {return true;} else {return false;}
413 { 474 },this);
414 checkbox.disabled = true; 475 if (included == null) {
415 checkbox.checked = false; 476 specification.metrics.enabled.push(this.name);
416 optH.className = "popup-checkbox disabled"; 477 }
417 } else if (interfaceNode.getAttribute('support') == "mandatory") 478 } else {
418 { 479 // Remove from specification.interfaces.option
419 checkbox.disabled = true; 480 var position = specification.metrics.enabled.findIndex(function(element,index,array){
420 checkbox.checked = true; 481 if (element == this.name) {return true;} else {return false;}
421 optH.className = "popup-checkbox disabled"; 482 },this);
422 } 483 if (position >= 0) {
484 specification.metrics.enabled.splice(position,1);
485 }
486 }
487 }
488 }
489
490 obj.input.addEventListener("click",obj);
491 obj.root.className = "popup-checkbox";
492 obj.input.type = "checkbox";
493 obj.input.setAttribute('name',checkName);
494 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
495 obj.root.appendChild(obj.input);
496 obj.root.appendChild(obj.text);
423 if(testNode != undefined) 497 if(testNode != undefined)
424 { 498 {
499 if (testNode.getAttribute('default') == 'on')
500 {
501 obj.input.checked = true;
502 }
503 if (testNode.getAttribute('support') == "none")
504 {
505 obj.input.disabled = true;
506 obj.input.checked = false;
507 obj.root.className = "popup-checkbox disabled";
508 }else if (interfaceNode.getAttribute('support') == "mandatory")
509 {
510 obj.input.disabled = true;
511 obj.input.checked = true;
512 obj.root.className = "popup-checkbox disabled";
513 }
514 } else {
425 if (interfaceNode.getAttribute('default') == 'on') 515 if (interfaceNode.getAttribute('default') == 'on')
426 { 516 {
427 checkbox.checked = true; 517 obj.input.checked = true;
428 } 518 }
429 if (testNode.getAttribute('support') == "none") 519 if (interfaceNode.getAttribute('support') == "none")
430 { 520 {
431 checkbox.disabled = true; 521 obj.input.disabled = true;
432 checkbox.checked = false; 522 obj.input.checked = false;
433 optH.className = "popup-checkbox disabled"; 523 obj.root.className = "popup-checkbox disabled";
434 }else if (interfaceNode.getAttribute('support') == "mandatory") 524 } else if (interfaceNode.getAttribute('support') == "mandatory")
435 { 525 {
436 checkbox.disabled = true; 526 obj.input.disabled = true;
437 checkbox.checked = true; 527 obj.input.checked = true;
438 optH.className = "popup-checkbox disabled"; 528 obj.root.className = "popup-checkbox disabled";
439 } 529 }
440 } 530 }
441 text.textContent = popupStateNodes.state[3].checkText.getAllElementsByName(checkName)[0].textContent; 531 var included = specification.metrics.enabled.find(function(element,index,array){
442 optH.appendChild(checkbox); 532 if (element == this.name) {return true;} else {return false;}
443 optH.appendChild(text); 533 },obj);
444 this.options.push(optH); 534 obj.handleEvent();
445 this.content.appendChild(optH); 535 if (included != undefined) {
536 obj.input.checked = true;
537 }
538 this.options.push(obj);
539 this.dynamicContent.appendChild(obj.root);
446 } 540 }
447 } 541 }
448 this.continue = function() 542 this.continue = function()
449 { 543 {
450 if (specification.metrics == null) {
451 specification.metrics = new specification.metricNode();
452 }
453 for (var object of this.options)
454 {
455 var checkbox = object.children[0];
456 if (checkbox.checked)
457 {
458 specification.metrics.enabled.push(checkbox.getAttribute('name'));
459 }
460 }
461 popupStateNodes.state[4].generate(); 544 popupStateNodes.state[4].generate();
462 popupObject.postNode(popupStateNodes.state[4]); 545 popupObject.postNode(popupStateNodes.state[4]);
546 }
547 this.back = function() {
548 popupObject.postNode(popupStateNodes.state[2]);
463 } 549 }
464 } 550 }
465 this.state[4] = new function() 551 this.state[4] = new function()
466 { 552 {
467 this.title = "Test Visuals"; 553 this.title = "Test Visuals";
474 this.content.appendChild(spnH); 560 this.content.appendChild(spnH);
475 this.options = []; 561 this.options = [];
476 this.checkText; 562 this.checkText;
477 this.testXML; 563 this.testXML;
478 this.interfaceXML; 564 this.interfaceXML;
565 this.dynamicContent = document.createElement("div");
566 this.content.appendChild(this.dynamicContent);
479 this.generate = function() 567 this.generate = function()
480 { 568 {
569 this.options = [];
570 this.dynamicContent.innerHTML = null;
481 var interfaceName = popupStateNodes.state[1].select.value; 571 var interfaceName = popupStateNodes.state[1].select.value;
482 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("show")[0]; 572 this.checkText = interfaceSpecs.getElementsByTagName("global")[0].getAllElementsByTagName("show")[0];
483 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0]; 573 this.testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(interfaceName)[0];
484 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("show")[0]; 574 this.interfaceXML = interfaceSpecs.getAllElementsByTagName("interfaces")[0].getAllElementsByName(this.testXML.getAttribute("interface"))[0].getAllElementsByTagName("show")[0];
485 this.testXML = this.testXML.getAllElementsByTagName("metrics"); 575 this.testXML = this.testXML.getAllElementsByTagName("show");
486 for (var i=0; i<this.interfaceXML.children.length; i++) 576 for (var i=0; i<this.interfaceXML.children.length; i++)
487 { 577 {
488 var interfaceNode = this.interfaceXML.children[i]; 578 var interfaceNode = this.interfaceXML.children[i];
489 var checkName = interfaceNode.getAttribute('name'); 579 var checkName = interfaceNode.getAttribute('name');
490 var testNode 580 var testNode
494 if(testNode.length != 0) {testNode = testNode[0];} 584 if(testNode.length != 0) {testNode = testNode[0];}
495 else {testNode = undefined;} 585 else {testNode = undefined;}
496 } else { 586 } else {
497 testNode = undefined; 587 testNode = undefined;
498 } 588 }
499 var optH = document.createElement('div'); 589 var obj = {
500 optH.className = "popup-checkbox"; 590 root: document.createElement("div"),
501 var checkbox = document.createElement('input'); 591 text: document.createElement("span"),
502 checkbox.type = "checkbox"; 592 input: document.createElement("input"),
503 var text = document.createElement('span'); 593 parent: this,
504 checkbox.setAttribute('name',checkName); 594 name: checkName,
505 if (interfaceNode.getAttribute('default') == 'on') 595 handleEvent: function(event) {
506 { 596 if (this.input.checked) {
507 checkbox.checked = true; 597 // Add to specification.interfaces.option
508 } 598 var included = specification.interfaces.options.find(function(element,index,array){
509 if (interfaceNode.getAttribute('support') == "none") 599 if (element.name == this.name) {return true;} else {return false;}
510 { 600 },this);
511 checkbox.disabled = true; 601 if (included == null) {
512 checkbox.checked = false; 602 specification.interfaces.options.push({type:"show",name:this.name});
513 optH.className = "popup-checkbox disabled"; 603 }
514 } else if (interfaceNode.getAttribute('support') == "mandatory") 604 } else {
515 { 605 // Remove from specification.interfaces.option
516 checkbox.disabled = true; 606 var position = specification.interfaces.options.findIndex(function(element,index,array){
517 checkbox.checked = true; 607 if (element.name == this.name) {return true;} else {return false;}
518 optH.className = "popup-checkbox disabled"; 608 },this);
519 } 609 if (position >= 0) {
610 specification.interfaces.options.splice(position,1);
611 }
612 }
613 }
614 }
615
616 obj.input.addEventListener("click",obj);
617 obj.root.className = "popup-checkbox";
618 obj.input.type = "checkbox";
619 obj.input.setAttribute('name',checkName);
620 obj.text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent;
621 obj.root.appendChild(obj.input);
622 obj.root.appendChild(obj.text);
520 if(testNode != undefined) 623 if(testNode != undefined)
521 { 624 {
625 if (testNode.getAttribute('default') == 'on')
626 {
627 obj.input.checked = true;
628 }
629 if (testNode.getAttribute('support') == "none")
630 {
631 obj.input.disabled = true;
632 obj.input.checked = false;
633 obj.root.className = "popup-checkbox disabled";
634 }else if (interfaceNode.getAttribute('support') == "mandatory")
635 {
636 obj.input.disabled = true;
637 obj.input.checked = true;
638 obj.root.className = "popup-checkbox disabled";
639 }
640 } else {
522 if (interfaceNode.getAttribute('default') == 'on') 641 if (interfaceNode.getAttribute('default') == 'on')
523 { 642 {
524 checkbox.checked = true; 643 obj.input.checked = true;
525 } 644 }
526 if (testNode.getAttribute('support') == "none") 645 if (interfaceNode.getAttribute('support') == "none")
527 { 646 {
528 checkbox.disabled = true; 647 obj.input.disabled = true;
529 checkbox.checked = false; 648 obj.input.checked = false;
530 optH.className = "popup-checkbox disabled"; 649 obj.root.className = "popup-checkbox disabled";
531 }else if (interfaceNode.getAttribute('support') == "mandatory") 650 } else if (interfaceNode.getAttribute('support') == "mandatory")
532 { 651 {
533 checkbox.disabled = true; 652 obj.input.disabled = true;
534 checkbox.checked = true; 653 obj.input.checked = true;
535 optH.className = "popup-checkbox disabled"; 654 obj.root.className = "popup-checkbox disabled";
536 } 655 }
537 } 656 }
538 text.textContent = this.checkText.getAllElementsByName(checkName)[0].textContent; 657 var included = specification.interfaces.options.find(function(element,index,array){
539 optH.appendChild(checkbox); 658 if (element.name == this.name) {return true;} else {return false;}
540 optH.appendChild(text); 659 },obj);
541 this.options.push(optH); 660 if (included != undefined) {
542 this.content.appendChild(optH); 661 obj.input.checked = true;
662 }
663 obj.handleEvent();
664 this.options.push(obj);
665 this.dynamicContent.appendChild(obj.root);
543 } 666 }
544 } 667 }
545 this.continue = function() 668 this.continue = function()
546 { 669 {
547 if (specification.interfaces == null)
548 {
549 specification.interfaces = new specification.interfaceNode();
550 }
551 for (var object of this.options)
552 {
553 var checkbox = object.children[0];
554 if (checkbox.checked)
555 {
556 var option = {
557 type: "show",
558 name: checkbox.getAttribute('name')
559 };
560 specification.interfaces.options.push(option);
561 }
562 }
563 popupObject.hide(); 670 popupObject.hide();
564 convert.convert(document.getElementById('content')); 671 convert.convert(document.getElementById('content'));
672 }
673 this.back = function() {
674 popupObject.postNode(popupStateNodes.state[3]);
565 } 675 }
566 } 676 }
567 this.state[5] = new function() { 677 this.state[5] = new function() {
568 this.title = "Add/Edit Survey Element"; 678 this.title = "Add/Edit Survey Element";
569 this.content = document.createElement("div"); 679 this.content = document.createElement("div");