comparison test_create/test_create.html @ 827:1db3dd91fb26

Merge again....
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Thu, 26 Nov 2015 09:39:37 +0000
parents 22ad83e232f7 1b6fa37d46a4
children 0920172d9478
comparison
equal deleted inserted replaced
814:22ad83e232f7 827:1db3dd91fb26
1819 }; 1819 };
1820 1820
1821 this.preTest = new this.prepostNode("pretest"); 1821 this.preTest = new this.prepostNode("pretest");
1822 this.postTest = new this.prepostNode("posttest"); 1822 this.postTest = new this.prepostNode("posttest");
1823 } 1823 }
1824
1825 function createDeleteNodeButton(node)
1826 {
1827 var button = document.createElement("button");
1828 button.textContent = "Delete";
1829 button.onclick = function(event)
1830 {
1831 var node = event.target.parentElement;
1832 node.parentElement.removeChild(node);
1833 }
1834 return button;
1835 }
1836
1824 function SpecficationToHTML() 1837 function SpecficationToHTML()
1825 { 1838 {
1826 // Take information from Specification Node and format it into an HTML layout 1839 // Take information from Specification Node and format it into an HTML layout
1827 var destination = document.getElementById("content"); 1840 var destination = document.getElementById("content");
1828 // Setup Header Node 1841 // Setup Header Node
1988 for (var j=0; j<specificationNode.preTest.options.length; j++) 2001 for (var j=0; j<specificationNode.preTest.options.length; j++)
1989 { 2002 {
1990 var node = PPSurveyToHTML(specificationNode.preTest.options[j]); 2003 var node = PPSurveyToHTML(specificationNode.preTest.options[j]);
1991 node.className = "SecondLevel"; 2004 node.className = "SecondLevel";
1992 node.id = preTest.id+"-"+j; 2005 node.id = preTest.id+"-"+j;
2006 node.appendChild(createDeleteNodeButton());
1993 preTest.appendChild(node); 2007 preTest.appendChild(node);
1994 } 2008 }
1995 setupNode.appendChild(preTest); 2009 setupNode.appendChild(preTest);
1996 2010
1997 // Test Session Post Test 2011 // Test Session Post Test
2007 for (var j=0; j<specificationNode.postTest.options.length; j++) 2021 for (var j=0; j<specificationNode.postTest.options.length; j++)
2008 { 2022 {
2009 var node = PPSurveyToHTML(specificationNode.postTest.options[j]); 2023 var node = PPSurveyToHTML(specificationNode.postTest.options[j]);
2010 node.className = "SecondLevel"; 2024 node.className = "SecondLevel";
2011 node.id = postTest.id+"-"+j; 2025 node.id = postTest.id+"-"+j;
2026 node.appendChild(createDeleteNodeButton());
2012 postTest.appendChild(node); 2027 postTest.appendChild(node);
2013 } 2028 }
2014 2029
2015 setupNode.appendChild(postTest); 2030 setupNode.appendChild(postTest);
2016 2031
2022 var aH = specificationNode.audioHolders[i]; 2037 var aH = specificationNode.audioHolders[i];
2023 var aHTML = document.createElement("div"); 2038 var aHTML = document.createElement("div");
2024 aHTML.name = "audioHolder"; 2039 aHTML.name = "audioHolder";
2025 aHTML.id = "audioHolder-"+aH.id; 2040 aHTML.id = "audioHolder-"+aH.id;
2026 aHTML.className = "topLevel"; 2041 aHTML.className = "topLevel";
2042 aHTML.appendChild(createDeleteNodeButton());
2027 destination.appendChild(aHTML); 2043 destination.appendChild(aHTML);
2028 var title = document.createElement("h2"); 2044 var title = document.createElement("h2");
2029 title.textContent = "Audio Holder "+aH.id; 2045 title.textContent = "Audio Holder "+aH.id;
2030 aHTML.appendChild(title); 2046 aHTML.appendChild(title);
2031 var attributes = document.createElement("div"); 2047 var attributes = document.createElement("div");
2097 for (var j=0; j<aH.preTest.options.length; j++) 2113 for (var j=0; j<aH.preTest.options.length; j++)
2098 { 2114 {
2099 var node = PPSurveyToHTML(aH.preTest.options[j]); 2115 var node = PPSurveyToHTML(aH.preTest.options[j]);
2100 node.className = "SecondLevel"; 2116 node.className = "SecondLevel";
2101 node.id = preTest.id+"-"+j; 2117 node.id = preTest.id+"-"+j;
2118 node.appendChild(createDeleteNodeButton());
2102 preTest.appendChild(node); 2119 preTest.appendChild(node);
2103 } 2120 }
2104 2121
2105 aHTML.appendChild(preTest); 2122 aHTML.appendChild(preTest);
2106 2123
2117 for (var j=0; j<aH.postTest.options.length; j++) 2134 for (var j=0; j<aH.postTest.options.length; j++)
2118 { 2135 {
2119 var node = PPSurveyToHTML(aH.postTest.options[j]); 2136 var node = PPSurveyToHTML(aH.postTest.options[j]);
2120 node.className = "SecondLevel"; 2137 node.className = "SecondLevel";
2121 node.id = postTest.id+"-"+j; 2138 node.id = postTest.id+"-"+j;
2139 node.appendChild(createDeleteNodeButton());
2122 postTest.appendChild(node); 2140 postTest.appendChild(node);
2123 } 2141 }
2124 2142
2125 aHTML.appendChild(postTest); 2143 aHTML.appendChild(postTest);
2126 2144
2152 input.value = aH.audioElements[i].url; 2170 input.value = aH.audioElements[i].url;
2153 text.style.margin = "5px"; 2171 text.style.margin = "5px";
2154 input.style.margin = "5px"; 2172 input.style.margin = "5px";
2155 entry.appendChild(text); 2173 entry.appendChild(text);
2156 entry.appendChild(input); 2174 entry.appendChild(input);
2175 entry.appendChild(createDeleteNodeButton());
2157 audioElems.appendChild(entry); 2176 audioElems.appendChild(entry);
2158 } 2177 }
2159
2160 aHTML.appendChild(audioElems); 2178 aHTML.appendChild(audioElems);
2161 } 2179 }
2162 2180
2163 function PPSurveyToHTML(node) 2181 function PPSurveyToHTML(node)
2164 { 2182 {