-
Notifications
You must be signed in to change notification settings - Fork 0
/
stlViewerState.js
57 lines (50 loc) · 1.84 KB
/
stlViewerState.js
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
/**
* This is the constructor for the state object that will be used to represent the
* student work. An instance of this object will be created each time the student
* submits an answer.
*
* note: you can change the variables in this constructor, the response variable
* is just used as an example. you can add any variables that will help you
* represent the student's work for your step type.
*/
function StlViewerState(response) {
//the text response the student wrote
this.response = "";
if(response != null) {
//set the response
this.response = response;
}
};
/**
* This function is used to reload previous work the student submitted for the step.
* The student work is retrieved and then this function is called to parse the student
* work so that we can display the previous answer the student submitted.
*
* note: you can change the variables in the stateJSONObj, the response
* variable is just used as an example. you can add any variables that will
* help you represent the student's work for your type of step.
*
* @param stateJSONObj a JSONObject representing the student work
* @return a StlViewerState object
*/
StlViewerState.prototype.parseDataJSONObj = function(stateJSONObj) {
//obtain the student work from the JSONObject
var response = stateJSONObj.response;
//create a state object with the student work
var stlViewerState = new StlViewerState(response);
//return the state object
return stlViewerState;
};
/**
* Get the student work for display purposes such as in the grading tool.
*
* @return the student work
*/
StlViewerState.prototype.getStudentWork = function() {
var studentWork = this;
return studentWork;
};
//used to notify scriptloader that this script has finished loading
if(typeof eventManager != 'undefined'){
eventManager.fire('scriptLoaded', 'vle/node/stlViewer/stlViewerState.js');
}