Index: lams_central/web/authoring/authoring.jsp =================================================================== diff -u -r365d015a0a78d8a4cceed841e5c5f660369887ad -r23d1ca610a1da0f865b7d3683bce41f8dd72d82d --- lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 365d015a0a78d8a4cceed841e5c5f660369887ad) +++ lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 23d1ca610a1da0f865b7d3683bce41f8dd72d82d) @@ -108,8 +108,6 @@ SEQUENCE_VALIDATION_ISSUES : '', SAVE_SUCCESSFUL : decoderDiv.html('').text(), - - NAVIGATE_AWAY_CONFIRM : decoderDiv.html('').text(), DELETE_NODE_CONFIRM : decoderDiv.html('').text(), Index: lams_central/web/includes/javascript/authoring/authoringActivity.js =================================================================== diff -u -r365d015a0a78d8a4cceed841e5c5f660369887ad -r23d1ca610a1da0f865b7d3683bce41f8dd72d82d --- lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 365d015a0a78d8a4cceed841e5c5f660369887ad) +++ lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 23d1ca610a1da0f865b7d3683bce41f8dd72d82d) @@ -1170,7 +1170,19 @@ 'height' : 800, 'width' : 1024, 'resizable' : true, - 'title' : activity.title + LABELS.ACTIVITY_DIALOG_TITLE_SUFFIX, + 'title' : activity.title + ' ' + LABELS.ACTIVITY_DIALOG_TITLE_SUFFIX, + 'beforeClose' : function(event){ + // ask the user if he really wants to exit before saving his work + var iframe = $('iframe', this); + // if X button was clicked, currentTarget is set + // if it is not the last Re-Edit/Close page, doCancel() exists + if (event.currentTarget && iframe[0].contentWindow.doCancel) { + iframe[0].contentWindow.doCancel(); + return false; + } else { + iframe.attr('src', null); + } + }, 'open' : function() { var dialog = $(this); // load contents after opening the dialog Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js =================================================================== diff -u -r365d015a0a78d8a4cceed841e5c5f660369887ad -r23d1ca610a1da0f865b7d3683bce41f8dd72d82d --- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 365d015a0a78d8a4cceed841e5c5f660369887ad) +++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 23d1ca610a1da0f865b7d3683bce41f8dd72d82d) @@ -1038,16 +1038,6 @@ win.focus(); } }); - - window.onbeforeunload = function(){ - if (layout.modified && - (layout.activities.length > 0 - || layout.regions.length > 0 - || layout.labels.length > 0 - || layout.floatingActivity)) { - return LABELS.NAVIGATE_AWAY_CONFIRM; - } - }; } }, @@ -1356,6 +1346,14 @@ }, + canClose : function(){ + return !(layout.modified && + (layout.activities.length > 0 + || layout.regions.length > 0 + || layout.labels.length > 0 + || layout.floatingActivity)); + }, + /** * Escapes HTML tags to prevent XSS injection. */ Index: lams_central/web/includes/javascript/dialog.js =================================================================== diff -u -r365d015a0a78d8a4cceed841e5c5f660369887ad -r23d1ca610a1da0f865b7d3683bce41f8dd72d82d --- lams_central/web/includes/javascript/dialog.js (.../dialog.js) (revision 365d015a0a78d8a4cceed841e5c5f660369887ad) +++ lams_central/web/includes/javascript/dialog.js (.../dialog.js) (revision 23d1ca610a1da0f865b7d3683bce41f8dd72d82d) @@ -37,7 +37,7 @@ "closable" : true, "maximizable" : true, "minimizable" : true, - "collapsable" : true, + "collapsable" : false, "dblclick" : "collapse", "minimizeLocation" : "right", "icons" : { Index: lams_central/web/includes/javascript/groupDisplay.js =================================================================== diff -u -r365d015a0a78d8a4cceed841e5c5f660369887ad -r23d1ca610a1da0f865b7d3683bce41f8dd72d82d --- lams_central/web/includes/javascript/groupDisplay.js (.../groupDisplay.js) (revision 365d015a0a78d8a4cceed841e5c5f660369887ad) +++ lams_central/web/includes/javascript/groupDisplay.js (.../groupDisplay.js) (revision 23d1ca610a1da0f865b7d3683bce41f8dd72d82d) @@ -233,6 +233,7 @@ 'height' : 600, 'width' : 850, 'modal' : true, + 'resizable' : true, 'title' : LABELS.SINGLE_ACTIVITY_LESSON_TITLE, 'open' : function() { var dialog = $(this), @@ -263,7 +264,7 @@ } }); } - }); + }, true); } @@ -382,6 +383,15 @@ 'width' : 1280, 'resizable' : true, 'title' : 'Authoring', + 'beforeClose' : function(){ + // if LD was modified, ask the user if he really wants to exit + var canClose = $('iframe', this)[0].contentWindow.GeneralLib.canClose(); + if (canClose || confirm(LABELS.NAVIGATE_AWAY_CONFIRM)) { + $('iframe', this).attr('src', null); + } else { + return false; + } + }, 'open' : function() { var orgID = $(this).dialog('option', 'orgID'); // load contents after opening the dialog Index: lams_central/web/main.jsp =================================================================== diff -u -r365d015a0a78d8a4cceed841e5c5f660369887ad -r23d1ca610a1da0f865b7d3683bce41f8dd72d82d --- lams_central/web/main.jsp (.../main.jsp) (revision 365d015a0a78d8a4cceed841e5c5f660369887ad) +++ lams_central/web/main.jsp (.../main.jsp) (revision 23d1ca610a1da0f865b7d3683bce41f8dd72d82d) @@ -69,7 +69,9 @@ SEARCH_LESSON_TITLE : '', - COURSE_GROUPS_TITLE : '' + COURSE_GROUPS_TITLE : '', + + NAVIGATE_AWAY_CONFIRM : decoderDiv.html('').text() }, tabName = '${tab}',