diff --git a/lms/envs/common.py b/lms/envs/common.py index c2fe202778..caaabc8b41 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1015,24 +1015,6 @@ main_vendor_js = base_vendor_js + [ 'js/vendor/jquery.qtip.min.js', 'js/vendor/swfobject/swfobject.js', 'js/vendor/jquery.ba-bbq.min.js', - 'js/vendor/ova/annotator-full.js', - 'js/vendor/ova/annotator-full-firebase-auth.js', - 'js/vendor/ova/video.dev.js', - 'js/vendor/ova/vjs.youtube.js', - 'js/vendor/ova/rangeslider.js', - 'js/vendor/ova/share-annotator.js', - 'js/vendor/ova/richText-annotator.js', - 'js/vendor/ova/reply-annotator.js', - 'js/vendor/ova/tags-annotator.js', - 'js/vendor/ova/flagging-annotator.js', - 'js/vendor/ova/diacritic-annotator.js', - 'js/vendor/ova/grouping-annotator.js', - 'js/vendor/ova/jquery-Watch.js', - 'js/vendor/ova/openseadragon.js', - 'js/vendor/ova/OpenSeaDragonAnnotation.js', - 'js/vendor/ova/ova.js', - 'js/vendor/ova/catch/js/catch.js', - 'js/vendor/ova/catch/js/handlebars-1.1.2.js', 'js/vendor/URI.min.js', ] diff --git a/lms/static/require-config-lms.js b/lms/static/require-config-lms.js new file mode 100644 index 0000000000..dc078d28f9 --- /dev/null +++ b/lms/static/require-config-lms.js @@ -0,0 +1,107 @@ +;(function (require, define, _) { + var paths = {}, config; + + // URI, tinymce, or jquery.tinymce may already have been loaded before the OVA templates and we do not want to load + // them a second time. Check if it is the case and use the global var in requireJS config. + if (window.URI) { + define("URI", [], function() {return window.URI;}); + } else { + paths.URI = "js/vendor/URI.min"; + } + if (window.tinymce) { + define('tinymce', [], function() {return window.tinymce;}); + } else { + paths.tinymce = "js/vendor/tinymce/js/tinymce/tinymce.full.min"; + } + if (window.jquery && window.jquery.tinymce) { + define("jquery.tinymce", [], function() {return window.jquery.tinymce;}); + } else { + paths.tinymce = "js/vendor/tinymce/js/tinymce/jquery.tinymce.min"; + } + + config = { + // NOTE: baseUrl has been previously set in lms/templates/main.html + waitSeconds: 60, + paths: { + // Files only needed for OVA + "annotator": "js/vendor/ova/annotator-full", + "annotator-harvardx": "js/vendor/ova/annotator-full-firebase-auth", + "video.dev": "js/vendor/ova/video.dev", + "vjs.youtube": 'js/vendor/ova/vjs.youtube', + "rangeslider": 'js/vendor/ova/rangeslider', + "share-annotator": 'js/vendor/ova/share-annotator', + "richText-annotator": 'js/vendor/ova/richText-annotator', + "reply-annotator": 'js/vendor/ova/reply-annotator', + "grouping-annotator": 'js/vendor/ova/grouping-annotator', + "tags-annotator": 'js/vendor/ova/tags-annotator', + "diacritic-annotator": 'js/vendor/ova/diacritic-annotator', + "flagging-annotator": 'js/vendor/ova/flagging-annotator', + "jquery-Watch": 'js/vendor/ova/jquery-Watch', + "openseadragon": 'js/vendor/ova/openseadragon', + "osda": 'js/vendor/ova/OpenSeaDragonAnnotation', + "ova": 'js/vendor/ova/ova', + "catch": 'js/vendor/ova/catch/js/catch', + "handlebars": 'js/vendor/ova/catch/js/handlebars-1.1.2', + // end of files only needed for OVA + }, + shim: { + // The following are all needed for OVA + "video.dev": { + exports:"videojs" + }, + "vjs.youtube": { + deps: ["video.dev"] + }, + "rangeslider": { + deps: ["video.dev"] + }, + "annotator": { + exports: "Annotator" + }, + "annotator-harvardx":{ + deps: ["annotator"] + }, + "share-annotator": { + deps: ["annotator"] + }, + "richText-annotator": { + deps: ["annotator", "tinymce"] + }, + "reply-annotator": { + deps: ["annotator"] + }, + "tags-annotator": { + deps: ["annotator"] + }, + "diacritic-annotator": { + deps: ["annotator"] + }, + "flagging-annotator": { + deps: ["annotator"] + }, + "grouping-annotator": { + deps: ["annotator"] + }, + "ova": { + exports: "ova", + deps: [ + "annotator", "annotator-harvardx", "video.dev", "vjs.youtube", "rangeslider", "share-annotator", + "richText-annotator", "reply-annotator", "tags-annotator", "flagging-annotator", + "grouping-annotator", "diacritic-annotator", "jquery-Watch", "catch", "handlebars", "URI" + ] + }, + "osda": { + exports: "osda", + deps: [ + "annotator", "annotator-harvardx", "video.dev", "vjs.youtube", "rangeslider", "share-annotator", + "richText-annotator", "reply-annotator", "tags-annotator", "flagging-annotator", + "grouping-annotator", "diacritic-annotator", "openseadragon", "jquery-Watch", "catch", "handlebars", + "URI" + ] + }, + // End of OVA + } + }; + _.extend(config.paths, paths); + require.config(config); +}).call(this, require || RequireJS.require, define || RequireJS.define, _); diff --git a/lms/templates/imageannotation.html b/lms/templates/imageannotation.html index 84f1f70216..d54b1ae886 100644 --- a/lms/templates/imageannotation.html +++ b/lms/templates/imageannotation.html @@ -41,7 +41,9 @@ \ No newline at end of file +}).call(this, require || RequireJS.require); + diff --git a/lms/templates/main.html b/lms/templates/main.html index 3dd96b1bec..da8d683f6d 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -6,6 +6,7 @@ <% # set doc language direction from django.utils.translation import get_language_bidi + from dealer.git import git dir_rtl = 'rtl' if get_language_bidi() else 'ltr' %> @@ -73,6 +74,23 @@ <%static:js group='main_vendor'/> % endif + + + <%block name="headextra"/> <% diff --git a/lms/templates/notes.html b/lms/templates/notes.html index fcdca788e9..34b4da61b9 100644 --- a/lms/templates/notes.html +++ b/lms/templates/notes.html @@ -4,8 +4,6 @@ ${static.css(group='style-vendor-tinymce-content', raw=True)} ${static.css(group='style-vendor-tinymce-skin', raw=True)} ${static.css(group='style-xmodule-annotations', raw=True)} - - <%inherit file="main.html" /> <%! from django.core.urlresolvers import reverse @@ -70,7 +68,9 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
${_('You do not have any notes.')}
diff --git a/lms/templates/textannotation.html b/lms/templates/textannotation.html index 15019d1767..3c34959370 100644 --- a/lms/templates/textannotation.html +++ b/lms/templates/textannotation.html @@ -32,8 +32,10 @@ ${static.css(group='style-xmodule-annotations', raw=True)} - diff --git a/lms/templates/videoannotation.html b/lms/templates/videoannotation.html index 76c70ef677..00d7d848cb 100644 --- a/lms/templates/videoannotation.html +++ b/lms/templates/videoannotation.html @@ -36,8 +36,10 @@ ${static.css(group='style-xmodule-annotations', raw=True)}