From 49ff1648bd80f3de5788aee44df8177eb855ed46 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 03:15:43 +0000 Subject: [PATCH] MINOR Fixed parameters in CMSMain->getfilteredsubtree() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92723 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index dda0cfc0..52bb1a6d 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -138,13 +138,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr * * @return string */ - public function getfilteredsubtree($request) { + public function getfilteredsubtree($data, $form) { $params = $form->getData(); // Get the tree $tree = $this->getSiteTreeFor( $this->stat('tree_class'), - $request->requestVar('ID'), + $data['ID'], null, array(new CMSMainMarkingFilter($params), 'mark') ); @@ -155,29 +155,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $tree; } - - /** - * Returns a list of batch actions - */ - function SiteTreeFilters() { - $filters = ClassInfo::subclassesFor('CMSSiteTreeFilter'); - array_shift($filters); - $doSet = new DataObjectSet(); - $doSet->push(new ArrayData(array( - 'ClassName' => 'all', - 'Title' => 'All items' - ))); - foreach($filters as $filter) { - if (call_user_func(array($filter, 'showInList'))) { - $doSet->push(new ArrayData(array( - 'ClassName' => $filter, - 'Title' => call_user_func(array($filter, 'title')) - ))); - } - } - return $doSet; - } - + public function generateDataTreeHints() { $classes = ClassInfo::subclassesFor( $this->stat('tree_class') ); @@ -1059,6 +1037,18 @@ JS; array_unshift($pageTypes, 'All'); $pageTypes = array_combine($pageTypes, $pageTypes); asort($pageTypes); + + // get all filter instances + $filters = ClassInfo::subclassesFor('CMSSiteTreeFilter'); + $filterMap = array(); + // remove base class + array_shift($filters); + // add filters to map + foreach($filters as $filter) { + if(!call_user_func(array($filter, 'showInList'))) continue; + + $filterMap[$filter] = call_user_func(array($filter, 'title')); + } $form = new Form( $this, @@ -1068,9 +1058,10 @@ JS; 'Title', _t('CMSMain.TITLEOPT', 'Title') ), + new DropdownField('filter', 'Type', $filterMap, null, null, 'Any'), new TextField('Content', 'Text'), new CalendarDateField('EditedSince', _t('CMSMain_left.ss.EDITEDSINCE','Edited Since')), - new DropdownField('ClassName', 'Page Type', $pageTypes, null, 'Any'), + new DropdownField('ClassName', 'Page Type', $pageTypes, null, null, 'Any'), new TextField( 'MenuTitle', _t('CMSMain.MENUTITLEOPT', 'Navigation Label')