annotate test_create/test_create.html @ 2022:a5cbc3b851bd

Create_test: Submit button exposes completed XML file.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Wed, 03 Jun 2015 12:15:14 +0100
parents 094b3a72978b
children e103d40537b5
rev   line source
nickjillings@2016 1 <!DOCTYPE html>
nickjillings@2016 2 <html lang="en">
nickjillings@2016 3 <head>
nickjillings@2016 4 <meta charset="utf-8">
nickjillings@2016 5
nickjillings@2016 6 <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
nickjillings@2016 7 Remove this if you use the .htaccess -->
nickjillings@2016 8 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
nickjillings@2016 9
nickjillings@2016 10 <title>WAET Create Test</title>
nickjillings@2016 11 <meta name="description" content="">
nickjillings@2016 12 <meta name="author" content="">
nickjillings@2016 13
nickjillings@2016 14 <meta name="viewport" content="width=device-width; initial-scale=1.0">
nickjillings@1591 15
nickjillings@1591 16 <script type="text/javascript">
nickjillings@1591 17 // To aid 'one-page set-up' all scripts and CSS must be included directly in this file!
nickjillings@1591 18 var topLevel;
nickjillings@1591 19 window.onload = function() {
nickjillings@1591 20 // Initialise page
nickjillings@1591 21 topLevel = document.getElementById('topLevelBody');
nickjillings@1591 22 var setup = document.createElement('div');
nickjillings@1591 23 setup.id = 'setupTagDiv';
nickjillings@1591 24
nickjillings@1591 25 };
nickjillings@1591 26
nickjillings@1594 27 function attributePair(string, type, mandatory){
nickjillings@1591 28 var id = document.createElement("span");
nickjillings@1591 29 id.textContent = string;
nickjillings@1591 30 var input = document.createElement("input");
nickjillings@1591 31 input.type = type;
nickjillings@1594 32 if (type == 'text') {
nickjillings@1594 33 if (mandatory == true) {
nickjillings@1594 34 input.setAttribute('mandatory','true');
nickjillings@1594 35 }
nickjillings@1594 36 else {
nickjillings@1594 37 input.setAttribute('mandatory','false');
nickjillings@1594 38 }
nickjillings@1594 39 }
nickjillings@1591 40 return [id, input];
nickjillings@1591 41 }
nickjillings@1591 42
nickjillings@1592 43 function removeNode(event) {
nickjillings@1592 44 event.srcElement.parentElement.parentElement.removeChild(event.srcElement.parentElement);
nickjillings@1592 45 }
nickjillings@1592 46
nickjillings@1594 47 function buttonClickedValidate() {
nickjillings@1594 48 var ready = validate();
nickjillings@1594 49 if (ready == false) {
nickjillings@1594 50 var errMsg = document.getElementById('errorMessage');
nickjillings@1595 51 errMsg.textContent = "There were some errors with your XML. Any input boxes highlighted in red are invalid because they are empty or because its ID matches another elements ID. Please fill these in correctly. Any boxes which are yellow are not-invalid but will use the default value.";
nickjillings@1594 52 errMsg.style.visibility = 'visible';
nickjillings@1594 53 document.getElementById('createXML').disabled = true;
nickjillings@1594 54
nickjillings@1594 55 } else {
nickjillings@1594 56 var errMsg = document.getElementById('errorMessage');
nickjillings@1594 57 errMsg.textContent = "";
nickjillings@1594 58 errMsg.style.visiblity = 'hidden';
nickjillings@1594 59 document.getElementById('createXML').disabled = false;
nickjillings@1594 60 }
nickjillings@1594 61 }
nickjillings@1594 62
nickjillings@1595 63 function buttonClickedSubmit() {
nickjillings@1595 64 var ready = validate();
nickjillings@1595 65 if (ready == true) {
nickjillings@2022 66 var xmlDoc = buildXML();
nickjillings@2022 67 var inject = document.getElementById('errorMessage');
nickjillings@2022 68 createProjectSave(xmlDoc, inject);
nickjillings@2022 69 }
nickjillings@2022 70 }
nickjillings@2022 71
nickjillings@2022 72 function createProjectSave(xmlDoc, injectPoint) {
nickjillings@2022 73 var parent = document.createElement("div");
nickjillings@2022 74 parent.appendChild(xmlDoc);
nickjillings@2022 75 var file = [parent.innerHTML];
nickjillings@2022 76 var bb = new Blob(file,{type : 'application/xml'});
nickjillings@2022 77 var dnlk = window.URL.createObjectURL(bb);
nickjillings@2022 78 var a = document.createElement("a");
nickjillings@2022 79 a.hidden = '';
nickjillings@2022 80 a.href = dnlk;
nickjillings@2022 81 a.download = "save.xml";
nickjillings@2022 82 a.textContent = "Save File";
nickjillings@2022 83 injectPoint.appendChild(a);
nickjillings@2022 84 }
nickjillings@2022 85
nickjillings@2022 86 function buildXML() {
nickjillings@2022 87 var xmlDoc = document.createElement('BrowserEvalProjectDocument');
nickjillings@2022 88 var setup = document.createElement('setup');
nickjillings@2022 89 setup.setAttribute('interface',document.getElementById('interface').value);
nickjillings@2022 90 if (document.getElementById('projectReturn').value == "") {
nickjillings@2022 91 setup.setAttribute('projectReturn',"null");
nickjillings@2022 92 } else {
nickjillings@2022 93 setup.setAttribute('projectReturn',document.getElementById('projectReturn').value);
nickjillings@2022 94 }
nickjillings@2022 95 setup.setAttribute('randomiseOrder',document.getElementById('randomisePageOrder').checked);
nickjillings@2022 96 setup.setAttribute('collectMetrics',document.getElementById('collectMetrics').checked);
nickjillings@2022 97
nickjillings@2022 98 var globalPreTest = document.createElement('preTest');
nickjillings@2022 99 var options = document.getElementById('globalPreTest').getElementsByClassName('head');
nickjillings@2022 100 constructPrePost(globalPreTest, options);
nickjillings@2022 101
nickjillings@2022 102 var globalPostTest = document.createElement('postTest');
nickjillings@2022 103 options = document.getElementById('globalPostTest').getElementsByClassName('head');
nickjillings@2022 104 constructPrePost(globalPostTest, options);
nickjillings@2022 105
nickjillings@2022 106 var globalMetrics = document.createElement('metric');
nickjillings@2022 107 options = document.getElementById('globalMetric').getElementsByClassName('attrib')[0].getElementsByTagName('input');
nickjillings@2022 108 for (var i=0; i<options.length; i++) {
nickjillings@2022 109 if (options[i].checked) {
nickjillings@2022 110 var metric = document.createElement('metricEnable');
nickjillings@2022 111 metric.textContent = options[i].id;
nickjillings@2022 112 globalMetrics.appendChild(metric);
nickjillings@1595 113 }
nickjillings@2022 114 }
nickjillings@2022 115 setup.appendChild(globalPreTest);
nickjillings@2022 116 setup.appendChild(globalPostTest);
nickjillings@2022 117 setup.appendChild(globalMetrics);
nickjillings@2022 118 xmlDoc.appendChild(setup);
nickjillings@2022 119
nickjillings@2022 120 var audioHolders = document.getElementsByName('audio-holder');
nickjillings@2022 121 for (var i=0; i<audioHolders.length; i++) {
nickjillings@2022 122 var audioHolder = document.createElement('audioHolder');
nickjillings@2022 123 var audioHolderDOM = audioHolders[i];
nickjillings@2022 124 var attribs = audioHolderDOM.getElementsByClassName('attrib')[0].getElementsByTagName('input');
nickjillings@2022 125 audioHolder.id = attribs[0].value;
nickjillings@2022 126 if (attribs[1].value != "") {audioHolder.setAttribute('sampleRate',attribs[1].value);}
nickjillings@2022 127 if (attribs[2].value != "") {audioHolder.setAttribute('hostURL',attribs[2].value);}
nickjillings@2022 128 audioHolder.setAttribute('randomiseOrder',attribs[3].checked);
nickjillings@2022 129 audioHolder.setAttribute('repeatCount',attribs[4].checked);
nickjillings@2022 130 audioHolder.setAttribute('loop',attribs[5].checked);
nickjillings@2022 131 audioHolder.setAttribute('elementComments',attribs[6].checked);
nickjillings@1595 132
nickjillings@2022 133 // Audio-Holder PreTests
nickjillings@2022 134 var audioHolderPreTest = document.createElement('preTest');
nickjillings@2022 135 var audioHolderPostTest = document.createElement('postTest');
nickjillings@2022 136 options = audioHolderDOM.childNodes[2].getElementsByClassName('head');
nickjillings@2022 137 constructPrePost(audioHolderPreTest, options);
nickjillings@2022 138 options = audioHolderDOM.childNodes[3].getElementsByClassName('head');
nickjillings@2022 139 constructPrePost(audioHolderPostTest, options);
nickjillings@1595 140
nickjillings@2022 141 audioHolder.appendChild(audioHolderPreTest);
nickjillings@2022 142 audioHolder.appendChild(audioHolderPostTest);
nickjillings@1595 143
nickjillings@2022 144 // audio-Elements
nickjillings@2022 145 var audioElementsDOM = [];
nickjillings@2022 146 var commentQuestionDOM = [];
nickjillings@2022 147 for (var j=0; j<audioHolderDOM.childElementCount; j++) {
nickjillings@2022 148 var child = audioHolderDOM.childNodes[j];
nickjillings@2022 149 var name = child.getAttribute('name');
nickjillings@2022 150 if (name == 'audio-element') {audioElementsDOM.push(child);}
nickjillings@2022 151 else if (name == 'comment-question') {commentQuestionDOM.push(child);}
nickjillings@1595 152 }
nickjillings@1595 153
nickjillings@2022 154 for (var j=0; j<audioElementsDOM.length; j++) {
nickjillings@2022 155 var audioElement = document.createElement('audioElement');
nickjillings@2022 156 attribs = audioElementsDOM[j].getElementsByClassName('attrib')[0].getElementsByTagName('input');
nickjillings@2022 157 audioElement.id = attribs[0].value;
nickjillings@2022 158 audioElement.setAttribute('url',attribs[1].value);
nickjillings@2022 159 audioHolder.appendChild(audioElement);
nickjillings@2021 160 }
nickjillings@2022 161
nickjillings@2022 162 for (var j=0; j<commentQuestionDOM.length; j++) {
nickjillings@2022 163 var commentQuestion = document.createElement('commentQuestion');
nickjillings@2022 164 attribs = commentQuestionDOM[j].getElementsByClassName('attrib')[0].getElementsByTagName('input');
nickjillings@2022 165 commentQuestion.id = attribs[0].value;
nickjillings@2022 166 commentQuestion.textContent = attribs[1].value;
nickjillings@2022 167 audioHolder.appendChild(commentQuestion);
nickjillings@2022 168 }
nickjillings@2022 169 xmlDoc.appendChild(audioHolder);
nickjillings@1595 170 }
nickjillings@2022 171 return xmlDoc;
nickjillings@1595 172 }
nickjillings@1595 173
nickjillings@1595 174 function constructPrePost(parent, options) {
nickjillings@1595 175 for (var i=0; i<options.length; i++) {
nickjillings@1595 176 var elem = options[i];
nickjillings@1595 177 var attributes = elem.getElementsByClassName('attrib')[0].getElementsByTagName('input');
nickjillings@1595 178 if (elem.getAttribute('name') == 'question-node') {
nickjillings@1595 179 var node = document.createElement('question');
nickjillings@1595 180 node.setAttribute('id',attributes[0].value);
nickjillings@1595 181 node.textContent = attributes[1].value;
nickjillings@1595 182 } else if (elem.getAttribute('name') == 'statement-node') {
nickjillings@1595 183 var node = document.createElement('statment');
nickjillings@1595 184 node.textContent = attributes[0].value;
nickjillings@1595 185 }
nickjillings@1595 186 parent.appendChild(node);
nickjillings@1595 187 }
nickjillings@1595 188 }
nickjillings@1595 189
nickjillings@1594 190 function validate() {
nickjillings@1594 191 var canExport = true;
nickjillings@1594 192 // Checks if the XML can be created from the given entries
nickjillings@1594 193 var inputs = document.getElementsByTagName('input');
nickjillings@1594 194 for (var i=0; i<inputs.length; i++) {
nickjillings@1594 195 if (inputs[i].type == 'text') {
nickjillings@1594 196 if (inputs[i].value == "") {
nickjillings@1594 197 var mandatory = inputs[i].getAttribute('mandatory');
nickjillings@1594 198 if (mandatory == "true") {
nickjillings@1594 199 errorInput(inputs[i]);
nickjillings@1594 200 canExport = false;
nickjillings@1594 201 } else {
nickjillings@1594 202 warningInput(inputs[i]);
nickjillings@1594 203 }
nickjillings@1594 204 } else {
nickjillings@1594 205 goodInput(inputs[i]);
nickjillings@1594 206 }
nickjillings@1594 207 }
nickjillings@1594 208 }
nickjillings@1595 209
nickjillings@1595 210 var audioHolders = document.getElementsByName('audio-holder');
nickjillings@1595 211 for (var i=0; i<audioHolders.length; i++) {
nickjillings@1595 212 var divs = audioHolders[i].getElementsByClassName('head');
nickjillings@1595 213 var IDs = [];
nickjillings@1595 214 for (var j=0; j<divs.length; j++) {
nickjillings@1595 215 if (divs[j].getAttribute('name') == 'audio-element') {
nickjillings@1595 216 var obj = divs[j].getElementsByClassName('attrib')[0].children[1];
nickjillings@1595 217 var aeID = obj.value;
nickjillings@1595 218 if (aeID != "") {
nickjillings@1595 219 var unique = true;
nickjillings@1595 220 for (var k=0; k<IDs.length; k++) {
nickjillings@1595 221 if (aeID == IDs[k]) {
nickjillings@1595 222 unique = false;
nickjillings@1595 223 break;
nickjillings@1595 224 }
nickjillings@1595 225 }
nickjillings@1595 226 if (unique == true) {
nickjillings@1595 227 IDs.push(aeID);
nickjillings@1595 228 } else {
nickjillings@1595 229 errorInput(obj);
nickjillings@1595 230 canExport = false;
nickjillings@1595 231 }
nickjillings@1595 232 }
nickjillings@1595 233 }
nickjillings@1595 234 }
nickjillings@1595 235 }
nickjillings@1594 236 return canExport;
nickjillings@1594 237 };
nickjillings@1594 238
nickjillings@1594 239 function errorInput(node) {
nickjillings@1594 240 node.style.backgroundColor = "#FF0000";
nickjillings@1594 241 }
nickjillings@1594 242
nickjillings@1594 243 function warningInput(node) {
nickjillings@1594 244 node.style.backgroundColor = "#FFFF00";
nickjillings@1594 245 }
nickjillings@1594 246
nickjillings@1594 247 function goodInput(node) {
nickjillings@1594 248 node.style.backgroundColor = "#FFFFFF";
nickjillings@1594 249 }
nickjillings@1594 250
nickjillings@1591 251 function questionNode() {
nickjillings@1591 252 var node = document.createElement("div");
nickjillings@1591 253 node.setAttribute('class','head');
nickjillings@1591 254 node.setAttribute('name','question-node');
nickjillings@1591 255 var nodeTitle = document.createElement("span");
nickjillings@1591 256 nodeTitle.textContent = "Question";
nickjillings@1591 257 var attributes = document.createElement("div");
nickjillings@1591 258 attributes.setAttribute('class','attrib');
nickjillings@1594 259 var id = attributePair("ID:","text", true);
nickjillings@1594 260 var question = attributePair("Question:","text", false);
nickjillings@1591 261 node.appendChild(nodeTitle);
nickjillings@1591 262 id.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1591 263 question.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1591 264 node.appendChild(attributes);
nickjillings@1592 265
nickjillings@1592 266 var removeButton = document.createElement("button");
nickjillings@1592 267 removeButton.textContent = "Remove";
nickjillings@1592 268 removeButton.onclick = removeNode;
nickjillings@1592 269 node.appendChild(removeButton);
nickjillings@1591 270 return node;
nickjillings@1591 271 }
nickjillings@1591 272
nickjillings@1591 273 function statementNode() {
nickjillings@1591 274 var node = document.createElement("div");
nickjillings@1591 275 node.setAttribute('class','head');
nickjillings@1594 276 node.setAttribute('name','statement-node');
nickjillings@1591 277 var nodeTitle = document.createElement("span");
nickjillings@1591 278 nodeTitle.textContent = "Statement";
nickjillings@1591 279 var attributes = document.createElement("div");
nickjillings@1591 280 attributes.setAttribute('class','attrib');
nickjillings@1594 281 var statement = attributePair("Statement:","text",false);
nickjillings@1591 282 node.appendChild(nodeTitle);
nickjillings@1591 283 statement.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1591 284 node.appendChild(attributes);
nickjillings@1592 285
nickjillings@1592 286 var removeButton = document.createElement("button");
nickjillings@1592 287 removeButton.textContent = "Remove";
nickjillings@1592 288 removeButton.onclick = removeNode;
nickjillings@1592 289 node.appendChild(removeButton);
nickjillings@1591 290 return node;
nickjillings@1591 291 }
nickjillings@1591 292
nickjillings@1591 293 function audioHolderNode() {
nickjillings@1591 294 var audioHolderCounts = document.getElementsByName("audio-holder").length;
nickjillings@1591 295 var node = document.createElement("div");
nickjillings@1591 296 node.setAttribute("class","head");
nickjillings@1591 297 node.setAttribute("name","audio-holder");
nickjillings@1592 298 node.setAttribute("id","audio-holder-"+audioHolderCounts);
nickjillings@1591 299 var nodeTitle = document.createElement("span");
nickjillings@1592 300 nodeTitle.textContent = "Audio Holder "+(audioHolderCounts+1);
nickjillings@1591 301
nickjillings@1591 302 var attributes = document.createElement("div");
nickjillings@1591 303 attributes.setAttribute('class','attrib');
nickjillings@1594 304 var id = attributePair("ID:","text",true);
nickjillings@1592 305 id[1].value=audioHolderCounts;
nickjillings@1594 306 var hostURL = attributePair("Host URL:", "text",false);
nickjillings@1594 307 var sampleRate = attributePair("Sample Rate:","text",false);
nickjillings@1592 308 var randomiseOrder = attributePair("Randomise Element Order:","checkbox");
nickjillings@1592 309 var repeatCount = attributePair("Repeat Page Count:","number");
nickjillings@1592 310 repeatCount[1].value = 0;
nickjillings@1592 311 var loop = attributePair("Loop Element Playback","checkbox");
nickjillings@1592 312 var elementComments = attributePair("Enable Comment Boxes","checkbox");
nickjillings@1592 313 id.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 314 hostURL.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 315 sampleRate.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 316 hostURL.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 317 randomiseOrder.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 318 repeatCount.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 319 loop.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 320 elementComments.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 321
nickjillings@1592 322 node.appendChild(nodeTitle);
nickjillings@1592 323 node.appendChild(attributes);
nickjillings@1592 324
nickjillings@1592 325 var pretest = document.createElement("div");
nickjillings@1592 326 pretest.setAttribute('class','head');
nickjillings@1592 327 pretest.setAttribute('name','pre-test');
nickjillings@1592 328 var pretestTitle = document.createElement("h4");
nickjillings@1592 329 pretestTitle.textContent = "Pre Test";
nickjillings@1592 330 var buttonAddQ = document.createElement("button");
nickjillings@1592 331 buttonAddQ.textContent = "Add Pre Test Question";
nickjillings@1592 332 buttonAddQ.onclick = function(){event.srcElement.parentElement.appendChild(questionNode());};
nickjillings@1592 333 var buttonAddS = document.createElement("button");
nickjillings@1592 334 buttonAddS.textContent = "Add Pre Test Statement";
nickjillings@1592 335 buttonAddS.onclick = function(){event.srcElement.parentElement.appendChild(statementNode());};
nickjillings@1592 336 pretest.appendChild(pretestTitle);
nickjillings@1592 337 pretest.appendChild(buttonAddQ);
nickjillings@1592 338 pretest.appendChild(buttonAddS);
nickjillings@1592 339
nickjillings@1592 340 var posttest = document.createElement("div");
nickjillings@1592 341 posttest.setAttribute('class','head');
nickjillings@1592 342 posttest.setAttribute('name','post-test');
nickjillings@1592 343 var posttestTitle = document.createElement("h4");
nickjillings@1592 344 posttestTitle.textContent = "Post Test";
nickjillings@1592 345 var buttonAddQ = document.createElement("button");
nickjillings@1592 346 buttonAddQ.textContent = "Add Post Test Question";
nickjillings@1592 347 buttonAddQ.onclick = function(){event.srcElement.parentElement.appendChild(questionNode());};
nickjillings@1592 348 var buttonAddS = document.createElement("button");
nickjillings@1592 349 buttonAddS.textContent = "Add Post Test Statement";
nickjillings@1592 350 buttonAddS.onclick = function(){event.srcElement.parentElement.appendChild(statementNode());};
nickjillings@1592 351 posttest.appendChild(posttestTitle);
nickjillings@1592 352 posttest.appendChild(buttonAddQ);
nickjillings@1592 353 posttest.appendChild(buttonAddS);
nickjillings@1592 354
nickjillings@1592 355 node.appendChild(pretest);
nickjillings@1592 356 node.appendChild(posttest);
nickjillings@1592 357
nickjillings@1592 358 var newAudioElementButton = document.createElement("button");
nickjillings@1592 359 newAudioElementButton.textContent = "Add audio element";
nickjillings@1592 360 newAudioElementButton.onclick = function(){
nickjillings@1592 361 event.srcElement.parentElement.appendChild(audioElementNode());
nickjillings@1592 362 };
nickjillings@1592 363 node.appendChild(newAudioElementButton);
nickjillings@1592 364
nickjillings@1592 365 var newCommentButton = document.createElement("button");
nickjillings@1592 366 newCommentButton.textContent = "Add Comment Box";
nickjillings@1592 367 newCommentButton.onclick = function() {
nickjillings@1592 368 event.srcElement.parentElement.appendChild(commentBox());
nickjillings@1592 369 };
nickjillings@1592 370 node.appendChild(newCommentButton);
nickjillings@1592 371
nickjillings@1592 372 var removeButton = document.createElement("button");
nickjillings@1592 373 removeButton.textContent = "Remove Audio Holder";
nickjillings@1592 374 removeButton.onclick = removeNode;
nickjillings@1592 375 node.appendChild(removeButton);
nickjillings@1592 376 return node;
nickjillings@1592 377 }
nickjillings@1592 378
nickjillings@1592 379 function audioElementNode() {
nickjillings@1592 380 var parentStructure = event.srcElement.parentElement.childNodes;
nickjillings@1592 381 var audioElemCounts = 0;
nickjillings@1592 382 for (var i=0; i<parentStructure.length; i++) {
nickjillings@1592 383 if (parentStructure[i].getAttribute('name') == "audio-element")
nickjillings@1592 384 {audioElemCounts++;}
nickjillings@1592 385 }
nickjillings@1592 386 var node = document.createElement('div');
nickjillings@1592 387 node.setAttribute('class','head');
nickjillings@1592 388 node.setAttribute('name','audio-element');
nickjillings@1592 389 var nodeTitle = document.createElement('span');
nickjillings@1592 390 nodeTitle.textContent = 'Audio Element '+(audioElemCounts+1);
nickjillings@1592 391
nickjillings@1592 392 var attributes = document.createElement("div");
nickjillings@1592 393 attributes.setAttribute('class','attrib');
nickjillings@1594 394 var id = attributePair("ID:","text",true);
nickjillings@1592 395 id[1].value = audioElemCounts;
nickjillings@1594 396 var url = attributePair("URL:","text",true);
nickjillings@1592 397 id.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 398 url.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 399
nickjillings@1592 400 node.appendChild(nodeTitle);
nickjillings@1592 401 node.appendChild(attributes);
nickjillings@1592 402
nickjillings@1592 403 var removeButton = document.createElement("button");
nickjillings@1592 404 removeButton.textContent = "Remove Audio Element";
nickjillings@1592 405 removeButton.onclick = removeNode;
nickjillings@1592 406 node.appendChild(removeButton);
nickjillings@1592 407 return node;
nickjillings@1592 408 }
nickjillings@1592 409
nickjillings@1592 410 function commentBox() {
nickjillings@1592 411 var node = document.createElement('div');
nickjillings@1592 412 node.setAttribute('class','head');
nickjillings@1592 413 node.setAttribute('name','comment-question');
nickjillings@1592 414 var nodeTitle = document.createElement('h4');
nickjillings@1592 415 nodeTitle.textContent = "Comment Box";
nickjillings@1592 416
nickjillings@1592 417 var attributes = document.createElement('div');
nickjillings@1592 418 attributes.setAttribute('class','attrib');
nickjillings@1594 419 var id = attributePair("ID:",'text',true);
nickjillings@1594 420 var question = attributePair("Question:",'text',true);
nickjillings@1592 421 id.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 422 question.forEach(function(item){attributes.appendChild(item);},false);
nickjillings@1592 423
nickjillings@1592 424 var removeButton = document.createElement("button");
nickjillings@1592 425 removeButton.textContent = "Remove Comment Box";
nickjillings@1592 426 removeButton.onclick = removeNode;
nickjillings@1592 427
nickjillings@1592 428 node.appendChild(nodeTitle);
nickjillings@1592 429 node.appendChild(attributes);
nickjillings@1592 430 node.appendChild(removeButton);
nickjillings@1592 431 return node;
nickjillings@1591 432 }
nickjillings@1591 433 </script>
nickjillings@1591 434 <style>
nickjillings@1591 435 div {
nickjillings@1591 436 padding: 2px;
nickjillings@1591 437 margin-top: 2px;
nickjillings@1591 438 margin-bottom: 2px;
nickjillings@1591 439 }
nickjillings@1591 440 div.head{
nickjillings@1591 441 margin-left: 10px;
nickjillings@1591 442 border: black;
nickjillings@1591 443 border-width: 2px;
nickjillings@1591 444 border-style: solid;
nickjillings@1591 445 }
nickjillings@1591 446 div.attrib{
nickjillings@1591 447 margin-left:25px;
nickjillings@1591 448 border: black;
nickjillings@1591 449 border-width: 2px;
nickjillings@1591 450 border-style: dashed;
nickjillings@1591 451 margin-bottom: 10px;
nickjillings@1591 452 }
nickjillings@1591 453 </style>
nickjillings@1591 454
nickjillings@2016 455 </head>
nickjillings@2016 456
nickjillings@2016 457 <body>
nickjillings@1591 458 <h1>Create Test Setup XML</h1>
nickjillings@1594 459 <button id="validateXML" onclick="buttonClickedValidate();">Validate</button>
nickjillings@2022 460 <button id="createXML" onclick="buttonClickedSubmit();" disabled>Submit</button>
nickjillings@1594 461 <span id="errorMessage" visibility="hidden"></span>
nickjillings@1591 462 <div id="topLevelBody" align="left">
nickjillings@2016 463 <!-- Interface goes here -->
nickjillings@1591 464 <div name='test-setup'>
nickjillings@1591 465 <div id="setup" class="head">
nickjillings@1591 466 <h2>Setup Tag</h2>
nickjillings@1591 467 <div id="setup-attribs" class="attrib">
nickjillings@1591 468 <span>Interface</span>
nickjillings@1591 469 <select id="interface">
nickjillings@1591 470 <option value='APE'>APE</option>
nickjillings@1591 471 </select>
nickjillings@1591 472 <span>Project Return</span>
nickjillings@1594 473 <input type="text" id="projectReturn" mandatory="false">
nickjillings@1591 474 <span>Randomise Test Page Order</span>
nickjillings@1591 475 <input id="randomisePageOrder" type="checkbox" value="false">
nickjillings@1591 476 <span>Collect Session Metrics</span>
nickjillings@1591 477 <input id="collectMetrics" type="checkbox">
nickjillings@1591 478 </div>
nickjillings@1591 479 <div id="globalPreTest" class="head">
nickjillings@1591 480 <h3>Pre Test</h3>
nickjillings@1591 481 <button id="addPreTestQ" onclick="event.srcElement.parentElement.appendChild(questionNode());">Add Pre Test Question</button>
nickjillings@1591 482 <button id="addPreTestS" onclick="event.srcElement.parentElement.appendChild(statementNode());">Add Pre Test Statement</button>
nickjillings@1591 483 </div>
nickjillings@1591 484 <div id="globalPostTest" class="head">
nickjillings@1591 485 <h3>Post Test</h3>
nickjillings@1591 486 <button id="addPreTestQ" onclick="event.srcElement.parentElement.appendChild(questionNode());">Add Post Test Question</button>
nickjillings@1591 487 <button id="addPreTestS" onclick="event.srcElement.parentElement.appendChild(statementNode());">Add Post Test Statement</button>
nickjillings@1591 488 </div>
nickjillings@1591 489 <div id="globalMetric" class="head">
nickjillings@1591 490 <h3>Global Metrics</h3>
nickjillings@1591 491 <div id="globalMetric-attrib" class="attrib">
nickjillings@1591 492 <span>Test Timer</span>
nickjillings@1591 493 <input type="checkbox" id="testTimer" />
nickjillings@1591 494 <span>Element Playback Timer</span>
nickjillings@1591 495 <input type="checkbox" id="elementTimer" />
nickjillings@1591 496 <span>Element Initial Position</span>
nickjillings@1591 497 <input type="checkbox" id="elementInitialPosition" />
nickjillings@1591 498 <span>Element Tracker</span>
nickjillings@1591 499 <input type="checkbox" id="elementTracker" />
nickjillings@1591 500 <span>Element Flag Listened To</span>
nickjillings@1595 501 <input type="checkbox" id="elementFlagListenedTo" />
nickjillings@1591 502 <span>Element Flag Moved</span>
nickjillings@1591 503 <input type="checkbox" id="elementFlagMoved" />
nickjillings@1591 504 </div>
nickjillings@1591 505 </div>
nickjillings@1592 506 <button id="addAudioHolder" onclick="event.srcElement.parentElement.appendChild(audioHolderNode());">Add AudioHolder / Test Page</button>
nickjillings@1591 507 </div>
nickjillings@1591 508 </div>
nickjillings@2016 509 </div>
nickjillings@2016 510 </body>
nickjillings@2016 511 </html>