Commit 44b36624 by Bridger Maxwell

Moved certificate requests to its own application. Fixed up styling on…

Moved certificate requests to its own application. Fixed up styling on certificate request form. Changed wording of the form.
parent 6a65041e
import json
import logging import logging
import os import os
import random import random
...@@ -192,7 +191,51 @@ def index(request, course="6.002 Spring 2012", chapter="Using the System", secti ...@@ -192,7 +191,51 @@ def index(request, course="6.002 Spring 2012", chapter="Using the System", secti
result = render_to_response('courseware.html', context) result = render_to_response('courseware.html', context)
return result return result
@ensure_csrf_cookie def modx_dispatch(request, module=None, dispatch=None, id=None):
''' Generic view for extensions. '''
if not request.user.is_authenticated():
return redirect('/')
# Grab the student information for the module from the database
s = StudentModule.objects.filter(student=request.user,
module_id=id)
#s = StudentModule.get_with_caching(request.user, id)
if len(s) == 0 or s is None:
log.debug("Couldnt find module for user and id " + str(module) + " " + str(request.user) + " "+ str(id))
raise Http404
s = s[0]
oldgrade = s.grade
oldstate = s.state
dispatch=dispatch.split('?')[0]
ajax_url = settings.MITX_ROOT_URL + '/modx/'+module+'/'+id+'/'
# Grab the XML corresponding to the request from course.xml
xml = content_parser.module_xml(request.user, module, 'id', id)
# Create the module
system = I4xSystem(track_function = make_track_function(request),
render_function = None,
ajax_url = ajax_url,
filestore = None
)
instance=courseware.modules.get_module_class(module)(system,
xml,
id,
state=oldstate)
# Let the module handle the AJAX
ajax_return=instance.handle_ajax(dispatch, request.POST)
# Save the state back to the database
s.state=instance.get_state()
if instance.get_score():
s.grade=instance.get_score()['score']
if s.grade != oldgrade or s.state != oldstate:
s.save()
# Return whatever the module wanted to return to the client/caller
return HttpResponse(ajax_return)
def certificate_request(request): def certificate_request(request):
''' Attempt to send a certificate. ''' ''' Attempt to send a certificate. '''
if request.method != "POST": if request.method != "POST":
......
...@@ -144,6 +144,7 @@ INSTALLED_APPS = ( ...@@ -144,6 +144,7 @@ INSTALLED_APPS = (
'simplewiki', 'simplewiki',
'track', 'track',
'circuit', 'circuit',
'certificates',
'perfstats', 'perfstats',
'util', 'util',
# Uncomment the next line to enable the admin: # Uncomment the next line to enable the admin:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -915,21 +915,21 @@ div#pwd_reset p { ...@@ -915,21 +915,21 @@ div#pwd_reset p {
div#pwd_reset input[type="email"] { div#pwd_reset input[type="email"] {
margin-bottom: 25.888px; } margin-bottom: 25.888px; }
div#apply_name_change, div#change_email, div#unenroll, div#deactivate-account { div#cert_request, div#apply_name_change, div#change_email, div#unenroll, div#deactivate-account {
max-width: 700px; } max-width: 700px; }
div#apply_name_change ul, div#change_email ul, div#unenroll ul, div#deactivate-account ul { div#cert_request ul, div#apply_name_change ul, div#change_email ul, div#unenroll ul, div#deactivate-account ul {
list-style: none; } list-style: none; }
div#apply_name_change ul li, div#change_email ul li, div#unenroll ul li, div#deactivate-account ul li { div#cert_request ul li, div#apply_name_change ul li, div#change_email ul li, div#unenroll ul li, div#deactivate-account ul li {
margin-bottom: 12.944px; } margin-bottom: 12.944px; }
div#apply_name_change ul li textarea, div#apply_name_change ul li input[type="email"], div#apply_name_change ul li input[type="number"], div#apply_name_change ul li input[type="password"], div#apply_name_change ul li input[type="search"], div#apply_name_change ul li input[type="tel"], div#apply_name_change ul li input[type="text"], div#apply_name_change ul li input[type="url"], div#apply_name_change ul li input[type="color"], div#apply_name_change ul li input[type="date"], div#apply_name_change ul li input[type="datetime"], div#apply_name_change ul li input[type="datetime-local"], div#apply_name_change ul li input[type="month"], div#apply_name_change ul li input[type="time"], div#apply_name_change ul li input[type="week"], div#change_email ul li textarea, div#change_email ul li input[type="email"], div#change_email ul li input[type="number"], div#change_email ul li input[type="password"], div#change_email ul li input[type="search"], div#change_email ul li input[type="tel"], div#change_email ul li input[type="text"], div#change_email ul li input[type="url"], div#change_email ul li input[type="color"], div#change_email ul li input[type="date"], div#change_email ul li input[type="datetime"], div#change_email ul li input[type="datetime-local"], div#change_email ul li input[type="month"], div#change_email ul li input[type="time"], div#change_email ul li input[type="week"], div#unenroll ul li textarea, div#unenroll ul li input[type="email"], div#unenroll ul li input[type="number"], div#unenroll ul li input[type="password"], div#unenroll ul li input[type="search"], div#unenroll ul li input[type="tel"], div#unenroll ul li input[type="text"], div#unenroll ul li input[type="url"], div#unenroll ul li input[type="color"], div#unenroll ul li input[type="date"], div#unenroll ul li input[type="datetime"], div#unenroll ul li input[type="datetime-local"], div#unenroll ul li input[type="month"], div#unenroll ul li input[type="time"], div#unenroll ul li input[type="week"], div#deactivate-account ul li textarea, div#deactivate-account ul li input[type="email"], div#deactivate-account ul li input[type="number"], div#deactivate-account ul li input[type="password"], div#deactivate-account ul li input[type="search"], div#deactivate-account ul li input[type="tel"], div#deactivate-account ul li input[type="text"], div#deactivate-account ul li input[type="url"], div#deactivate-account ul li input[type="color"], div#deactivate-account ul li input[type="date"], div#deactivate-account ul li input[type="datetime"], div#deactivate-account ul li input[type="datetime-local"], div#deactivate-account ul li input[type="month"], div#deactivate-account ul li input[type="time"], div#deactivate-account ul li input[type="week"] { div#cert_request ul li textarea, div#cert_request ul li input[type="email"], div#cert_request ul li input[type="number"], div#cert_request ul li input[type="password"], div#cert_request ul li input[type="search"], div#cert_request ul li input[type="tel"], div#cert_request ul li input[type="text"], div#cert_request ul li input[type="url"], div#cert_request ul li input[type="color"], div#cert_request ul li input[type="date"], div#cert_request ul li input[type="datetime"], div#cert_request ul li input[type="datetime-local"], div#cert_request ul li input[type="month"], div#cert_request ul li input[type="time"], div#cert_request ul li input[type="week"], div#apply_name_change ul li textarea, div#apply_name_change ul li input[type="email"], div#apply_name_change ul li input[type="number"], div#apply_name_change ul li input[type="password"], div#apply_name_change ul li input[type="search"], div#apply_name_change ul li input[type="tel"], div#apply_name_change ul li input[type="text"], div#apply_name_change ul li input[type="url"], div#apply_name_change ul li input[type="color"], div#apply_name_change ul li input[type="date"], div#apply_name_change ul li input[type="datetime"], div#apply_name_change ul li input[type="datetime-local"], div#apply_name_change ul li input[type="month"], div#apply_name_change ul li input[type="time"], div#apply_name_change ul li input[type="week"], div#change_email ul li textarea, div#change_email ul li input[type="email"], div#change_email ul li input[type="number"], div#change_email ul li input[type="password"], div#change_email ul li input[type="search"], div#change_email ul li input[type="tel"], div#change_email ul li input[type="text"], div#change_email ul li input[type="url"], div#change_email ul li input[type="color"], div#change_email ul li input[type="date"], div#change_email ul li input[type="datetime"], div#change_email ul li input[type="datetime-local"], div#change_email ul li input[type="month"], div#change_email ul li input[type="time"], div#change_email ul li input[type="week"], div#unenroll ul li textarea, div#unenroll ul li input[type="email"], div#unenroll ul li input[type="number"], div#unenroll ul li input[type="password"], div#unenroll ul li input[type="search"], div#unenroll ul li input[type="tel"], div#unenroll ul li input[type="text"], div#unenroll ul li input[type="url"], div#unenroll ul li input[type="color"], div#unenroll ul li input[type="date"], div#unenroll ul li input[type="datetime"], div#unenroll ul li input[type="datetime-local"], div#unenroll ul li input[type="month"], div#unenroll ul li input[type="time"], div#unenroll ul li input[type="week"], div#deactivate-account ul li textarea, div#deactivate-account ul li input[type="email"], div#deactivate-account ul li input[type="number"], div#deactivate-account ul li input[type="password"], div#deactivate-account ul li input[type="search"], div#deactivate-account ul li input[type="tel"], div#deactivate-account ul li input[type="text"], div#deactivate-account ul li input[type="url"], div#deactivate-account ul li input[type="color"], div#deactivate-account ul li input[type="date"], div#deactivate-account ul li input[type="datetime"], div#deactivate-account ul li input[type="datetime-local"], div#deactivate-account ul li input[type="month"], div#deactivate-account ul li input[type="time"], div#deactivate-account ul li input[type="week"] {
display: block; display: block;
width: 100%; width: 100%;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; } box-sizing: border-box; }
div#apply_name_change ul li textarea, div#change_email ul li textarea, div#unenroll ul li textarea, div#deactivate-account ul li textarea { div#cert_request ul li textarea, div#apply_name_change ul li textarea, div#change_email ul li textarea, div#unenroll ul li textarea, div#deactivate-account ul li textarea {
height: 60px; } height: 60px; }
div#apply_name_change ul li input[type="submit"], div#change_email ul li input[type="submit"], div#unenroll ul li input[type="submit"], div#deactivate-account ul li input[type="submit"] { div#cert_request ul li input[type="submit"], div#apply_name_change ul li input[type="submit"], div#change_email ul li input[type="submit"], div#unenroll ul li input[type="submit"], div#deactivate-account ul li input[type="submit"] {
white-space: normal; } white-space: normal; }
div#feedback_div form ol li { div#feedback_div form ol li {
......
...@@ -341,9 +341,8 @@ $(function() { ...@@ -341,9 +341,8 @@ $(function() {
<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 have earned the grade <strong>${grade_sheet['grade']}</strong> in this class.</p> <p>You can request a certificate verifying your grade in this course. The certificate can be sent to your email, or directly to any other email address.</p>
<p>Your name is <strong>${name}</strong></p> <p>The certificate will indicate that <strong>${name}</strong> has earned a grade of <strong>${grade_sheet['grade']}</strong> in the Fall 2012 offering of <strong>6.002x Beta - Circuits and Electronics</strong>. Please ensure that this is correct.</p>
<p>You can request a certificate be sent to your email, or send the certificate directly to another school or employer.</p>
<form id="cert_request_form"> <form id="cert_request_form">
<div id="cert_request_error"> </div> <div id="cert_request_error"> </div>
...@@ -354,8 +353,8 @@ $(function() { ...@@ -354,8 +353,8 @@ $(function() {
<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. The name shown above is correct. </label>
</li> </li>
<li> <li>
<label> Please enter your new email address: </label> <label> Please enter the email address to send the certificate to: </label>
<input id="cert_request_email" type="email" value="" /> <input id="cert_request_email" type="email" value="${email}" />
</li> </li>
<li> <li>
<input type="submit" id="" value="Send Certificate" /> <input type="submit" id="" value="Send Certificate" />
......
...@@ -205,6 +205,7 @@ div#pwd_reset { ...@@ -205,6 +205,7 @@ div#pwd_reset {
} }
} }
div#cert_request,
div#apply_name_change, div#apply_name_change,
div#change_email, div#change_email,
div#unenroll, div#unenroll,
......
...@@ -15,7 +15,7 @@ urlpatterns = ('', ...@@ -15,7 +15,7 @@ urlpatterns = ('',
url(r'^accept_name_change$', 'student.views.accept_name_change'), url(r'^accept_name_change$', 'student.views.accept_name_change'),
url(r'^reject_name_change$', 'student.views.reject_name_change'), url(r'^reject_name_change$', 'student.views.reject_name_change'),
url(r'^pending_name_changes$', 'student.views.pending_name_changes'), url(r'^pending_name_changes$', 'student.views.pending_name_changes'),
url(r'^certificate_request$', 'courseware.views.certificate_request'), url(r'^certificate_request$', 'certificates.views.certificate_request'),
url(r'^gradebook$', 'courseware.views.gradebook'), url(r'^gradebook$', 'courseware.views.gradebook'),
url(r'^event$', 'track.views.user_track'), url(r'^event$', 'track.views.user_track'),
url(r'^t/(?P<template>[^/]*)$', 'static_template_view.views.index'), url(r'^t/(?P<template>[^/]*)$', 'static_template_view.views.index'),
......
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