From 1d6f3c631db91ca042be66ee34d1fdee9a8eed89 Mon Sep 17 00:00:00 2001 From: lduarte1991 Date: Wed, 28 May 2014 14:38:37 -0400 Subject: [PATCH] Annotation Tools: Load Tinymce in student_view --- common/lib/xmodule/xmodule/imageannotation_module.py | 8 ++++++-- common/lib/xmodule/xmodule/textannotation_module.py | 9 ++++++--- common/lib/xmodule/xmodule/videoannotation_module.py | 9 ++++++--- lms/templates/imageannotation.html | 3 --- lms/templates/textannotation.html | 3 --- lms/templates/videoannotation.html | 4 ---- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/lib/xmodule/xmodule/imageannotation_module.py b/common/lib/xmodule/xmodule/imageannotation_module.py index e5a3306f7c..c6dc50d9ce 100644 --- a/common/lib/xmodule/xmodule/imageannotation_module.py +++ b/common/lib/xmodule/xmodule/imageannotation_module.py @@ -9,6 +9,7 @@ from xmodule.raw_module import RawDescriptor from xblock.core import Scope, String from xmodule.annotator_mixin import get_instructions, html_to_text from xmodule.annotator_token import retrieve_token +from xblock.fragment import Fragment import textwrap @@ -94,7 +95,7 @@ class ImageAnnotationModule(AnnotatableFields, XModule): """ Removes from the xmltree and returns them as a string, otherwise None. """ return get_instructions(xmltree) - def get_html(self): + def student_view(self, context): """ Renders parameters to template. """ context = { 'display_name': self.display_name_with_default, @@ -105,7 +106,10 @@ class ImageAnnotationModule(AnnotatableFields, XModule): 'openseadragonjson': self.openseadragonjson, } - return self.system.render_template('imageannotation.html', context) + fragment = Fragment(self.system.render_template('imageannotation.html', context)) + fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js") + fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js") + return fragment class ImageAnnotationDescriptor(AnnotatableFields, RawDescriptor): # pylint: disable=abstract-method diff --git a/common/lib/xmodule/xmodule/textannotation_module.py b/common/lib/xmodule/xmodule/textannotation_module.py index 9468f7e58f..afbdd86f27 100644 --- a/common/lib/xmodule/xmodule/textannotation_module.py +++ b/common/lib/xmodule/xmodule/textannotation_module.py @@ -8,7 +8,7 @@ from xmodule.raw_module import RawDescriptor from xblock.core import Scope, String from xmodule.annotator_mixin import get_instructions from xmodule.annotator_token import retrieve_token - +from xblock.fragment import Fragment import textwrap # Make '_' a no-op so we can scrape strings @@ -73,7 +73,7 @@ class TextAnnotationModule(AnnotatableFields, XModule): """ Removes from the xmltree and returns them as a string, otherwise None. """ return get_instructions(xmltree) - def get_html(self): + def student_view(self, context): """ Renders parameters to template. """ context = { 'course_key': self.runtime.course_id, @@ -85,7 +85,10 @@ class TextAnnotationModule(AnnotatableFields, XModule): 'annotation_storage': self.annotation_storage_url, 'token': retrieve_token(self.user_email, self.annotation_token_secret), } - return self.system.render_template('textannotation.html', context) + fragment = Fragment(self.system.render_template('textannotation.html', context)) + fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js") + fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js") + return fragment class TextAnnotationDescriptor(AnnotatableFields, RawDescriptor): diff --git a/common/lib/xmodule/xmodule/videoannotation_module.py b/common/lib/xmodule/xmodule/videoannotation_module.py index 564d19b182..72e3d8cab5 100644 --- a/common/lib/xmodule/xmodule/videoannotation_module.py +++ b/common/lib/xmodule/xmodule/videoannotation_module.py @@ -9,6 +9,7 @@ from xmodule.raw_module import RawDescriptor from xblock.core import Scope, String from xmodule.annotator_mixin import get_instructions, get_extension from xmodule.annotator_token import retrieve_token +from xblock.fragment import Fragment import textwrap @@ -72,7 +73,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule): ''' get the extension of a given url ''' return get_extension(src_url) - def get_html(self): + def student_view(self, context): """ Renders parameters to template. """ extension = self._get_extension(self.sourceurl) @@ -87,8 +88,10 @@ class VideoAnnotationModule(AnnotatableFields, XModule): 'annotation_storage': self.annotation_storage_url, 'token': retrieve_token(self.user_email, self.annotation_token_secret), } - - return self.system.render_template('videoannotation.html', context) + fragment = Fragment(self.system.render_template('videoannotation.html', context)) + fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js") + fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js") + return fragment class VideoAnnotationDescriptor(AnnotatableFields, RawDescriptor): diff --git a/lms/templates/imageannotation.html b/lms/templates/imageannotation.html index 3342d296bb..e815c49506 100644 --- a/lms/templates/imageannotation.html +++ b/lms/templates/imageannotation.html @@ -31,8 +31,6 @@ <%namespace name='static' file='/static_content.html'/> ${static.css(group='style-vendor-tinymce-content', raw=True)} ${static.css(group='style-vendor-tinymce-skin', raw=True)} -