Index: lams_central/web/includes/javascript/addLesson.js
===================================================================
diff -u -r6ad9d70c6f0a8834f64e481b6099497b41326120 -r1ea212824aed3f67314546966f021f788bf09fb8
--- lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 6ad9d70c6f0a8834f64e481b6099497b41326120)
+++ lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 1ea212824aed3f67314546966f021f788bf09fb8)
@@ -490,21 +490,29 @@
}
generatingLearningDesign = true;
+
// iframe just to load Authoring for a single purpose, generate the SVG
- $('').appendTo('body').css('visibility', 'hidden').load(function(){
+ var frame = $('').appendTo('body').css('visibility', 'hidden');
+ frame.load(function(){
+ // disable current onload handler as closing the dialog reloads the iframe
+ frame.off('load');
+
// call svgGenerator.jsp code to store LD SVG on the server
- var frame = $(this),
- win = frame[0].contentWindow || frame[0].contentDocument;
- // when LD opens, make a callback which save the thumbnail and displays it in current window
- win.GeneralLib.openLearningDesign(ldId, function(){
- result = win.GeneralLib.saveLearningDesignImage();
- frame.remove();
- if (result) {
- // load the image again
- loadLearningDesignSVG(ldId);
- }
+ var win = frame[0].contentWindow || frame[0].contentDocument;
+ $(win.document).ready(function(){
+ // when LD opens, make a callback which save the thumbnail and displays it in current window
+ win.GeneralLib.openLearningDesign(ldId, function(){
+ result = win.GeneralLib.saveLearningDesignImage();
+ frame.remove();
+ if (result) {
+ // load the image again
+ loadLearningDesignSVG(ldId);
+ }
+ });
});
- }).attr('src', LAMS_URL + 'authoring/generateSVG.do?selectable=false');
+ });
+ // load svgGenerator.jsp to render LD SVG
+ frame.attr('src', LAMS_URL + 'authoring/generateSVG.do?selectable=false');
}
});
Index: lams_monitoring/web/includes/javascript/monitorLesson.js
===================================================================
diff -u -ra5fe38ed6e104a6d05c1b7b4857cd4a9a1909dd8 -r1ea212824aed3f67314546966f021f788bf09fb8
--- lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision a5fe38ed6e104a6d05c1b7b4857cd4a9a1909dd8)
+++ lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision 1ea212824aed3f67314546966f021f788bf09fb8)
@@ -1238,22 +1238,29 @@
if (error.status != 404) {
return;
}
+
// iframe just to load Authoring for a single purpose, generate the SVG
- $('').appendTo('body').css('visibility', 'hidden').load(function(){
+ var frame = $('').appendTo('body').css('visibility', 'hidden');
+ frame.load(function(){
+ // disable current onload handler as closing the dialog reloads the iframe
+ frame.off('load');
+
// call svgGenerator.jsp code to store LD SVG on the server
- var frame = $(this),
- win = frame[0].contentWindow || frame[0].contentDocument;
- // when LD opens, make a callback which save the thumbnail and displays it in current window
- win.GeneralLib.openLearningDesign(ldId, function(){
- result = win.GeneralLib.saveLearningDesignImage();
- frame.remove();
- if (result) {
- // load the image again
- updateSequenceTab();
- }
+ var win = frame[0].contentWindow || frame[0].contentDocument;
+ $(win.document).ready(function(){
+ // when LD opens, make a callback which save the thumbnail and displays it in current window
+ win.GeneralLib.openLearningDesign(ldId, function(){
+ result = win.GeneralLib.saveLearningDesignImage();
+ frame.remove();
+ if (result) {
+ // load the image again
+ updateSequenceTab();
+ }
+ });
});
- }).attr('src', LAMS_URL + 'authoring/generateSVG.do?selectable=false');
-
+ });
+ // load svgGenerator.jsp to render LD SVG
+ frame.attr('src', LAMS_URL + 'authoring/generateSVG.do?selectable=false');
}
});