Commit 7a1aed89 by Your Name

Merge remote-tracking branch 'origin/master' into feature/victor/revert-revert-of-forums-ui

parents f5008062 75449359
...@@ -122,7 +122,8 @@ def index(request): ...@@ -122,7 +122,8 @@ def index(request):
course.location.course, course.location.course,
course.location.name])) course.location.name]))
for course in courses], for course in courses],
'user': request.user 'user': request.user,
'disable_course_creation': settings.MITX_FEATURES.get('DISABLE_COURSE_CREATION', False) and not request.user.is_staff
}) })
...@@ -1259,6 +1260,10 @@ def edge(request): ...@@ -1259,6 +1260,10 @@ def edge(request):
@login_required @login_required
@expect_json @expect_json
def create_new_course(request): def create_new_course(request):
if settings.MITX_FEATURES.get('DISABLE_COURSE_CREATION', False) and not request.user.is_staff:
raise PermissionDenied()
# This logic is repeated in xmodule/modulestore/tests/factories.py # This logic is repeated in xmodule/modulestore/tests/factories.py
# so if you change anything here, you need to also change it there. # so if you change anything here, you need to also change it there.
# TODO: write a test that creates two courses, one with the factory and # TODO: write a test that creates two courses, one with the factory and
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
<h1>My Courses</h1> <h1>My Courses</h1>
<article class="my-classes"> <article class="my-classes">
% if user.is_active: % if user.is_active:
<a href="#" class="new-button new-course-button"><span class="plus-icon white"></span> New Course</a> % if not disable_course_creation:
<a href="#" class="new-button new-course-button"><span class="plus-icon white"></span> New Course</a>
%endif
<ul class="class-list"> <ul class="class-list">
%for course, url in courses: %for course, url in courses:
<li> <li>
......
...@@ -1112,9 +1112,11 @@ def test_center_login(request): ...@@ -1112,9 +1112,11 @@ def test_center_login(request):
# or possibly both. But for now we know what to do with an ExamSeriesCode, # or possibly both. But for now we know what to do with an ExamSeriesCode,
# while we currently have no record of RegistrationID values at all. # while we currently have no record of RegistrationID values at all.
if 'vueExamSeriesCode' not in request.POST: if 'vueExamSeriesCode' not in request.POST:
# TODO: confirm this error code (made up, not in documentation) # we are not allowed to make up a new error code, according to Pearson,
# so instead of "missingExamSeriesCode", we use a valid one that is
# inaccurate but at least distinct. (Sigh.)
log.error("missing exam series code for cand ID {}".format(client_candidate_id)) log.error("missing exam series code for cand ID {}".format(client_candidate_id))
return HttpResponseRedirect(makeErrorURL(error_url, "missingExamSeriesCode")); return HttpResponseRedirect(makeErrorURL(error_url, "missingPartnerID"));
exam_series_code = request.POST.get('vueExamSeriesCode') exam_series_code = request.POST.get('vueExamSeriesCode')
# special case for supporting test user: # special case for supporting test user:
if client_candidate_id == "edX003671291147" and exam_series_code != '6002x001': if client_candidate_id == "edX003671291147" and exam_series_code != '6002x001':
...@@ -1188,7 +1190,7 @@ def test_center_login(request): ...@@ -1188,7 +1190,7 @@ def test_center_login(request):
# this information is correct, we allow the user to be logged in # this information is correct, we allow the user to be logged in
# without a password. This could all be formalized in a backend object # without a password. This could all be formalized in a backend object
# that does the above checking. # that does the above checking.
# TODO: create a backend class to do this. # TODO: (brian) create a backend class to do this.
# testcenteruser.user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__) # testcenteruser.user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)
testcenteruser.user.backend = "%s.%s" % ("TestcenterAuthenticationModule", "TestcenterAuthenticationClass") testcenteruser.user.backend = "%s.%s" % ("TestcenterAuthenticationModule", "TestcenterAuthenticationClass")
login(request, testcenteruser.user) login(request, testcenteruser.user)
......
...@@ -999,7 +999,7 @@ def sympy_check2(): ...@@ -999,7 +999,7 @@ def sympy_check2():
self.context['debug'] = self.system.DEBUG self.context['debug'] = self.system.DEBUG
# exec the check function # exec the check function
if type(self.code) == str: if isinstance(self.code, basestring):
try: try:
exec self.code in self.context['global_context'], self.context exec self.code in self.context['global_context'], self.context
correct = self.context['correct'] correct = self.context['correct']
......
...@@ -238,8 +238,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None ...@@ -238,8 +238,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
###### PMathML input ###### ###### PMathML input ######
# convert mathml answer to formula # convert mathml answer to formula
try: try:
if dynamath: mmlans = dynamath[0] if dynamath else None
mmlans = dynamath[0]
except Exception, err: except Exception, err:
mmlans = None mmlans = None
if not mmlans: if not mmlans:
......
${module_content} ${module_content}
%if edit_link: %if location.category in ['problem','video','html']:
% if edit_link:
<div> <div>
<a href="${edit_link}">Edit</a> / <a href="${edit_link}">Edit</a> /
<a href="#${element_id}_xqa-modal" onclick="javascript:getlog('${element_id}', { <a href="#${element_id}_xqa-modal" onclick="javascript:getlog('${element_id}', {
...@@ -9,7 +10,7 @@ ${module_content} ...@@ -9,7 +10,7 @@ ${module_content}
'user': '${user}' 'user': '${user}'
})" id="${element_id}_xqa_log">QA</a> })" id="${element_id}_xqa_log">QA</a>
</div> </div>
% endif % endif
<div><a href="#${element_id}_debug" id="${element_id}_trig">Staff Debug Info</a></div> <div><a href="#${element_id}_debug" id="${element_id}_trig">Staff Debug Info</a></div>
<section id="${element_id}_xqa-modal" class="modal xqa-modal" style="width:80%; left:20%; height:80%; overflow:auto" > <section id="${element_id}_xqa-modal" class="modal xqa-modal" style="width:80%; left:20%; height:80%; overflow:auto" >
...@@ -74,3 +75,5 @@ category = ${category | h} ...@@ -74,3 +75,5 @@ category = ${category | h}
'user': '${user}' 'user': '${user}'
}); });
</script> </script>
%endif
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