Commit 98ff3d5b by David Ormsbee

Merge branch 'master' into move_settings

Conflicts:
	djangoapps/student/views.py
	urls.py
parents f0d80a07 0c69e009
File deleted
...@@ -9,3 +9,5 @@ courseware/static/js/mathjax/* ...@@ -9,3 +9,5 @@ courseware/static/js/mathjax/*
db.newaskbot db.newaskbot
db.oldaskbot db.oldaskbot
flushdb.sh flushdb.sh
build
\#*\#
\ No newline at end of file
#! /bin/bash
set -x
set -e
#sass sass:static/css -r templates/sass/bourbon/lib/bourbon.rb --style :compressed
if [ -z "${GIT_COMMIT}" ]; then
GIT_COMMIT=$(git rev-parse HEAD)
fi
if [ -z "${GIT_BRANCH}" ]; then
GIT_BRANCH=$(git symbolic-ref -q HEAD)
GIT_BRANCH=${GIT_BRANCH##refs/heads/}
GIT_BRANCH=${GIT_BRANCH:-HEAD}
fi
GIT_BRANCH=${GIT_BRANCH##origin/}
GIT_BRANCH=${GIT_BRANCH//\//_}
if [ -z "${BUILD_NUMBER}" ]; then
BUILD_NUMBER=dev
fi
ID=mitx-${GIT_BRANCH}-${BUILD_NUMBER}-${GIT_COMMIT}
REPO_ROOT=$(dirname $0)/..
BUILD_DIR=${REPO_ROOT}/build
mkdir -p ${BUILD_DIR}
tar --exclude=.git --exclude=build --transform="s#^#mitx/#" -czf ${BUILD_DIR}/${ID}.tgz ${REPO_ROOT}
...@@ -5,6 +5,7 @@ import operator ...@@ -5,6 +5,7 @@ import operator
import re import re
import numpy import numpy
import numbers
import scipy.constants import scipy.constants
from pyparsing import Word, alphas, nums, oneOf, Literal from pyparsing import Word, alphas, nums, oneOf, Literal
...@@ -121,7 +122,7 @@ def evaluator(variables, functions, string, cs=False): ...@@ -121,7 +122,7 @@ def evaluator(variables, functions, string, cs=False):
def number_parse_action(x): # [ '7' ] -> [ 7 ] def number_parse_action(x): # [ '7' ] -> [ 7 ]
return [super_float("".join(x))] return [super_float("".join(x))]
def exp_parse_action(x): # [ 2 ^ 3 ^ 2 ] -> 512 def exp_parse_action(x): # [ 2 ^ 3 ^ 2 ] -> 512
x = [e for e in x if type(e) in [float, numpy.float64, numpy.complex]] # Ignore ^ x = [e for e in x if isinstance(e, numbers.Number)] # Ignore ^
x.reverse() x.reverse()
x=reduce(lambda a,b:b**a, x) x=reduce(lambda a,b:b**a, x)
return x return x
...@@ -130,7 +131,7 @@ def evaluator(variables, functions, string, cs=False): ...@@ -130,7 +131,7 @@ def evaluator(variables, functions, string, cs=False):
return x[0] return x[0]
if 0 in x: if 0 in x:
return float('nan') return float('nan')
x = [1./e for e in x if type(e) == float] # Ignore ^ x = [1./e for e in x if isinstance(e, numbers.Number)] # Ignore ||
return 1./sum(x) return 1./sum(x)
def sum_parse_action(x): # [ 1 + 2 - 3 ] -> 0 def sum_parse_action(x): # [ 1 + 2 - 3 ] -> 0
total = 0.0 total = 0.0
...@@ -217,4 +218,7 @@ if __name__=='__main__': ...@@ -217,4 +218,7 @@ if __name__=='__main__':
print evaluator({},{}, "-(7+5)") print evaluator({},{}, "-(7+5)")
print evaluator({},{}, "-0.33") print evaluator({},{}, "-0.33")
print evaluator({},{}, "-.33") print evaluator({},{}, "-.33")
print evaluator({},{}, "5+1*j")
print evaluator({},{}, "j||1")
print evaluator({},{}, "e^(j*pi)")
print evaluator({},{}, "5+7 QWSEKO") print evaluator({},{}, "5+7 QWSEKO")
...@@ -8,7 +8,8 @@ class textline(object): ...@@ -8,7 +8,8 @@ class textline(object):
def render(element, value, state): def render(element, value, state):
eid=element.get('id') eid=element.get('id')
count = int(eid.split('_')[-2])-1 # HACK count = int(eid.split('_')[-2])-1 # HACK
context = {'id':eid, 'value':value, 'state':state, 'count':count} size = element.get('size')
context = {'id':eid, 'value':value, 'state':state, 'count':count, 'size': size}
html=render_to_string("textinput.html", context) html=render_to_string("textinput.html", context)
return etree.XML(html) return etree.XML(html)
......
import json import json
import math import math
import numbers
import numpy import numpy
import random import random
import scipy import scipy
...@@ -37,7 +38,6 @@ class numericalresponse(object): ...@@ -37,7 +38,6 @@ class numericalresponse(object):
def __init__(self, xml, context): def __init__(self, xml, context):
self.xml = xml self.xml = xml
self.correct_answer = contextualize_text(xml.get('answer'), context) self.correct_answer = contextualize_text(xml.get('answer'), context)
self.correct_answer = float(self.correct_answer)
self.tolerance_xml = xml.xpath('//*[@id=$id]//responseparam[@type="tolerance"]/@default', self.tolerance_xml = xml.xpath('//*[@id=$id]//responseparam[@type="tolerance"]/@default',
id=xml.get('id'))[0] id=xml.get('id'))[0]
self.tolerance = contextualize_text(self.tolerance_xml, context) self.tolerance = contextualize_text(self.tolerance_xml, context)
...@@ -48,8 +48,11 @@ class numericalresponse(object): ...@@ -48,8 +48,11 @@ class numericalresponse(object):
''' Display HTML for a numeric response ''' ''' Display HTML for a numeric response '''
student_answer = student_answers[self.answer_id] student_answer = student_answers[self.answer_id]
try: try:
correct = compare_with_tolerance (evaluator(dict(),dict(),student_answer), self.correct_answer, self.tolerance) correct = compare_with_tolerance (evaluator(dict(),dict(),student_answer), complex(self.correct_answer), self.tolerance)
except: # We should catch this explicitly.
# I think this is just pyparsing.ParseException, calc.UndefinedVariable:
# But we'd need to confirm
except:
raise StudentInputError('Invalid input -- please use a number only') raise StudentInputError('Invalid input -- please use a number only')
if correct: if correct:
...@@ -141,7 +144,7 @@ class formularesponse(object): ...@@ -141,7 +144,7 @@ class formularesponse(object):
except: except:
#traceback.print_exc() #traceback.print_exc()
raise StudentInputError("Error in formula") raise StudentInputError("Error in formula")
if math.isnan(student_result) or math.isinf(student_result): if numpy.isnan(student_result) or numpy.isinf(student_result):
return {self.answer_id:"incorrect"} return {self.answer_id:"incorrect"}
if not compare_with_tolerance(student_result, instructor_result, self.tolerance): if not compare_with_tolerance(student_result, instructor_result, self.tolerance):
return {self.answer_id:"incorrect"} return {self.answer_id:"incorrect"}
...@@ -153,9 +156,9 @@ class formularesponse(object): ...@@ -153,9 +156,9 @@ class formularesponse(object):
keys and all non-numeric values stripped out. All values also keys and all non-numeric values stripped out. All values also
converted to float. Used so we can safely use Python contexts. converted to float. Used so we can safely use Python contexts.
''' '''
d=dict([(k, float(d[k])) for k in d if type(k)==str and \ d=dict([(k, numpy.complex(d[k])) for k in d if type(k)==str and \
k.isalnum() and \ k.isalnum() and \
(type(d[k]) == float or type(d[k]) == int) ]) isinstance(d[k], numbers.Number)])
return d return d
def get_answers(self): def get_answers(self):
......
...@@ -26,6 +26,12 @@ import courseware.content_parser as content_parser ...@@ -26,6 +26,12 @@ import courseware.content_parser as content_parser
log = logging.getLogger("mitx.courseware") log = logging.getLogger("mitx.courseware")
class ComplexEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, complex):
return "{real:.7g}{imag:+.7g}*j".format(real = obj.real,imag = obj.imag)
return json.JSONEncoder.default(self, obj)
class Module(XModule): class Module(XModule):
''' Interface between capa_problem and x_module. Originally a hack ''' Interface between capa_problem and x_module. Originally a hack
meant to be refactored out, but it seems to be serving a useful meant to be refactored out, but it seems to be serving a useful
...@@ -240,7 +246,8 @@ class Module(XModule): ...@@ -240,7 +246,8 @@ class Module(XModule):
if not self.answer_available(): if not self.answer_available():
raise Http404 raise Http404
else: else:
return json.dumps(self.lcp.get_question_answers()) return json.dumps(self.lcp.get_question_answers(),
cls=ComplexEncoder)
# Figure out if we should move these to capa_problem? # Figure out if we should move these to capa_problem?
......
...@@ -20,7 +20,7 @@ class ModelsTest(unittest.TestCase): ...@@ -20,7 +20,7 @@ class ModelsTest(unittest.TestCase):
variables={'R1':2.0, 'R3':4.0} variables={'R1':2.0, 'R3':4.0}
functions={'sin':numpy.sin, 'cos':numpy.cos} functions={'sin':numpy.sin, 'cos':numpy.cos}
self.assertEqual(calc.evaluator(variables, functions, "10000||sin(7+5)-6k"), 4000.0) self.assertTrue(abs(calc.evaluator(variables, functions, "10000||sin(7+5)+0.5356"))<0.01)
self.assertEqual(calc.evaluator({'R1': 2.0, 'R3':4.0}, {}, "13"), 13) self.assertEqual(calc.evaluator({'R1': 2.0, 'R3':4.0}, {}, "13"), 13)
self.assertEqual(calc.evaluator(variables, functions, "13"), 13) self.assertEqual(calc.evaluator(variables, functions, "13"), 13)
self.assertEqual(calc.evaluator({'a': 2.2997471478310274, 'k': 9, 'm': 8, 'x': 0.66009498411213041}, {}, "5"), 5) self.assertEqual(calc.evaluator({'a': 2.2997471478310274, 'k': 9, 'm': 8, 'x': 0.66009498411213041}, {}, "5"), 5)
...@@ -30,6 +30,8 @@ class ModelsTest(unittest.TestCase): ...@@ -30,6 +30,8 @@ class ModelsTest(unittest.TestCase):
self.assertEqual(calc.evaluator(variables, functions, "R1*R3"), 8.0) self.assertEqual(calc.evaluator(variables, functions, "R1*R3"), 8.0)
self.assertTrue(abs(calc.evaluator(variables, functions, "sin(e)-0.41"))<0.01) self.assertTrue(abs(calc.evaluator(variables, functions, "sin(e)-0.41"))<0.01)
self.assertTrue(abs(calc.evaluator(variables, functions, "k*T/q-0.025"))<0.001) self.assertTrue(abs(calc.evaluator(variables, functions, "k*T/q-0.025"))<0.001)
self.assertTrue(abs(calc.evaluator(variables, functions, "e^(j*pi)")+1)<0.00001)
self.assertTrue(abs(calc.evaluator(variables, functions, "j||1")-0.5-0.5j)<0.00001)
exception_happened = False exception_happened = False
try: try:
calc.evaluator({},{}, "5+7 QWSEKO") calc.evaluator({},{}, "5+7 QWSEKO")
......
...@@ -12,6 +12,7 @@ import uuid ...@@ -12,6 +12,7 @@ import uuid
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
import json
#from cache_toolbox import cache_model, cache_relation #from cache_toolbox import cache_model, cache_relation
...@@ -29,6 +30,18 @@ class UserProfile(models.Model): ...@@ -29,6 +30,18 @@ class UserProfile(models.Model):
meta = models.CharField(blank=True, max_length=255) # JSON dictionary for future expansion meta = models.CharField(blank=True, max_length=255) # JSON dictionary for future expansion
courseware = models.CharField(blank=True, max_length=255, default='course.xml') courseware = models.CharField(blank=True, max_length=255, default='course.xml')
def get_meta(self):
js_str = self.meta
if not js_str:
js_str = dict()
else:
js_str = json.loads(self.meta)
return js_str
def set_meta(self,js):
self.meta = json.dumps(js)
## TODO: Should be renamed to generic UserGroup, and possibly ## TODO: Should be renamed to generic UserGroup, and possibly
# Given an optional field for type of group # Given an optional field for type of group
class UserTestGroup(models.Model): class UserTestGroup(models.Model):
...@@ -58,6 +71,16 @@ class Registration(models.Model): ...@@ -58,6 +71,16 @@ class Registration(models.Model):
self.user.save() self.user.save()
#self.delete() #self.delete()
class PendingNameChange(models.Model):
user = models.OneToOneField(User, unique=True, db_index=True)
new_name = models.CharField(blank=True, max_length=255)
rationale = models.CharField(blank=True, max_length=1024)
class PendingEmailChange(models.Model):
user = models.OneToOneField(User, unique=True, db_index=True)
new_email = models.CharField(blank=True, max_length=255, db_index=True)
activation_key = models.CharField(('activation key'), max_length=32, unique=True, db_index=True)
#cache_relation(User.profile) #cache_relation(User.profile)
#### Helper methods for use from python manage.py shell. #### Helper methods for use from python manage.py shell.
...@@ -88,6 +111,8 @@ def change_name(email, new_name): ...@@ -88,6 +111,8 @@ def change_name(email, new_name):
up.save() up.save()
def user_count(): def user_count():
print "All users", User.objects.all().count()
print "Active users", User.objects.filter(is_active = True).count()
return User.objects.all().count() return User.objects.all().count()
def active_user_count(): def active_user_count():
...@@ -99,12 +124,29 @@ def create_group(name, description): ...@@ -99,12 +124,29 @@ def create_group(name, description):
utg.description = description utg.description = description
utg.save() utg.save()
def add_user_to_group(group, user): def add_user_to_group(user, group):
utg = UserTestGroup.objects.get(name = group) utg = UserTestGroup.objects.get(name = group)
utg.users.add(User.objects.get(username = user)) utg.users.add(User.objects.get(username = user))
utg.save() utg.save()
def remove_user_from_group(group, user): def remove_user_from_group(user, group):
utg = UserTestGroup.objects.get(name = group) utg = UserTestGroup.objects.get(name = group)
utg.users.remove(User.objects.get(username = user)) utg.users.remove(User.objects.get(username = user))
utg.save() utg.save()
default_groups = {'email_future_courses' : 'Receive e-mails about future MITx courses',
'email_helpers' : 'Receive e-mails about how to help with MITx',
'mitx_unenroll' : 'Fully unenrolled -- no further communications',
'6002x_unenroll' : 'Took and dropped 6002x'}
def add_user_to_default_group(user, group):
try:
utg = UserTestGroup.objects.get(name = group)
except UserTestGroup.DoesNotExist:
utg = UserTestGroup()
utg.name = group
utg.description = default_groups[group]
utg.save()
utg.users.add(User.objects.get(username = user))
utg.save()
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distribuetd under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from mako.lookup import TemplateLookup from mako.lookup import TemplateLookup
import tempfile import tempfile
from django.template import RequestContext from django.template import RequestContext
from django.conf import settings
requestcontext = None requestcontext = None
lookup = {} lookup = {}
...@@ -44,4 +45,5 @@ class MakoMiddleware(object): ...@@ -44,4 +45,5 @@ class MakoMiddleware(object):
def process_request (self, request): def process_request (self, request):
global requestcontext global requestcontext
requestcontext = RequestContext(request) requestcontext = RequestContext(request)
requestcontext['is_secure'] = request.is_secure()
requestcontext['site'] = settings.SITE_NAME
...@@ -18,18 +18,21 @@ from django.http import HttpResponse ...@@ -18,18 +18,21 @@ from django.http import HttpResponse
import mitxmako.middleware as middleware import mitxmako.middleware as middleware
from django.conf import settings from django.conf import settings
from mitxmako.middleware import requestcontext import mitxmako.middleware
def render_to_string(template_name, dictionary, context_instance=None, namespace='main'): def render_to_string(template_name, dictionary, context=None, namespace='main'):
context_instance = context_instance or Context(dictionary) context_instance = Context(dictionary)
# add dictionary to context_instance # add dictionary to context_instance
context_instance.update(dictionary or {}) context_instance.update(dictionary or {})
# collapse context_instance to a single dictionary for mako # collapse context_instance to a single dictionary for mako
context_dictionary = {} context_dictionary = {}
context_instance['settings'] = settings context_instance['settings'] = settings
context_instance['request_context'] = requestcontext for d in mitxmako.middleware.requestcontext:
context_dictionary.update(d)
for d in context_instance: for d in context_instance:
context_dictionary.update(d) context_dictionary.update(d)
if context:
context_dictionary.update(context)
# fetch and render template # fetch and render template
template = middleware.lookup[namespace].get_template(template_name) template = middleware.lookup[namespace].get_template(template_name)
return template.render(**context_dictionary) return template.render(**context_dictionary)
......
require 'rake/clean'
require 'tempfile'
# Build Constants
REPO_ROOT = File.dirname(__FILE__)
BUILD_DIR = File.join(REPO_ROOT, "build")
# Packaging constants
DEPLOY_DIR = "/opt/wwc"
PACKAGE_NAME = "mitx"
LINK_PATH = File.join(DEPLOY_DIR, PACKAGE_NAME)
VERSION = "0.1"
COMMIT = (ENV["GIT_COMMIT"] || `git rev-parse HEAD`).chomp()[0, 10]
BRANCH = (ENV["GIT_BRANCH"] || `git symbolic-ref -q HEAD`).chomp().gsub('refs/heads/', '').gsub('origin/', '').gsub('/', '_')
BUILD_NUMBER = (ENV["BUILD_NUMBER"] || "dev").chomp()
if BRANCH == "master"
DEPLOY_NAME = "#{PACKAGE_NAME}-#{BUILD_NUMBER}-#{COMMIT}"
else
DEPLOY_NAME = "#{PACKAGE_NAME}-#{BRANCH}-#{BUILD_NUMBER}-#{COMMIT}"
end
INSTALL_DIR_PATH = File.join(DEPLOY_DIR, DEPLOY_NAME)
PACKAGE_REPO = "packages@gp.mitx.mit.edu:/opt/pkgrepo.incoming"
# Set up the clean and clobber tasks
CLOBBER.include('build')
CLEAN.include("#{BUILD_DIR}/*.deb", "#{BUILD_DIR}/util")
task :package do
FileUtils.mkdir_p(BUILD_DIR)
Dir.chdir(BUILD_DIR) do
postinstall = Tempfile.new('postinstall')
postinstall.write <<-POSTINSTALL.gsub(/^\s*/, '')
#! /bin/sh
set -e
set -x
service gunicorn stop
rm -f #{LINK_PATH}
ln -s #{INSTALL_DIR_PATH} #{LINK_PATH}
service gunicorn start
POSTINSTALL
postinstall.close()
FileUtils.chmod(0755, postinstall.path)
args = ["fakeroot", "fpm", "-s", "dir", "-t", "deb",
"--after-install=#{postinstall.path}",
"--prefix=#{INSTALL_DIR_PATH}",
"-C", "#{REPO_ROOT}",
"--depends=python-mysqldb",
"--depends=python-django",
"--depends=python-pip",
"--depends=python-flup",
"--depends=python-numpy",
"--depends=python-scipy",
"--depends=python-matplotlib",
"--depends=python-libxml2",
"--depends=python2.7-dev",
"--depends=libxml2-dev",
"--depends=libxslt-dev",
"--depends=python-markdown",
"--depends=python-pygments",
"--depends=mysql-client",
"--name=#{DEPLOY_NAME}",
"--version=#{VERSION}",
"-a", "all",
"."]
system(*args) || raise("fpm failed to build the .deb")
end
end
task :publish => :package do
sh("scp #{BUILD_DIR}/#{DEPLOY_NAME}_#{VERSION}-1_all.deb #{PACKAGE_REPO}")
end
...@@ -166,6 +166,15 @@ MAKO_TEMPLATES = {} ...@@ -166,6 +166,15 @@ MAKO_TEMPLATES = {}
LOGGING_ENV = "dev" # override this in different environments LOGGING_ENV = "dev" # override this in different environments
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '../mitx.db',
}
}
SECRET_KEY = 'unsecure'
# Default dev cache (i.e. no caching) # Default dev cache (i.e. no caching)
CACHES = { CACHES = {
'default': { 'default': {
...@@ -174,7 +183,9 @@ CACHES = { ...@@ -174,7 +183,9 @@ CACHES = {
} }
# Make sure we execute correctly regardless of where we're called from # Make sure we execute correctly regardless of where we're called from
execfile(os.path.join(BASE_DIR, "settings.py")) override_settings = os.path.join(BASE_DIR, "settings.py")
if os.path.isfile(override_settings):
execfile(override_settings)
# A sample logging configuration. The only tangible logging # A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to # performed by this configuration is to send an email to
...@@ -238,7 +249,7 @@ LOGGING = { ...@@ -238,7 +249,7 @@ LOGGING = {
}, },
'loggers' : { 'loggers' : {
'django' : { 'django' : {
'handlers' : handlers + ['mail_admins'], 'handlers' : handlers, # + ['mail_admins'],
'propagate' : True, 'propagate' : True,
'level' : 'INFO' 'level' : 'INFO'
}, },
......
...@@ -754,7 +754,8 @@ div.leanModal_box { ...@@ -754,7 +754,8 @@ div.leanModal_box {
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
display: none; display: none;
padding: 51.776px; } padding: 51.776px;
text-align: left; }
div.leanModal_box a.modal_close { div.leanModal_box a.modal_close {
color: #aaa; color: #aaa;
display: block; display: block;
...@@ -914,6 +915,23 @@ div#pwd_reset p { ...@@ -914,6 +915,23 @@ 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 {
max-width: 700px; }
div#apply_name_change ul, div#change_email ul, div#unenroll ul, div#deactivate-account ul {
list-style: none; }
div#apply_name_change ul li, div#change_email ul li, div#unenroll ul li, div#deactivate-account ul li {
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"] {
display: block;
width: 100%;
-webkit-box-sizing: border-box;
-moz-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 {
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"] {
white-space: normal; }
div#feedback_div form ol li { div#feedback_div form ol li {
float: none; float: none;
width: 100%; } width: 100%; }
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
<section class="activation"> <section class="activation">
<h1>Account already active!</h1> <h1>Account already active!</h1>
<!-- <p>Now go <a href="/">log in</a> and try the course!</a></p> --> <!-- <p>Now go <a href="/">log in</a> and try the course!</a></p> -->
<p> This account has already been activated. We will notify you as <p> This account has already been activated. You can log in at
soon as the course starts.</p> the <a href="/">6.002x course page</a>.</p>
<p>For now you can go to the <a href="http://mitx.mit.edu/">MITx homepage</a> or the <a href="/">6.002x course page</a>.</p>
</div> </div>
</section> </section>
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
<div> <div>
<h1>Activation Complete!</h1> <h1>Activation Complete!</h1>
<!-- <p>Now go <a href="/">log in</a> and try the course!</a></p> --> <!-- <p>Now go <a href="/">log in</a> and try the course!</a></p> -->
<p>Thanks for activating your email. We will notify you as soon as the course starts.</p> <p>Thanks for activating your account. You can log in at the <a href="/">6.002x course page</a>.</p>
<p>For now you can go to the <a href="http://mitx.mit.edu/">MITx homepage</a> or the <a href="/">6.002x course page</a>.</p>
</div> </div>
</section> </section>
<h1>E-mail change successful!</h1>
<p> You should see your new name in your profile.
<h1> Could not change e-mail </h1>
An account with the new e-mail address already exists. Sorry.
...@@ -3,7 +3,11 @@ offering of 6.002 using this email address. If it was you, and you'd ...@@ -3,7 +3,11 @@ offering of 6.002 using this email address. If it was you, and you'd
like to activate and use your account, copy and paste this address like to activate and use your account, copy and paste this address
into your web browser's address bar: into your web browser's address bar:
http://${ site }/activate/${ key } % if is_secure:
https://${ site }/activate/${ key }
% else:
http://${ site }/activate/${ key }
% endif
If you didn't request this, you don't need to do anything; you won't If you didn't request this, you don't need to do anything; you won't
receive any more email from us. Please do not reply to this e-mail; if receive any more email from us. Please do not reply to this e-mail; if
......
This is to confirm that you changed the e-mail associated with MITx
from ${old_email} to ${new_email}. If you did not make this request,
please contact the course staff immediately. Contact information is
listed at:
% if is_secure:
https://${ site }/t/mitx_help.html
% else:
http://${ site }/t/mitx_help.html
% endif
We keep a log of old e-mails, so if this request was unintentional, we
can investigate.
We received a request to change the e-mail associated with your MITx
account from ${old_email} to ${new_email}. If this is correct, please
confirm your new e-mail address by visiting:
% if is_secure:
https://${ site }/email_confirm/${ key }
% else:
http://${ site }/email_confirm/${ key }
% endif
If you didn't request this, you don't need to do anything; you won't
receive any more email from us. Please do not reply to this e-mail; if
you require assistance, check the help section of the MITx web site.
Request to change MITx account e-mail
(Not currently used)
We are sorry. Our course staff did not approve your request to change
your name from ${old_name} to ${new_name}. If you need further
assistance, please e-mail the course staff at ta@mitx.mit.edu.
MITx's prototype offering, 6.002x, is now open. To log in, visit MITx's prototype offering, 6.002x, is now open. To log in, visit
% if is_secure:
https://6002x.mitx.mit.edu https://6002x.mitx.mit.edu
% else:
http://6002x.mitx.mit.edu
% endif
where you will find a login button at the top right-hand corner of the where you will find a login button at the top right-hand corner of the
window. window.
......
<h1>E-mail change successful!</h1>
<p> You should see your new name in your profile.
<%inherit file="main.html" /> <%inherit file="main.html" />
<%block name="headextra">
<script type="text/javascript" src="/static/js/flot/jquery.flot.js"></script>
<script type="text/javascript" src="/static/js/flot/jquery.flot.stack.js"></script>
<script type="text/javascript" src="/static/js/flot/jquery.flot.symbol.js"></script>
<style type="text/css">
.grade_a {color:green;}
.grade_b {color:Chocolate;}
.grade_c {color:DimGray;}
.grade_none {color:LightGray;}
</style>
</%block>
<%include file="navigation.html" args="active_page=''" /> <%include file="navigation.html" args="active_page=''" />
<section class="main-content"> <section class="main-content">
<div class="gradebook-wrapper"> <div class="gradebook-wrapper">
<section class="gradebook-content"> <section class="gradebook-content">
<h1>Gradebook</h1> <h1>Gradebook</h1>
% for s in students:
<h2><a href=/profile/${s['id']}>${s['username']}</a></h2> %if len(students) > 0:
% for c in s['grade_info']['grade_summary']: <table>
<h3>${c['category']} </h3> <%
<p> templateSummary = students[0]['grade_info']['grade_summary']
% if 'subscores' in c: %>
% for ss in c['subscores']:
<br>${ss['summary']}
% endfor <tr> <!-- Header Row -->
% endif <th>Student</th>
</p> %for section in templateSummary:
% endfor %if 'subscores' in section:
% endfor %for subsection in section['subscores']:
<th>${subsection['label']}</th>
%endfor
<th>${section['totallabel']}</th>
%else:
<th>${section['category']}</th>
%endif
%endfor
</tr>
<%def name="percent_data(percentage)">
<%
data_class = "grade_none"
if percentage > .87:
data_class = "grade_a"
elif percentage > .70:
data_class = "grade_b"
elif percentage > .6:
data_class = "grade_c"
%>
<td class="${data_class}">${ "{0:.0%}".format( percentage ) }</td>
</%def>
%for student in students:
<tr>
<td><a href="/discussion/users/${student['id']}/${student['username']}/">${student['username']}</a></td>
%for section in student['grade_info']['grade_summary']:
%if 'subscores' in section:
%for subsection in section['subscores']:
${percent_data( subsection['percentage'] )}
%endfor
${percent_data( section['totalscore'] )}
%else:
${percent_data( section['totalscore'] )}
%endif
%endfor
</tr>
%endfor
</table>
%endif
</section> </section>
</div> </div>
</section> </section>
\ No newline at end of file
<%inherit file="main.html" />
<%namespace name="profile_graphs" file="profile_graphs.js"/>
<%block name="headextra">
<script type="text/javascript" src="/static/js/flot/jquery.flot.js"></script>
<script type="text/javascript" src="/static/js/flot/jquery.flot.stack.js"></script>
<script type="text/javascript" src="/static/js/flot/jquery.flot.symbol.js"></script>
% for s in students:
<script>
${profile_graphs.body(s['grade_info']['grade_summary'], "grade-detail-graph-" + str(s['id']))}
</script>
%endfor
</%block>
<%include file="navigation.html" args="active_page=''" />
<section class="main-content">
<div class="gradebook-wrapper">
<section class="gradebook-content">
<h1>Gradebook</h1>
<ol>
% for s in students:
<li>
<h2><a href=/profile/${s['id']}>${s['username']}</a></h2>
<div id="grade-detail-graph-${s['id']}" style="width:1000px;height:300px;"></div>
</li>
% endfor
</ol>
</section>
</div>
</section>
<h1>Invalid key</h1>
<p> This e-mail key is not valid. Please check:
<ul>
<li> Was this key already used? Check whether the e-mail change has already happened.
<li> Did your e-mail client break the URL into two lines?
<li> The keys are valid for a limited amount of time. Has the key expired?
</ul>
...@@ -57,21 +57,27 @@ ...@@ -57,21 +57,27 @@
<div id="calculator_wrapper"> <div id="calculator_wrapper">
<form id="calculator"> <form id="calculator">
<input type="text" id="calculator_input" /> <div class="input-wrapper">
<dl class="help"> <input type="text" id="calculator_input" />
<dt>Suffixes:</dt>
<dd> %kMGTcmunp</dd> <div class="help-wrapper">
<dt>Operations:</dt> <a href="#">Hints</a>
<dd>^ * / + - ()</dd> <dl class="help">
<dt>Functions:</dt> <dt>Suffixes:</dt>
<dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd> <dd> %kMGTcmunp</dd>
<dt>Constants</dt> <dt>Operations:</dt>
<dd>e, pi</dd> <dd>^ * / + - ()</dd>
<dt>Functions:</dt>
<!-- Students won't know what parallel means at this time. Complex numbers aren't well tested in the courseware, so we would prefer to not expose them. If you read the comments in the source, feel free to use them. If you run into a bug, please let us know. But we can't officially support them right now. <dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd>
<dt>Constants</dt>
<dt>Unsupported:</dt> <dd>||, j </dd> --> <dd>e, pi</dd>
</dl>
<!-- Students won't know what parallel means at this time. Complex numbers aren't well tested in the courseware, so we would prefer to not expose them. If you read the comments in the source, feel free to use them. If you run into a bug, please let us know. But we can't officially support them right now.
<dt>Unsupported:</dt> <dd>||, j </dd> -->
</dl>
</div>
</div>
<input id="calculator_button" type="submit" value="="/> <input id="calculator_button" type="submit" value="="/>
<input type="text" id="calculator_output" readonly /> <input type="text" id="calculator_output" readonly />
</form> </form>
...@@ -128,11 +134,20 @@ $(function() { ...@@ -128,11 +134,20 @@ $(function() {
$("#calculator_wrapper").hide(); $("#calculator_wrapper").hide();
$(".calc").click(function(){ $(".calc").click(function(){
$("#calculator_wrapper").slideToggle(); $("#calculator_wrapper").slideToggle("fast");
$("#calculator_wrapper #calculator_input").focus(); $("#calculator_wrapper #calculator_input").focus();
$(this).toggleClass("closed"); $(this).toggleClass("closed");
return false;
}); });
$("div.help-wrapper a").hover(function(){
$(".help").toggleClass("shown");
});
$("div.help-wrapper a").click(function(){
return false;
});
$("form#calculator").submit(function(e){ $("form#calculator").submit(function(e){
e.preventDefault(); e.preventDefault();
$.getJSON("/calculate", {"equation":$("#calculator_input").attr("value")}, $.getJSON("/calculate", {"equation":$("#calculator_input").attr("value")},
......
<%inherit file="main.html" />
<%include file="navigation.html" args="active_page=''" />
<section class="main-content">
<script>
function name_confirm(id) {
postJSON('/accept_name_change',{"id":id},
function(data){
if(data.success){
$("#div"+id).html("Accepted");
} else {
alert('Error');
}
});
}
function name_deny(id) {
postJSON('/reject_name_change',{"id":id},
function(data){
if(data.success){
$("#div"+id).html("Rejected");
} else {
alert('Error');
}
});
}
</script>
<div class="gradebook-wrapper">
<section class="gradebook-content">
<h1>Pending name changes</h1>
<table>
% for s in students:
<tr>
<td><a href=/profile/${s['uid']}/>${s['old_name']}</td>
<td>${s['new_name']|h}</td>
<td>${s['email']|h}</td>
<td>${s['rationale']|h}</td>
<td><span id="div${s['cid']}"><span onclick="name_confirm(${s['cid']});">[Confirm]</span>
<span onclick="name_deny(${s['cid']});">[Reject]</span></span></td></tr>
% endfor
</table>
</section>
</div>
</section>
<%inherit file="main.html" /> <%inherit file="main.html" />
<%namespace name="profile_graphs" file="profile_graphs.js"/>
<%block name="title"><title>Profile - MITx 6.002x</title></%block> <%block name="title"><title>Profile - MITx 6.002x</title></%block>
<%! <%!
...@@ -10,7 +12,7 @@ ...@@ -10,7 +12,7 @@
<script type="text/javascript" src="/static/js/flot/jquery.flot.stack.js"></script> <script type="text/javascript" src="/static/js/flot/jquery.flot.stack.js"></script>
<script type="text/javascript" src="/static/js/flot/jquery.flot.symbol.js"></script> <script type="text/javascript" src="/static/js/flot/jquery.flot.symbol.js"></script>
<script> <script>
<%include file="profile_graphs.js"/> ${profile_graphs.body(grade_summary, "grade-detail-graph")}
</script> </script>
<script> <script>
...@@ -78,6 +80,46 @@ $(function() { ...@@ -78,6 +80,46 @@ $(function() {
log_event("profile", {"type":"password_send"}); log_event("profile", {"type":"password_send"});
}); });
}); });
$("#change_email_form").submit(function(){
var new_email = $('#new_email_field').val();
var new_password = $('#new_email_password').val();
postJSON('/change_email',{"new_email":new_email,
"password":new_password},
function(data){
if(data.success){
$("#change_email").html("<h1>Please verify your new email</h1><p>You'll receive a confirmation in your in-box. Please click the link in the email to confirm the email change.</p>");
} else {
$("#change_email_error").html(data.error);
}
});
log_event("profile", {"type":"email_change_request",
"old_email":"${email}",
"new_email":new_email});
return false;
});
$("#change_name_form").submit(function(){
var new_name = $('#new_name_field').val();
var rationale = $('#name_rationale_field').val();
postJSON('/change_name',{"new_name":new_name,
"rationale":rationale},
function(data){
if(data.success){
$("#apply_name_change").html("<h1>Your request has been submitted.</h1><p>We'll send you an e-mail when approve the change or need further information. Please allow for up to a week for us to process your request.</p>");
} else {
$("#change_name_error").html(data.error);
}
});
log_event("profile", {"type":"name_change_request",
"new_name":new_name,
"rationale":rationale});
return false;
});
}); });
</script> </script>
</%block> </%block>
...@@ -89,23 +131,25 @@ $(function() { ...@@ -89,23 +131,25 @@ $(function() {
<div class="profile-wrapper"> <div class="profile-wrapper">
<section class="course-info"> <section class="course-info">
<h1>Course Progress</h1> <header>
<h1>Course Progress</h1>
</header>
<div id="grade-detail-graph"></div> <div id="grade-detail-graph"></div>
<ol class="chapters"> <ol class="chapters">
%for chapter in chapters: %for chapter in courseware_summary:
%if not chapter['chapter'] == "hidden": %if not chapter['chapter'] == "hidden":
<li> <li>
<h2><a href="${reverse('courseware_chapter', args=format_url_params([chapter['course'], chapter['chapter']])) }"> <h2><a href="${reverse('courseware_chapter', args=format_url_params([chapter['course'], chapter['chapter']])) }">
${ chapter['chapter'] }</a></h2> ${ chapter['chapter'] }</a></h2>
<ol class="sections"> <ol class="sections">
%for section in chapter['sections']: %for section in chapter['sections']:
<li> <li>
<% <%
earned = section['section_total'][0] earned = section['section_total'].earned
total = section['section_total'][1] total = section['section_total'].possible
percentageString = "{0:.0%}".format( float(earned)/total) if earned > 0 else "" percentageString = "{0:.0%}".format( float(earned)/total) if earned > 0 else ""
%> %>
...@@ -120,7 +164,7 @@ $(function() { ...@@ -120,7 +164,7 @@ $(function() {
<ol class="scores"> <ol class="scores">
${ "Problem Scores: " if section['graded'] else "Practice Scores: "} ${ "Problem Scores: " if section['graded'] else "Practice Scores: "}
%for score in section['scores']: %for score in section['scores']:
<li class="score">${"{0:g}/{1:g}".format(score[0],score[1])}</li> <li class="score">${"{0:g}/{1:g}".format(score.earned,score.possible)}</li>
%endfor %endfor
</ol> </ol>
%endif %endif
...@@ -132,37 +176,135 @@ $(function() { ...@@ -132,37 +176,135 @@ $(function() {
%endif %endif
%endfor %endfor
</ol> <!--End chapters--> </ol> <!--End chapters-->
</section> </section>
<section class="user-info"> <section class="user-info">
<h1>${name}</h1> <header>
<h1>Student Profile</h1>
</header>
<ul> <ul>
<li>Forum name: <strong>${username}</strong></li> <li>
<li>E-mail: <strong>${email}</strong></li> Name: <strong>${name}</strong>
%if True:
<a href="#apply_name_change" rel="leanModal" class="name-edit">Edit</a>
%else:
(Name change pending)
%endif
</li>
<li>
Forum name: <strong>${username}</strong>
</li>
<li>
E-mail: <strong>${email}</strong> <a href="#change_email" rel="leanModal" class="edit-email">Edit</a>
</li>
<li> <li>
Location: <div id="location_sub">${location}</div><div id="description"></div> <a href="#" id="change_location">Edit</a> Location: <div id="location_sub">${location}</div><div id="description"></div> <a href="#" id="change_location">Edit</a>
</li> </li>
<li> <li>
Language: <div id="language_sub">${language}</div> <a href="#" id="change_language">Edit</a> Language: <div id="language_sub">${language}</div> <a href="#" id="change_language">Edit</a>
</li> </li>
<li>
Password reset
<input id="id_email" type="hidden" name="email" maxlength="75" value="${email}" />
<input type="submit" id="pwd_reset_button" value="Reset" />
<p>We'll e-mail a password reset link to ${email}.</p>
</li>
</ul> </ul>
<div id="change_password_pop">
<h2>Password change</h2>
<p>We'll e-mail a password reset link to ${email}.</p>
<input id="id_email" type="hidden" name="email" maxlength="75" value="${email}" />
<input type="submit" id="pwd_reset_button" value="Reset Password" />
</div>
</section> </section>
</div> </div>
</section> </section>
<div id="password_reset_complete" class="leanModal_box"> <div id="password_reset_complete" class="leanModal_box">
<a href="#password_reset_complete" rel="leanModal" id="password_reset_complete_link"></a> <a href="#password_reset_complete" rel="leanModal" id="password_reset_complete_link"></a>
<h1>Password Reset Email Sent</h1> <h1>Password Reset Email Sent</h1>
An email has been sent to ${email}. Follow the link in the email to change your password. <p>
</div> An email has been sent to ${email}. Follow the link in the email to change your password.
</p>
</div>
<div id="apply_name_change" class="leanModal_box">
<h1>Apply to change your name</h1>
<form id="change_name_form">
<div id="change_name_error"> </div>
<fieldset>
<p>To uphold the credibility of MITx certificates, name changes must go through an approval process. A member of the course staff will review your request, and if approved, update your information. Please allow up to a week for your request to be processed. Thank you.</p>
<ul>
<li>
<label>Enter your desired full name, as it will appear on the MITx Certificate: </label>
<input id="new_name_field" value="" type="text" />
</li>
<li>
<label>Reason for name change:</label>
<textarea id="name_rationale_field" value=""></textarea>
</li>
<li>
<input type="submit" id="submit">
</li>
</ul>
</fieldset>
</form>
</div>
<div id="change_email" class="leanModal_box">
<h1>Change e-mail</h1>
<div id="apply_name_change_error"></div>
<form id="change_email_form">
<div id="change_email_error"> </div>
<fieldset>
<ul>
<li>
<label> Please enter your new email address: </label>
<input id="new_email_field" type="email" value="" />
</li>
<li>
<label> Please confirm your password: </label>
<input id="new_email_password" value="" type="password" />
</li>
<li>
<p>We will send a confirmation to both ${email} and your new e-mail as part of the process.</p>
<input type="submit" id="submit_email_change" />
</li>
</ul>
</fieldset>
</form>
</div>
<div id="deactivate-account" class="leanModal_box">
<h1>Deactivate MITx Account</h1>
<p>Once you deactivate you&rsquo;re MIT<em>x</em> account you will no longer recieve updates and new class announcements from MIT<em>x</em>.</p>
<p>If you&rsquo;d like to still get updates and new class announcements you can just <a href="#unenroll" rel="leanModal">unenroll</a> and keep your account active.</p>
<form id="unenroll_form">
<div id="unenroll_error"> </div>
<fieldset>
<ul>
<li>
<input type="submit" id="" value="Yes, I don't want an MITx account or hear about any new classes or updates to MITx" />
</li>
</ul>
</fieldset>
</form>
</div>
<div id="unenroll" class="leanModal_box">
<h1>Unenroll from 6.002x</h1>
<p>Please note: you will still receive updates and new class announcements from MIT<em>x</em>. If you don&rsquo;t wish to receive any more updates or announcements <a href="#deactivate-account" rel="leanModal">deactivate your account</a>.</p>
<form id="unenroll_form">
<div id="unenroll_error"> </div>
<fieldset>
<ul>
<li>
<input type="submit" id="" value="Yes, I want to unenroll from 6.002x but still hear about any new classes or updates to MITx" />
</li>
</ul>
</fieldset>
</form>
</div>
<%page args="grade_summary, graph_div_id, **kwargs"/>
<%! <%!
import json import json
%> %>
...@@ -57,21 +58,21 @@ $(function () { ...@@ -57,21 +58,21 @@ $(function () {
category_total_label = section['category'] + " Total" category_total_label = section['category'] + " Total"
series.append({ series.append({
'label' : category_total_label, 'label' : category_total_label,
'data' : [ [tickIndex, section['totalscore']['score']] ], 'data' : [ [tickIndex, section['totalscore']] ],
'color' : colors[sectionIndex] 'color' : colors[sectionIndex]
}) })
ticks.append( [tickIndex, section['totallabel']] ) ticks.append( [tickIndex, section['totallabel']] )
detail_tooltips[category_total_label] = [section['totalscore']['summary']] detail_tooltips[category_total_label] = [section['totalscore_summary']]
else: else:
series.append({ series.append({
'label' : section['category'], 'label' : section['category'],
'data' : [ [tickIndex, section['totalscore']['score']] ], 'data' : [ [tickIndex, section['totalscore']] ],
'color' : colors[sectionIndex] 'color' : colors[sectionIndex]
}) })
ticks.append( [tickIndex, section['totallabel']] ) ticks.append( [tickIndex, section['totallabel']] )
detail_tooltips[section['category']] = [section['totalscore']['summary']] detail_tooltips[section['category']] = [section['totalscore_summary']]
tickIndex += 1 + sectionSpacer tickIndex += 1 + sectionSpacer
sectionIndex += 1 sectionIndex += 1
...@@ -86,12 +87,12 @@ $(function () { ...@@ -86,12 +87,12 @@ $(function () {
overviewBarX = tickIndex overviewBarX = tickIndex
for section in grade_summary: for section in grade_summary:
weighted_score = section['totalscore']['score'] * section['weight'] weighted_score = section['totalscore'] * section['weight']
summary_text = "{0} - {1:.1%} of a possible {2:.0%}".format(section['category'], weighted_score, section['weight']) summary_text = "{0} - {1:.1%} of a possible {2:.0%}".format(section['category'], weighted_score, section['weight'])
weighted_category_label = section['category'] + " - Weighted" weighted_category_label = section['category'] + " - Weighted"
if section['totalscore']['score'] > 0: if section['totalscore'] > 0:
series.append({ series.append({
'label' : weighted_category_label, 'label' : weighted_category_label,
'data' : [ [overviewBarX, weighted_score] ], 'data' : [ [overviewBarX, weighted_score] ],
...@@ -101,7 +102,7 @@ $(function () { ...@@ -101,7 +102,7 @@ $(function () {
detail_tooltips[weighted_category_label] = [ summary_text ] detail_tooltips[weighted_category_label] = [ summary_text ]
sectionIndex += 1 sectionIndex += 1
totalWeight += section['weight'] totalWeight += section['weight']
totalScore += section['totalscore']['score'] * section['weight'] totalScore += section['totalscore'] * section['weight']
ticks += [ [overviewBarX, "Total"] ] ticks += [ [overviewBarX, "Total"] ]
tickIndex += 1 + sectionSpacer tickIndex += 1 + sectionSpacer
...@@ -128,7 +129,7 @@ $(function () { ...@@ -128,7 +129,7 @@ $(function () {
legend: {show: false}, legend: {show: false},
}; };
var $grade_detail_graph = $("#grade-detail-graph"); var $grade_detail_graph = $("#${graph_div_id}");
if ($grade_detail_graph.length > 0) { if ($grade_detail_graph.length > 0) {
var plot = $.plot($grade_detail_graph, series, options); var plot = $.plot($grade_detail_graph, series, options);
...@@ -137,7 +138,7 @@ $(function () { ...@@ -137,7 +138,7 @@ $(function () {
} }
var previousPoint = null; var previousPoint = null;
$("#grade-detail-graph").bind("plothover", function (event, pos, item) { $grade_detail_graph.bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(2)); $("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2)); $("#y").text(pos.y.toFixed(2));
if (item) { if (item) {
......
...@@ -8,4 +8,4 @@ div.gradebook-wrapper { ...@@ -8,4 +8,4 @@ div.gradebook-wrapper {
@extend .top-header; @extend .top-header;
} }
} }
} }
\ No newline at end of file
...@@ -21,12 +21,12 @@ div.info-wrapper { ...@@ -21,12 +21,12 @@ div.info-wrapper {
@extend .clearfix; @extend .clearfix;
border-bottom: 1px solid #e3e3e3; border-bottom: 1px solid #e3e3e3;
// &:first-child { &:first-child {
// padding: lh(.5); padding: lh(.5);
// margin-left: (-(lh(.5))); margin: 0 (-(lh(.5))) lh();
// background: $cream; background: $cream;
// border-bottom: 1px solid darken($cream, 10%); border-bottom: 1px solid darken($cream, 10%);
// } }
h2 { h2 {
float: left; float: left;
......
...@@ -8,11 +8,29 @@ div.profile-wrapper { ...@@ -8,11 +8,29 @@ div.profile-wrapper {
border-left: 1px solid #d3d3d3; border-left: 1px solid #d3d3d3;
border-right: 0; border-right: 0;
h1 { header {
padding: lh(.5) lh(); padding: lh(.5) lh();
font-size: 18px;
margin: 0 ; margin: 0 ;
@extend .bottom-border; @extend .bottom-border;
h1 {
font-size: 18px;
margin: 0;
padding-right: 30px;
}
a {
position: absolute;
top: 13px;
right: lh(.5);
text-transform: uppercase;
font-size: 12px;
color: #999;
&:hover {
color: #555;
}
}
} }
ul { ul {
...@@ -57,7 +75,11 @@ div.profile-wrapper { ...@@ -57,7 +75,11 @@ div.profile-wrapper {
font-size: 12px; font-size: 12px;
} }
a#change_language, a#change_location { a#change_language,
a#change_location,
a.edit-email,
a.name-edit,
a.email-edit {
position: absolute; position: absolute;
top: 9px; top: 9px;
right: lh(.5); right: lh(.5);
...@@ -69,20 +91,66 @@ div.profile-wrapper { ...@@ -69,20 +91,66 @@ div.profile-wrapper {
color: #555; color: #555;
} }
} }
p {
font-size: 12px;
margin-bottom: 0;
margin-top: 4px;
color: #999;
}
a.deactivate {
color: #aaa;
font-style: italic;
}
input {
background: none;
border: none;
@include box-shadow(none);
color: #999;
font-size: 12px;
font-weight: normal;
margin: 0;
padding: 0;
position: absolute;
right: lh(.5);
text-transform: uppercase;
top: 9px;
&:hover {
color: #555;
}
}
} }
} }
div#change_password_pop { div#change_password_pop {
padding: 7px lh(); border-bottom: 1px solid #d3d3d3;
@include box-shadow(0 1px 0 #eee);
color: #4D4D4D; color: #4D4D4D;
padding: 7px lh();
h2 {
margin-top: 0;
font-weight: bold;
text-transform: uppercase;
font-size: $body-font-size;
}
} }
} }
section.course-info { section.course-info {
@extend .content; @extend .content;
> h1 { header {
@extend .top-header; @extend h1.top-header;
@extend .clearfix;
h1 {
margin: 0;
float: left;
}
} }
div#grade-detail-graph { div#grade-detail-graph {
...@@ -122,30 +190,30 @@ div.profile-wrapper { ...@@ -122,30 +190,30 @@ div.profile-wrapper {
padding-left: flex-gutter(9); padding-left: flex-gutter(9);
width: flex-grid(7, 9); width: flex-grid(7, 9);
> li { > li {
padding:0 0 lh() 0; padding:0 0 lh() 0;
&:first-child { &:first-child {
padding-top: 0; padding-top: 0;
} }
&:last-child { &:last-child {
border-bottom: 0; border-bottom: 0;
} }
h3 { h3 {
color: #666; color: #666;
} }
ol { ol {
list-style: none; list-style: none;
li { li {
display: inline-block; display: inline-block;
padding-right: 1em; padding-right: 1em;
}
} }
} }
}
} }
} }
} }
......
@mixin border-image($images) { @mixin border-image ($image) {
-webkit-border-image: border-add-prefix($images, webkit); -webkit-border-image: $image;
-moz-border-image: border-add-prefix($images, moz); -moz-border-image: $image;
-o-border-image: border-add-prefix($images, o); -ms-border-image: $image;
border-image: border-add-prefix($images); -o-border-image: $image;
border-image: $image;
} }
@function border-add-prefix($images, $vendor: false) {
$border-image: ();
$images-type: type-of(nth($images, 1));
$first-var: nth(nth($images, 1), 1); // Get type of Gradient (Linear || radial)
// If input is a gradient
@if $images-type == string {
@if ($first-var == "linear") or ($first-var == "radial") {
@for $i from 2 through length($images) {
$gradient-type: nth($images, 1); // Get type of gradient (linear || radial)
$gradient-args: nth($images, $i); // Get actual gradient (red, blue)
$border-image: render-gradients($gradient-args, $gradient-type, $vendor);
}
}
// If input is a URL
@else {
$border-image: $images;
}
}
// If input is gradient or url + additional args
@else if $images-type == list {
@for $i from 1 through length($images) {
$type: type-of(nth($images, $i)); // Get type of variable - List or String
// If variable is a list - Gradient
@if $type == list {
$gradient-type: nth(nth($images, $i), 1); // Get type of gradient (linear || radial)
$gradient-args: nth(nth($images, $i), 2); // Get actual gradient (red, blue)
$border-image: render-gradients($gradient-args, $gradient-type, $vendor);
}
// If variable is a string - Image or number
@else if ($type == string) or ($type == number) {
$border-image: append($border-image, nth($images, $i));
}
}
}
@return $border-image;
}
//Examples:
// @include border-image(url("image.png"));
// @include border-image(url("image.png") 20 stretch);
// @include border-image(linear-gradient(45deg, orange, yellow));
// @include border-image(linear-gradient(45deg, orange, yellow) stretch);
// @include border-image(linear-gradient(45deg, orange, yellow) 20 30 40 50 stretch round);
// @include border-image(radial-gradient(top, cover, orange, yellow, orange));
nav.sequence-nav { nav.sequence-nav {
@extend .topbar; @extend .topbar;
@include box-sizing(border-box);
margin-bottom: $body-line-height; margin-bottom: $body-line-height;
position: relative;
ol { ol {
display: table-row; border-bottom: 1px solid darken($cream, 20%);
float: left; @include box-sizing(border-box);
width: flex-grid(8,9) + flex-gutter(); display: table;
position: relative; padding-right: flex-grid(1, 9);
width: 100%;
a { a {
@extend .block-link; @extend .block-link;
} }
li { li {
border-left: 1px solid darken($cream, 20%);
display: table-cell; display: table-cell;
min-width: 20px;
&:first-child {
border-left: none;
}
.inactive { .inactive {
background-repeat: no-repeat; background-repeat: no-repeat;
...@@ -35,9 +44,9 @@ nav.sequence-nav { ...@@ -35,9 +44,9 @@ nav.sequence-nav {
} }
.active { .active {
@include box-shadow(0 1px 0 #fff);
background-color: #fff; background-color: #fff;
background-repeat: no-repeat; background-repeat: no-repeat;
@include box-shadow(0 1px 0 #fff);
&:hover { &:hover {
background-color: #fff; background-color: #fff;
...@@ -46,15 +55,14 @@ nav.sequence-nav { ...@@ -46,15 +55,14 @@ nav.sequence-nav {
} }
a { a {
@include box-shadow(1px 0 0 #fff);
background-position: center center; background-position: center center;
border: none; border: none;
border-right: 1px solid darken($cream, 10%);
cursor: pointer; cursor: pointer;
padding: 15px 4px 14px; display: block;
width: 28px;
height: 17px; height: 17px;
padding: 15px 0 14px;
@include transition(all, .4s, $ease-in-out-quad); @include transition(all, .4s, $ease-in-out-quad);
width: 100%;
// @media screen and (max-width: 800px) { // @media screen and (max-width: 800px) {
// padding: 12px 8px; // padding: 12px 8px;
...@@ -134,8 +142,8 @@ nav.sequence-nav { ...@@ -134,8 +142,8 @@ nav.sequence-nav {
z-index: 99; z-index: 99;
&.shown { &.shown {
opacity: 1;
margin-top: 4px; margin-top: 4px;
opacity: 1;
} }
&:empty { &:empty {
...@@ -151,9 +159,9 @@ nav.sequence-nav { ...@@ -151,9 +159,9 @@ nav.sequence-nav {
content: " "; content: " ";
display: block; display: block;
height: 10px; height: 10px;
left: 18px;
position: absolute; position: absolute;
top: -5px; top: -5px;
left: 18px;
@include transform(rotate(45deg)); @include transform(rotate(45deg));
width: 10px; width: 10px;
} }
...@@ -162,33 +170,34 @@ nav.sequence-nav { ...@@ -162,33 +170,34 @@ nav.sequence-nav {
} }
ul { ul {
float: right;
margin-right: 1px; margin-right: 1px;
position: absolute;
right: 0;
top: 0;
width: flex-grid(1, 9); width: flex-grid(1, 9);
display: table-row;
li { li {
display: table-cell; float: left;
width: 50%;
&.prev, &.next { &.prev, &.next {
a { a {
@include box-shadow(inset 1px 0 0 lighten(#f6efd4, 5%));
background-color: darken($cream, 5%); background-color: darken($cream, 5%);
background-position: center center; background-position: center center;
background-repeat: no-repeat; background-repeat: no-repeat;
border-left: 1px solid darken(#f6efd4, 20%); border-left: 1px solid darken(#f6efd4, 20%);
@include box-shadow(inset 1px 0 0 lighten(#f6efd4, 5%));
@include box-sizing(border-box);
cursor: pointer; cursor: pointer;
padding: 0 4px;
text-indent: -9999px;
width: 38px;
display: block; display: block;
text-indent: -9999px;
&:hover { &:hover {
text-decoration: none; background-color: none;
color: darken($cream, 60%); color: darken($cream, 60%);
text-decoration: none; text-decoration: none;
background-color: none; text-decoration: none;
} }
&.disabled { &.disabled {
...@@ -223,28 +232,26 @@ nav.sequence-nav { ...@@ -223,28 +232,26 @@ nav.sequence-nav {
section.course-content { section.course-content {
position: relative;
div#seq_content { div#seq_content {
margin-bottom: 60px; margin-bottom: 60px;
} }
nav.sequence-bottom { nav.sequence-bottom {
position: absolute; bottom: (-(lh()));
bottom: 0; position: relative;
right: 50%;
margin-right: -53px;
ul { ul {
@extend .clearfix; @extend .clearfix;
background-color: darken(#F6EFD4, 5%); background-color: darken(#F6EFD4, 5%);
background-color: darken($cream, 5%);
border: 1px solid darken(#f6efd4, 20%); border: 1px solid darken(#f6efd4, 20%);
border-bottom: 0; border-bottom: 0;
@include border-radius(3px 3px 0 0); @include border-radius(3px 3px 0 0);
@include box-shadow(inset 0 0 0 1px lighten(#f6efd4, 5%));
margin: 0 auto;
overflow: hidden; overflow: hidden;
width: 106px; width: 106px;
background-color: darken($cream, 5%);
@include box-shadow(inset 0 0 0 1px lighten(#f6efd4, 5%));
li { li {
float: left; float: left;
...@@ -257,11 +264,11 @@ section.course-content { ...@@ -257,11 +264,11 @@ section.course-content {
background-repeat: no-repeat; background-repeat: no-repeat;
border-bottom: none; border-bottom: none;
display: block; display: block;
display: block;
padding: lh(.75) 4px; padding: lh(.75) 4px;
text-indent: -9999px; text-indent: -9999px;
width: 45px;
display: block;
@include transition(all, .4s, $ease-in-out-quad); @include transition(all, .4s, $ease-in-out-quad);
width: 45px;
&:hover { &:hover {
background-color: darken($cream, 10%); background-color: darken($cream, 10%);
......
li.calc-main { li.calc-main {
bottom: 0; bottom: -36px;
left: 0; left: 0;
position: fixed; position: fixed;
width: 100%; width: 100%;
...@@ -16,6 +16,8 @@ li.calc-main { ...@@ -16,6 +16,8 @@ li.calc-main {
padding: 8px 12px; padding: 8px 12px;
width: 16px; width: 16px;
height: 20px; height: 20px;
position: relative;
top: -36px;
&:hover { &:hover {
opacity: .8; opacity: .8;
...@@ -28,27 +30,14 @@ li.calc-main { ...@@ -28,27 +30,14 @@ li.calc-main {
div#calculator_wrapper { div#calculator_wrapper {
background: rgba(#111, .9); background: rgba(#111, .9);
position: relative;
top: -36px;
clear: both; clear: both;
form { form {
padding: lh(); padding: lh();
@extend .clearfix; @extend .clearfix;
input#calculator_input {
border: none;
@include box-shadow(none);
@include box-sizing(border-box);
font-size: 16px;
padding: 10px;
width: flex-grid(7.5);
margin: 0;
float: left;
&:focus {
outline: none;
border: none;
}
}
input#calculator_button { input#calculator_button {
background: #111; background: #111;
...@@ -83,20 +72,70 @@ li.calc-main { ...@@ -83,20 +72,70 @@ li.calc-main {
padding: 10px; padding: 10px;
width: flex-grid(4); width: flex-grid(4);
} }
}
dl {
display: none;
dt { div.input-wrapper {
clear: both; position: relative;
@extend .clearfix;
width: flex-grid(7.5);
margin: 0;
float: left; float: left;
font-weight: bold;
padding-right: lh(.5); input#calculator_input {
border: none;
@include box-shadow(none);
@include box-sizing(border-box);
font-size: 16px;
padding: 10px;
width: 100%;
&:focus {
outline: none;
border: none;
}
} }
dd { div.help-wrapper {
float: left; position: absolute;
right: 8px;
top: 15px;
a {
@include hide-text;
width: 17px;
height: 17px;
background: url("/static/images/info-icon.png") center center no-repeat;
}
dl {
background: #fff;
@include border-radius(3px);
@include box-shadow(0 0 3px #999);
color: #333;
opacity: 0;
padding: 10px;
position: absolute;
right: -40px;
top: -110px;
width: 500px;
@include transition();
&.shown {
opacity: 1;
top: -115px;
}
dt {
clear: both;
float: left;
font-weight: bold;
padding-right: lh(.5);
}
dd {
float: left;
}
}
}
} }
} }
} }
......
...@@ -17,7 +17,7 @@ html { ...@@ -17,7 +17,7 @@ html {
@include box-shadow(0 0 4px #dfdfdf); @include box-shadow(0 0 4px #dfdfdf);
@include box-sizing(border-box); @include box-sizing(border-box);
margin-top: 3px; margin-top: 3px;
overflow: hidden; // overflow: hidden;
@media print { @media print {
border-bottom: 0; border-bottom: 0;
......
...@@ -17,6 +17,7 @@ div.leanModal_box { ...@@ -17,6 +17,7 @@ div.leanModal_box {
@include box-sizing(border-box); @include box-sizing(border-box);
display: none; display: none;
padding: lh(2); padding: lh(2);
text-align: left;
a.modal_close { a.modal_close {
color: #aaa; color: #aaa;
...@@ -204,6 +205,35 @@ div#pwd_reset { ...@@ -204,6 +205,35 @@ div#pwd_reset {
} }
} }
div#apply_name_change,
div#change_email,
div#unenroll,
div#deactivate-account {
max-width: 700px;
ul {
list-style: none;
li {
margin-bottom: lh(.5);
textarea, #{$all-text-inputs} {
display: block;
width: 100%;
@include box-sizing(border-box);
}
textarea {
height: 60px;
}
input[type="submit"] {
white-space: normal;
}
}
}
}
div#feedback_div{ div#feedback_div{
form{ form{
ol { ol {
......
<section class="text-input"> <section class="text-input">
<input type="text" name="input_${id}" id="input_${id}" value="${value}" /> <input type="text" name="input_${id}" id="input_${id}" value="${value}"
% if size:
size="${size}"
% endif
/>
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
......
...@@ -10,19 +10,25 @@ import django.contrib.auth.views ...@@ -10,19 +10,25 @@ import django.contrib.auth.views
# admin.autodiscover() # admin.autodiscover()
urlpatterns = ('', urlpatterns = ('',
url(r'^$', 'student.views.index'), # Main marketing page, or redirect to courseware
url(r'^change_email$', 'student.views.change_email_request'),
url(r'^email_confirm/(?P<key>[^/]*)$', 'student.views.confirm_email_change'),
url(r'^change_name$', 'student.views.change_name_request'),
url(r'^accept_name_change$', 'student.views.accept_name_change'),
url(r'^reject_name_change$', 'student.views.reject_name_change'),
url(r'^pending_name_changes$', 'student.views.pending_name_changes'),
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'),
url(r'^logout$', 'student.views.logout_user'),
url(r'^info$', 'util.views.info'),
url(r'^login$', 'student.views.login_user'), url(r'^login$', 'student.views.login_user'),
url(r'^login/(?P<error>[^/]*)$', 'student.views.login_user'), url(r'^login/(?P<error>[^/]*)$', 'student.views.login_user'),
url(r'^logout$', 'student.views.logout_user'),
url(r'^create_account$', 'student.views.create_account'), url(r'^create_account$', 'student.views.create_account'),
url(r'^activate/(?P<key>[^/]*)$', 'student.views.activate_account'), url(r'^activate/(?P<key>[^/]*)$', 'student.views.activate_account'),
url(r'^$', 'student.views.index'), # url(r'^reactivate/(?P<key>[^/]*)$', 'student.views.reactivation_email'),
# url(r'^password_reset/$', 'django.contrib.auth.views.password_reset',
# dict(from_email='registration@mitx.mit.edu'),name='auth_password_reset'),
url(r'^password_reset/$', 'student.views.password_reset'), url(r'^password_reset/$', 'student.views.password_reset'),
## Obsolete Django views for password resets
## TODO: Replace with Mako-ized views
url(r'^password_change/$',django.contrib.auth.views.password_change,name='auth_password_change'), url(r'^password_change/$',django.contrib.auth.views.password_change,name='auth_password_change'),
url(r'^password_change_done/$',django.contrib.auth.views.password_change_done,name='auth_password_change_done'), url(r'^password_change_done/$',django.contrib.auth.views.password_change_done,name='auth_password_change_done'),
url(r'^password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',django.contrib.auth.views.password_reset_confirm, url(r'^password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',django.contrib.auth.views.password_reset_confirm,
...@@ -31,6 +37,7 @@ urlpatterns = ('', ...@@ -31,6 +37,7 @@ urlpatterns = ('',
name='auth_password_reset_complete'), name='auth_password_reset_complete'),
url(r'^password_reset_done/$',django.contrib.auth.views.password_reset_done, url(r'^password_reset_done/$',django.contrib.auth.views.password_reset_done,
name='auth_password_reset_done'), name='auth_password_reset_done'),
## Feedback
url(r'^send_feedback$', 'util.views.send_feedback'), url(r'^send_feedback$', 'util.views.send_feedback'),
) )
...@@ -40,6 +47,7 @@ if settings.PERFSTATS: ...@@ -40,6 +47,7 @@ if settings.PERFSTATS:
if settings.COURSEWARE_ENABLED: if settings.COURSEWARE_ENABLED:
urlpatterns += ( urlpatterns += (
url(r'^courseware/$', 'courseware.views.index', name="courseware"), url(r'^courseware/$', 'courseware.views.index', name="courseware"),
url(r'^info$', 'util.views.info'),
url(r'^wiki/', include('simplewiki.urls')), url(r'^wiki/', include('simplewiki.urls')),
url(r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/$', 'courseware.views.index', name="courseware_section"), url(r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/$', 'courseware.views.index', name="courseware_section"),
url(r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/$', 'courseware.views.index', name="courseware_chapter"), url(r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/$', 'courseware.views.index', name="courseware_chapter"),
......
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