mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merged revisions 48503 via svnmerge from
http://svn.silverstripe.com/open/modules/cms/branches/2.2.1asfonz ........ r48503 | sminnee | 2008-01-24 11:22:14 +1300 (Thu, 24 Jan 2008) | 1 line Added 'duplicate page and children' context-item in addition to 'duplicate just this page' ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@48524 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
17f796d0af
commit
22f27b5afa
@ -1203,6 +1203,18 @@ HTML;
|
||||
}
|
||||
}
|
||||
|
||||
function duplicatewithchildren() {
|
||||
if(($id = $this->urlParams['ID']) && is_numeric($id)) {
|
||||
$page = DataObject::get_by_id("SiteTree", $id);
|
||||
|
||||
$newPage = $page->duplicateWithChildren();
|
||||
|
||||
return $this->returnItemToUser($newPage);
|
||||
} else {
|
||||
user_error("CMSMain::duplicate() Bad ID: '$id'", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the cms language and reload the site tree
|
||||
*
|
||||
|
@ -371,7 +371,11 @@ TreeContextMenu = {
|
||||
'Edit this page' : function(treeNode) {
|
||||
treeNode.selectTreeNode();
|
||||
},
|
||||
'Duplicate this page' : function(treeNode) {
|
||||
'Duplicate page and children' : function(treeNode) {
|
||||
// First save the page silently (without confirmation) and then duplicate the page.
|
||||
autoSave(false, treeNode.duplicatePageWithChildren.bind(treeNode));
|
||||
},
|
||||
'Duplicate just this page' : function(treeNode) {
|
||||
// First save the page silently (without confirmation) and then duplicate the page.
|
||||
autoSave(false, treeNode.duplicatePage.bind(treeNode));
|
||||
},
|
||||
|
@ -203,6 +203,15 @@ TreeNodeAPI.prototype = {
|
||||
errorMessage('Error: ', response);
|
||||
}
|
||||
});
|
||||
},
|
||||
duplicatePageWithChildren: function() {
|
||||
new Ajax.Request(baseHref() + 'admin/duplicatewithchildren/' + this.getIdx() + '?ajax=1', {
|
||||
method : 'get',
|
||||
onSuccess : Ajax.Evaluator,
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error: ', response);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user