mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FEATURE #1614: Allow use of admin/addpage?ParentID=(ID)&PageType=(Class) url to quick-add pages
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@65904 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f001eee5fe
commit
16d96c7f36
@ -443,9 +443,9 @@ JS;
|
||||
|
||||
|
||||
public function addpage() {
|
||||
$className = $_REQUEST['PageType'] ? $_REQUEST['PageType'] : "Page";
|
||||
$parent = $_REQUEST['ParentID'] ? $_REQUEST['ParentID'] : 0;
|
||||
$suffix = $_REQUEST['Suffix'] ? "-" . $_REQUEST['Suffix'] : null;
|
||||
$className = isset($_REQUEST['PageType']) ? $_REQUEST['PageType'] : "Page";
|
||||
$parent = isset($_REQUEST['ParentID']) ? $_REQUEST['ParentID'] : 0;
|
||||
$suffix = isset($_REQUEST['Suffix']) ? "-" . $_REQUEST['Suffix'] : null;
|
||||
|
||||
|
||||
if(is_numeric($parent)) $parentObj = DataObject::get_by_id("SiteTree", $parent);
|
||||
@ -465,7 +465,7 @@ JS;
|
||||
* @uses LeftAndMainDecorator->augmentNewSiteTreeItem()
|
||||
*/
|
||||
public function getNewItem($id, $setID = true) {
|
||||
list($dummy, $className, $parentID, $suffix) = explode('-',$id);
|
||||
list($dummy, $className, $parentID, $suffix) = array_pad(explode('-',$id),4,null);
|
||||
if(Translatable::is_enabled()) {
|
||||
if (!Translatable::is_default_lang()) {
|
||||
$originalItem = Translatable::get_original($className,Session::get("{$id}_originalLangID"));
|
||||
|
@ -410,9 +410,12 @@ class LeftAndMain extends Controller {
|
||||
newNode.selectTreeNode();
|
||||
JS;
|
||||
FormResponse::add($response);
|
||||
|
||||
return FormResponse::respond();
|
||||
} else {
|
||||
Director::redirect("admin/show/" . $p->ID);
|
||||
}
|
||||
|
||||
return FormResponse::respond();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user