From 68acf66f6ca78512bed981ec64da1b8d395d18f8 Mon Sep 17 00:00:00 2001 From: lduarte1991 Date: Thu, 5 Jun 2014 12:44:36 -0400 Subject: [PATCH] Annotation Tools: PR Fixes - Fixed camel case for variable name - Fixed indentation in imageannotation.html - Changed all mentions of Instructor Username to Email - Turned annotation_mode into phrase - Fixed indentation in imageannotation.html - Added comments in imageannotation.html - Changing annotation_mode in OSDA --- .../xmodule/xmodule/imageannotation_module.py | 13 +- .../xmodule/xmodule/textannotation_module.py | 13 +- .../xmodule/xmodule/videoannotation_module.py | 15 +- .../js/vendor/ova/OpenSeaDragonAnnotation.js | 2 +- common/static/js/vendor/ova/catch/js/catch.js | 88 ++++----- lms/templates/imageannotation.html | 167 +++++++++--------- lms/templates/textannotation.html | 9 +- lms/templates/videoannotation.html | 9 +- 8 files changed, 163 insertions(+), 153 deletions(-) diff --git a/common/lib/xmodule/xmodule/imageannotation_module.py b/common/lib/xmodule/xmodule/imageannotation_module.py index 754c29359c..40d50b8b06 100644 --- a/common/lib/xmodule/xmodule/imageannotation_module.py +++ b/common/lib/xmodule/xmodule/imageannotation_module.py @@ -69,17 +69,18 @@ class AnnotatableFields(object): scope=Scope.settings, default="myNotes", ) - instructor_username = String( - display_name=_("Username for 'Instructor' Annotations"), - help=_("Username that will be attached to all annotations that will be found in 'Instructor' tab."), + # currently only supports one instructor, will build functionality for multiple later + instructor_email = String( + display_name=_("Email for 'Instructor' Annotations"), + help=_("Email of the user that will be attached to all annotations that will be found in 'Instructor' tab."), scope=Scope.settings, default="", ) annotation_mode = String( display_name=_("Mode for Annotation Tool"), - help=_("Type in number corresponding to following modes: 1 = only instructor can annotate , 2 = Everyone can annotate"), + help=_("Type in number corresponding to following modes: 'instructor' or 'everyone'"), scope=Scope.settings, - default="2", + default="everyone", ) @@ -123,7 +124,7 @@ class ImageAnnotationModule(AnnotatableFields, XModule): 'tag': self.instructor_tags, 'openseadragonjson': self.openseadragonjson, 'default_tab': self.default_tab, - 'instructor_username': self.instructor_username, + 'instructor_email': self.instructor_email, 'annotation_mode': self.annotation_mode, } diff --git a/common/lib/xmodule/xmodule/textannotation_module.py b/common/lib/xmodule/xmodule/textannotation_module.py index 7d47ef87fa..2bdda68ea2 100644 --- a/common/lib/xmodule/xmodule/textannotation_module.py +++ b/common/lib/xmodule/xmodule/textannotation_module.py @@ -71,17 +71,18 @@ class AnnotatableFields(object): scope=Scope.settings, default="myNotes", ) - instructor_username = String( - display_name=_("Username for 'Instructor' Annotations"), - help=_("Username that will be attached to all annotations that will be found in 'Instructor' tab."), + # currently only supports one instructor, will build functionality for multiple later + instructor_email = String( + display_name=_("Email for 'Instructor' Annotations"), + help=_("Email of the user that will be attached to all annotations that will be found in 'Instructor' tab."), scope=Scope.settings, default="", ) annotation_mode = String( display_name=_("Mode for Annotation Tool"), - help=_("Type in number corresponding to following modes: 1 = only instructor can annotate , 2 = Everyone can annotate"), + help=_("Type in number corresponding to following modes: 'instructor' or 'everyone'"), scope=Scope.settings, - default="2", + default="everyone", ) @@ -120,7 +121,7 @@ class TextAnnotationModule(AnnotatableFields, XModule): 'token': retrieve_token(self.user_email, self.annotation_token_secret), 'diacritic_marks': self.diacritics, 'default_tab': self.default_tab, - 'instructor_username': self.instructor_username, + 'instructor_email': self.instructor_email, 'annotation_mode': self.annotation_mode, } fragment = Fragment(self.system.render_template('textannotation.html', context)) diff --git a/common/lib/xmodule/xmodule/videoannotation_module.py b/common/lib/xmodule/xmodule/videoannotation_module.py index e3fbde9944..95848c0e9e 100644 --- a/common/lib/xmodule/xmodule/videoannotation_module.py +++ b/common/lib/xmodule/xmodule/videoannotation_module.py @@ -48,7 +48,7 @@ class AnnotatableFields(object): annotation_storage_url = String( help=_("Location of Annotation backend"), scope=Scope.settings, - default="http://your_annotation_storage.com", + default="http://your_annotation_storage.com", display_name=_("Url for Annotation Storage"), ) annotation_token_secret = String( @@ -63,17 +63,18 @@ class AnnotatableFields(object): scope=Scope.settings, default="myNotes", ) - instructor_username = String( - display_name=_("Username for 'Instructor' Annotations"), - help=_("Username that will be attached to all annotations that will be found in 'Instructor' tab."), + # currently only supports one instructor, will build functionality for multiple later + instructor_email = String( + display_name=_("Email for 'Instructor' Annotations"), + help=_("Email of the user that will be attached to all annotations that will be found in 'Instructor' tab."), scope=Scope.settings, default="", ) annotation_mode = String( display_name=_("Mode for Annotation Tool"), - help=_("Type in number corresponding to following modes: 1 = only instructor can annotate , 2 = Everyone can annotate"), + help=_("Type in number corresponding to following modes: 'instructor' or 'everyone'"), scope=Scope.settings, - default="2", + default="everyone", ) class VideoAnnotationModule(AnnotatableFields, XModule): @@ -125,7 +126,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule): 'annotation_storage': self.annotation_storage_url, 'token': retrieve_token(self.user_email, self.annotation_token_secret), 'default_tab': self.default_tab, - 'instructor_username': self.instructor_username, + 'instructor_email': self.instructor_email, 'annotation_mode': self.annotation_mode, } fragment = Fragment(self.system.render_template('videoannotation.html', context)) diff --git a/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js b/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js index 4fbadc4f47..938af6e8d3 100644 --- a/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js +++ b/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js @@ -380,7 +380,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. clickTimeThreshold: viewer.clickTimeThreshold, clickDistThreshold: viewer.clickDistThreshold }); - if(this.options.viewer.annotation_mode == "2" || this.options.viewer.flags){ + if(this.options.viewer.annotation_mode == "everyone" || this.options.viewer.flags){ /* Set elements to the control menu */ viewer.annotatorControl = viewer.wrapperAnnotation.element; if( viewer.toolbar ){ diff --git a/common/static/js/vendor/ova/catch/js/catch.js b/common/static/js/vendor/ova/catch/js/catch.js index 950966fb07..c2f16b98e4 100644 --- a/common/static/js/vendor/ova/catch/js/catch.js +++ b/common/static/js/vendor/ova/catch/js/catch.js @@ -42,29 +42,29 @@ annotationList: ''+ '
'+ - 'User'+ + gettext('User')+ '
'+ '
'+ - 'Annotation'+ + gettext('Annotation')+ '
'+ '{{#if videoFormat}}'+ '
'+ - 'Start'+ + gettext('Start')+ '
'+ '
'+ - 'End'+ + gettext('End')+ '
'+ '{{/if}}'+ '
'+ - '#Replies'+ + gettext('#Replies')+ '
'+ '
'+ - 'Date posted'+ + gettext('Date posted')+ '
'+ ''+ ''+ @@ -73,41 +73,41 @@ annotationList: '{{/each}}'+ ''+ '
'+ - '
More
'+ + '
'+gettext('More')+'
'+ '
', //Main->PublicPrivateInstructor annotationPublicPrivateInstructor: - '
My NotesmyNotes
'+ - '
Instructorinstructor
'+ - '
Publicpublic
'+ - '', + '
'+gettext('My Notes')+'myNotes
'+ + '
'+gettext('Instructor')+'instructor
'+ + '
'+gettext('Public')+'public
'+ + '', //Main->PublicPrivate annotationPublicPrivate: - '
My NotesmyNotes
'+ - '
Publicpublic
'+ - '', + '
'+gettext('My Notes')+'myNotes
'+ + '
'+gettext('Public')+'public
'+ + '', //Main->MediaSelector annotationMediaSelector: '', @@ -137,7 +137,7 @@ annotationReply: '
'+ ''+ '{{/if}}'+ - '
Delete
'+ + '
'+gettext('Delete')+'
'+ '

'+ '

'+ '{{#if this.text}}'+ @@ -244,13 +244,13 @@ annotationDetail: ''+ '

'+ - '
Reply
 '+ + '
'+gettext('Reply')+'
 '+ '
Show Replies
 '+ '{{#if authToEditButton}}'+ - '
Edit
'+ + '
'+gettext('Edit')+'
'+ '{{/if}}'+ '{{#if authToDeleteButton}}'+ - '
Delete
'+ + '
'+gettext('Delete')+'
'+ '{{/if}}'+ '
'+ @@ -259,7 +259,7 @@ annotationDetail: '{{#if tags}}'+ '
'+ - '

Tags:

'+ + '

'+gettext('Tags:')+'

'+ '{{#each tags}}'+ '
'+ '{{this}}'+ @@ -348,14 +348,22 @@ CatchAnnotation.prototype = { this.HTMLTEMPLATES = CatchSources.HTMLTEMPLATES(this.options.imageUrlRoot); this.TEMPLATES = {}; this._compileTemplates(); + + // the default annotations are the user's personal ones instead of instructor + // if the default tab is instructor, we must refresh the catch to pull the ones + // under the instructor's email. passing empty strings as arguments will default + // to pulling the annotations for the email within this.options.userId. if(this.options.default_tab.toLowerCase() == 'instructor'){ - this.options.userId = this.options.instructor_username; + this.options.userId = this.options.instructor_email; this._refresh('',''); } }, // // GLOBAL UTILITIES // + getTemplate: function(templateName){ + return this.TEMPLATES[templateName]() || ''; + }, refreshCatch: function(newInstance) { var mediaType = this.options.media || 'text', annotationItems = [], @@ -396,18 +404,16 @@ CatchAnnotation.prototype = { if (newInstance){ var videoFormat = (mediaType === "video") ? true:false; - var publicprivatetemplate = ''; + var publicPrivateTemplate = ''; if (self.options.showPublicPrivate) { - if(self.options.instructor_username != ''){ - publicprivatetemplate = self.TEMPLATES.annotationPublicPrivateInstructor(); - } else{ - publicprivatetemplate = self.TEMPLATES.annotationPublicPrivate(); - } + var templateName = this.options.instructor_email ? + "annotationPublicPrivateInstructor" : + "annotationPublicPrivate"; } el.html(self.TEMPLATES.annotationList({ annotationItems: annotationItems, videoFormat: videoFormat, - PublicPrivate: publicprivatetemplate, + PublicPrivate: this.getTemplate(templateName), MediaSelector: self.options.showMediaSelector?self.TEMPLATES.annotationMediaSelector():'', })); }else{ @@ -433,7 +439,7 @@ CatchAnnotation.prototype = { self.options.userId = ''; break; case 'instructor': - self.options.userId = this.options.instructor_username; + self.options.userId = this.options.instructor_email; break; default: self.options.userId = this.annotator.plugins.Permissions.user.id; @@ -1055,7 +1061,7 @@ CatchAnnotation.prototype = { userId = ''; break; case 'instructor': - userId = this.options.instructor_username; + userId = this.options.instructor_email; break; default: userId = this.annotator.plugins.Permissions.user.id; @@ -1119,7 +1125,7 @@ CatchAnnotation.prototype = { }, _onClearSearchButtonClick: function(evt){ - this._refresh("",""); + this._refresh('',''); }, _clearAnnotator: function(){ var annotator = this.annotator, diff --git a/lms/templates/imageannotation.html b/lms/templates/imageannotation.html index e938abee42..74ce462560 100644 --- a/lms/templates/imageannotation.html +++ b/lms/templates/imageannotation.html @@ -9,70 +9,69 @@
-
- % if display_name is not UNDEFINED and display_name is not None: -
${display_name}
- % endif -
- % if instructions_html is not UNDEFINED and instructions_html is not None: -
-
- ${_('Instructions')} - ${_('Collapse Instructions')} -
-
- ${instructions_html} -
-
- % endif -
-
-
+
+ % if display_name is not UNDEFINED and display_name is not None: +
${display_name}
+ % endif +
+ % if instructions_html is not UNDEFINED and instructions_html is not None: +
+
+ ${_('Instructions')} + ${_('Collapse Instructions')} +
+
+ ${instructions_html} +
+
+ % endif +
+
+
<%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)}
-
- ## Translators: Notes below refer to annotations. They wil later be put under a "Notes" section. -
${_('Note: only instructors may annotate.')}
-
-
-
+
+
${_('Note: only instructors may annotate.')}
+
+
+
\ No newline at end of file diff --git a/lms/templates/textannotation.html b/lms/templates/textannotation.html index 5a55410434..19a261f7fa 100644 --- a/lms/templates/textannotation.html +++ b/lms/templates/textannotation.html @@ -177,10 +177,9 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)} //Load the plugin Video/Text Annotation var ova = new OpenVideoAnnotation.Annotator($('#textHolder'),options); - var userId = '${user.email}'; - if('${default_tab}'.toLowerCase() == 'instructor'){ - userId = '${instructor_username}'; - } + var userId = ('${default_tab}'.toLowerCase() === 'instructor') ? + '${instructor_email}': + '${user.email}'; //Catch var annotator = ova.annotator; @@ -194,7 +193,7 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)} pagination:pagination,//Number of Annotations per load in the pagination, flags:is_staff, default_tab: "${default_tab}", - instructor_username: "${instructor_username}", + instructor_email: "${instructor_email}", annotation_mode: "${annotation_mode}", }; var Catch = new CatchAnnotation($('#catchDIV'),catchOptions); diff --git a/lms/templates/videoannotation.html b/lms/templates/videoannotation.html index 1ec4e18751..07b61213c5 100644 --- a/lms/templates/videoannotation.html +++ b/lms/templates/videoannotation.html @@ -175,10 +175,9 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)} var ova = new OpenVideoAnnotation.Annotator($('#videoHolder'),options); ova.annotator.addPlugin('Tags'); - var userId = '${user.email}'; - if('${default_tab}'.toLowerCase() == 'instructor'){ - userId = '${instructor_username}'; - } + var userId = ('${default_tab}'.toLowerCase() === 'instructor') ? + '${instructor_email}': + '${user.email}'; //Catch var annotator = ova.annotator; @@ -192,7 +191,7 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)} pagination:pagination,//Number of Annotations per load in the pagination, flags:is_staff, default_tab: "${default_tab}", - instructor_username: "${instructor_username}", + instructor_email: "${instructor_email}", annotation_mode: "${annotation_mode}", }; var Catch = new CatchAnnotation($('#catchDIV'),catchOptions);