Index: lams_central/web/includes/javascript/addLesson.js
===================================================================
diff -u -r2708837c1330f2c5fd30195d17115eadc1264dca -r9091ed8c9bae9a48f88622c0c5031af2a39772dc
--- lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 2708837c1330f2c5fd30195d17115eadc1264dca)
+++ lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 9091ed8c9bae9a48f88622c0c5031af2a39772dc)
@@ -360,12 +360,19 @@
// copy CKEditor contents to textarea for submit
$('#introDescription').val(CKEDITOR.instances['introDescription'].getData());
+
+ //handle multiple lessons feature
+ if ($(".multiple-lessons:checked").length) {
+ //don't send main organisation's id to the server in case other multiple lessons are chosen
+ $("#organisation-id").prop("disabled", true);
+ }
submitInProgress = true;
$('#lessonForm').ajaxSubmit({
'success' : function(){
window.parent.closeDialog('dialogAddLesson', true);
- }});
+ }
+ });
}
function previewLesson(){
@@ -457,21 +464,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');
}
});