Commit be1e308d by Piotr Mitros

Cale's fix for eval/extra json encode

parent 7567e5eb
......@@ -41,11 +41,9 @@ class Module(XModule):
if self.rendered:
return
def j(m):
''' jsonify contents so it can be embedded in a js array
We also need to split </script> tags so they don't break
mid-string'''
content=json.dumps(m['content'])
content=content.replace('</script>', '<"+"/script>')
''' Split </script> tags -- browsers handle this as end
of script, even if it occurs mid-string'''
content=m['content'].replace('</script>', '<"+"/script>')
return {'content':content,
'type': m['type']}
......@@ -76,13 +74,6 @@ class Module(XModule):
'titles':titles,
'tag':self.xmltree.tag}
# TODO/BUG: Destroy JavaScript should only be called for the active view
# This calls it for all the views
#
# To fix this, we'd probably want to have some way of assigning unique
# IDs to sequences.
destroy_js="".join([e['destroy_js'] for e in self.contents if 'destroy_js' in e])
if self.xmltree.tag in ['sequential', 'videosequence']:
self.content=render_to_string('seq_module.html',params)
if self.xmltree.tag == 'tab':
......
......@@ -39,7 +39,7 @@ class @Sequence
$.postWithPrefix "/modx/#{@tag}/#{@id}/goto_position", position: new_position
@mark_active new_position
@$('#seq_content').html eval(@elements[new_position - 1].content)
@$('#seq_content').html @elements[new_position - 1].content
MathJax.Hub.Queue(["Typeset", MathJax.Hub])
@position = new_position
......
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