From 459c1dab4e7a9250fc6909040ab4bf6202a882c6 Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Mon, 12 Dec 2011 08:03:27 -0500 Subject: [PATCH] Using Ajax URL --- courseware/capa_module.py | 1 + courseware/views.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/courseware/capa_module.py b/courseware/capa_module.py index c1a19229d1..4ada2b489f 100644 --- a/courseware/capa_module.py +++ b/courseware/capa_module.py @@ -43,6 +43,7 @@ class LoncapaModule(XModule): {'problem':content, 'id':self.filename, 'check_button':check_button, + 'ajax_url':self.ajax_url, }) if encapsulate: html = '
'.format(id=self.item_id)+html+"
" diff --git a/courseware/views.py b/courseware/views.py index f69fe5bcb7..aa4cd66936 100644 --- a/courseware/views.py +++ b/courseware/views.py @@ -173,8 +173,10 @@ def render_x_module(request, xml_module): state = smod.state # Create a new instance + ajax_url = '/modx/'+module_type+'/'+module_id+'/' instance=module_class(xml_module.toxml(), module_id, + ajax_url=ajax_url, state=state) # If instance wasn't already in the database, create it @@ -201,7 +203,10 @@ def modx_dispatch(request, module=None, dispatch=None, id=None): s=s[0] dispatch=dispatch.split('?')[0] - instance=modx_modules[module](s.xml, s.module_id, state=s.state) + + ajax_url = '/modx/'+module+'/'+id+'/' + + instance=modx_modules[module](s.xml, s.module_id, ajax_url=ajax_url, state=s.state) html=instance.handle_ajax(dispatch, request.GET) s.state=instance.get_state() s.grade=instance.get_score()['score']