-
Notifications
You must be signed in to change notification settings - Fork 0
/
summer.html
635 lines (568 loc) · 32.1 KB
/
summer.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
{% extends "page_template.html" %}
{% block pagesubmenu %}
<span class="breadcrumbs_nav">
<a href="http://www.khanacademy.org">Home</a>
</span>
{% endblock pagesubmenu %}
{% block pagecontent %}
<script type="text/javascript">
var is_parent_js = {{ is_parent_js }}
var student_js = {{ student_js }}
var parent_js = {{ parent_js }}
</script>
<div id="discovery_lab" style="padding: 9px 23px;">
<div>
<h2>Khan Academy Discovery Lab 2012 Application</h2>
{% if authenticated %}
Logged in as: <u>{{ user_email }}</u>.
{% if make_payment %}
{% if student.processing_fee_paid %}
<br><br>Your application processing fee of ${{ student.processing_fee }} has been paid.<br>
We are still processing all applications, you can always check your application
<a href="/summer/application-status">status</a>
{% else %}
<br><br>Please pay the processing fee of ${{ student.processing_fee }} via Paypal using the
link below<br><br>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="39E8HDTV7CHHA">
<input type="hidden" name="first_name" value="{{ payee.first_name }}">
<input type="hidden" name="last_name" value="{{ payee.last_name }}">
<input type="hidden" name="address1" value="{{ payee.address_1 }}">
<input type="hidden" name="address2" value="{{ payee.address_2 }}">
<input type="hidden" name="city" value="{{ payee.city }}">
<input type="hidden" name="state" value="{{ payee.state }}">
<input type="hidden" name="zip" value="{{ payee.zipcode }}">
<input type="hidden" name="email" value="{{ payee.email }}">
<input type="hidden" name="night_phone_a" value="{{ payee_phone_a }}">
<input type="hidden" name="night_phone_b" value="{{ payee_phone_b }}">
<input type="hidden" name="night_phone_c" value="{{ payee_phone_c }}">
<input type="hidden" name="custom" value="{{ student.email }}">
<input type="hidden" name="return" value="http://khan-report.appspot.com/summer/paypal-autoreturn?student_email={{ student.email }}&user_email={{ user_email }}">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<br><br>
{% if not is_parent %}
All of your application information has been saved.
If you need your parent (or another adult) to make a payment, please let them know
your email address ({{ user_email }}) that you used to apply and have them login
to the site and process the payment on your behalf.<br><br>
You can always check the <a href="/summer/application-status">status</a> of your application
{% endif %}
{% endif %}
{% else %}
<form id="discovery-lab-application" method="POST" action="/summer/application" style="display: block; margin: 22px 0">
{% if applied %}
{% if is_parent %}
You have already applied for {{ students|length }} student(s). You can make changes to their
application or add a new student<br><br>
{% for student in students %}
<input id="{{ student.email }}" type="radio" name="applicant_email" value="{{ student.email }}"> "{{ student.first_name }} {{ student.last_name }}"<br>
{% endfor %}
<input id="new" type="radio" name="applicant_email" value="new"> Apply for a new student<br><br>
{% else %}
You have already applied, You can however make changes to your application<br><br>
<input id="applicant-email" name="applicant_email" type="hidden" value="{{ user_email }}" />
{% endif %}
{% else %}
To apply for the 2012 Khan Academy Discovery Lab, please fill out the form below.
Due to overwhelming demand, we will have limited space at the Discovery Lab. Please fill in this application
form if you'd like to be considered.<br><br>
There will be 3 two-week sessions held on the following dates
<ul>
<li>Session 1: Jun 25 - Jul 6</li>
<li>Session 2: Jul 16 - Jul 27</li>
<li>Session 3: Jul 30 - Aug 10</li>
</ul><br>
You can check back on the status of your application at any time (or edit your existing
application).<br><br>
{% endif %}
<u>Location for the camp:</u><br>
<a href="http://www.istp.org">International School of the Peninsula in Palo Alto.</a><br>
151 Laura Lane<br>
Palo Alto CA 94303<br><br>
Final decisions will be made on or before 15th February, 2012.
<hr>
<input id="user-email" name="user_email" type="hidden" value="{{ user_email }}" />
<input id="access-token-key" name="access_token_key" type="hidden" value={{ access_token_key }} />
<input id="access-token-secret" name="access_token_secret" type="hidden" value={{ access_token_secret }} />
<h3>Student Information</h3>
<b>Khan Academy email of the student: <font color="FF0000">*</font></b><br>
{% if is_parent %}
<input type="text" size="32" id="student_email" name="student_email" value="{{ student.email }}">
(<a href="#" class="student-autofill">autofill</a>)<br><br>
{% else %}
<input type="text" size="32" id="student_email" name="student_email" value="{{ user_email }}"><br><br>
{% endif %}
<b>Student Name: <font color="FF0000">*</font></b><br>
<table>
<tr>
<td><input type="text" id="first_name" name="first_name" value="{{ student.first_name }}"></td>
<td><input type="text" id="last_name" name="last_name" value="{{ student.last_name }}"></td>
</tr>
<tr>
<td>First</td>
<td>Last</td>
</tr>
</table><br>
<b>Date of Birth: <font color="FF0000">*</font></b><br>
<table>
<tr>
<td><input size="16" id="date_of_birth" name="date_of_birth" value="{{ student.date_of_birth }}"></td>
</tr>
<td><small>(MM/DD/YYYY)</small></td>
</table><br>
<b>Gender: <font color="FF0000">*</font></b><br>
<select id="gender" name="gender">
{% if student.is_female %}
<option value="Female">Female</option>
<option value="Male">Male</option>
{% else %}
<option value="Female">Female</option>
<option value="Male" selected>Male</option>
{% endif %}
</select><br><br>
<b>Grade entering in Fall 2012: <font color="FF0000">*</font></b><br>
<select id="grade" name="grade">
<option value=""></option>
<option value="5th grade">5th grade</option>
<option value="6th grade">6th grade</option>
<option value="7th grade">7th grade</option>
<option value="8th grade">8th grade</option>
<option value="Other">Other</option>
</select><br><br>
<b>School attending in Fall 2012: <font color="FF0000">*</font></b><br>
<input type="text" name="school" id="school" value="{{ student.school }}"><br><br>
<b>Home Mailing Address: <font color="FF0000">*</font></b><br>
<input type="text" size="87" name="address_1" id="address_1" value="{{ student.address_1 }}"><br>
Street address<br>
<input type="text" size="87" name="address_2" id="address_2" value="{{ student.address_2 }}"><br>
Address line 2<br>
<table>
<tr>
<td><input type="text" size="30" name="city" id="city" value="{{ student.city }}"></td>
{% if student.state %}
<td><input type="text" size="4" name="state" id="state" value="{{ student.state }}"></td>
{% else %}
<td><input type="text" size="4" name="state" id="state" value="CA"></td>
{% endif %}
<td><input type="text" size="10" name="zip" id="zip" value="{{ student.zipcode }}"></td>
{% if student.state %}
<td><input type="text" size="25" name="country" id="country" value="{{ student.country }}"></td>
{% else %}
<td><input type="text" size="25" name="country" id="country" value="United States"></td>
{% endif %}
</tr>
<tr>
<td>City</td>
<td>State</td>
<td>Zipcode</td>
</tr>
</table><br>
<hr>
<h3>Choose session and provide Khan Academy information:</h3>
Choose the sessions the students should be considered for, in order of preference. For example,
if you would like to be considered for session 3 first, choose that option as your first choice.
If you don't want to be considered for a session, choose N/A for that session
<font color="FF0000">*</font><br><br>
<table>
<tr>
<td width="180"><b>Session 1</b> (Jun 25 - Jul 6):</td>
<td><select id="session_1" name="session_1">
<option value=""></option>
<option value="1">First choice</option>
<option value="2">Second choice</option>
<option value="3">Third choice</option>
<option value="0">N/A</option>
</select></td>
</tr>
<tr>
<td><b>Session 2</b> Jul 16 - Jul 27:</td>
<td><select id="session_2" name="session_2">
<option value=""></option>
<option value="1">First choice</option>
<option value="2">Second choice</option>
<option value="3">Third choice</option>
<option value="0">N/A</option>
</select></td>
</tr>
<tr>
<td><b>Session 3</b> Jul 30 - Aug 10:</td>
<td><select id="session_3" name="session_3">
<option value=""></option>
<option value="1">First choice</option>
<option value="2">Second choice</option>
<option value="3">Third choice</option>
<option value="0">N/A</option>
</select></td>
</tr>
</table><br>
<b>Why do you want to come to the Khan Academy Discovery Lab? (to be answered by the student):
<font color="FF0000">*</font></b><br>
<textarea rows="10" cols="64" id="answer_why" name="answer_why">{{ student.answer_why }}</textarea><br><br>
<b>How do you use Khan Academy today? (to be answered by the student):
<font color="FF0000">*</font></b><br>
<textarea rows="10" cols="64" id="answer_how" name="answer_how">{{ student.answer_how }}</textarea><br><br>
<hr>
<h3>Parent/Guardian Information</h3>
<b>Name: <font color="FF0000">*</font></b><br>
<table>
<tr>
<td><input type="text" id="parent_first_name" name="parent_first_name" value="{{ parent.first_name }}"></td>
<td><input type="text" id="parent_last_name" name="parent_last_name" value="{{ parent.last_name }}"></td>
</tr>
<tr>
<td>First</td>
<td>Last</td>
</tr>
</table><br>
<b>Relationship to the student: <font color="FF0000">*</font></b><br>
<select id="relation" name="relation">
<option value=""></option>
<option value="Mother">Mother</option>
<option value="Father">Father</option>
<option value="Guardian">Guardian</option>
<option value="Other">Other</option>
</select><br><br>
<b>Parent email: <font color="FF0000">*</font></b><br>
<input type="text" size="32" id="parent_email" name="parent_email" value="{{ parent.email }}"><br><br>
<b>Phone number: <font color="FF0000">*</font></b><br>
<input type="text" name="parent_phone" id="parent_phone" value="{{ parent.phone }}"><br>
(###-###-####)<br><br>
<b>Address (<a href="#" class="parent-address">same as above</a>):</b><br>
<input type="text" size="87" name="parent_address_1" id="parent_address_1" value="{{ parent.address_1 }}"><br>
Street address<br>
<input type="text" size="87" name="parent_address_2" id="parent_address_2 value="{{ parent.address_2 }}""><br>
Address line 2<br>
<table>
<tr>
<td><input type="text" size="30" name="parent_city" id="parent_city" value="{{ parent.city }}"></td>
{% if parent.state %}
<td><input type="text" size="4" name="parent_state" id="parent_state" value="{{ parent.state }}"></td>
{% else %}
<td><input type="text" size="4" name="parent_state" id="parent_state" value="CA"></td>
{% endif %}
<td><input type="text" size="10" name="parent_zip" id="parent_zip" value="{{ parent.zipcode }}"></td>
{% if parent.country %}
<td><input type="text" size="25" name="parent_country" id="parent_country" value="{{ parent.country }}"></td>
{% else %}
<td><input type="text" size="25" name="parent_country" id="parent_country" value="United States"></td>
{% endif %}
</tr>
<tr>
<td>City</td>
<td>State</td>
<td>Zipcode</td>
</tr>
</table><br>
<b>Any other comments:</b><br>
<textarea rows="10" cols="64" id="parent_comments" name="parent_comments">{{ parent.comments }}</textarea><br><br>
<b>Processing Fee: <font color="FF0000">*</font></b><br>
{% if student.processing_fee_paid %}
$<input type="text" size="5" name="fee" id="fee" value="5 (paid)" readonly><br><br>
{% else %}
$<input type="text" size="5" name="fee" id="fee" value="5" readonly><br><br>
{% endif %}
<input id="discovery-lab-application-submit" type="submit" value="Apply for the Discovery Lab"/>
</form>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
var autofill = function(email, alert_user) {
$.ajax({
type: "GET",
url: "/summer/getstudent?student_email=" + email,
dataType: "jsonp",
success: function(l) {
if (l == null) {
if (alert_user) {
alert("Student " + email + " has not yet applied")
}
if (email == "new") {
$("#student_email").val("");
}
else {
$("#student_email").val(email);
}
$("#first_name").val("");
$("#last_name").val("");
$("#date_of_birth").val("");
$("#grade").val("");
$("#school").val("");
$("#session_1").val("");
$("#session_2").val("");
$("#session_3").val("");
$("#answer_why").val("");
$("#answer_how").val("");
$("#relation").val("");
$("#fee").val("5");
$("input[name=applicant_email]").filter('[id="new"]').attr("checked", "checked")
$("input[id='discovery-lab-application-submit']").val("Apply for the Discovery Lab")
}
else {
var current_user = {{ user_email_js }}
var update = 1
if (l.parent_email != "None" && l.parent_email != current_user) {
if (alert_user) {
if (confirm("Change parent for " + email + " from " + l.parent_email + " to you?")) {
update = 1
}
else {
update = 0
}
}
}
if (update == 1) {
$("#student_email").val(l.email);
$("#first_name").val(l.first_name);
$("#last_name").val(l.last_name);
$("#date_of_birth").val(l.date_of_birth);
$("#grade").val(l.grade);
$("#school").val(l.school);
$("#address_1").val(l.address_1);
$("#address_2").val(l.address_2);
$("#city").val(l.city);
$("#state").val(l.state);
$("#zip").val(l.zipcode);
$("#country").val(l.country);
$("#session_1").val(l.session_1);
$("#session_2").val(l.session_2);
$("#session_3").val(l.session_3);
$("#answer_why").val(l.answer_why);
$("#answer_how").val(l.answer_how);
if (l.parent_email == current_user) {
$("#relation").val(l.parent_relation);
}
if (l.processing_fee_paid = "True") {
$("#fee").val("5 (paid)");
}
else {
$("#fee").val("5");
}
$("input[name=applicant_email]").filter('[id="' + email + '"]').attr("checked", "checked")
$("input[id='discovery-lab-application-submit']").val("Modify Discovery Lab Application")
}
}
student_js = l
}
});
}
$(document).ready(function() {
if (student_js != null) {
$("input[id='discovery-lab-application-submit']").val("Modify Discovery Lab Application")
$("input[name=applicant_email]").filter('[id="' + student_js.email + '"]').attr("checked", "checked")
}
$("input[name='applicant_email']").bind('change keypress', function() {
var email = $("input[name='applicant_email']:checked").val()
autofill(email, false)
});
$("#student_email").change(function(e) {
var email = $("#student_email").val()
var user_email = {{ user_email_js }}
if (email != user_email) {
$("#parent_email").val(user_email)
$("#parent_email").attr("readonly", "readonly")
}
else {
$("#parent_email").removeAttr("readonly")
if (parent_js == null) {
$("#parent_email").val("")
}
else {
$("#parent_email").val(parent_js.email)
}
}
autofill(email, false)
});
$(".parent-address").click(function(e) {
$("#parent_address_1").val($("#address_1").val());
$("#parent_address_2").val($("#address_2").val());
$("#parent_city").val($("#city").val());
$("#parent_state").val($("#state").val());
$("#parent_zip").val($("#zip").val());
$("#parent_country").val($("#country").val());
e.preventDefault();
});
$(".student-autofill").click(function(e) {
if (!is_parent_js) {
return
}
var email = $("#student_email").val()
if (email == "") {
alert("Please enter the student's khan academy email to autofill data")
}
else {
autofill(email, true)
}
e.preventDefault();
});
$("#date_of_birth").datepicker();
if (student_js != null) {
$("#grade").val(student_js.grade)
$("#session_1").val(student_js.session_1)
$("#session_2").val(student_js.session_2)
$("#session_3").val(student_js.session_3)
$("#relation").val(student_js.parent_relation)
}
var parent_email = $("#parent_email").val()
var user_email = {{ user_email_js }}
if (parent_email == user_email) {
$("#parent_email").attr("readonly", "readonly")
}
});
$("#discovery-lab-application").submit(function(e) {
var first_name = $("#first_name").val()
if (first_name == "") {
alert("Student's first name is a required field")
e.preventDefault();
return
}
var last_name = $("#last_name").val()
if (last_name == "") {
alert("Student's last name is a required field")
e.preventDefault();
return
}
var dob = $("#date_of_birth").val()
if (dob == "") {
alert("Student's date of birth is a required field")
e.preventDefault();
return
}
var gender = $("#gender").val()
if (gender == "") {
alert("Student's gender is a required field")
e.preventDefault();
return
}
var grade = $("#grade").val()
if (grade == "") {
alert("Student's grade is a required field")
e.preventDefault();
return
}
var school = $("#school").val()
if (school == "") {
alert("Student's school is a required field")
e.preventDefault();
return
}
var address_1 = $("#address_1").val()
if (address_1 == "") {
alert("Student's address is a required field")
e.preventDefault();
return
}
var city = $("#city").val()
if (city == "") {
alert("Student's city is a required field")
e.preventDefault();
return
}
var state = $("#state").val()
if (state == "") {
alert("Student's state is a required field")
e.preventDefault();
return
}
var zip = $("#zip").val()
if (zip == "") {
alert("Student's zip is a required field")
e.preventDefault();
return
}
var country = $("#country").val()
if (country == "") {
alert("Student's country is a required field")
e.preventDefault();
return
}
var session_1 = $("#session_1").val()
if (session_1 == "") {
alert("Indicate a preference for session 1")
e.preventDefault();
return
}
var session_2 = $("#session_2").val()
if (session_2 == "") {
alert("Indicate a preference for session 2")
e.preventDefault();
return
}
var session_3 = $("#session_3").val()
if (session_3 == "") {
alert("Indicate a preference for session 3")
e.preventDefault();
return
}
var answer_why = $("#answer_why").val()
if (answer_why == "") {
alert("Please answer why do you want come to the Discovery lab")
e.preventDefault();
return
}
var answer_how = $("#answer_how").val()
if (answer_how == "") {
alert("Please answer how you use Khan Academy today")
e.preventDefault();
return
}
var student_email = $("#student_email").val()
if (student_email == "") {
alert("Khan Academy email is a required field")
e.preventDefault();
return
}
var parent_first_name = $("#parent_first_name").val()
if (parent_first_name == "") {
alert("Parent's first name is a required field")
e.preventDefault();
return
}
var parent_last_name = $("#parent_last_name").val()
if (parent_last_name == "") {
alert("Parent's last name is a required field")
e.preventDefault();
return
}
var parent_email = $("#parent_email").val()
if (parent_email == "") {
alert("Parent's email is a required field")
e.preventDefault();
return
}
var parent_phone = $("#parent_phone").val()
if (parent_phone == "") {
alert("Parent's phone is a required field")
e.preventDefault();
return
}
var relation = $("#relation").val()
if (relation == "") {
alert("Relationship to student is a required field")
e.preventDefault();
return
}
var parent_email = $("#parent_email").val()
var student_email = $("#student_email").val()
var user_email = {{ user_email_js }}
if (parent_email != user_email && student_email != user_email) {
alert("Either the parent or student email should be " + user_email + " (i.e. you)")
e.preventDefault();
return
}
if (student_js != null) {
if (student_js.processing_fee_paid == "True") {
window.location = "/summer/application-status"
e.preventDefault()
}
}
});
</script>
{% endif %}
{% else %}
<a id="auth_link" class="authenticate-user" href="{{login_url|escape}}">Log in to your Khan Academy account</a>
{% endif %}
</div>
</div>
{% endblock pagecontent %}