-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·73 lines (72 loc) · 3.31 KB
/
index.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
<html>
<head>
<script src="https://cdn.ctat.cs.cmu.edu/releases/current/jquery.min.js"></script>
<script type="module" src="./lib/datashoplogger.min.js"></script>
<script>
let params={};
params["SessionLog"]="true";
params["Logging"]="ClientToLogServer";
params["log_service_url"]="https://pslc-qa.andrew.cmu.edu/log/server";
params["dataset_name"]="HTML5LoggingTest";
params["dataset_level_name1"]="Unit1.0";
params["dataset_level_type1"]="unit";
params["dataset_level_name2"]="Section1.0";
params["dataset_level_type2"]="section";
params["problem_name"]="AFractionsProblem";
params["school_name"]="CMU";
params["instructor_name"]="A Teacher Name";
params["user_guid"]="student1";
params["class_name"]="22-512";
let sessionId="";
let lastTxID="";
let loggingLibrary=null;
</script>
<style>
div { margin: 1em; }
</style>
<body onLoad="console.log(params, 'typeof CTATLoggingLibrary', typeof CTATLoggingLibrary) || (loggingLibrary=new CTATLoggingLibrary(params))">
<div>
<label for="start">Click for session and context_message</label>
<button id="start" type="button" onClick="sessionId || (sessionId=loggingLibrary.start())">Start Log Session</button>
</div>
<div>
<label for="text1">Enter a string and tab out for a tool_message</label>
<input type="text" id="text1" data-action="UpdateTextField"
onBlur="lastTxID=loggingLibrary.logInterfaceAttempt(this.id, this.dataset.action, this.value)"/>
</div>
<div>
<label for="text1-evel">Choose an eval and tab out for a tutor_message</label>
<select id="text1-eval" required
onBlur="var that=document.getElementById(this.id.replace(/-eval/,'')), unused=this.value && loggingLibrary.logResponse(lastTxID, that.id, that.dataset.action, that.value, 'RESULT', this.value, this.value=='Correct'?'successMsg':'buggyMsg', {tutor_input: that.value})">
<option></option>
<option>Correct</option>
<option>Incorrect</option>
</select>
</div>
<div>
<label for="text1-hbtn">Click for a hint request</label>
<button id="text1-hbtn" type="button" onClick="lastTxID=logHintRequest(this.id.replace(/-hbtn/,''))">Hint</button>
</div>
<div>
<label for="text1-hints">Choose a hint and tab out for a hint response</label>
<select id="text1-hints" required
onBlur="var that=document.getElementById(this.id.replace(/-hints/,'')), unused=loggingLibrary.logHintResponse(lastTxID, that.id, that.dataset.action, that.value, this.selectedIndex, this.options.length-1, this.value, {tutor_input: that.value})">
<option></option>
<option>First hint</option>
<option>Second hint</option>
</select>
</div>
<script>
function logHintRequest(selection) {
let s="hint", a="ButtonPressed", i=-1, previousFocus=document.getElementById(selection);
if(previousFocus?.value) {
a=[a, "PreviousFocus"]; // asks tutor to bias hint selection
s=[s, selection]; // selection of step to get bias
}
return loggingLibrary.logInterfaceHintRequest(s, a, i, // strings or arrays
previousFocus ? {previous_input: previousFocus.value} : null // custom field
)
}
</script>
</body>
</html>