elofgren: When 'Duplicate this page' is clicked, first silently (without confirmation) save the page, then duplicate it so the new page is identical to the other page. Closes gsoc Ticket #41: Apply xmedeko's "autoSave before page duplicate" fixes to gsoc branch. Adapted from code posted here: http://www.silverstripe.com/contributions/flat/2073 Thanks Ondra\!

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41963 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 21:56:40 +00:00
parent 4bd9352924
commit c3dc22e7b8
2 changed files with 11 additions and 7 deletions

View File

@ -244,13 +244,8 @@ TreeContextMenu = {
treeNode.selectTreeNode();
},
'Duplicate this page' : function(treeNode) {
new Ajax.Request(baseHref() + 'admin/duplicate/' + treeNode.getIdx() + '?ajax=1', {
method : 'get',
onSuccess : Ajax.Evaluator,
onFailure : function(response) {
errorMessage('Error: ', response);
}
});
// First save the page silently (without confirmation) and then duplicate the page.
autoSave(false, treeNode.duplicatePage.bind(treeNode));
},
'Sort sub-pages' : function(treeNode) {
var children = treeNode.treeNodeHolder().childTreeNodes();

View File

@ -188,6 +188,15 @@ TreeNodeAPI.prototype = {
Event.stop(event);
return false;
}
},
duplicatePage: function() {
new Ajax.Request(baseHref() + 'admin/duplicate/' + this.getIdx() + '?ajax=1', {
method : 'get',
onSuccess : Ajax.Evaluator,
onFailure : function(response) {
errorMessage('Error: ', response);
}
});
}
}