',
//Main->MediaSelector
annotationMediaSelector:
@@ -290,14 +301,14 @@ CatchAnnotation = function (element, options) {
//Reset element an create a new element div
element.html('');
-
+ this.current_tab = this.options.default_tab;
//INIT
var self = this;
$( document ).ready(function() {
self.init();
self.refreshCatch(true);
- var moreBut = self.element.find('.annotationListButtons .moreButtonCatch');
- moreBut.hide();
+ var moreBut = self.element.find('.annotationListButtons .moreButtonCatch');
+ moreBut.hide();
});
return this;
@@ -310,6 +321,7 @@ CatchAnnotation.prototype = {
this.TEMPLATENAMES = [
"annotationList", //Main
"annotationPublicPrivate", //Main->PublicPrivate
+ "annotationPublicPrivateInstructor", //Main->PublicPrivateInstructor
"annotationMediaSelector", //Main->MediaSelector
"annotationItem", //Main->ContainerRow
"annotationReply",//Main->ContainerRow->Reply
@@ -317,8 +329,8 @@ CatchAnnotation.prototype = {
"annotationDetail",//Main->ContainerRow->DetailRow
];
//annotator
- var wrapper = $('.annotator-wrapper').parent()[0],
- annotator = $.data(wrapper, 'annotator');
+ var wrapper = $('.annotator-wrapper').parent()[0];
+ var annotator = $.data(wrapper, 'annotator');
this.annotator = annotator;
//Subscribe to annotator
@@ -336,6 +348,10 @@ CatchAnnotation.prototype = {
this.HTMLTEMPLATES = CatchSources.HTMLTEMPLATES(this.options.imageUrlRoot);
this.TEMPLATES = {};
this._compileTemplates();
+ if(this.options.default_tab.toLowerCase() == 'instructor'){
+ this.options.userId = this.options.instructor_username;
+ this._refresh('','');
+ }
},
//
// GLOBAL UTILITIES
@@ -380,10 +396,18 @@ CatchAnnotation.prototype = {
if (newInstance){
var videoFormat = (mediaType === "video") ? true:false;
+ var publicprivatetemplate = '';
+ if (self.options.showPublicPrivate) {
+ if(self.options.instructor_username != ''){
+ publicprivatetemplate = self.TEMPLATES.annotationPublicPrivateInstructor();
+ } else{
+ publicprivatetemplate = self.TEMPLATES.annotationPublicPrivate();
+ }
+ }
el.html(self.TEMPLATES.annotationList({
annotationItems: annotationItems,
videoFormat: videoFormat,
- PublicPrivate: self.options.showPublicPrivate?self.TEMPLATES.annotationPublicPrivate():'',
+ PublicPrivate: publicprivatetemplate,
MediaSelector: self.options.showMediaSelector?self.TEMPLATES.annotationMediaSelector():'',
}));
}else{
@@ -402,10 +426,21 @@ CatchAnnotation.prototype = {
//Set PublicPrivate
var PublicPrivateButtons = el.find('.annotationListButtons .PublicPrivate').removeClass('active'); //reset
for (var index=0;index
From 1dcf2dc10ab1916647664469a237ed0909595447 Mon Sep 17 00:00:00 2001
From: lduarte1991
Date: Mon, 2 Jun 2014 23:27:23 -0400
Subject: [PATCH 2/8] Video Annotation Tool: Added Instructor Filter
---
.../xmodule/xmodule/videoannotation_module.py | 21 +++++++++++++++++++
lms/templates/textannotation.html | 2 --
lms/templates/videoannotation.html | 10 ++++++++-
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/common/lib/xmodule/xmodule/videoannotation_module.py b/common/lib/xmodule/xmodule/videoannotation_module.py
index 857ec5fcd9..e3fbde9944 100644
--- a/common/lib/xmodule/xmodule/videoannotation_module.py
+++ b/common/lib/xmodule/xmodule/videoannotation_module.py
@@ -57,6 +57,24 @@ class AnnotatableFields(object):
default="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
display_name=_("Secret Token String for Annotation")
)
+ default_tab = String(
+ display_name=_("Default Annotations Tab"),
+ help=_("Select which tab will be the default in the annotations table: myNotes, Instructor, or Public."),
+ 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."),
+ 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"),
+ scope=Scope.settings,
+ default="2",
+ )
class VideoAnnotationModule(AnnotatableFields, XModule):
'''Video Annotation Module'''
@@ -106,6 +124,9 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
'content_html': self.content,
'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,
+ 'annotation_mode': self.annotation_mode,
}
fragment = Fragment(self.system.render_template('videoannotation.html', context))
fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js")
diff --git a/lms/templates/textannotation.html b/lms/templates/textannotation.html
index ba27390b62..4a817cafd8 100644
--- a/lms/templates/textannotation.html
+++ b/lms/templates/textannotation.html
@@ -182,8 +182,6 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
userId = '${instructor_username}';
}
- console.log("${user.is_staff}");
-
//Catch
var annotator = ova.annotator,
catchOptions = {
diff --git a/lms/templates/videoannotation.html b/lms/templates/videoannotation.html
index 539e86909a..2259257d68 100644
--- a/lms/templates/videoannotation.html
+++ b/lms/templates/videoannotation.html
@@ -175,6 +175,10 @@ ${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}';
+ }
//Catch
var annotator = ova.annotator,
@@ -184,9 +188,13 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
imageUrlRoot:imgURLRoot,
showMediaSelector: false,
showPublicPrivate: true,
- userId:'${user.email}',
+ userId:userId,
pagination:pagination,//Number of Annotations per load in the pagination,
flags:is_staff
+ flags:is_staff,
+ default_tab: "${default_tab}",
+ instructor_username: "${instructor_username}",
+ annotation_mode: "${annotation_mode}",
},
Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
From 50e8ae9a6efeaf42fe3a98ad764cdd14bc1a7b3b Mon Sep 17 00:00:00 2001
From: lduarte1991
Date: Mon, 2 Jun 2014 23:31:14 -0400
Subject: [PATCH 3/8] Image Annotation Tool: Added Instructor Filter
---
.../xmodule/xmodule/imageannotation_module.py | 21 +++++++++++++++++++
lms/templates/imageannotation.html | 14 ++++++++++---
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/common/lib/xmodule/xmodule/imageannotation_module.py b/common/lib/xmodule/xmodule/imageannotation_module.py
index c6dc50d9ce..754c29359c 100644
--- a/common/lib/xmodule/xmodule/imageannotation_module.py
+++ b/common/lib/xmodule/xmodule/imageannotation_module.py
@@ -63,6 +63,24 @@ class AnnotatableFields(object):
default="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
display_name=_("Secret Token String for Annotation")
)
+ default_tab = String(
+ display_name=_("Default Annotations Tab"),
+ help=_("Select which tab will be the default in the annotations table: myNotes, Instructor, or Public."),
+ 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."),
+ 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"),
+ scope=Scope.settings,
+ default="2",
+ )
class ImageAnnotationModule(AnnotatableFields, XModule):
@@ -104,6 +122,9 @@ class ImageAnnotationModule(AnnotatableFields, XModule):
'token': retrieve_token(self.user, self.annotation_token_secret),
'tag': self.instructor_tags,
'openseadragonjson': self.openseadragonjson,
+ 'default_tab': self.default_tab,
+ 'instructor_username': self.instructor_username,
+ 'annotation_mode': self.annotation_mode,
}
fragment = Fragment(self.system.render_template('imageannotation.html', context))
diff --git a/lms/templates/imageannotation.html b/lms/templates/imageannotation.html
index e815c49506..dce0304516 100644
--- a/lms/templates/imageannotation.html
+++ b/lms/templates/imageannotation.html
@@ -189,6 +189,11 @@
//Load the plugin Image/Text Annotation
var osda = new OpenSeadragonAnnotation($('#imageHolder'),options);
+ var userId = '${user.email}';
+ if('${default_tab}'.toLowerCase() == 'instructor'){
+ userId = '${instructor_username}';
+ }
+
//Catch
var annotator = osda.annotator,
catchOptions = {
@@ -197,9 +202,12 @@
imageUrlRoot:imgURLRoot,
showMediaSelector: false,
showPublicPrivate: true,
- userId:'${user.email}',
- pagination:pagination,//Number of Annotations per load in the pagination,
- flags:is_staff
+ userId:userId,
+ pagination:pagination,//Number of Annotations per load in the pagination,
+ flags:is_staff,
+ default_tab: "${default_tab}",
+ instructor_username: "${instructor_username}",
+ annotation_mode: "${annotation_mode}",
},
Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
From b22643adc2084d5ef53c0a5b40126c581c778668 Mon Sep 17 00:00:00 2001
From: lduarte1991
Date: Tue, 3 Jun 2014 11:01:58 -0400
Subject: [PATCH 4/8] Image Annotation Tool: Annotation Mode for AB Testing
Annotation Tools PR Fixes
- forgot to overwrite the previous line
---
.../js/vendor/ova/OpenSeaDragonAnnotation.js | 27 ++++++++++---------
lms/templates/imageannotation.html | 18 ++++++++-----
lms/templates/textannotation.html | 8 +++---
lms/templates/videoannotation.html | 9 +++----
4 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js b/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js
index d8c2f595c0..4fbadc4f47 100644
--- a/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js
+++ b/common/static/js/vendor/ova/OpenSeaDragonAnnotation.js
@@ -380,19 +380,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
clickTimeThreshold: viewer.clickTimeThreshold,
clickDistThreshold: viewer.clickDistThreshold
});
-
- /* Set elements to the control menu */
- viewer.annotatorControl = viewer.wrapperAnnotation.element;
- if( viewer.toolbar ){
- viewer.toolbar.addControl(
- viewer.annotatorControl,
- {anchor: $.ControlAnchor.BOTTOM_RIGHT}
- );
- }else{
- viewer.addControl(
- viewer.annotatorControl,
- {anchor: $.ControlAnchor.TOP_LEFT}
- );
+ if(this.options.viewer.annotation_mode == "2" || this.options.viewer.flags){
+ /* Set elements to the control menu */
+ viewer.annotatorControl = viewer.wrapperAnnotation.element;
+ if( viewer.toolbar ){
+ viewer.toolbar.addControl(
+ viewer.annotatorControl,
+ {anchor: $.ControlAnchor.BOTTOM_RIGHT}
+ );
+ }else{
+ viewer.addControl(
+ viewer.annotatorControl,
+ {anchor: $.ControlAnchor.TOP_LEFT}
+ );
+ }
}
},
_reset: function(){
diff --git a/lms/templates/imageannotation.html b/lms/templates/imageannotation.html
index dce0304516..e938abee42 100644
--- a/lms/templates/imageannotation.html
+++ b/lms/templates/imageannotation.html
@@ -34,7 +34,7 @@
## Translators: Notes below refer to annotations. They wil later be put under a "Notes" section.
-
${_('You do not have any notes.')}
+
${_('Note: only instructors may annotate.')}
@@ -72,7 +72,7 @@
var unit_id = $('#sequence-list').find('.active').attr("data-element");
uri += unit_id;
var pagination = 100,
- is_staff = !('${user.is_staff}'=='False'),
+ is_staff = ('${user.email}'=='${instructor_username}'),
options = {
optionsAnnotator: {
permissions:{
@@ -172,6 +172,8 @@
},
optionsOpenSeadragon:{
id: "imageHolder",
+ annotation_mode: "${annotation_mode}",
+ flags: is_staff,
prefixUrl: "${settings.STATIC_URL}" + "js/vendor/ova/images/",
${openseadragonjson}
},
@@ -195,8 +197,8 @@
}
//Catch
- var annotator = osda.annotator,
- catchOptions = {
+ var annotator = osda.annotator;
+ var catchOptions = {
media:'image',
externalLink:false,
imageUrlRoot:imgURLRoot,
@@ -208,8 +210,10 @@
default_tab: "${default_tab}",
instructor_username: "${instructor_username}",
annotation_mode: "${annotation_mode}",
- },
- Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
-
+ };
+ if ("${annotation_mode}" == "2" || ("${annotation_mode}" == 1 && "${instructor_username}" != ""))
+ var Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
+ if ("${annotation_mode}" == 1 && "${instructor_username}" == "" && !is_staff)
+ osda.annotator.destroy();
}
\ No newline at end of file
diff --git a/lms/templates/textannotation.html b/lms/templates/textannotation.html
index 4a817cafd8..5a55410434 100644
--- a/lms/templates/textannotation.html
+++ b/lms/templates/textannotation.html
@@ -183,8 +183,8 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
}
//Catch
- var annotator = ova.annotator,
- catchOptions = {
+ var annotator = ova.annotator;
+ var catchOptions = {
media:'text',
externalLink:false,
imageUrlRoot:imgURLRoot,
@@ -196,6 +196,6 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
default_tab: "${default_tab}",
instructor_username: "${instructor_username}",
annotation_mode: "${annotation_mode}",
- },
- Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
+ };
+ var Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
diff --git a/lms/templates/videoannotation.html b/lms/templates/videoannotation.html
index 2259257d68..1ec4e18751 100644
--- a/lms/templates/videoannotation.html
+++ b/lms/templates/videoannotation.html
@@ -181,8 +181,8 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
}
//Catch
- var annotator = ova.annotator,
- catchOptions = {
+ var annotator = ova.annotator;
+ var catchOptions = {
media:'video',
externalLink:false,
imageUrlRoot:imgURLRoot,
@@ -190,11 +190,10 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
showPublicPrivate: true,
userId:userId,
pagination:pagination,//Number of Annotations per load in the pagination,
- flags:is_staff
flags:is_staff,
default_tab: "${default_tab}",
instructor_username: "${instructor_username}",
annotation_mode: "${annotation_mode}",
- },
- Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
+ };
+ var Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
From 68acf66f6ca78512bed981ec64da1b8d395d18f8 Mon Sep 17 00:00:00 2001
From: lduarte1991
Date: Thu, 5 Jun 2014 12:44:36 -0400
Subject: [PATCH 5/8] 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:
''+
'