mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
parents-merge 33200 - Fix duplicate page with multiple parents
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@45044 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
dbe70dc381
commit
584481c100
@ -1168,6 +1168,12 @@ HTML;
|
||||
|
||||
$newPage = $page->duplicate();
|
||||
|
||||
// ParentID can be hard-set in the URL. This is useful for pages with multiple parents
|
||||
if($_GET['parentID'] && is_numeric($_GET['parentID'])) {
|
||||
$newPage->ParentID = $_GET['parentID'];
|
||||
$newPage->write();
|
||||
}
|
||||
|
||||
return $this->returnItemToUser($newPage);
|
||||
} else {
|
||||
user_error("CMSMain::duplicate() Bad ID: '$id'", E_USER_WARNING);
|
||||
|
@ -190,7 +190,13 @@ TreeNodeAPI.prototype = {
|
||||
}
|
||||
},
|
||||
duplicatePage: function() {
|
||||
new Ajax.Request(baseHref() + 'admin/duplicate/' + this.getIdx() + '?ajax=1', {
|
||||
// Pass the parent ID to the duplicator, which helps ensure that multi-parent pages are duplicated into the node that the user clicked
|
||||
var parentClause = "";
|
||||
if(this.parentTreeNode && this.parentTreeNode.getIdx) {
|
||||
parentClause = "&parentID=" + this.parentTreeNode.getIdx();
|
||||
}
|
||||
|
||||
new Ajax.Request(baseHref() + 'admin/duplicate/' + this.getIdx() + '?ajax=1' + parentClause, {
|
||||
method : 'get',
|
||||
onSuccess : Ajax.Evaluator,
|
||||
onFailure : function(response) {
|
||||
|
Loading…
Reference in New Issue
Block a user