Commit 9a691935 by Bridger Maxwell

Changed certificate request form wording. Removed email address field.

parent 32f9f631
...@@ -20,16 +20,22 @@ def certificate_request(request): ...@@ -20,16 +20,22 @@ def certificate_request(request):
if request.method != "POST" or not settings.END_COURSE_ENABLED: if request.method != "POST" or not settings.END_COURSE_ENABLED:
raise Http404 raise Http404
verification_checked = request.POST.get('cert_request_verify', 'false') honor_code_verify = request.POST.get('cert_request_honor_code_verify', 'false')
destination_email = request.POST.get('cert_request_email', '') name_verify = request.POST.get('cert_request_name_verify', 'false')
id_verify = request.POST.get('cert_request_id_verify', 'false')
error = '' error = ''
if verification_checked != 'true':
error += 'You must verify that you have followed the honor code to receive a certificate. ' if honor_code_verify != 'true':
try: error += 'Please verify that you have followed the honor code to receive a certificate. '
validate_email(destination_email)
except ValidationError: if name_verify != 'true':
error += 'Please provide a valid email address to send the certificate. ' error += 'Please verify that your name is correct to receive a certificate. '
if id_verify != 'true':
error += 'Please certify that you understand the unique ID on the certificate. '
grade = None grade = None
if len(error) == 0: if len(error) == 0:
student_gradesheet = grades.grade_sheet(request.user) student_gradesheet = grades.grade_sheet(request.user)
...@@ -40,18 +46,17 @@ def certificate_request(request): ...@@ -40,18 +46,17 @@ def certificate_request(request):
error += 'You have not earned a grade in this course. ' error += 'You have not earned a grade in this course. '
if len(error) == 0: if len(error) == 0:
generate_certificate(request.user, grade, destination_email) generate_certificate(request.user, grade)
# TODO: Send the certificate email # TODO: Send the certificate email
return HttpResponse(json.dumps({'success':True, return HttpResponse(json.dumps({'success':True}))
'value': 'A certificate is being generated and will be sent. ' }))
else: else:
return HttpResponse(json.dumps({'success':False, return HttpResponse(json.dumps({'success':False,
'error': error })) 'error': error }))
# This method should only be called if the user has a grade and has requested a certificate # This method should only be called if the user has a grade and has requested a certificate
def generate_certificate(user, grade, destination_email): def generate_certificate(user, grade):
# Make sure to see the comments in models.GeneratedCertificate to read about the valid # Make sure to see the comments in models.GeneratedCertificate to read about the valid
# states for a GeneratedCertificate object # states for a GeneratedCertificate object
generated_certificate = None generated_certificate = None
......
...@@ -142,8 +142,10 @@ $(function() { ...@@ -142,8 +142,10 @@ $(function() {
}); });
$("#cert_request_form").submit(function(){ $("#cert_request_form").submit(function(){
var values = {'cert_request_verify' : $("#cert_request_verify").is(':checked'), var values = {'cert_request_honor_code_verify' : $("#cert_request_honor_code_verify").is(':checked'),
'cert_request_email': $("#cert_request_email").val() }; 'cert_request_name_verify' : $("#cert_request_name_verify").is(':checked'),
'cert_request_id_verify' : $("#cert_request_id_verify").is(':checked'),
};
postJSON('/certificate_request', values, function(data) { postJSON('/certificate_request', values, function(data) {
if (data.success) { if (data.success) {
...@@ -155,7 +157,7 @@ $(function() { ...@@ -155,7 +157,7 @@ $(function() {
$("#survey_form").submit(); $("#survey_form").submit();
} }
$("#cert_request").html("<h1>Certificate Request Received</h1><p>A certificate will be sent to the specified email in a short time.</p>"); $("#cert_request").html("<h1>Certificate Request Received</h1><p>Thank you! A certificate is being generated. You will be notified when it is ready to download.</p>");
$(".cert_request_link").text("Certificate is being generated..."); $(".cert_request_link").text("Certificate is being generated...");
} else { } else {
$("#cert_request_error").html(data.error); $("#cert_request_error").html(data.error);
...@@ -405,28 +407,31 @@ $(function() { ...@@ -405,28 +407,31 @@ $(function() {
%if grade_sheet['grade']: %if grade_sheet['grade']:
<div id="cert_request" class="leanModal_box"> <div id="cert_request" class="leanModal_box">
<h1>Request a 6.002x Certificate</h1> <h1>Request a 6.002x Certificate</h1>
<p>You can request a certificate which verifies that you passed this course. When the certificate has been generated, it will be emailed. Later, the certificate can be downloaded from your Profile page.</p> <p>You can request a certificate which verifies that you passed this course. When the certificate has been generated, you will receive an email notification that it can be downloaded from your Profile page.</p>
<p>The certificate will indicate that <strong>${name}</strong> has successfully completed the Fall 2012 offering of <strong>Circuits and Electronics 6.002x</strong>. Please ensure that this is correct.</p> <p>The certificate will indicate that <strong>${name}</strong> has successfully completed the Fall 2012 offering of <strong>Circuits and Electronics 6.002x</strong>. Please ensure that this information is correct.</p>
<form id="cert_request_form"> <form id="cert_request_form">
<fieldset> <fieldset>
<div id="cert_request_error"> </div> <div id="cert_request_error"> </div>
<ul> <ul>
<li class="verify"> <li class="verify">
<input type="checkbox" id="cert_request_verify"/> <input type="checkbox" id="cert_request_honor_code_verify"/>
<label> I certify that I have not violated the Honor Code for this course. The name shown above is correct. </label> <label> I certify that I have not violated the Honor Code for this course. </label>
</li> </li>
<li> <li class="verify">
<label> Please enter the email address to send the certificate to: </label> <input type="checkbox" id="cert_request_name_verify"/>
<input id="cert_request_email" type="email" value="${email}" /> <label> The name shown above is correct. </label>
</li>
<li class="verify">
<input type="checkbox" id="cert_request_id_verify"/>
<label> I understand that my certificate contains my name a unique ID which will be visible on the certificate. I will give this ID only to those who I wish to visit the verification page on www.edXOnline.org to confirm that I passed Circuits and Electronics 6.002x. </label>
</li> </li>
</ul> </ul>
</fieldset> </fieldset>
<div id="cert_request_survey_holder"> </div> <div id="cert_request_survey_holder"> </div>
<input type="submit" id="" value="Send Certificate" /> <input type="submit" id="" value="Generate Certificate" />
</form> </form>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment