Commit 08b42c52 by Calen Pennington

Make courseware work with multicourse disabled

parent f55dfc36
...@@ -98,14 +98,20 @@ def render_x_module(user, request, xml_module, module_object_preload): ...@@ -98,14 +98,20 @@ def render_x_module(user, request, xml_module, module_object_preload):
# get coursename if stored # get coursename if stored
coursename = multicourse_settings.get_coursename_from_request(request) coursename = multicourse_settings.get_coursename_from_request(request)
if coursename and settings.ENABLE_MULTICOURSE:
xp = multicourse_settings.get_course_xmlpath(coursename) # path to XML for the course xp = multicourse_settings.get_course_xmlpath(coursename) # path to XML for the course
data_root = settings.DATA_DIR + xp
else:
data_root = settings.DATA_DIR
# Create a new instance # Create a new instance
ajax_url = settings.MITX_ROOT_URL + '/modx/'+module_type+'/'+module_id+'/' ajax_url = settings.MITX_ROOT_URL + '/modx/'+module_type+'/'+module_id+'/'
system = I4xSystem(track_function = make_track_function(request), system = I4xSystem(track_function = make_track_function(request),
render_function = lambda x: render_module(user, request, x, module_object_preload), render_function = lambda x: render_module(user, request, x, module_object_preload),
ajax_url = ajax_url, ajax_url = ajax_url,
filestore = OSFS(settings.DATA_DIR + xp), filestore = OSFS(data_root),
) )
instance=module_class(system, instance=module_class(system,
etree.tostring(xml_module), etree.tostring(xml_module),
......
...@@ -249,7 +249,12 @@ def modx_dispatch(request, module=None, dispatch=None, id=None): ...@@ -249,7 +249,12 @@ def modx_dispatch(request, module=None, dispatch=None, id=None):
# get coursename if stored # get coursename if stored
coursename = multicourse_settings.get_coursename_from_request(request) coursename = multicourse_settings.get_coursename_from_request(request)
if coursename and settings.ENABLE_MULTICOURSE:
xp = multicourse_settings.get_course_xmlpath(coursename) # path to XML for the course xp = multicourse_settings.get_course_xmlpath(coursename) # path to XML for the course
data_root = settings.DATA_DIR + xp
else:
data_root = settings.DATA_DIR
# Grab the XML corresponding to the request from course.xml # Grab the XML corresponding to the request from course.xml
try: try:
...@@ -266,7 +271,7 @@ def modx_dispatch(request, module=None, dispatch=None, id=None): ...@@ -266,7 +271,7 @@ def modx_dispatch(request, module=None, dispatch=None, id=None):
system = I4xSystem(track_function = make_track_function(request), system = I4xSystem(track_function = make_track_function(request),
render_function = None, render_function = None,
ajax_url = ajax_url, ajax_url = ajax_url,
filestore = OSFS(settings.DATA_DIR + xp), filestore = OSFS(data_root),
) )
try: try:
......
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