-
Notifications
You must be signed in to change notification settings - Fork 0
/
answer.html
193 lines (180 loc) · 7.27 KB
/
answer.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
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
<style>
body {
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 13px;
margin-left: 5px;
}
.buton{
color: white;
padding: 4px 3px 4px 12px;
background-color: #398a00;
border: 1px solid #29691d;
width: 55px;
border-radius: 2px;
text-shadow:0 1px rgba(0, 0, 0, .1);
font-family: arial, sans-serif;
font-size: 11px;
font-weight: bold;
position: absolute;
top: 238px;
left: 115px;
}
</style>
<script>
var strUser;
window.onload = function ()
{
google.script.run.withSuccessHandler(addList).comboBox();
};
function addList(infoList)
{
var select = document.getElementById("questions");
var parts = infoList.split("-");
for(var i = 0; i <(parts.length-1); i++)
{
var option = document.createElement('option');
option.text = parts[i];
option.value = parts[i];
select.add(option, 0);
}
}
function obtainAnswer()
{
var e = document.getElementById("questions");
strUser = e.options[e.selectedIndex].value;
//google.script.run.withSuccessHandler(getMaster).putAnswers(strUser);
var myRunner = google.script.run.withFailureHandler(onFailure);
var myRunner1 = myRunner.withSuccessHandler(getMaster);
myRunner1.putAnswers(strUser);
document.getElementById("info").innerHTML="";
var div= document.getElementById("info");
var para = document.createElement("p");
para.style.color = "red";
var node = document.createTextNode("The spreadsheet with the answers is being created, please do not close the page.");
para.style.textAlign="justify"
para.appendChild(node);
div.appendChild(para);
};
function view()
{
document.getElementById("info").innerHTML="";
var div= document.getElementById("info");
var para = document.createElement("p");
var node = document.createTextNode("Successful Notification");
para.style.color="#33cc33";
para.style.fontSize="20px";
para.appendChild(node);
div.appendChild(para);
var para1 = document.createElement("p");
var node1 = document.createTextNode("There is a new spreadsheet in the folder with name 'MasterAnswers', which contains the answers to the questions.");
para1.style.color="#000000";
para1.appendChild(node1);
div.appendChild(para1);
}
function getMaster(contador)
{
if(contador==0)
{
document.getElementById("info").innerHTML="";
var div= document.getElementById("info");
var para = document.createElement("p");
var node = document.createTextNode("Error Notification");
para.style.color="#e60000";
para.style.fontSize="20px";
para.appendChild(node);
div.appendChild(para);
var para1 = document.createElement("p");
var node1 = document.createTextNode("There are no spreadsheets to get the answers, please go to the option 'add noise' and share the spreadsheet with the students.");
para1.style.color="#000000";
para1.appendChild(node1);
div.appendChild(para1);
}
else if(contador==-1)
{
document.getElementById("info").innerHTML="";
var div= document.getElementById("info");
var para = document.createElement("p");
var node = document.createTextNode("Error Notification");
para.style.color="#e60000";
para.style.fontSize="20px";
para.appendChild(node);
div.appendChild(para);
var para1 = document.createElement("p");
var node1 = document.createTextNode("There is no 'Questions' sheet, create a sheet with name 'Questions' and add the questions and solutions.");
para1.style.color="#000000";
para1.appendChild(node1);
div.appendChild(para1);
}
else if(contador==-2)
{
document.getElementById("info").innerHTML="";
var div= document.getElementById("info");
var para = document.createElement("p");
var node = document.createTextNode("Error Notification");
para.style.color="#e60000";
para.style.fontSize="20px";
para.appendChild(node);
div.appendChild(para);
var para1 = document.createElement("p");
var node1 = document.createTextNode("The sheet of questions has mistakes, please check that you select the correct sheet with the headers: questions and answers. Also, that the column of answers are formulas.");
para1.style.color="#000000";
para1.appendChild(node1);
div.appendChild(para1);
}
else{var myVar =setTimeout(getMaster2, 4000);}
}
function getMaster2()
{
var div= document.getElementById("info");
var para = document.createElement("p");
var node = document.createTextNode("The answers are being added to the spreadsheet, this process can take minutes.");
para.style.textAlign="justify"
para.appendChild(node);
div.appendChild(para);
//google.script.run.withSuccessHandler(view).getAnswers(strUser);
var myRunner = google.script.run.withFailureHandler(onFailure);
var myRunner1 = myRunner.withSuccessHandler(view);
myRunner1.getAnswers(strUser);
}
function onFailure()
{
document.getElementById("info").innerHTML="";
var div= document.getElementById("info");
var para = document.createElement("p");
var node = document.createTextNode("Error Notification");
para.style.fontSize="20px";
para.appendChild(node);
div.appendChild(para);
var para4 = document.createElement("p");
var node4 = document.createTextNode("An unexpected error has occurred please check that you selected the right values and try again. If the error persists please call the administrator.");
para4.style.color="#000000";
para4.style.textAlign="justify"
para4.appendChild(node4);
div.appendChild(para4);
}
</script>
</head>
<body>
<div id="info" style="padding: 4px;">
<div class="label">Before creating the spreadsheet with the answers, please consider the following conditions:</div>
<ol style="margin: 0px; -webkit-padding-start: 20px;">
<li>You must have shared the spreadsheet with the students.</li>
<li>You must have a sheet with the following headers: </li>
<ul style="list-style-type: square; -webkit-padding-start: 20px;">
<li>Questions, this column contains the questions of the quiz to be sent to students.</li>
<li>Answers, this column contains the formulas related to the question column.</li>
</ul>
</ol>
<br />
<div class="label">
<select id="questions" name="questions" style="width: 100px;"></select>
<div class="buton" onclick="obtainAnswer();">Answers</div>
</div><br />
</div>
</body>
</html>