changeset 2501:23c390902378

Fixed copying title and first interface axis title if <page> has no title node defined
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Wed, 21 Sep 2016 09:55:07 +0100
parents 32366178b6a8
children 5ddfab2c92e4
files js/specification.js tests/examples/project.xml
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/js/specification.js	Tue Sep 20 17:55:56 2016 +0100
+++ b/js/specification.js	Wed Sep 21 09:55:07 2016 +0100
@@ -495,13 +495,13 @@
             
             // Get the title
             var title = xml.getElementsByTagName('title');
-            if (title.length != 0) {
+            if (title.length != 0 && title[0].parentElement == xml) {
                 this.title = title[0].textContent;
             }
 			
 			// Get the Comment Box Prefix
 			var CBP = xml.getElementsByTagName('commentboxprefix');
-			if (CBP.length != 0) {
+			if (CBP.length != 0 && CBP[0].parentElement == xml) {
 				this.commentBoxPrefix = CBP[0].textContent;
 			}
 			
--- a/tests/examples/project.xml	Tue Sep 20 17:55:56 2016 +0100
+++ b/tests/examples/project.xml	Wed Sep 21 09:55:07 2016 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd">
-	<setup interface="APE" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100" calibration="true">
+	<setup interface="APE" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" calibration="true">
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
 				<statement>Please enter your name.</statement>
@@ -94,7 +94,7 @@
 		</survey>
 	</page>
 	<page id='test-1' hostURL="media/example/" randomiseOrder='true' repeatCount='0' loop='false' label="letter">
-		<commentboxprefix>Comment on fragment</commentboxprefix>
+        <commentboxprefix>Comment on fragment</commentboxprefix>
 		<interface name="preference">
 			<title>Example Test Question</title>
 			<scales>