From f0810dc772eea9de43659ce8841597e0a744073f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 1 Nov 2012 17:22:25 +0100 Subject: [PATCH 1/6] Added composer.json --- composer.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..60c4ebe0 --- /dev/null +++ b/composer.json @@ -0,0 +1,23 @@ +{ + "name": "silverstripe/cms", + "type": "silverstripe-module", + "description": "The SilverStripe Content Management System", + "homepage": "http://silverstripe.org", + "license": "BSD-3-Clause", + "keywords": ["silverstripe", "cms"], + "authors": [ + { + "name": "SilverStripe", + "homepage": "http://silverstripe.com" + }, + { + "name": "The SilverStripe Community", + "homepage": "http://silverstripe.org" + } + ], + "require": { + "php": ">=5.3.2", + "composer/installers": "*", + "silverstripe/framework": "self.version" + } +} \ No newline at end of file From 79cc947ed80a9809086df0552bf89581c31f7ec2 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Fri, 12 Oct 2012 16:04:56 +1300 Subject: [PATCH 2/6] Batch actions UI enhancement (#7878) --- .../CMSPagesController_ContentToolActions.ss | 3 +-- .../CMSPagesController_ContentToolbar.ss | 20 +++++-------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/templates/Includes/CMSPagesController_ContentToolActions.ss b/templates/Includes/CMSPagesController_ContentToolActions.ss index b87c7ddf..4299e08a 100644 --- a/templates/Includes/CMSPagesController_ContentToolActions.ss +++ b/templates/Includes/CMSPagesController_ContentToolActions.ss @@ -1,4 +1,3 @@ - + \ No newline at end of file diff --git a/templates/Includes/CMSPagesController_ContentToolbar.ss b/templates/Includes/CMSPagesController_ContentToolbar.ss index da77ca81..24dace8e 100644 --- a/templates/Includes/CMSPagesController_ContentToolbar.ss +++ b/templates/Includes/CMSPagesController_ContentToolbar.ss @@ -1,18 +1,8 @@
+
+ + +
+ $BatchActionsForm
- -
- <% _t("TreeTools.DisplayLabel","Display:") %> - <% if CanOrganiseSitetree %> -
- - -
- <% end_if %> -
- - -
-
- From fa348d66660931c1e9f80cb3442f72d6e1d8f713 Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Tue, 30 Oct 2012 17:56:14 +1300 Subject: [PATCH 3/6] MINOR Code refactoring of CMSMain::SearchForm() extracted some methods. --- code/controllers/CMSMain.php | 112 +++++++++++++++---------- code/controllers/CMSSiteTreeFilter.php | 24 ++++++ 2 files changed, 92 insertions(+), 44 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index ccafe2fc..c3477a90 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -245,74 +245,98 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $html; } + /** + * Returns a Form for page searching for use in templates. + * + * Can be modified from a decorator by a 'updateSearchForm' method + * + * @return Form + */ public function SearchForm() { - // get all page types in a dropdown-compatible format - $pageTypeClasses = SiteTree::page_type_classes(); - $pageTypes = array(); - foreach ($pageTypeClasses as $pageTypeClass) { - $pageTypes[$pageTypeClass] = _t($pageTypeClass.'.SINGULARNAME', $pageTypeClass); - } - 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) { - $filterMap[$filter] = call_user_func(array($filter, 'title')); - } - // ensure that 'all pages' filter is on top position - uasort($filterMap, - create_function('$a,$b', 'return ($a == "CMSSiteTreeFilter_Search") ? 1 : -1;') + // Create the fields + $content = new TextField('q[Term]', _t('CMSSearch.FILTERLABELTEXT', 'Content')); + $dateHeader = new HeaderField('q[Date]', _t('CMSSearch.FILTERDATEHEADING', 'Date'), 4); + $dateFrom = new DateField( + 'q[LastEditedFrom]', + _t('CMSSearch.FILTERDATEFROM', 'From') ); + $dateFrom->setConfig('showcalendar', true); + $dateTo = new DateField( + 'q[LastEditedTo]', + _t('CMSSearch.FILTERDATETO', 'To') + ); + $dateTo->setConfig('showcalendar', true); + $pageFilter = new DropdownField( + 'q[FilterClass]', + _t('CMSMain.PAGES', 'Pages'), + CMSSiteTreeFilter::get_all_filters() + ); + $pageClasses = new DropdownField( + 'q[ClassName]', + _t('CMSMain.PAGETYPEOPT', 'Page Type', 'Dropdown for limiting search to a page type'), + $this->getPageTypes() + ); + $pageClasses->setEmptyString(_t('CMSMain.PAGETYPEANYOPT','Any')); - $fields = new FieldList( - new TextField('q[Term]', _t('CMSSearch.FILTERLABELTEXT', 'Content')), - $dateGroup = new FieldGroup( - new HeaderField('q[Date]', _t('CMSSearch.FILTERDATEHEADING', 'Date'), 4), - $dateFrom = new DateField('q[LastEditedFrom]', _t('CMSSearch.FILTERDATEFROM', 'From')), - $dateTo = new DateField('q[LastEditedTo]', _t('CMSSearch.FILTERDATETO', 'To')) - ), - new DropdownField( - 'q[FilterClass]', - _t('CMSMain.PAGES', 'Pages'), - $filterMap - ), - $classDropdown = new DropdownField( - 'q[ClassName]', - _t('CMSMain.PAGETYPEOPT','Page Type', 'Dropdown for limiting search to a page type'), - $pageTypes - ) - // new TextField('MetaTags', _t('CMSMain.SearchMetaTags', 'Meta tags')) + // Group the Datefields + $dateGroup = new FieldGroup( + $dateHeader, + $dateFrom, + $dateTo ); $dateGroup->setFieldHolderTemplate('FieldGroup_DefaultFieldHolder')->addExtraClass('stacked'); - $dateFrom->setConfig('showcalendar', true); - $dateTo->setConfig('showcalendar', true); - $classDropdown->setEmptyString(_t('CMSMain.PAGETYPEANYOPT','Any')); - + + // Create the Field list + $fields = new FieldList( + $content, + $dateGroup, + $pageFilter, + $pageClasses + ); + + // Create the Search and Reset action $actions = new FieldList( FormAction::create('doSearch', _t('CMSMain_left.ss.APPLY FILTER', 'Apply Filter')) ->addExtraClass('ss-ui-action-constructive'), Object::create('ResetFormAction', 'clear', _t('CMSMain_left.ss.RESET', 'Reset')) ); - // Use