Index: lams_central/web/main.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/main.jsp,v diff -u -r1.86 -r1.87 --- lams_central/web/main.jsp 27 May 2015 06:21:24 -0000 1.86 +++ lams_central/web/main.jsp 8 Jun 2015 15:01:53 -0000 1.87 @@ -69,7 +69,9 @@ SEARCH_LESSON_TITLE : '', - COURSE_GROUPS_TITLE : '' + COURSE_GROUPS_TITLE : '', + + NAVIGATE_AWAY_CONFIRM : decoderDiv.html('').text() }, tabName = '${tab}', Index: lams_central/web/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/authoring/authoring.jsp,v diff -u -r1.16 -r1.17 --- lams_central/web/authoring/authoring.jsp 27 May 2015 06:21:24 -0000 1.16 +++ lams_central/web/authoring/authoring.jsp 8 Jun 2015 15:01:53 -0000 1.17 @@ -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/dialog.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/dialog.js,v diff -u -r1.1 -r1.2 --- lams_central/web/includes/javascript/dialog.js 27 May 2015 06:21:24 -0000 1.1 +++ lams_central/web/includes/javascript/dialog.js 8 Jun 2015 15:01:53 -0000 1.2 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/groupDisplay.js,v diff -u -r1.42 -r1.43 --- lams_central/web/includes/javascript/groupDisplay.js 27 May 2015 06:21:24 -0000 1.42 +++ lams_central/web/includes/javascript/groupDisplay.js 8 Jun 2015 15:01:53 -0000 1.43 @@ -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/includes/javascript/authoring/authoringActivity.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringActivity.js,v diff -u -r1.44 -r1.45 --- lams_central/web/includes/javascript/authoring/authoringActivity.js 27 May 2015 06:21:24 -0000 1.44 +++ lams_central/web/includes/javascript/authoring/authoringActivity.js 8 Jun 2015 15:01:53 -0000 1.45 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/authoring/authoringGeneral.js,v diff -u -r1.62 -r1.63 --- lams_central/web/includes/javascript/authoring/authoringGeneral.js 27 May 2015 06:21:24 -0000 1.62 +++ lams_central/web/includes/javascript/authoring/authoringGeneral.js 8 Jun 2015 15:01:53 -0000 1.63 @@ -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. */