From 5a0eef5bab9b8c1c463b80adb291da5e7c7d83df Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 9 Jan 2012 11:37:36 +0100 Subject: [PATCH] ENHANCEMENT Replaced AssetTableField with GridField in Folder->getCMSFields() (and thereby in AssetAdmin) --- filesystem/Folder.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 0323b59e0..1bc585d90 100644 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -398,30 +398,29 @@ class Folder extends File { * and implemeting updateCMSFields(FieldList $fields) on that extension. */ function getCMSFields() { - $fileList = new AssetTableField( - $this, - "Files", - "File", - array("Title" => _t('Folder.TITLE', "Title"), "Filename" => _t('Folder.FILENAME', "Filename")), - "" - ); - $fileList->setFolder($this); - $fileList->setPopupCaption(_t('Folder.VIEWEDITASSET', "View/Edit Asset")); + $config = GridFieldConfig::create(); + $config->addComponent(new GridFieldFilter()); + $config->addComponent(new GridFieldDefaultColumns()); + $config->addComponent(new GridFieldSortableHeader()); + $config->addComponent(new GridFieldPaginator(2)); + $config->addComponent(new GridFieldAction_Delete()); + $files = DataList::create('File')->filter('ParentID', $this->ID)->exclude('ClassName', 'Folder'); + $gridField = new GridField('File','Files', $files, $config); + $gridField->setDisplayFields(array( + 'StripThumbnail' => '', + 'Parent.FileName' => 'Folder', + 'Title'=>'Title', + 'Size'=>'Size', + )); $titleField = ($this->ID && $this->ID != "root") ? new TextField("Title", _t('Folder.TITLE')) : new HiddenField("Title"); - if( $this->canEdit() ) { - $deleteButton = new InlineFormAction('deletemarked',_t('Folder.DELSELECTED','Delete selected files'), 'delete'); - $deleteButton->includeDefaultJS(false); - } else { - $deleteButton = new HiddenField('deletemarked'); - } $fields = new FieldList( new HiddenField("Name"), new TabSet("Root", new Tab("Files", _t('Folder.FILESTAB', "Files"), $titleField, - $fileList, + $gridField, new HiddenField("DestFolderID") ), new Tab("Details", _t('Folder.DETAILSTAB', "Details"),