Permalink
Browse files

MINOR Fixed parameters in CMSMain->getfilteredsubtree()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92723 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
chillu committed Nov 21, 2009
1 parent 44e16b9 commit 49ff1648bd80f3de5788aee44df8177eb855ed46
Showing with 17 additions and 26 deletions.
  1. +17 −26 code/CMSMain.php
View
@@ -138,13 +138,13 @@ public function SiteTreeAsUL() {
*
* @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 @@ public function getfilteredsubtree($request) {
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 @@ function SearchTreeForm() {
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 @@ function SearchTreeForm() {
'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')

0 comments on commit 49ff164

Please sign in to comment.