diff --git a/code/CMSMain.php b/code/CMSMain.php index fa720f3f..27030a2c 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -833,24 +833,6 @@ HTML; ); } - function savedialog() { - Requirements::clear(); - Requirements::css('cms/css/dialog.css'); - Requirements::javascript('jsparty/prototype.js'); - Requirements::javascript('jsparty/behaviour.js'); - Requirements::javascript('jsparty/prototype_improvements.js'); - Requirements::javascript('cms/javascript/dialog.js'); - - $message = "You have unsaved changes. Would you like to save them?"; - $buttons = ""; - - return $this->customise( array( - 'Message' => $message, - 'Buttons' => $buttons, - 'DialogType' => 'alert' - ))->renderWith( 'Dialog' ); - } - function canceldraftchangesdialog() { Requirements::clear(); Requirements::css('cms/css/dialog.css'); diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index a99bee30..aafe079a 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -626,18 +626,6 @@ function doYouWantToRollback(handlers) { OpenModalDialog(url, handlers, 'Are you sure?' ); } -/** - * Shows a "do you want to save" dialog box. - * Returns save / discard / cancel - */ - -var _DO_YOU_WANT_TO_SAVE_IS_OPEN = false; -function doYouWantToSave(handlers) { - // modalDialog('admin/dialog?Message=You+have+changed+this+page.+Do+you+want+to+save+these+changes%3F&Buttons[]=save,Save+changes&Buttons[]=discard,Discard+changes&Buttons[]=cancel,Cancel', handlers); - var url = document.getElementsByTagName('base')[0].href + 'admin/savedialog'; - OpenModalDialog(url, handlers, 'Unsaved Changes' ); -} - function modalDialog(url, handlers) { var baseURL = document.getElementsByTagName('base')[0].href; if(window.showModalDialog) { @@ -645,9 +633,6 @@ function modalDialog(url, handlers) { if(handlers[result]) handlers[result](); - } else { - _DO_YOU_WANT_TO_SAVE_IS_OPEN = true; - doYouWantToSave.dialog = new ModalDialog(baseURL + url, handlers); } } diff --git a/javascript/NewsletterAdmin_right.js b/javascript/NewsletterAdmin_right.js index ad236184..9cd5af3f 100755 --- a/javascript/NewsletterAdmin_right.js +++ b/javascript/NewsletterAdmin_right.js @@ -342,64 +342,6 @@ Behaviour.register({ } }); - -function save(ifChanged, callAfter, confirmation) { - tinyMCE.triggerSave(true); - - var form = $('Form_EditForm'); - - var alreadySaved = false; - - if(ifChanged) { - if(form.elements.length < 2) alreadySaved = true; - else alreadySaved = !form.isChanged(); - } - - if(alreadySaved && ifChanged) { // pressing save always saves - if(!ifChanged && !confirmation) { - statusMessage("There's nothing to save"); - } - - if(callAfter) callAfter(); - - } else { - var options = { - save: (function() { - statusMessage('saving...', '', true); - - var success = function(response) { - Ajax.Evaluator(response); - if(this.callAfter) this.callAfter(); - } - if(callAfter) success = success.bind(this); - - if( $('Form_EditForm_Type').value == 'Newsletter' ) - var data = form.serializeChangedFields('ID','type') + '&ajax=1&action_savenewsletter=1'; - else - var data = form.serializeChangedFields('ID','type') + '&ajax=1&action_save=1'; - - new Ajax.Request(form.action, { - method : form.method, - postBody: data, - onSuccess : success, - onFailure : function(response) { - errorMessage('Error saving content', response); - } - }); - }).bind({callAfter : callAfter}), - - discard: callAfter, - cancel: function() { - } - } - - if(confirmation) doYouWantToSave(options); - else options.save(); - } - - return false; -} - Behaviour.register({ /** * When the iframe has loaded, apply the listeners