-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathuiStep2.html
More file actions
152 lines (119 loc) · 3.69 KB
/
uiStep2.html
File metadata and controls
152 lines (119 loc) · 3.69 KB
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>
<script>
if (window.trustedTypes && window.trustedTypes.createPolicy) {
window.trustedTypes.createPolicy('default', {
createHTML: string => string,
createScriptURL: string => string,
createScript: string => string,
});
}
</script>
<?!= HtmlService.createTemplateFromFile('uiStyle').evaluate().getContent(); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</script>
<div id="s2_mw">
<div id="s2_mw_instr">
<table border="0">
<tr>
<td><img src="<?= FLUBAROO_WELCOME_IMG_URL ?>"
style="padding-right:15px;">
</td>
<td>
<?= langstr("FBL_STR_STEP2_INSTR") ?>
</td>
</tr>
</table>
</div>
<div id="s2_mw_alert" class="error" style="display:none;"></div>
<div class="vspacer_full"></div>
<div id="s2_mw_sel">
<?=langstr('FLB_STR_LOADING')?>
</div>
<div style="float:right;margin-top:20px;">
<table border="0" id="s2_mw_continue"><tr>
<td><img id="s2_mw_working" src="<?= FLUBAROO_WORKING_IMG_BAR_URL ?>" style="display:none;"></td>
<td width="35px"></td>
<td><input id="step2ContinueButton" type="button" class="action" value="Continue" onclick="step2Continue()" /></td>
</tr></table>
</div>
</div>
<script>
// run on load
$(function() {
google.script.run.withSuccessHandler(populateAnswerKeyData)
.uiStep2GetAnswerKeyData();
});
function populateAnswerKeyData(ak_data)
{
var h = '<table id="s2_mw_sel_table">';
h += '<tr><td><b><?= langstr("FLB_STR_GRADE_STEP2_LABEL_SELECT") ?></b></td>';
for (var i=0; i < ak_data.aks_header.length; i++)
{
var header = ak_data.aks_header[i];
h += '<td class="s2_mw_sel_table_hspacer"><b>' + header + '</b></td>';
}
h += '</tr>';
for (var i=0; i < ak_data.aks_vals.length; i++)
{
var ak_val_row = ak_data.aks_vals[i];
var checked = "";
if (ak_data.aks_subm_rows[i] == ak_data.aks_last_selected)
{
checked = ' checked = "checked" ';
}
h += '<tr><td><input type="radio" name="ak_select" value="' + ak_data.aks_subm_rows[i] + '"' + checked + '></td>'
for (var j=0; j < ak_val_row.length; j++)
{
var akv = ak_val_row[j];
h += '<td class="s2_mw_sel_table_hspacer">' + akv + '</td>';
}
h += '</tr>';
}
h += '</table>';
$('#s2_mw_sel').html(h);
}
// The code in this function runs when the page is loaded.
function step2Continue()
{
var ak_selected = false;
var ak_subm_row;
clearAlert();
// check that at least one option was selected
var ak_select = document.getElementsByName('ak_select');
for (var i=0; i < ak_select.length; i++)
{
if (ak_select[i].checked)
{
ak_selected = true;
ak_subm_row = ak_select[i].value;
break;
}
}
// Do client-side checks (at least one stud iden field)
if (!ak_selected)
{
showAlert('<?=langstr("FBL_STR_GRADE_STEP2_NO_AK_SELECTED")?>');
return;
}
// show the animation next to the continue button
$('#s2_mw_working').show();
$('step2ContinueButton').prop('disabled', true);
// call server-side function, passing it the selected answer key row.
google.script.run.gradingStep2SubmitHandler(ak_subm_row);
// show please wait...
setTimeout(step2CloseWindow, 3000);
}
function step2CloseWindow() {
google.script.host.close();
}
function showAlert(alert)
{
$('#s2_mw_alert').html(alert);
$('#s2_mw_alert').show(200);
}
function clearAlert()
{
$('#s2_mw_alert').html('');
$('#s2_mw_alert').hide(200);
}
</script>