Commit 0e81f916 by Vik Paruchuri

Move open ended module file

parent dabb5ee7
...@@ -12,6 +12,7 @@ import sys ...@@ -12,6 +12,7 @@ import sys
from pkg_resources import resource_string from pkg_resources import resource_string
from .capa_module import only_one, ComplexEncoder from .capa_module import only_one, ComplexEncoder
from common.lib.xmodule.xmodule import open_ended_module
from .editing_module import EditingDescriptor from .editing_module import EditingDescriptor
from .html_checker import check_html from .html_checker import check_html
from progress import Progress from progress import Progress
...@@ -20,7 +21,6 @@ from .x_module import XModule ...@@ -20,7 +21,6 @@ from .x_module import XModule
from .xml_module import XmlDescriptor from .xml_module import XmlDescriptor
from xmodule.modulestore import Location from xmodule.modulestore import Location
import self_assessment_module import self_assessment_module
import open_ended_module
log = logging.getLogger("mitx.courseware") log = logging.getLogger("mitx.courseware")
...@@ -122,7 +122,7 @@ class CombinedOpenEndedModule(XModule): ...@@ -122,7 +122,7 @@ class CombinedOpenEndedModule(XModule):
else: else:
self.current_task=self_assessment_module.SelfAssessmentModule(self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor, instance_state=current_task_state) self.current_task=self_assessment_module.SelfAssessmentModule(self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor, instance_state=current_task_state)
elif current_task_type=="openended": elif current_task_type=="openended":
self.current_task_descriptor=open_ended_module.OpenEndedDescriptor(self.system) self.current_task_descriptor= open_ended_module.OpenEndedDescriptor(self.system)
self.current_task_parsed_xml=self.current_task_descriptor.definition_from_xml(etree.fromstring(self.current_task_xml),self.system) self.current_task_parsed_xml=self.current_task_descriptor.definition_from_xml(etree.fromstring(self.current_task_xml),self.system)
if current_task_state is None and self.current_task_number==0: if current_task_state is None and self.current_task_number==0:
self.current_task=open_ended_module.OpenEndedModule(self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor) self.current_task=open_ended_module.OpenEndedModule(self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor)
......
...@@ -544,18 +544,17 @@ class OpenEndedModule(): ...@@ -544,18 +544,17 @@ class OpenEndedModule():
}) })
return json.dumps(d, cls=ComplexEncoder) return json.dumps(d, cls=ComplexEncoder)
def get_problem: def get_problem(self, get):
return self.get_html() return self.get_html()
def reset_problem: def reset_problem(self, get):
self.change_state(self.INITIAL) self.change_state(self.INITIAL)
return {'success': True} return {'success': True}
def save_problem(self, get):
def save_problem:
pass pass
def update_score: def update_score(self, get):
""" """
Delivers grading response (e.g. from asynchronous code checking) to Delivers grading response (e.g. from asynchronous code checking) to
the capa problem, so its score can be updated the capa problem, so its score can be updated
...@@ -602,10 +601,10 @@ class OpenEndedModule(): ...@@ -602,10 +601,10 @@ class OpenEndedModule():
return html return html
def change_state(self, new_state): def change_state(self, new_state):
""" """
A centralized place for state changes--allows for hooks. If the A centralized place for state changes--allows for hooks. If the
current state matches the old state, don't run any hooks. current state matches the old state, don't run any hooks.
""" """
if self.state == new_state: if self.state == new_state:
return return
...@@ -639,7 +638,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor): ...@@ -639,7 +638,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
stores_state = True stores_state = True
has_score = True has_score = True
template_dir_name = openended" template_dir_name = "openended"
js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]} js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]}
js_module_name = "HTMLEditingDescriptor" js_module_name = "HTMLEditingDescriptor"
......
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