ENHANCEMENT Replaced AssetTableField with GridField in Folder->getCMSFields() (and thereby in AssetAdmin)

This commit is contained in:
Ingo Schommer 2012-01-09 11:37:36 +01:00
parent 24a37daa50
commit 5a0eef5bab

View File

@ -398,30 +398,29 @@ class Folder extends File {
* and implemeting updateCMSFields(FieldList $fields) on that extension. * and implemeting updateCMSFields(FieldList $fields) on that extension.
*/ */
function getCMSFields() { function getCMSFields() {
$fileList = new AssetTableField( $config = GridFieldConfig::create();
$this, $config->addComponent(new GridFieldFilter());
"Files", $config->addComponent(new GridFieldDefaultColumns());
"File", $config->addComponent(new GridFieldSortableHeader());
array("Title" => _t('Folder.TITLE', "Title"), "Filename" => _t('Folder.FILENAME', "Filename")), $config->addComponent(new GridFieldPaginator(2));
"" $config->addComponent(new GridFieldAction_Delete());
); $files = DataList::create('File')->filter('ParentID', $this->ID)->exclude('ClassName', 'Folder');
$fileList->setFolder($this); $gridField = new GridField('File','Files', $files, $config);
$fileList->setPopupCaption(_t('Folder.VIEWEDITASSET', "View/Edit Asset")); $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"); $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( $fields = new FieldList(
new HiddenField("Name"), new HiddenField("Name"),
new TabSet("Root", new TabSet("Root",
new Tab("Files", _t('Folder.FILESTAB', "Files"), new Tab("Files", _t('Folder.FILESTAB', "Files"),
$titleField, $titleField,
$fileList, $gridField,
new HiddenField("DestFolderID") new HiddenField("DestFolderID")
), ),
new Tab("Details", _t('Folder.DETAILSTAB', "Details"), new Tab("Details", _t('Folder.DETAILSTAB', "Details"),