comparison core.js @ 1270:aebb9754d491

Fix Bug #1562
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 22 Mar 2016 12:35:48 +0000
parents a7ad6fc6a3b2
children 2dd5f7071e3f
comparison
equal deleted inserted replaced
1269:64ec9c5e9730 1270:aebb9754d491
599 input.type = 'checkbox'; 599 input.type = 'checkbox';
600 var span = document.createElement('span'); 600 var span = document.createElement('span');
601 span.textContent = option.text; 601 span.textContent = option.text;
602 var hold = document.createElement('div'); 602 var hold = document.createElement('div');
603 hold.setAttribute('name','option'); 603 hold.setAttribute('name','option');
604 hold.style.padding = '4px'; 604 hold.className = "popup-option-checbox";
605 hold.appendChild(input); 605 hold.appendChild(input);
606 hold.appendChild(span); 606 hold.appendChild(span);
607 this.popupResponse.appendChild(hold); 607 this.popupResponse.appendChild(hold);
608 if (node.response[index] != undefined){ 608 if (node.response[index] != undefined){
609 if (node.response[index].checked == true) { 609 if (node.response[index].checked == true) {
610 input.checked = "true"; 610 input.checked = "true";
611 } 611 }
612 } 612 }
613 var w = $(span).width(); 613 var w = $(hold).width();
614 if (w > max_w) 614 if (w > max_w)
615 max_w = w; 615 max_w = w;
616 index++; 616 index++;
617 } 617 }
618 max_w += 12;
619 this.popupResponse.style.textAlign=""; 618 this.popupResponse.style.textAlign="";
620 var leftP = ((max_w/500)/2)*100; 619 var leftP = 50-(((max_w/$('#popupContent').width())/2)*100);
621 this.popupResponse.style.left=leftP+"%"; 620 this.popupResponse.style.left=leftP+"%";
622 } else if (node.specification.type == 'radio') { 621 } else if (node.specification.type == 'radio') {
623 if (node.response == undefined) { 622 if (node.response == undefined) {
624 node.response = {name: "", text: ""}; 623 node.response = {name: "", text: ""};
625 } 624 }
632 input.name = node.specification.id; 631 input.name = node.specification.id;
633 var span = document.createElement('span'); 632 var span = document.createElement('span');
634 span.textContent = option.text; 633 span.textContent = option.text;
635 var hold = document.createElement('div'); 634 var hold = document.createElement('div');
636 hold.setAttribute('name','option'); 635 hold.setAttribute('name','option');
637 hold.style.padding = '4px'; 636 hold.className = "popup-option-checbox";
638 hold.appendChild(input); 637 hold.appendChild(input);
639 hold.appendChild(span); 638 hold.appendChild(span);
640 this.popupResponse.appendChild(hold); 639 this.popupResponse.appendChild(hold);
641 if (input.id == node.response.name) { 640 if (input.id == node.response.name) {
642 input.checked = "true"; 641 input.checked = "true";
643 } 642 }
644 var w = $(span).width(); 643 var w = $(hold).width();
645 if (w > max_w) 644 if (w > max_w)
646 max_w = w; 645 max_w = w;
647 } 646 }
648 max_w += 12;
649 this.popupResponse.style.textAlign=""; 647 this.popupResponse.style.textAlign="";
650 var leftP = ((max_w/500)/2)*100; 648 var leftP = 50-(((max_w/$('#popupContent').width())/2)*100);
651 this.popupResponse.style.left=leftP+"%"; 649 this.popupResponse.style.left=leftP+"%";
652 } else if (node.specification.type == 'number') { 650 } else if (node.specification.type == 'number') {
653 var input = document.createElement('input'); 651 var input = document.createElement('input');
654 input.type = 'textarea'; 652 input.type = 'textarea';
655 if (node.min != null) {input.min = node.specification.min;} 653 if (node.min != null) {input.min = node.specification.min;}