From 3bfb633fd396d6a3c3b317915ccc95e4d3d117bc Mon Sep 17 00:00:00 2001 From: lduarte1991 Date: Fri, 6 Jun 2014 12:36:59 -0400 Subject: [PATCH] Annotator Tool: Fixed delete bug and factored out settings Removed print context --- common/lib/xmodule/xmodule/annotator_mixin.py | 6 ---- .../xmodule/xmodule/imageannotation_module.py | 6 ++-- .../xmodule/xmodule/textannotation_module.py | 6 ++-- .../xmodule/xmodule/videoannotation_module.py | 6 ++-- common/static/js/vendor/ova/catch/js/catch.js | 33 +++++++++++-------- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/common/lib/xmodule/xmodule/annotator_mixin.py b/common/lib/xmodule/xmodule/annotator_mixin.py index 114dde292c..93768f564c 100644 --- a/common/lib/xmodule/xmodule/annotator_mixin.py +++ b/common/lib/xmodule/xmodule/annotator_mixin.py @@ -90,9 +90,3 @@ class CommonAnnotatorMixin(object): scope=Scope.settings, default="everyone", ) - extra_context = { - 'annotation_storage': annotation_storage_url, - 'default_tab': default_tab, - 'instructor_email': instructor_email, - 'annotation_mode': annotation_mode, - } \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/imageannotation_module.py b/common/lib/xmodule/xmodule/imageannotation_module.py index 31c095da59..b605dfa131 100644 --- a/common/lib/xmodule/xmodule/imageannotation_module.py +++ b/common/lib/xmodule/xmodule/imageannotation_module.py @@ -91,9 +91,11 @@ class ImageAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule): 'token': retrieve_token(self.user, self.annotation_token_secret), 'tag': self.instructor_tags, 'openseadragonjson': self.openseadragonjson, + 'annotation_storage': self.annotation_storage_url, + 'default_tab': self.default_tab, + 'instructor_email': self.instructor_email, + 'annotation_mode': self.annotation_mode, } - context.update(self.extra_context) - print 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") diff --git a/common/lib/xmodule/xmodule/textannotation_module.py b/common/lib/xmodule/xmodule/textannotation_module.py index 1f10cea193..cdfe43857d 100644 --- a/common/lib/xmodule/xmodule/textannotation_module.py +++ b/common/lib/xmodule/xmodule/textannotation_module.py @@ -88,9 +88,11 @@ class TextAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule): 'content_html': self.content, 'token': retrieve_token(self.user_email, self.annotation_token_secret), 'diacritic_marks': self.diacritics, + 'annotation_storage': self.annotation_storage_url, + 'default_tab': self.default_tab, + 'instructor_email': self.instructor_email, + 'annotation_mode': self.annotation_mode, } - context.update(self.extra_context) - print 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") diff --git a/common/lib/xmodule/xmodule/videoannotation_module.py b/common/lib/xmodule/xmodule/videoannotation_module.py index cf93bf31d5..17dc49acb5 100644 --- a/common/lib/xmodule/xmodule/videoannotation_module.py +++ b/common/lib/xmodule/xmodule/videoannotation_module.py @@ -94,9 +94,11 @@ class VideoAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule): 'poster': self.poster_url, 'content_html': self.content, 'token': retrieve_token(self.user_email, self.annotation_token_secret), + 'annotation_storage': self.annotation_storage_url, + 'default_tab': self.default_tab, + 'instructor_email': self.instructor_email, + 'annotation_mode': self.annotation_mode, } - context.update(self.extra_context) - print 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") diff --git a/common/static/js/vendor/ova/catch/js/catch.js b/common/static/js/vendor/ova/catch/js/catch.js index 130d51a35e..a45b778d99 100644 --- a/common/static/js/vendor/ova/catch/js/catch.js +++ b/common/static/js/vendor/ova/catch/js/catch.js @@ -613,21 +613,26 @@ CatchAnnotation.prototype = { var annotations = annotator.plugins['Store'].annotations, tot = typeof annotations !='undefined'?annotations.length:0, attempts = 0; // max 100 + if(annotation.media == "image"){ + self.refreshCatch(true); + self.checkTotAnnotations(); + } else { //This is to watch the annotations object, to see when is deleted the annotation - var ischanged = function(){ - var new_tot = annotator.plugins['Store'].annotations.length; - if (attempts<100) - setTimeout(function(){ - if (new_tot != tot){ - self.refreshCatch(true); - self.checkTotAnnotations(); - }else{ - attempts++; - ischanged(); - } - },100); //wait for the change in the annotations - }; - ischanged(); + var ischanged = function(){ + var new_tot = annotator.plugins['Store'].annotations.length; + if (attempts<100) + setTimeout(function(){ + if (new_tot != tot){ + self.refreshCatch(true); + self.checkTotAnnotations(); + }else{ + attempts++; + ischanged(); + } + },100); //wait for the change in the annotations + }; + ischanged(); + } }); annotator.subscribe("annotationCreated", function (annotation){ var attempts = 0; // max 100