diff --git a/common/lib/xmodule/xmodule/gst_module.py b/common/lib/xmodule/xmodule/gst_module.py index d90bc46e6e..e98b7b6c90 100644 --- a/common/lib/xmodule/xmodule/gst_module.py +++ b/common/lib/xmodule/xmodule/gst_module.py @@ -3,21 +3,19 @@ Graphical slider tool module is ungraded xmodule used by students to understand functional dependencies. """ -# import json +import json import logging - from lxml import etree +import xmltodict +import re from xmodule.mako_module import MakoModuleDescriptor from xmodule.xml_module import XmlDescriptor from xmodule.x_module import XModule -from xmodule.progress import Progress -from xmodule.exceptions import NotFoundError -from pkg_resources import resource_string -from xmodule.raw_module import RawDescriptor from xmodule.stringify import stringify_children -# log = logging.getLogger("mitx.common.lib.seq_module") + +log = logging.getLogger("mitx.common.lib.gst_module") class GraphicalSliderToolModule(XModule): @@ -71,15 +69,49 @@ class GraphicalSliderToolModule(XModule): instance_state, shared_state, **kwargs) def get_html(self): + self.get_configuration() + gst_html = self.substitute_controls(self.definition['render'].strip()) + params = { - 'main_html': self.definition['render'].strip(), + 'gst_html': gst_html, 'element_id': self.location.html_id(), - 'element_class': self.location.category + 'element_class': self.location.category, + 'configuration_json': self.configuration_json } self.content = (self.system.render_template( 'graphical_slider_tool.html', params)) + # import ipdb; ipdb.set_trace() return self.content + def substitute_controls(self, html_string): + """ Substitue control element via their divs. + Simple variant: slider and plot controls are not inside any tag. + """ + plot_div = '