-
Notifications
You must be signed in to change notification settings - Fork 4
/
Template_Multiple_Choice_Activity.html
152 lines (143 loc) · 5.02 KB
/
Template_Multiple_Choice_Activity.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Template for Multiple Choice Question Brix" name="description">
<!-- widgets.css contains styling for the interactive brix -->
<link href="css/widgets.css" rel="stylesheet">
</head>
<body>
<div id="target1"></div>
<script src="js/d3.v3.min.js"></script>
<script src="js/brixlib-compiled.js"></script>
<script>
// Create an object that will contain the objects needed for the activities
// on this page.
pearson.brix.activity = {};
var a = pearson.brix.activity;
// The activity config that defines the brix and mortar for this page
a.config =
{
"description": "A Sample Activity containing a single multiple choice bric",
"sequenceNodeKey": "b3d5b510-34dd-480f-b8e1-b474522c9b03",
"maxAttempts": 2,
"containerConfig":
[
{
"description": "container for the sample multiple choice question",
"containerId": "target1",
"brixConfig":
[
{
"bricId": "Q1",
"bricType": "MultipleChoiceQuestion",
"config":
{
"id": "sampleQ1",
//"questionId": "b3d5b510-34dd-480f-b8e1-b474522c9b03",
"order": "randomized",
"presenterType": "RadioGroup",
"presenterConfig": { "numberFormat": "latin-upper" },
"question": "Which of the following statements about resource demands is incorrect?",
"choices":
[
{
"content": "We will need 300% more food by 2050",
"answerKey": "answer1"
},
{
"content": "We will need 70% more food by 2050",
"answerKey": "answer2"
},
{
"content": "We will need 80% more water by 2050",
"answerKey": "answer3"
},
{
"content": "We will need 200% more energy by 2050",
"answerKey": "answer4"
}
]
},
"configFixup":
[
{
"type": "set-property",
"name": "questionId",
"value": { "type": "ref", "domain": "info", "refId": "sequenceNodeKey" }
},
{
"type": "set-property",
"name": "maxAttempts",
"value": { "type": "ref", "domain": "info", "refId": "maxAttempts" }
}
],
"answerKey":
{
"assessmentType": "multiplechoice",
"answers":
{
"answer1":
{
"score": 1,
"response": "We need enough more food to support the increase in population but it isn't going to quadruple by 2050."
},
"answer2":
{
"score": 0,
"response": ""
},
"answer3":
{
"score": 0,
"response": ""
},
"answer4":
{
"score": 0,
"response": "The energy used per person is increasing at the same time the population is increasing so we're going to need three times as much energy."
}
}
}
}
],
"hookupActions":
[
{
"description": "Hookup the submit manager to evaluate answers",
"type": "method-call",
"instance": { "type": "submit-manager" },
"methodName": "handleRequestsFrom",
"args":
[
{ "type": "ref", "domain": "brix", "refId": "Q1" },
]
},
{
"description": "Draw the question",
"type": "method-call",
"instance": {"type": "ref", "domain": "brix", "refId": "Q1"},
"methodName": "draw",
"args":
[
{ "type": "d3select", "selector": "#target1" },
]
}
]
}
]
};
// create the eventmanager to be used by the created brix, and the
// bricLayer which will create them, and then tell the bricLayer to build.
a.eventManager = new pearson.utils.EventManager();
a.answerMan = new pearson.brix.utils.LocalAnswerMan();
a.submitManager = new pearson.brix.utils.SubmitManager(a.eventManager, a.answerMan);
a.bricLayer = new pearson.brix.BricLayer(null, a.eventManager, a.submitManager);
a.building = a.bricLayer.build(a.config);
a.answerMan.setMaxAttempts(a.config.maxAttempts);
a.answerMan.registerAnswerKey(a.config.sequenceNodeKey,
a.config.containerConfig[0].brixConfig[0].answerKey);
</script>
</body>
</html>