BUGFIX Fixed duplicated 'confirm save' message in changetracker logic for LeftAndMain.EditForm.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92697 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 03:14:38 +00:00
parent 8b8867ba76
commit ffb6790fe6
2 changed files with 10 additions and 8 deletions

View File

@ -53,11 +53,11 @@
* Checks the jquery.changetracker plugin status for this form.
* Usually bound to window.onbeforeunload.
*
* @param {boolean} doConfirm
* @param {boolean} isUnloadEvent
* @return Either a string with a confirmation message, or the result of a confirm() dialog,
* based on the doConfirm parameter.
* based on the isUnloadEvent parameter.
*/
_checkChangeTracker: function(doConfirm) {
_checkChangeTracker: function(isUnloadEvent) {
var self = this;
// @todo TinyMCE coupling
@ -65,13 +65,14 @@
// check for form changes
if(self.is('.changed')) {
var msg = ss.i18n._t('LeftAndMain.CONFIRMUNSAVED');
// returned string will trigger a confirm() dialog,
// but only if the method is triggered by an event
return (doConfirm) ? confirm(msg) : msg;
if(isUnloadEvent) {
return confirm(ss.i18n._t('LeftAndMain.CONFIRMUNSAVED'));
} else {
return ss.i18n._t('LeftAndMain.CONFIRMUNSAVEDSHORT');
}
}
return null;
},
/**

View File

@ -24,6 +24,7 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
'ModelAdmin.DELETED': "Deleted",
'ModelAdmin.VALIDATIONERROR': "Validation Error",
'LeftAndMain.PAGEWASDELETED': "This page was deleted. To edit a page, select it from the left.",
'LeftAndMain.CONFIRMUNSAVED': "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."
'LeftAndMain.CONFIRMUNSAVED': "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.",
'LeftAndMain.CONFIRMUNSAVEDSHORT': "WARNING: Your changes have not been saved."
});
}