elofgren: Remove unused code: 1. doYouWantToSave() that called OpenModalDialog?() has been replaced by a call to confirm() 2. CMSMain::savedialog() which was the PHP part of the old modal save dialog. 3. save() in NewsletterAdmin?_right.js which seems to have been replaced by the save function of Form_EditForm

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41800 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-14 19:32:19 +00:00
parent 93ae866e60
commit 7f61325204
3 changed files with 0 additions and 91 deletions

View File

@ -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 = "<button name=\"save\">Save changes</button><button name=\"discard\">Discard changes</button><button name=\"cancel\">Stay on this page</button>";
return $this->customise( array(
'Message' => $message,
'Buttons' => $buttons,
'DialogType' => 'alert'
))->renderWith( 'Dialog' );
}
function canceldraftchangesdialog() {
Requirements::clear();
Requirements::css('cms/css/dialog.css');

View File

@ -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);
}
}

View File

@ -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