elofgren: USABILITY: Make Newsletter section use new js confirm dialog instead of old modal one. More info: http://www.elijahlofgren.com/silverstripe/alert-users-when-leaving-tab-with-unsaved-changes/

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41799 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-14 19:30:54 +00:00
parent f7ed6b050f
commit 93ae866e60

View File

@ -488,6 +488,8 @@ function autoSave(confirmation, callAfter) {
}); });
if(__somethingHasChanged) { if(__somethingHasChanged) {
// Note: discard and cancel options are no longer used since switching to confirm dialog.
// save is still used if confirmation = false
var options = { var options = {
save: function() { save: function() {
statusMessage('saving...', '', true); statusMessage('saving...', '', true);
@ -507,8 +509,18 @@ function autoSave(confirmation, callAfter) {
} }
} }
if(confirmation) doYouWantToSave(options); if(confirmation ) {
else options.save(); if(confirm("Are you sure you want to navigate away from this page?\n\nWARNING: Your changes have not been saved.\n\nPress OK to continue, or Cancel to stay on the current page."))
{
// OK was pressed, call function for what was clicked on
if(__callAfter) __callAfter();
} else {
// Cancel was pressed, stay on the current page
return false;
}
} else {
options.save();
}
} else { } else {
if(__callAfter) __callAfter(); if(__callAfter) __callAfter();