searchableFields() as $fieldName => $fieldSpec) { if(strpos($fieldName, '.') === false) $searchFilters[] = "\"$fieldName\" LIKE '%{$SQL_search}%'"; } $this->sourceFilter = '(' . implode(' OR ', $searchFilters) . ')'; } $this->sourceSort = 'Title'; $this->Markable = true; } function FieldHolder() { Requirements::javascript('cms/javascript/ImageEditor/Activator.js'); return parent::FieldHolder(); } function setFolder($folder) { $this->folder = $folder; $this->sourceFilter .= ($this->sourceFilter) ? " AND " : ""; $this->sourceFilter .= " \"ParentID\" = '" . $folder->ID . "' AND \"ClassName\" <> 'Folder'"; } function Folder() { return $this->folder; } function sourceID() { if($this->folder) return $this->folder->ID; } /** * Get the pop-up fields for the given record. */ function getCustomFieldsFor($childData) { if(!$childData) { user_error("AssetTableField::DetailForm No record found"); return null; } if($childData->ParentID) { $folder = DataObject::get_by_id('File', $childData->ParentID ); } else { $folder = singleton('Folder'); } $urlLink = "
"; $urlLink .= ""; $urlLink .= "{$childData->RelativeLink()}"; $urlLink .= "
"; $detailFormFields = new FieldSet( new TabSet("BottomRoot", new Tab(_t('AssetTableField.MAIN', 'Main'), new TextField("Title", _t('AssetTableField.TITLE','Title')), new TextField("Name", _t('AssetTableField.FILENAME','Filename')), new LiteralField("AbsoluteURL", $urlLink), new ReadonlyField("FileType", _t('AssetTableField.TYPE','Type')), new ReadonlyField("Size", _t('AssetTableField.SIZE','Size'), $childData->getSize()), new DropdownField("OwnerID", _t('AssetTableField.OWNER','Owner'), Member::mapInCMSGroups()), new DateField_Disabled("Created", _t('AssetTableField.CREATED','First uploaded')), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT','Last changed')) ) ) ); if(is_a($childData,'Image')) { $big = $childData->URL; $thumbnail = $childData->getFormattedImage('AssetLibraryPreview')->URL; // Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab $detailFormFields->addFieldToTab("BottomRoot."._t('AssetTableField.MAIN','Main'), new ReadonlyField("Dimensions", _t('AssetTableField.DIM','Dimensions')), "Created" ); $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.IMAGE', 'Image'), new LiteralField("ImageFull", '' . "{$childData->Name}

"._t('AssetTableField.EDITIMAGE', 'Edit this image')."

" . '
' . '' ) ), 'Main' ); if(class_exists('GalleryFile')) { $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ) ) ); } } else if (class_exists('GalleryFile')) { if( $childData->Extension == 'swf' ) { $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ), new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ), new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') ), new HeaderField( 'SWFFileOptionsHeader', _t('AssetTableField.SWFFILEOPTIONS', 'SWF File Options') ), new CheckboxField( 'Embed', _t('AssetTableField.ISFLASH', 'Is A Flash Document') ), new CheckboxField( 'LimitDimensions', _t('AssetTableField.DIMLIMT', 'Limit The Dimensions In The Popup Window') ) ) ); } else { $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ), new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ), new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') ) ) ); } } if($childData && $childData->hasMethod('BackLinkTracking')) { $links = $childData->BackLinkTracking(); if($links->exists()) { foreach($links as $link) { $backlinks[] = "
  • ID\">" . $link->Breadcrumbs(null,true). "
  • "; } $backlinks = "
    ". _t('AssetTableField.PAGESLINKING','The following pages link to this file:') .""; } if(!isset($backlinks)) $backlinks = "

    ". _t('AssetTableField.NOLINKS',"This file hasn't been linked to from any pages.") ."

    "; $detailFormFields->addFieldToTab("BottomRoot.Links", new LiteralField("Backlinks", $backlinks)); } // the ID field confuses the Controller-logic in finding the right view for ReferencedField $detailFormFields->removeByName('ID'); if($childData) $childData->extend('updateCMSFields', $detailFormFields); return $detailFormFields; } /** * Provide some HTML for a search form, to be * added above the AssetTable field, allowing * a user to filter the current table's files * by their filename. * * @return string HTML for search form */ function SearchForm() { $searchFields = new FieldGroup( new TextField('FileSearch', _t('MemberTableField.SEARCH', 'Search')), new HiddenField("ctf[ID]", '', $this->ID), new HiddenField('FileFieldName', '', $this->name) ); $actionFields = new LiteralField( 'FileFilterButton', '' ); $fieldContainer = new FieldGroup( $searchFields, $actionFields ); return $fieldContainer->FieldHolder(); } } ?>