Commit 3bfb633f by lduarte1991

Annotator Tool: Fixed delete bug and factored out settings

Removed print context
parent 54974a51
...@@ -90,9 +90,3 @@ class CommonAnnotatorMixin(object): ...@@ -90,9 +90,3 @@ class CommonAnnotatorMixin(object):
scope=Scope.settings, scope=Scope.settings,
default="everyone", 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
...@@ -91,9 +91,11 @@ class ImageAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule): ...@@ -91,9 +91,11 @@ class ImageAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule):
'token': retrieve_token(self.user, self.annotation_token_secret), 'token': retrieve_token(self.user, self.annotation_token_secret),
'tag': self.instructor_tags, 'tag': self.instructor_tags,
'openseadragonjson': self.openseadragonjson, '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 = 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/tinymce.full.min.js")
fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js") fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js")
......
...@@ -88,9 +88,11 @@ class TextAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule): ...@@ -88,9 +88,11 @@ class TextAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule):
'content_html': self.content, 'content_html': self.content,
'token': retrieve_token(self.user_email, self.annotation_token_secret), 'token': retrieve_token(self.user_email, self.annotation_token_secret),
'diacritic_marks': self.diacritics, '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 = 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/tinymce.full.min.js")
fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js") fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js")
......
...@@ -94,9 +94,11 @@ class VideoAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule): ...@@ -94,9 +94,11 @@ class VideoAnnotationModule(AnnotatableFields, CommonAnnotatorMixin, XModule):
'poster': self.poster_url, 'poster': self.poster_url,
'content_html': self.content, 'content_html': self.content,
'token': retrieve_token(self.user_email, self.annotation_token_secret), '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 = 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/tinymce.full.min.js")
fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js") fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js")
......
...@@ -613,21 +613,26 @@ CatchAnnotation.prototype = { ...@@ -613,21 +613,26 @@ CatchAnnotation.prototype = {
var annotations = annotator.plugins['Store'].annotations, var annotations = annotator.plugins['Store'].annotations,
tot = typeof annotations !='undefined'?annotations.length:0, tot = typeof annotations !='undefined'?annotations.length:0,
attempts = 0; // max 100 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 //This is to watch the annotations object, to see when is deleted the annotation
var ischanged = function(){ var ischanged = function(){
var new_tot = annotator.plugins['Store'].annotations.length; var new_tot = annotator.plugins['Store'].annotations.length;
if (attempts<100) if (attempts<100)
setTimeout(function(){ setTimeout(function(){
if (new_tot != tot){ if (new_tot != tot){
self.refreshCatch(true); self.refreshCatch(true);
self.checkTotAnnotations(); self.checkTotAnnotations();
}else{ }else{
attempts++; attempts++;
ischanged(); ischanged();
} }
},100); //wait for the change in the annotations },100); //wait for the change in the annotations
}; };
ischanged(); ischanged();
}
}); });
annotator.subscribe("annotationCreated", function (annotation){ annotator.subscribe("annotationCreated", function (annotation){
var attempts = 0; // max 100 var attempts = 0; // max 100
......
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