From 7b6b35328c2e65aba2aa95190a2c0595725add57 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 29 Sep 2010 04:02:15 +0000 Subject: [PATCH] BUGFIX SubsitesTreeDropdownField::getsubtree() failed because it was removed from TreeDropdownField in r88482 --- code/SubsitesTreeDropdownField.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/code/SubsitesTreeDropdownField.php b/code/SubsitesTreeDropdownField.php index ad0763f..70cf127 100644 --- a/code/SubsitesTreeDropdownField.php +++ b/code/SubsitesTreeDropdownField.php @@ -38,15 +38,23 @@ class SubsitesTreeDropdownField extends TreeDropdownField { return $results; } - function getsubtree() { + public function getsubtree(SS_HTTPRequest $request) { $oldSubsiteID = Session::get('SubsiteID'); Session::set('SubsiteID', $this->subsiteID); - - $results = parent::getsubtree(); - + + $obj = $this->objectForKey($_REQUEST['SubtreeRootID']); + + if(!$obj) user_error("Can't find database record $this->sourceObject with $this->keyField = $_REQUEST[SubtreeRootID]", E_USER_ERROR); + + if($this->filterFunc) $obj->setMarkingFilterFunction($this->filterFunc); + else if($this->sourceObject == 'Folder') $obj->setMarkingFilter('ClassName', 'Folder'); + $obj->markPartialTree(); + + $eval = '"
  • name . '-$child->' . $this->keyField . '\" class=\"$child->class" . $child->markingClasses() . "\">" . $child->' . $this->labelField . ' . ""'; + $tree = $obj->getChildrenAsUL("", $eval, null, true); + echo substr(trim($tree), 4,-5); + Session::set('SubsiteID', $oldSubsiteID); - - return $results; } -} -?> \ No newline at end of file + +} \ No newline at end of file