-
Notifications
You must be signed in to change notification settings - Fork 4
/
selectGroupTests.html
287 lines (248 loc) · 8.64 KB
/
selectGroupTests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="Author" content="Leslie Bondaryk" />
<meta name="Owner" content="Pearson" />
<meta name="Copyright" content="Copyright (c) 2013 Pearson. All rights reserved." />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="Carmen Santiago, Demo Book" name="description" />
<title class="setTitle"></title>
<!-- bootstrap_plus.css contains styling for the dropdown menu and other common core styles -->
<link href="css/bootstrap_plus.css" rel="stylesheet" media="screen">
<!-- widgets.css contains styling for the interactive brix -->
<link href="css/widgets.css" rel="stylesheet">
<!-- eCourse-master.css contains styling for all the navigation -->
<link href="css/eCourse-master.css" rel="stylesheet" media="screen">
<!-- content_styles.css contains styling for the narrative layout and responsive design -->
<link href="css/content_styles.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container">
<div class="span12 lc_ec_page">
<section class="lc_ec_fiftyFifty lc_ec_pageInner">
<div class="lc_ec_content">
<h2 class="lc_ec_bHead"><span class='number setId'></span>
<span class="setTitle"></span>
</h2>
<div class="lc_ec_leading">
<p>0. Dropdown SelectGroup w/o question</p>
<div id="sb-test"/></div>
<p>In order to manually test that selecting an answer correctly
publishes the selected event, we have an event handler that displays
the answer key of the selection. It should change as you manually
select an answer.</p>
<p>The key selected is: <b id="sb-test-key">none</b>.</p>
<p>
These are some options: <span id="resLength"></span>
</p>
<div id="selectRnd"><p>1. Multiple Choice dropdown question, randomized</p></div>
<div id="selectOrd"><p>2. Multiple Choice dropdown question, nonrandomized</p></div>
</div>
<div class="lc_ec_trailing">
<div id="selectEvents"> </div>
<p>3. Multiple Choice dropdown selector as UI (events)</p>
<div id="seaImages"></div>
<div id="graphIn"><p>4. Dropdowns on top of image (labeling)</p></div>
<div id="graphIn"><p>5. Dropdowns of objects</p></div>
</div>
</div>
</section>
</div>
</div>
<script src="js/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-ui-1.10.2.custom.js"></script>
<script src="js/toc-structure.js"></script>
<script src="js/eCourse-master.js"></script>
<script src="js/d3.v3.min.js"></script>
<script src="js/brixlib-compiled.js"></script>
<!--
<script src="js/widget-base.js"></script>
<script src="js/widget-selectgroup.js"></script>
<script src="js/widget-image.js"></script>
<script src="js/widget-carousel.js"></script>
<script src="js/widget-button.js"></script>
<script src="js/widget-imageviewer.js"></script>
<script src="js/widget-multiplechoicequestion.js"></script>
<script src="js/widget-linegraph.js"></script>
<script src="js/widget-labelgroup.js"></script>
<script src="js/submitmanager.js"></script>
<script src="js/answerman.js"></script>
<script src="js/fakeactivitydb.js"></script>
!-->
<script>
// local aliases for convenience
var Size = pearson.utils.Size;
var SVGContainer = pearson.brix.SVGContainer;
var Image = pearson.brix.Image;
var CaptionedImage = pearson.brix.CaptionedImage;
var Carousel = pearson.brix.Carousel;
var ImageViewer = pearson.brix.ImageViewer;
var Callouts = pearson.brix.Callouts;
var LineGraph = pearson.brix.LineGraph;
var LabelGroup = pearson.brix.LabelGroup;
var Button = pearson.brix.Button;
var Slider = pearson.brix.Slider;
var Readout = pearson.brix.Readout;
var SelectGroup = pearson.brix.SelectGroup;
var EventManager = pearson.utils.EventManager;
var SubmitManager = pearson.brix.utils.SubmitManager;
var MultipleChoiceQuestion = pearson.brix.MultipleChoiceQuestion;
var SelectGroup = pearson.brix.SelectGroup;
var eventManager = new EventManager();
var submitManager = new SubmitManager(eventManager);
var selector2 = new SelectGroup(
{ id: "foobar",
choices: [
{
content: "smaller",
key: "Imakey",
},
{
content: "greater",
response: "Longer length requires more potential to move electrons across.",
},
{
content: "approximately the same",
response: "Longer length requires more potential to move electrons across.",
}]
}, eventManager);
selector2.draw(d3.select("#resLength"));
// Handle dropdown changes
eventManager.subscribe(selector2.selectedEventId,
function(eventDetails){
d3.select("#sb-test-key").text(eventDetails.selectKey);
});
//<div id="selectOrd"><p>2. Multiple Choice question, dropdown, nonrandomized</p></div>
var Q1Choices = [
{
content: "Because as the population increases, the absolute number of births increases even though the growth rate stays constant",
response: "Growth rate stays constant.",
answerKey: "answer000"
},
{
content: "Because the growth rate increases as the population rises",
response: "Does the growth rate change with population size?",
answerKey: "answer001"
},
{
content: "Because the total fertility rate increases with population",
response: "Does the fertility rate change with population size?",
answerKey: "answer002"
},
{
content: "Because social behaviors change and people decide to have more children",
response: "This might happen but is it something is necessarily occurs?",
answerKey: "answer003"
}
];
var Q2 = new MultipleChoiceQuestion({
questionId: "SanVan001",
question: "Why not dropdown choices?",
choices: Q1Choices,
order: "randomized",
widget: SelectGroup,
widgetConfig: {
numberFormat: "latin-lower",
question: true,
},
}, eventManager);
Q2.draw(d3.select("#selectRnd"));
submitManager.handleRequestsFrom(Q2);
var Q3 = new MultipleChoiceQuestion({
questionId: "SanVan001",
question: "Why not dropdown choices?",
choices: Q1Choices,
order: "ordered",
widget: SelectGroup,
widgetConfig: {
numberFormat: "latin-lower",
question: true,
},
}, eventManager);
Q3.draw(d3.select("#selectOrd"));
submitManager.handleRequestsFrom(Q3);
//<div id="selectEvents"><p>3. Multiple Choice dropdown selector as UI (events)</p></div>
//////////////////////////////////////////////
/* temperature images in a carousel */
//////////////////////////////////////////////*
var profiles = new SelectGroup(
{ id: "seas",
choices: [
{
content: "Sea Surface Temperature",
},
{
content: "Sea Height Anomoly",
},
{
content: "Depth to 26°C Isotherm",
},
{
content: "Tropical Cyclone Heat Potential",
}]
}, eventManager);
profiles.draw(d3.select("#selectEvents"));
var svg3D = new SVGContainer({
node: d3.select("#seaImages"),
maxWid: 600,
maxHt: 600
});
var layers = new ImageViewer({
items:
[
new Image({
URI: 'img/seaTempSeries/gom_sst_26aug2005_260.jpg',
caption: "",
actualSize: {height: 288, width: 435}
}),
new Image({
URI: 'img/seaTempSeries/gom_sha_26aug2005_260.jpg',
caption: "",
actualSize: {height: 288, width: 435}
}),
new Image({
URI: 'img/seaTempSeries/gom_26.c_26aug2005_260.jpg',
caption: "",
actualSize: {height: 288, width: 435}
}),
new Image({
URI: 'img/seaTempSeries/gom_tchp_26aug2005_260.jpg',
caption: "",
actualSize: {height: 288, width: 435}
})
],
}, eventManager);
svg3D.append(layers);
eventManager.subscribe(profiles.selectedEventId, carouselUpdate);
eventManager.subscribe(layers.selectedEventId, dropdownUpdate);
function carouselUpdate (eventDetails)
{
layers.selectItemAtIndex(eventDetails.selectKey);
}
function dropdownUpdate ()
{
var newImage = layers.selectedItem();
var newval = layers.itemKeyToIndex(newImage.key);
profiles.lite(newval);
}
/************************************************************************
* handleSubmit *//**
*
* handleSubmit is called from the event handler for one of
* the input widgets when the user submits an answer. It scores
* the triggering widget and returns any answer response.
*
* @param eventDetails These are the keyed values returned by
* the event, in this case, a submission.
*************************************************************************/
function handleSsubmit(eventDetails)
{
//Handler needs to get written into each page,
//each widget will have it's own way of responding
eventDetails.id.score(eventDetails.selectKey);
}
</script>
</body>
</html>