From 6369bb80def80dfa2cc5c9af804d0e5144a74d95 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 20 May 2009 06:45:32 +0000 Subject: [PATCH] API CHANGE Removed @deprecated 2.3 GhostPage and SiteTree::MultipleParents() which used it git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77383 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/GhostPage.php | 146 --------------------------------------- core/model/SiteTree.php | 21 ------ 2 files changed, 167 deletions(-) delete mode 100755 core/model/GhostPage.php diff --git a/core/model/GhostPage.php b/core/model/GhostPage.php deleted file mode 100755 index 61aef893f..000000000 --- a/core/model/GhostPage.php +++ /dev/null @@ -1,146 +0,0 @@ - "SiteTree", - ); - - static $db = array(); - - function getCMSFields($val) { - if($this->getField('LinkedPageID')) { - return $this->LinkedPage()->getCMSFields($val); - } else { - return new FieldSet( - new LabelField('GhostPageNoLinkedLabel',_t('GhostPage.NOLINKED', "This ghost page has no linked page.")) - ); - } - } - - function hasField($fieldName) { - return parent::hasField($fieldName) || ($this->getField('LinkedPageID') && $this->LinkedPage()->hasField($fieldName)); - } - - function __get($fieldName) { - // echo "
  • $fieldName = "; - // echo $this->getComponent('LinkedPage')->__get($fieldName); - switch($fieldName) { - case "ID": - case "ClassName": - case "LinkedPageID": - case "ParentID": - case "URLSegment": - case "Parent": - return parent::__get($fieldName); - - default: - if($this->getField('LinkedPageID')) { - return $this->getComponent('LinkedPage')->__get($fieldName); - } else { - return parent::__get($fieldName); - } - } - } - - function __call($funcName, $args) { - switch($funcName) { - case "LinkedPage": - return parent::__call($funcName, $args); - - default: - if($this->getField('LinkedPageID')) { - return $this->getComponent('LinkedPage')->__call($funcName, $args); - } else { - return parent::__call($funcName, $args); - } - } - } - - function __set($fieldName, $fieldVal) { - switch($fieldName) { - case "ClassName": - case "MultipleParents"; - break; - - case "ID": - case "LinkedPageID": - parent::__set($fieldName, $fieldVal); - break; - - default: - if($this->getField("LinkedPageID")) { - $this->LinkedPage()->__set($fieldName, $fieldVal); - } - parent::__set($fieldName, $fieldVal); - } - } - - function write() { - if($this->getField("LinkedPageID")) { - $this->LinkedPage()->write(); - } - parent::write(); - } - - function MultipleParents() { - return $this->LinkedPage()->MultipleParents(); - } -} - -/** - * Controller for GhostPages - * @package cms - */ -class GhostPage_Controller extends Page_Controller { - function getViewer($action) { - return $this->LinkedPage()->getViewer($action); - } -} - -/** - * Special type of ComponentSet just for GhostPages - * @package cms - */ -class GhostPage_ComponentSet extends ComponentSet { - function setOwner($ownerObj) { - $this->ownerObj = $ownerObj; - } - - function add($item) { - $id = is_object($item) ? $item->ID : $item; - - $ghost = new GhostPage(); - $ghost->setField('ParentID', $id); - $ghost->setField('LinkedPageID', $this->ownerObj->ID); - $ghost->setField('URLSegment', $this->ownerObj->URLSegment); - $ghost->write(); - } - - function remove($item) { - $id = is_object($item) ? $item->ID : $item; - - $ghosts = DataObject::get("GhostPage","\"ParentID\" = $id AND \"LinkedPageID\" = {$this->ownerObj->ID}"); - if($ghosts) { - foreach($ghosts as $ghost) { - $ghost->delete(); - } - } - } - - function removeMany($itemList) { - if($itemList) { - foreach($itemList as $item) { - $this->remove($item); - } - } - } -} - -?> \ No newline at end of file diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 152875048..aef88542b 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -1581,27 +1581,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid : false; } - - /** - * Look for ghost parents - */ - function MultipleParents() { - $parents = new GhostPage_ComponentSet($this->Parent); - $parents->setOwner($this); - $ghostPages = DataObject::get("GhostPage", "\"LinkedPageID\" = '$this->ID'"); - - if($ghostPages) { - foreach($ghostPages as $ghostPage) { - // Ignore root ghost-pages - if($p = $ghostPage->getParent()) - $parents->push($p); - } - } - - return $parents; - } - - /** * Get the class dropdown used in the CMS to change the class of a page. * This returns the list of options in the drop as a Map from class name