From 8429897c82c0a3992b499bf64729feb08cb03839 Mon Sep 17 00:00:00 2001 From: lduarte1991 Date: Mon, 2 Jun 2014 23:22:26 -0400 Subject: [PATCH] Text Annotation Tool: Added Instructor Filter and Clear Search --- .../xmodule/xmodule/textannotation_module.py | 21 +++++ .../static/js/vendor/ova/catch/css/main.css | 20 +++-- common/static/js/vendor/ova/catch/js/catch.js | 84 +++++++++++++++---- lms/templates/textannotation.html | 14 +++- 4 files changed, 116 insertions(+), 23 deletions(-) diff --git a/common/lib/xmodule/xmodule/textannotation_module.py b/common/lib/xmodule/xmodule/textannotation_module.py index fe36d917d3..7d47ef87fa 100644 --- a/common/lib/xmodule/xmodule/textannotation_module.py +++ b/common/lib/xmodule/xmodule/textannotation_module.py @@ -65,6 +65,24 @@ class AnnotatableFields(object): scope=Scope.settings, default='', ) + 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 TextAnnotationModule(AnnotatableFields, XModule): @@ -101,6 +119,9 @@ class TextAnnotationModule(AnnotatableFields, XModule): 'annotation_storage': self.annotation_storage_url, 'token': retrieve_token(self.user_email, self.annotation_token_secret), 'diacritic_marks': self.diacritics, + 'default_tab': self.default_tab, + 'instructor_username': self.instructor_username, + 'annotation_mode': self.annotation_mode, } fragment = Fragment(self.system.render_template('textannotation.html', context)) fragment.add_javascript_url("/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js") diff --git a/common/static/js/vendor/ova/catch/css/main.css b/common/static/js/vendor/ova/catch/css/main.css index b79bd80e0a..5f5406c560 100644 --- a/common/static/js/vendor/ova/catch/css/main.css +++ b/common/static/js/vendor/ova/catch/css/main.css @@ -379,14 +379,14 @@ display:inline-block; color:#302f2f; font-family:arial; - font-size:15px; + font-size:14px; font-weight:bold; padding:6px 24px; text-decoration:none; margin: 0px 0px 10px 0px; cursor:pointer; - width:140px; + width:115px; text-align:center; } @@ -468,7 +468,7 @@ #mainCatch .searchbox input{ margin: 0; padding: 0; - width: 60%; + width: 50%; margin-left: 10px; display: inline; float: left; @@ -493,19 +493,28 @@ cursor:pointer; } +#mainCatch .searchbox .clear-search-icon{ + font-size: 12px; + text-decoration: underline; + float: right; + margin-top: 10px; + padding-right: 3px; + cursor:pointer; +} + #mainCatch .searchbox .search-icon:hover{ opacity:0.5; box-shadow: 2px 4px 5px #888888; } #mainCatch .selectors{ - width:40%; + width:45%; position:relative; float:left; } #mainCatch .searchbox{ - width:60%; + width:52%; position:relative; float:right; } @@ -515,6 +524,7 @@ position:relative; padding-right:5px; margin-top:8px; + font-size:14px; } #mainCatch .replies .replyItem .deleteReply{ diff --git a/common/static/js/vendor/ova/catch/js/catch.js b/common/static/js/vendor/ova/catch/js/catch.js index 442873659f..950966fb07 100644 --- a/common/static/js/vendor/ova/catch/js/catch.js +++ b/common/static/js/vendor/ova/catch/js/catch.js @@ -76,6 +76,17 @@ annotationList: '
More
'+ '', +//Main->PublicPrivateInstructor +annotationPublicPrivateInstructor: + '
My NotesmyNotes
'+ + '
Instructorinstructor
'+ + '
Publicpublic
'+ + '', + //Main->PublicPrivate annotationPublicPrivate: '
My NotesmyNotes
'+ @@ -84,7 +95,7 @@ annotationPublicPrivate: ''+ ''+ ''+ - '
', + '
Clear
', //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