Annotation Tools: Adding try-catch in case Annotator is missing from LMS

This commit is contained in:
lduarte1991
2014-08-13 22:05:42 -04:00
parent 8cfdb8f14c
commit 76b8891b69
3 changed files with 24 additions and 9 deletions

View File

@@ -221,11 +221,17 @@
if ("${annotation_mode}" == "instructor" && "${instructor_email}" == "" && !is_staff)
osda.annotator.destroy();
}
// if the following is true, template is being rendered in LMS, otherwise it is in Studio
if (typeof Annotator !== 'undefined') {
startosda();
} else {
require(["osda"], function(osda){
startosda();
});
try {
require(["osda"], function(osda){
startosda();
});
} catch(error) {
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
}
}
</script>

View File

@@ -204,11 +204,16 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
}
// if the following is true, template is being rendered in LMS, otherwise it is in Studio
if (typeof Annotator !== 'undefined') {
startova();
} else {
require(["ova"], function(ova){
startova();
});
try {
require(["ova"], function(ova) {
startova();
});
} catch(error) {
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
}
}
</script>

View File

@@ -201,8 +201,12 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
if (typeof Annotator !== 'undefined') {
startova();
} else {
require(["ova"], function(ova){
startova();
});
try {
require(["ova"], function(ova) {
startova();
});
} catch(error) {
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
}
}
</script>