comparison test_create/test_create.html @ 1102:b5bf2f57187c

Merge
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 08 Mar 2016 14:44:14 +0000
parents 0a15fa67bda1
children 83b439322229
comparison
equal deleted inserted replaced
1101:a497058ae2ae 1102:b5bf2f57187c
1 <html> 1 <html>
2 <head> 2 <head>
3 <!-- This defines the test creator tool for the Web Audio Evaluation Toolbox --> 3 <!-- This defines the test creator tool for the Web Audio Evaluation Toolbox -->
4 <link rel='stylesheet' type="text/css" href="style.css"/> 4 <link rel='stylesheet' type="text/css" href="style.css"/>
5 <link rel='stylesheet' type="text/css" href="custom.css"/>
5 <script type="text/javascript"> 6 <script type="text/javascript">
7 window.onbeforeunload = function (e) {var message = 'If you leave the page now, any unsaved changes will be lost', e = e || window.event; if (e) { e.returnValue = message;}return message;};
6 // Copy of Specifiation node from Core.js 8 // Copy of Specifiation node from Core.js
7 function Specification() { 9 function Specification() {
8 // Handles the decoding of the project specification XML into a simple JavaScript Object. 10 // Handles the decoding of the project specification XML into a simple JavaScript Object.
9 11
10 this.interface = null; 12 this.interface = null;
226 } 228 }
227 }; 229 };
228 230
229 this.exportXML = function(doc) 231 this.exportXML = function(doc)
230 { 232 {
231 var node = doc.createElement('surveyelement'); 233 var node = doc.createElement('surveyentry');
232 node.setAttribute('type',this.type); 234 node.setAttribute('type',this.type);
233 var statement = doc.createElement('statement'); 235 var statement = doc.createElement('statement');
234 statement.textContent = this.statement; 236 statement.textContent = this.statement;
235 node.appendChild(statement); 237 node.appendChild(statement);
236 switch(this.type) 238 switch(this.type)
237 { 239 {
238 case "statement": 240 case "statement":
239 break; 241 break;
240 case "question": 242 case "question":
241 node.id = this.id; 243 node.id = this.id;
242 node.setAttribute("mandatory",this.mandatory); 244 if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
243 node.setAttribute("boxsize",this.boxsize); 245 if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
244 break; 246 break;
245 case "number": 247 case "number":
246 node.id = this.id; 248 node.id = this.id;
247 node.setAttribute("mandatory",this.mandatory); 249 if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
248 node.setAttribute("min", this.min); 250 if (this.min != undefined) {node.setAttribute("min", this.min);}
249 node.setAttribute("max", this.max); 251 if (this.max != undefined) {node.setAttribute("max", this.max);}
250 node.setAttribute("step", this.step);
251 break; 252 break;
252 case "checkbox": 253 case "checkbox":
253 case "radio": 254 case "radio":
254 node.id = this.id; 255 node.id = this.id;
255 for (var i=0; i<this.options.length; i++) 256 for (var i=0; i<this.options.length; i++)
570 this.audioElementNode = function() { 571 this.audioElementNode = function() {
571 this.url = null; 572 this.url = null;
572 this.id = null; 573 this.id = null;
573 this.parent = null; 574 this.parent = null;
574 this.type = null; 575 this.type = null;
575 this.marker = false; 576 this.marker = null;
576 this.enforce = false; 577 this.enforce = false;
577 this.gain = 1.0; 578 this.gain = 0.0;
578 this.schema = specification.schema.getAllElementsByName('audioelement')[0];; 579 this.schema = specification.schema.getAllElementsByName('audioelement')[0];;
579 this.parent = null; 580 this.parent = null;
580 this.decode = function(parent,xml) 581 this.decode = function(parent,xml)
581 { 582 {
582 this.parent = parent; 583 this.parent = parent;