Commit 1494cbbd by ichuang Committed by pmitros

Merged root URL prefix from Ike. Errors should be attributed to pmitros.

parent cd782670
...@@ -78,7 +78,7 @@ def render_x_module(user, request, xml_module, module_object_preload): ...@@ -78,7 +78,7 @@ def render_x_module(user, request, xml_module, module_object_preload):
state = smod.state state = smod.state
# Create a new instance # Create a new instance
ajax_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,
...@@ -102,6 +102,8 @@ def render_x_module(user, request, xml_module, module_object_preload): ...@@ -102,6 +102,8 @@ def render_x_module(user, request, xml_module, module_object_preload):
content = instance.get_html() content = instance.get_html()
init_js = instance.get_init_js() init_js = instance.get_init_js()
destory_js = instance.get_destroy_js() destory_js = instance.get_destroy_js()
# special extra information about each problem, only for users who are staff
if user.is_staff: if user.is_staff:
histogram = grade_histogram(module_id) histogram = grade_histogram(module_id)
render_histogram = len(histogram) > 0 render_histogram = len(histogram) > 0
......
...@@ -204,7 +204,7 @@ def modx_dispatch(request, module=None, dispatch=None, id=None): ...@@ -204,7 +204,7 @@ def modx_dispatch(request, module=None, dispatch=None, id=None):
dispatch=dispatch.split('?')[0] dispatch=dispatch.split('?')[0]
ajax_url = '/modx/'+module+'/'+id+'/' ajax_url = settings.MITX_ROOT_URL + '/modx/'+module+'/'+id+'/'
# Grab the XML corresponding to the request from course.xml # Grab the XML corresponding to the request from course.xml
xml = content_parser.module_xml(request.user, module, 'id', id) xml = content_parser.module_xml(request.user, module, 'id', id)
......
...@@ -27,6 +27,7 @@ def render_to_string(template_name, dictionary, context=None, namespace='main'): ...@@ -27,6 +27,7 @@ def render_to_string(template_name, dictionary, context=None, namespace='main'):
# 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['MITX_ROOT_URL'] = settings.MITX_ROOT_URL
for d in mitxmako.middleware.requestcontext: for d in mitxmako.middleware.requestcontext:
context_dictionary.update(d) context_dictionary.update(d)
for d in context_instance: for d in context_instance:
......
...@@ -5,6 +5,14 @@ import tempfile ...@@ -5,6 +5,14 @@ import tempfile
import djcelery import djcelery
MITX_ROOT_URL = ''
COURSE_NAME = "6.002_Spring_2012"
COURSE_NUMBER = "6.002x"
COURSE_TITLE = "Circuits and Electronics"
ROOT_URLCONF = 'urls'
# from settings2.askbotsettings import LIVESETTINGS_OPTIONS # from settings2.askbotsettings import LIVESETTINGS_OPTIONS
DEFAULT_GROUPS = [] DEFAULT_GROUPS = []
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</li> </li>
<li><a href="/s/help.html">Help</a></li> <li><a href="/s/help.html">Help</a></li>
% if user.is_authenticated(): % if user.is_authenticated():
<li><a href="/logout">Log out</a></li> <li><a href="${ settings.MITX_ROOT_URL }/logout">Log out</a></li>
% endif % endif
</ul> </ul>
</nav> </nav>
......
...@@ -3,20 +3,20 @@ ...@@ -3,20 +3,20 @@
<header> <header>
<hgroup> <hgroup>
<h1><em>MITx</em></h1> <h1><em>MITx</em></h1>
<h2><a href="/courseware">Circuits and Electronics</a></h2> <h2><a href="${ MITX_ROOT_URL }/courseware/">${ settings.COURSE_TITLE }</a></h2>
</hgroup> </hgroup>
<nav class="${active_page}"> <nav class="${active_page}">
<ul class="coursenav"> <ul class="coursenav">
<li class="courseware"><a href="/courseware">Courseware</a></li> <li class="courseware"><a href="${ MITX_ROOT_URL }/courseware/">Courseware</a></li>
<li class="info"><a href="/info">Course Info</a></li> <li class="info"><a href="${ MITX_ROOT_URL }/info">Course Info</a></li>
% if user.is_authenticated(): % if user.is_authenticated():
<li class="book"><a href="/book">Textbook</a></li> <li class="book"><a href="${ MITX_ROOT_URL }/book">Textbook</a></li>
<li class="discussion"><a href="/discussion/questions">Discussion</a></li> <li class="discussion"><a href="${ MITX_ROOT_URL }/discussion/questions/">Discussion</a></li>
% endif % endif
<li class="wiki"><a href="/wiki/view">Wiki</a></li> <li class="wiki"><a href="${ MITX_ROOT_URL }/wiki/view/">Wiki</a></li>
% if user.is_authenticated(): % if user.is_authenticated():
<li class="profile"><a href="/profile">Profile</a></li> <li class="profile"><a href="${ MITX_ROOT_URL }/profile">Profile</a></li>
% endif % endif
</ul> </ul>
</nav> </nav>
......
...@@ -8,7 +8,7 @@ function ${ id }_content_updated() { ...@@ -8,7 +8,7 @@ function ${ id }_content_updated() {
$.each($("[id^=input_${ id }_]"), function(index,value){ $.each($("[id^=input_${ id }_]"), function(index,value){
submit_data[value.id]=value.value; submit_data[value.id]=value.value;
}); });
postJSON('/modx/problem/${ id }/problem_check', postJSON('${ MITX_ROOT_URL }/modx/problem/${ id }/problem_check',
submit_data, submit_data,
function(json) { function(json) {
switch(json.success) { switch(json.success) {
...@@ -30,7 +30,7 @@ function ${ id }_content_updated() { ...@@ -30,7 +30,7 @@ function ${ id }_content_updated() {
submit_data[value.id]=value.value; submit_data[value.id]=value.value;
}); });
postJSON('/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(html_as_json) { postJSON('${ MITX_ROOT_URL }/modx/problem/${ id }/problem_reset', {'id':'${ id }'}, function(html_as_json) {
$('#main_${ id }').html(html_as_json); $('#main_${ id }').html(html_as_json);
${ id }_content_updated(); ${ id }_content_updated();
}); });
...@@ -38,7 +38,7 @@ function ${ id }_content_updated() { ...@@ -38,7 +38,7 @@ function ${ id }_content_updated() {
}); });
$('#show_${ id }').unbind('click').click(function() { $('#show_${ id }').unbind('click').click(function() {
postJSON('/modx/problem/${ id }/problem_show', {}, function(data) { postJSON('${ MITX_ROOT_URL }/modx/problem/${ id }/problem_show', {}, function(data) {
for (var key in data) { for (var key in data) {
$("#answer_"+key).text(data[key]); $("#answer_"+key).text(data[key]);
} }
...@@ -53,7 +53,7 @@ function ${ id }_content_updated() { ...@@ -53,7 +53,7 @@ function ${ id }_content_updated() {
$.each($("[id^=input_${ id }_]"), function(index,value) { $.each($("[id^=input_${ id }_]"), function(index,value) {
submit_data[value.id]=value.value; submit_data[value.id]=value.value;
}); });
postJSON('/modx/problem/${ id }/problem_save', postJSON('${ MITX_ROOT_URL }/modx/problem/${ id }/problem_save',
submit_data, submit_data,
function(data) { function(data) {
if(data.success) { if(data.success) {
......
...@@ -53,7 +53,7 @@ function disablePrev() { ...@@ -53,7 +53,7 @@ function disablePrev() {
function ${ id }goto(i) { function ${ id }goto(i) {
log_event("seq_goto", {'old':${id}loc, 'new':i,'id':'${id}'}); log_event("seq_goto", {'old':${id}loc, 'new':i,'id':'${id}'});
postJSON('/modx/sequential/${ id }/goto_position', postJSON('${ MITX_ROOT_URL }/modx/sequential/${ id }/goto_position',
{'position' : i }); {'position' : i });
if (${ id }loc!=-1) if (${ id }loc!=-1)
......
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