Assume any non-xml modulestore is r/w
LMS-11235
This commit is contained in:
committed by
Ben McMorran
parent
63603d70f4
commit
24cdd7a481
@@ -185,7 +185,7 @@ def add_staff_markup(user, has_instructor_access, block, view, frag, context):
|
||||
# TODO: make this more general, eg use an XModule attribute instead
|
||||
if isinstance(block, VerticalModule) and (not context or not context.get('child_of_vertical', False)):
|
||||
# check that the course is a mongo backed Studio course before doing work
|
||||
is_mongo_course = modulestore().get_modulestore_type(block.location.course_key) == ModuleStoreEnum.Type.mongo
|
||||
is_mongo_course = modulestore().get_modulestore_type(block.location.course_key) != ModuleStoreEnum.Type.xml
|
||||
is_studio_course = block.course_edit_method == "Studio"
|
||||
|
||||
if is_studio_course and is_mongo_course:
|
||||
|
||||
@@ -360,14 +360,15 @@ def get_cms_block_link(block, page):
|
||||
return u"//{}/{}/{}".format(settings.CMS_BASE, page, block.location)
|
||||
|
||||
|
||||
def get_studio_url(course_key, page):
|
||||
def get_studio_url(course, page):
|
||||
"""
|
||||
Get the Studio URL of the page that is passed in.
|
||||
|
||||
Args:
|
||||
course (CourseDescriptor)
|
||||
"""
|
||||
assert(isinstance(course_key, CourseKey))
|
||||
course = get_course_by_id(course_key)
|
||||
is_studio_course = course.course_edit_method == "Studio"
|
||||
is_mongo_course = modulestore().get_modulestore_type(course_key) == ModuleStoreEnum.Type.mongo
|
||||
is_mongo_course = modulestore().get_modulestore_type(course.id) != ModuleStoreEnum.Type.xml
|
||||
studio_link = None
|
||||
if is_studio_course and is_mongo_course:
|
||||
studio_link = get_cms_course_link(course, page)
|
||||
|
||||
@@ -311,7 +311,7 @@ def index(request, course_id, chapter=None, section=None,
|
||||
u' far, should have gotten a course module for this user')
|
||||
return redirect(reverse('about_course', args=[course_key.to_deprecated_string()]))
|
||||
|
||||
studio_url = get_studio_url(course_key, 'course')
|
||||
studio_url = get_studio_url(course, 'course')
|
||||
|
||||
context = {
|
||||
'csrf': csrf(request)['csrf_token'],
|
||||
@@ -419,7 +419,7 @@ def index(request, course_id, chapter=None, section=None,
|
||||
context['section_title'] = section_descriptor.display_name_with_default
|
||||
else:
|
||||
# section is none, so display a message
|
||||
studio_url = get_studio_url(course_key, 'course')
|
||||
studio_url = get_studio_url(course, 'course')
|
||||
prev_section = get_current_child(chapter_module)
|
||||
if prev_section is None:
|
||||
# Something went wrong -- perhaps this chapter has no sections visible to the user
|
||||
@@ -553,7 +553,7 @@ def course_info(request, course_id):
|
||||
staff_access = has_access(request.user, 'staff', course)
|
||||
masq = setup_masquerade(request, staff_access) # allow staff to toggle masquerade on info page
|
||||
reverifications = fetch_reverify_banner_info(request, course_key)
|
||||
studio_url = get_studio_url(course_key, 'course_info')
|
||||
studio_url = get_studio_url(course, 'course_info')
|
||||
|
||||
context = {
|
||||
'request': request,
|
||||
@@ -655,7 +655,7 @@ def course_about(request, course_id):
|
||||
course = get_course_with_access(request.user, 'see_exists', course_key)
|
||||
registered = registered_for_course(course, request.user)
|
||||
staff_access = has_access(request.user, 'staff', course)
|
||||
studio_url = get_studio_url(course_key, 'settings/details')
|
||||
studio_url = get_studio_url(course, 'settings/details')
|
||||
|
||||
if has_access(request.user, 'load', course):
|
||||
course_target = reverse('info', args=[course.id.to_deprecated_string()])
|
||||
@@ -812,7 +812,7 @@ def _progress(request, course_key, student_id):
|
||||
student = User.objects.prefetch_related("groups").get(id=student.id)
|
||||
|
||||
courseware_summary = grades.progress_summary(student, request, course)
|
||||
studio_url = get_studio_url(course_key, 'settings/grading')
|
||||
studio_url = get_studio_url(course, 'settings/grading')
|
||||
grade_summary = grades.grade(student, request, course)
|
||||
|
||||
if courseware_summary is None:
|
||||
|
||||
Reference in New Issue
Block a user