changeset 191:a2b30d251f01

Feature #1228: Added survey question box sizes
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 05 Jun 2015 13:26:31 +0100
parents 437f826a9a05
children 566fc4fa2bea
files core.js example_eval/project.xml
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Fri Jun 05 12:54:52 2015 +0100
+++ b/core.js	Fri Jun 05 13:26:31 2015 +0100
@@ -116,6 +116,24 @@
 			var span = document.createElement('span');
 			span.textContent = node.question;
 			var textArea = document.createElement('textarea');
+			switch (node.boxsize) {
+			case 'small':
+				textArea.cols = "20";
+				textArea.rows = "1";
+				break;
+			case 'normal':
+				textArea.cols = "30";
+				textArea.rows = "2";
+				break;
+			case 'large':
+				textArea.cols = "40";
+				textArea.rows = "5";
+				break;
+			case 'huge':
+				textArea.cols = "50";
+				textArea.rows = "10";
+				break;
+			}
 			var br = document.createElement('br');
 			this.popupContent.appendChild(span);
 			this.popupContent.appendChild(br);
@@ -1100,7 +1118,7 @@
 				this.id = element.id;
 				this.name = element.getAttribute('name');
 				this.text = element.textContent;
-			}
+			};
 			
 			this.type = child.nodeName;
 			if (child.nodeName == "question") {
@@ -1109,6 +1127,11 @@
 				if (child.getAttribute('mandatory') == "true") {this.mandatory = true;}
 				else {this.mandatory = false;}
 				this.question = child.textContent;
+				if (child.getAttribute('boxsize') == null) {
+					this.boxsize = 'normal';
+				} else {
+					this.boxsize = child.getAttribute('boxsize');
+				}
 			} else if (child.nodeName == "statement") {
 				this.statement = child.textContent;
 			} else if (child.nodeName == "checkbox" || child.nodeName == "radio") {
--- a/example_eval/project.xml	Fri Jun 05 12:54:52 2015 +0100
+++ b/example_eval/project.xml	Fri Jun 05 13:26:31 2015 +0100
@@ -2,7 +2,7 @@
 <BrowserEvalProjectDocument>
 	<setup interface="APE" projectReturn="/save" randomiseOrder='true' collectMetrics='true'>
 		<PreTest>
-			<question id="Location" mandatory="true">Please enter your location.</question>
+			<question id="Location" mandatory="true" boxsize="large">Please enter your location.</question>
 			<checkbox id="experience">
 				<statement>Check options which are relevant to you</statement>
 				<option id="digital">Digital Consoles</option>