From c9e51b9956f80b6a23af501e01d2df1603d7c92c Mon Sep 17 00:00:00 2001 From: lduarte1991 Date: Tue, 22 Jul 2014 11:12:40 -0400 Subject: [PATCH] Annotation Tools: Adding Loading Bar to Annotations Table - added label below loading gif - fixed spacing issues - change the error messages in annotator code --- common/static/js/vendor/ova/annotator-full.js | 12 +- .../static/js/vendor/ova/catch/css/main.css | 7 +- .../js/vendor/ova/catch/img/loading_bar.gif | Bin 0 -> 10819 bytes common/static/js/vendor/ova/catch/js/catch.js | 195 +++++++++--------- 4 files changed, 111 insertions(+), 103 deletions(-) create mode 100644 common/static/js/vendor/ova/catch/img/loading_bar.gif diff --git a/common/static/js/vendor/ova/annotator-full.js b/common/static/js/vendor/ova/annotator-full.js index 156b14e212..0b85c3dc68 100644 --- a/common/static/js/vendor/ova/annotator-full.js +++ b/common/static/js/vendor/ova/annotator-full.js @@ -2506,21 +2506,21 @@ Annotator.Plugin.Store = (function(_super) { Store.prototype._onError = function(xhr) { var action, message; action = xhr._action; - message = Annotator._t("Sorry we could not ") + action + Annotator._t(" this annotation"); + message = Annotator._t("Sorry, our server seems to be down. We could not ") + action + Annotator._t(" this annotation"); if (xhr._action === 'search') { - message = Annotator._t("Sorry we could not search the store for annotations"); + message = Annotator._t("Sorry, the Annotations service is down. Contact your instructor and try again later."); } else if (xhr._action === 'read' && !xhr._id) { - message = Annotator._t("Sorry we could not ") + action + Annotator._t(" the annotations from the store"); + message = Annotator._t("Sorry, our server seems to be down. We could not ") + action + Annotator._t(" the annotation(s)."); } switch (xhr.status) { case 401: - message = Annotator._t("Sorry you are not allowed to ") + action + Annotator._t(" this annotation"); + message = Annotator._t("Sorry, you are not allowed to ") + action + Annotator._t(" this annotation"); break; case 404: - message = Annotator._t("Sorry we could not connect to the annotations store"); + message = Annotator._t("Sorry, we could not connect to the annotations database."); break; case 500: - message = Annotator._t("Sorry something went wrong with the annotation store"); + message = Annotator._t("Sorry, our server is down. Contact your instructor and try again later."); } Annotator.showNotification(message, Annotator.Notification.ERROR); return console.error(Annotator._t("API request failed:") + (" '" + xhr.status + "'")); diff --git a/common/static/js/vendor/ova/catch/css/main.css b/common/static/js/vendor/ova/catch/css/main.css index 5f5406c560..331e171fa2 100644 --- a/common/static/js/vendor/ova/catch/css/main.css +++ b/common/static/js/vendor/ova/catch/css/main.css @@ -530,4 +530,9 @@ #mainCatch .replies .replyItem .deleteReply{ text-decoration: underline; cursor: pointer; -} \ No newline at end of file +} + +#mainCatch div.annotations-loading-gif{ + width:100%; + text-align:center; +} diff --git a/common/static/js/vendor/ova/catch/img/loading_bar.gif b/common/static/js/vendor/ova/catch/img/loading_bar.gif new file mode 100644 index 0000000000000000000000000000000000000000..dd936613b10e68982cc58d922ea8600785ab24dd GIT binary patch literal 10819 zcmb`NXHZjX->;L91QJksO+b()O%YU3Q9(BX7GztHZs?&V^w84?z4y?2Z;DjK08*t% z?}T0j#6q!fa6j+!o-^n3&di$0hc&a-tXcQ9uHWx}YiQk7zG^xR-~@aH0A^-p002N< zUS3pGRA69WW@aXpN-ZxhZ)|KVE-tRCt9$qET}w+#dwY9wa&k^iPFGh~Z*Ol!MaAIY z;PCM9t5>f^M@LIbORKA^`}_MF8X5`<3u9wr$HvA&Lqmx~qR26`w))d2chq#$70$~u z08cI^@>}4Jv!$u4rG>DEjVoH%)YcSdk1@44Z{ui%0f-!eVepf)WKRyjpPK|gj)jFI zENs%z#pU*!O<37}SBE)V`Hs)dF)b6T31)(lbDg{FuVoAry51`@s2DGGzs6P#hLBo! z&yg5YtGuRX>gGDWQh#ZV?;z@NJLttvXdiDse=i~#N3jd?2qC%od%8qMBM3xj7(OC7 zDj?PsWd$*jF}C2~=7Ynt%Rz`-fmckgnGhCO$CouVu=<8KZ)<7TmbdR38d+OkcXf9( zwKep<@2=|U?QfoFoob)y9I9;LD`H}h1w&zQW|mWI%n-(+?;O0WpV@x?{PJyocYSj# zl2CwWfOTKTT@X_I|tHRiQEwF_k05jcm4Ul_!{w5&1(h;avmFz0}1$Rz-^{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LBz z*Tj(I*!Unjn+&grqND<^z+gNE$sfs$y(7K- zUdh9wz3;MO8$i=DP}1D|BGc?3taH8XV;F>Wef;yMFFVU~o`;Lyw|+Vq^1{#Du;UZk z5}*+Q@(^Y|;Xjk&woneCOaDxG7#TT?dTOdfJ0dy$I?k`gspV)zu&A27S=$ruj)!qr z$=WF7cV@s0_qNtt#Co$NKZmgx3@vqp-1TT8(-m3oW<4?Qt5!y%Nl*biJNld|kRgJ^ zhEmN`RU7yx>3&-mS_I zo@E2!@@=L0Sy(EwwtX#WX^8Jb#cilvE%h@jgu0c+%@&AQeW_BcagL5T}fKy zweJV7-euU`xUzgS)wVkNM^k_d?5dT7WAjh1#c3|Smb&RAw(c<=MXnZ&DdJ&O9u3N` z*Dj(cL@X3}!EBbvV#jJ=m1QMFErXT?g$~NrT(vS{JK62igheli5o9^g~#DGg7FIOM^cIER0qmhChmNq<>jDusprW8D#1hoGgCsc z4eY6^n2(_RZuaG~hnl%XebENCu0no+vxT2$mU(bF<#4<3+IDpr*EnBEV03*`x1Avm zyJ2p5NdQmr%l9w4bxAGfHf4@WvP5LmumfgOVfm6v5_*szhf&?gawopcdWCWxM5Clo zu;81U-Paw$&YCD^h1>Den|c;}{;?UoawVv|!d0u%EF5vLu@lLw@J1p63G&&FVm&Fe zm>J%GrOB5-^2eRUBrT}Wv#sjJMlbqO#+={Pu;^J1$%W{XQcr0Z-`?rwnayC-M4wL# zd09%eA?j-(6ErgJUg~d;x?B~t&z;?rpPYf0!p;1?Y~=1wAFdlhyS#&|D!4Y!3s 0){ - for(var len=item.tags.length, index = len-1; index >= 0; --index){ + if (!this.options.flags && typeof item.tags !== 'undefined' && item.tags.length > 0) { + for (var len = item.tags.length, index = len-1; index >= 0; --index) { var currTag = item.tags[index]; - if(currTag.indexOf("flagged-") !== -1){ - + if (currTag.indexOf("flagged-") !== -1) { item.tags.splice(index); } } @@ -789,60 +789,62 @@ CatchAnnotation.prototype = { }, _closeAnnotationItem: function(evt) { var existEvent = typeof evt.target !== 'undefined' && typeof evt.target.localName !== 'undefined'; - if(existEvent && evt.target.parentNode.className !== 'geolocationIcon'){ + if (existEvent && evt.target.parentNode.className !== 'geolocationIcon') { this._openAnnotationItem(evt); } }, _onGeolocationClick: function(evt) { var latitude = $(evt.target).parent().find('.latitude').html(); var longitude = $(evt.target).parent().find('.longitude').html(); - var imgSrc = ''; + var imgSrc = ''; $(evt.target).parents('.detailHeader:first').find('#myLocationMap .map').html(imgSrc); }, _onPlaySelectionClick: function(evt) { var id = $(evt.target).find('.idAnnotation').html(); var uri = $(evt.target).find('.uri').html(); var container = $(evt.target).find('.container').html(); - if(this.options.externalLink){ - uri += (uri.indexOf('?') >= 0)?'&ovaId='+id:'?ovaId='+id; + if (this.options.externalLink) { + uri += (uri.indexOf('?') >= 0) ? '&ovaId=' + id : '?ovaId=' + id; location.href = uri; - }else{ - var isContainer = typeof this.annotator.an !== 'undefined' && typeof this.annotator.an[container] !== 'undefined', - ovaInstance = isContainer? this.annotator.an[container]:null; - if(ovaInstance !== null){ + } else { + var isContainer = typeof this.annotator.an !== 'undefined' && typeof this.annotator.an[container] !== 'undefined'; + var ovaInstance = isContainer ? this.annotator.an[container] : null; + if (ovaInstance !== null) { var allannotations = this.annotator.plugins['Store'].annotations, ovaId = id, player = ovaInstance.player; for (var item in allannotations) { var an = allannotations[item]; - if (typeof an.id !== 'undefined' && an.id === ovaId) { //this is the annotation - if (this._isVideoJS(an)) { //It is a video - if (player.id_ === an.target.container && player.tech.options_.source.src === an.target.src){ + if (typeof an.id !== 'undefined' && an.id === ovaId) { // this is the annotation + if (this._isVideoJS(an)) { // It is a video + if (player.id_ === an.target.container && player.tech.options_.source.src === an.target.src) { var anFound = an; var playFunction = function(){ // Fix problem with youtube videos in the first play. The plugin don't have this trigger - if (player.techName === 'Youtube'){ - var startAPI = function(){ + if (player.techName === 'Youtube') { + var startAPI = function() { + ovaInstance.showAnnotation(anFound); } if (ovaInstance.loaded) startAPI(); else player.one('loadedRangeSlider', startAPI); // show Annotations once the RangeSlider is loaded - }else{ + } else { + ovaInstance.showAnnotation(anFound); } $('html, body').animate({ - scrollTop: $("#"+player.id_).offset().top}, + scrollTop: $("#" + player.id_).offset().top}, 'slow'); }; if (player.paused()) { player.play(); player.one('playing', playFunction); - }else{ + } else { playFunction(); } @@ -862,11 +864,11 @@ CatchAnnotation.prototype = { var allannotations = this.annotator.plugins['Store'].annotations; var osda = this.annotator.osda; - if(this.options.externalLink){ - uri += (uri.indexOf('?') >= 0)?'&osdaId='+osdaId:'?osdaId='+osdaId; + if (this.options.externalLink) { + uri += (uri.indexOf('?') >= 0) ?'&osdaId=' + osdaId : '?osdaId=' + osdaId; location.href = uri; } - for(var item in allannotations){ + for(var item in allannotations) { var an = allannotations[item]; // Makes sure that all images are set to transparent in case one was // previously selected. @@ -883,7 +885,7 @@ CatchAnnotation.prototype = { } } }, - _onQuoteMediaButton: function(evt){ + _onQuoteMediaButton: function(evt) { var quote = $(evt.target).hasClass('quote')?$(evt.target):$(evt.target).parents('.quote:first'); var id = quote.find('.idAnnotation').html(); var uri = quote.find('.uri').html(); @@ -893,22 +895,22 @@ CatchAnnotation.prototype = { id = quote.find('.idAnnotation').html(); // clickPlaySelection(evt); } - if(this.options.externalLink){ + if (this.options.externalLink) { uri += (uri.indexOf('?') >= 0)?'&ovaId='+id:'?ovaId='+id; location.href = uri; - }else{ + } else { var allannotations = this.annotator.plugins['Store'].annotations; var ovaId = id; for (var item in allannotations) { var an = allannotations[item]; - if (typeof an.id !== 'undefined' && an.id === ovaId){ // this is the annotation - if(!this._isVideoJS(an)){ + if (typeof an.id !== 'undefined' && an.id === ovaId) { // this is the annotation + if(!this._isVideoJS(an)) { var hasRanges = typeof an.ranges !== 'undefined' && typeof an.ranges[0] !== 'undefined', startOffset = hasRanges?an.ranges[0].startOffset:'', endOffset = hasRanges?an.ranges[0].endOffset:''; - if(typeof startOffset !== 'undefined' && typeof endOffset !== 'undefined'){ + if (typeof startOffset !== 'undefined' && typeof endOffset !== 'undefined') { $(an.highlights).parent().find('.annotator-hl').removeClass('api'); // change the color @@ -923,7 +925,7 @@ CatchAnnotation.prototype = { } } }, - _refreshReplies: function(evt){ + _refreshReplies: function(evt) { var item = $(evt.target).parents('.annotationItem:first'); var anId = item.attr('annotationId'); @@ -937,7 +939,7 @@ CatchAnnotation.prototype = { parentid:anId, uri:loadFromSearchURI, }; - var onSuccess=function(data){ + var onSuccess=function(data) { if (data === null) data = {}; annotations = data.rows || []; var _i, _len; @@ -949,17 +951,16 @@ CatchAnnotation.prototype = { annotations: annotations })); var replyItems = $('.replies .replyItem'); - if(typeof replyItems !== 'undefined' && replyItems.length > 0){ - annotations.forEach(function(ann){ - replyItems.each(function(item){ + if (typeof replyItems !== 'undefined' && replyItems.length > 0) { + annotations.forEach(function(ann) { + replyItems.each(function(item) { var id = $(replyItems[item]).attr('annotationid'); - if(id === ann.id){ + if (id === ann.id) { var perm = self.annotator.plugins.Permissions; - if(!perm.options.userAuthorize('delete', ann, perm.user)){ + if (!perm.options.userAuthorize('delete', ann, perm.user)) { $(replyItems[item]).find('.deleteReply').remove(); - }else{ + } else { $(replyItems[item]).data('annotation', ann); - } } }); @@ -975,10 +976,10 @@ CatchAnnotation.prototype = { request._id = id; request._action = action; }, - _onControlRepliesClick: function(evt){ + _onControlRepliesClick: function(evt) { var action = $(evt.target)[0].className; - if(action === 'newReply'){ + if (action === 'newReply') { var item = $(evt.target).parents('.annotationItem:first'); var id = item.attr('annotationId'); // Pre-show Adder @@ -1012,12 +1013,12 @@ CatchAnnotation.prototype = { parentValue.html(id); var self = this; - }else if(action === 'hideReplies'){ + } else if (action === 'hideReplies') { var oldAction = $(evt.target).html(); if (oldAction === 'Show Replies'){ $(evt.target).html('Hide Replies'); - }else{ + } else { $(evt.target).html('Show Replies'); var replyElem = $(evt.target).parents('.annotationItem:first').find('.replies'); replyElem.html(''); @@ -1026,8 +1027,8 @@ CatchAnnotation.prototype = { // search this._refreshReplies(evt); - }else if(action === 'deleteAnnotation'){ - if(confirm("Would you like to delete the annotation?")){ + } else if (action === 'deleteAnnotation') { + if (confirm("Would you like to delete the annotation?")) { var annotator = this.annotator; var item = $(evt.target).parents('.annotationItem:first'); var id = item.attr('annotationId'); @@ -1035,15 +1036,15 @@ CatchAnnotation.prototype = { var annotations = store.annotations; var permissions = annotator.plugins.Permissions; var annotation; - annotations.forEach(function(ann){ - if(ann.id === id) + annotations.forEach(function(ann) { + if (ann.id === id) annotation = ann; }); var authorized = permissions.options.userAuthorize('delete', annotation, permissions.user); - if(authorized) + if (authorized) annotator.deleteAnnotation(annotation); } - }else if(action === 'editAnnotation'){ + } else if (action === 'editAnnotation') { var annotator = this.annotator; var item = $(evt.target).parents('.annotationItem:first'); @@ -1052,12 +1053,12 @@ CatchAnnotation.prototype = { var annotations = store.annotations; var permissions = annotator.plugins.Permissions; var annotation; - annotations.forEach(function(ann){ - if(ann.id === id) + annotations.forEach(function(ann) { + if (ann.id === id) annotation = ann; }); var authorized = permissions.options.userAuthorize('update', annotation, permissions.user); - if(authorized){ + if (authorized){ // Get elements var wrapper = $('.annotator-wrapper'); // Calculate Editor position @@ -1087,19 +1088,18 @@ CatchAnnotation.prototype = { }, _onShareControlsClick: function(evt) { var action = $(evt.target)[0].className; - if(action === 'privacy_button'){ + if (action === 'privacy_button') { - }else if(action === 'groups_button'){ + } else if (action === 'groups_button') { alert("Coming soon..."); - }else if(action === 'reply_button'){ + } else if (action === 'reply_button') { var item = $(evt.target).parents('.annotationItem:first'), id = item.attr('annotationId'); // New annotation var an = this.annotator.setupAnnotation(this.annotator.createAnnotation()); an.text="010"; an.parent = id; - }else if(action === 'share_button'){ - + } else if (action === 'share_button') { } }, @@ -1133,7 +1133,7 @@ CatchAnnotation.prototype = { // Change userid and refresh this.changeUserId(userId); }, - _onSelectionButtonClick: function(evt){ + _onSelectionButtonClick: function(evt) { var but = $(evt.target); var action = but.attr('media'); @@ -1144,7 +1144,7 @@ CatchAnnotation.prototype = { // Change media and refresh this.changeMedia(action); }, - _onMoreButtonClick: function(evt){ + _onMoreButtonClick: function(evt) { this.clean = false; var moreBut = this.element.find('.annotationListButtons .moreButtonCatch'); var isLoading = moreBut.html() === 'More'?false:true; @@ -1152,7 +1152,7 @@ CatchAnnotation.prototype = { this.loadAnnotations(); }, - _refresh:function(searchtype, searchInput){ + _refresh:function(searchtype, searchInput) { var searchtype = searchtype || ""; var searchInput = searchInput || ""; this.clean = true; @@ -1170,26 +1170,26 @@ CatchAnnotation.prototype = { loadFromSearch.tag = ""; loadFromSearch.text = ""; - if (searchtype === "Users"){ + if (searchtype === "Users") { loadFromSearch.username = searchInput; - } else if(searchtype === "Tags"){ + } else if(searchtype === "Tags") { loadFromSearch.tag = searchInput; - } else{ + } else { loadFromSearch.text = searchInput; } annotator.plugins['Store'].loadAnnotationsFromSearch(loadFromSearch); }, - _onSearchButtonClick: function(evt){ + _onSearchButtonClick: function(evt) { var searchtype = this.element.find('.searchbox .dropdown-list').val(); var searchInput = this.element.find('.searchbox input').val(); this._refresh(searchtype, searchInput); }, - _onClearSearchButtonClick: function(evt){ + _onClearSearchButtonClick: function(evt) { this._refresh('', ''); }, - _clearAnnotator: function(){ + _clearAnnotator: function() { var annotator = this.annotator; var store = annotator.plugins.Store; var annotations = store.annotations.slice(); @@ -1210,7 +1210,7 @@ CatchAnnotation.prototype = { store.unregisterAnnotation(ann); }); }, - _onDeleteReplyButtonClick : function(evt){ + _onDeleteReplyButtonClick : function(evt) { var annotator = this.annotator; var item = $(evt.target).parents('.replyItem:first'); var id = item.attr('annotationid'); @@ -1223,5 +1223,8 @@ CatchAnnotation.prototype = { item.remove(); } } - } + }, + openLoadingGIF: function() { + $('#mainCatch').append('

Annotations Data Loading... Please Wait.
'); + }, }