From 3b0ab9b0a019c3e1df75b41e1036728834f71bac Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 17 Feb 2012 12:06:12 +1300 Subject: [PATCH 01/29] BUGFIX: SiteTree#getCMSFields referenced $linkedPages even if $linkedPages wasnt set --- code/model/SiteTree.php | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index f408b8a0..e7e85e33 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1760,36 +1760,36 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid // Create a status message for multiple parents if($this->ID && is_numeric($this->ID)) { $linkedPages = $this->VirtualPages(); - } - - $parentPageLinks = array(); - if($linkedPages->Count() > 0) { - foreach($linkedPages as $linkedPage) { - $parentPage = $linkedPage->Parent; - if($parentPage) { - if($parentPage->ID) { - $parentPageLinks[] = "ID\">{$parentPage->Title}"; - } else { - $parentPageLinks[] = "ID\">" . - _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . - ""; + $parentPageLinks = array(); + + if($linkedPages->Count() > 0) { + foreach($linkedPages as $linkedPage) { + $parentPage = $linkedPage->Parent; + if($parentPage) { + if($parentPage->ID) { + $parentPageLinks[] = "ID\">{$parentPage->Title}"; + } else { + $parentPageLinks[] = "ID\">" . + _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . + ""; + } } } + + $lastParent = array_pop($parentPageLinks); + $parentList = "'$lastParent'"; + + if(count($parentPageLinks) > 0) { + $parentList = "'" . implode("', '", $parentPageLinks) . "' and " + . $parentList; + } + + $statusMessage[] = sprintf( + _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), + $parentList + ); } - - $lastParent = array_pop($parentPageLinks); - $parentList = "'$lastParent'"; - - if(count($parentPageLinks) > 0) { - $parentList = "'" . implode("', '", $parentPageLinks) . "' and " - . $parentList; - } - - $statusMessage[] = sprintf( - _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), - $parentList - ); } if($this->HasBrokenLink || $this->HasBrokenFile) { From 128d3a8316d5b7e7c278276bb0d8df1a878b8691 Mon Sep 17 00:00:00 2001 From: jbridson Date: Fri, 17 Feb 2012 12:15:02 +1300 Subject: [PATCH 02/29] MINOR:added classes so that the tabs to change page view can have the appropriate icons. --- templates/Includes/CMSPagesController_Content.ss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/Includes/CMSPagesController_Content.ss b/templates/Includes/CMSPagesController_Content.ss index c76a67c0..0c2cbe22 100644 --- a/templates/Includes/CMSPagesController_Content.ss +++ b/templates/Includes/CMSPagesController_Content.ss @@ -9,13 +9,13 @@ From 371f42e61a51fc4c5f1d29daad70b94812108273 Mon Sep 17 00:00:00 2001 From: jbridson Date: Fri, 17 Feb 2012 12:37:25 +1300 Subject: [PATCH 03/29] MINOR:added classes for assets page so that the icons for view tabs appear. --- templates/Includes/AssetAdmin_Content.ss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/Includes/AssetAdmin_Content.ss b/templates/Includes/AssetAdmin_Content.ss index c647b543..19f40a23 100644 --- a/templates/Includes/AssetAdmin_Content.ss +++ b/templates/Includes/AssetAdmin_Content.ss @@ -8,13 +8,13 @@ From 876c809a7da4bf68a4a1c9c695e9c8a823f430e4 Mon Sep 17 00:00:00 2001 From: Stig Lindqvist Date: Tue, 21 Feb 2012 16:02:54 +1300 Subject: [PATCH 04/29] ENHANCEMENT Filterpanel for assetadmin --- code/controllers/AssetAdmin.php | 35 ++++++++++++++++++++++++++ templates/Includes/AssetAdmin_Tools.ss | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index e083c1ea..177cc1c6 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -31,6 +31,7 @@ class AssetAdmin extends LeftAndMain { 'savefile', 'deleteUnusedThumbnails' => 'ADMIN', 'SyncForm', + 'filter', ); /** @@ -103,6 +104,40 @@ JS return $form; } + /** + * Returns a form for filtering of files and assets gridfield + * + * @return Form + * @see AssetAdmin.js + */ + public function FilterForm() { + $fields = new FieldList(); + // Below is the filters that this field should filter on + $fields->push(new TextField('Title')); + $fields->push(new TextField('ClassName','Type')); + + $actions = new FieldList(); + $actions->push(new FormAction('doFilter', 'Filter')); + $actions->push(new ResetFormAction('doResetFilter', 'Clear Filter')); + + $form = new Form($this, 'filter', $fields, $actions); + $form->addExtraClass('cms-filter-form'); + // This have to match data-name attribute on the gridfield so that the javascript selectors work + $form->setAttribute('data-gridfield', 'File'); + return $form; + } + + /** + * If this method get's called, it means that javascript didn't hook into to the submit on + * FilterForm and we can currently not do a Filter without javascript. + * + * @param SS_HTTPRequest $data + * @throws SS_HTTPResponse_Exception + */ + public function filter(SS_HTTPRequest $data) { + throw new SS_HTTPResponse_Exception('Filterpanel doesn\'t work without javascript enabled.'); + } + public function AddForm() { $form = parent::AddForm(); $form->Actions()->fieldByName('action_doAdd')->setTitle(_t('AssetAdmin.ActionAdd', 'Add folder')); diff --git a/templates/Includes/AssetAdmin_Tools.ss b/templates/Includes/AssetAdmin_Tools.ss index 6431b873..60f37ce1 100644 --- a/templates/Includes/AssetAdmin_Tools.ss +++ b/templates/Includes/AssetAdmin_Tools.ss @@ -1,7 +1,7 @@