diff --git a/code/DMSDocument.php b/code/DMSDocument.php index 6c0a803..72d83d2 100644 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -225,7 +225,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { * Returns a link to download this document from the DMS store * @return String */ - function downloadLink() { + function getDownloadLink() { return Controller::join_links(Director::baseURL(),'dmsdocument/'.$this->ID); } @@ -506,7 +506,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { new ReadonlyField("FileType", _t('AssetTableField.TYPE','File type') . ':', self::get_file_type($extension)), new ReadonlyField("Size", _t('AssetTableField.SIZE','File size') . ':', File::format_size(filesize($this->getFullPath()))), $urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL','URL'), - sprintf('%s', $this->downloadLink(), $this->downloadLink()) + sprintf('%s', $this->getDownloadLink(), $this->getDownloadLink()) ), new ReadonlyField("FilenameWithoutIDField", "Filename". ':', $this->getFilenameWithoutID()), new DateField_Disabled("Created", _t('AssetTableField.CREATED','First uploaded') . ':', $this->Created), diff --git a/code/DMSSiteTreeExtension.php b/code/DMSSiteTreeExtension.php index 479b0f9..6578d74 100644 --- a/code/DMSSiteTreeExtension.php +++ b/code/DMSSiteTreeExtension.php @@ -19,7 +19,9 @@ class DMSSiteTreeExtension extends DataExtension { //GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d') ); $modelClass = DMS::$modelClass; - $gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields($modelClass::$display_fields); + $gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields($modelClass::$display_fields) + ->setFieldCasting(array('LastChanged'=>"Date->Ago")) + ->setFieldFormatting(array('FilenameWithoutID'=>'$FilenameWithoutID')); $gridField = GridField::create( 'Documents', false, diff --git a/code/interface/DMSDocumentInterface.php b/code/interface/DMSDocumentInterface.php index a699f38..b57dbf8 100644 --- a/code/interface/DMSDocumentInterface.php +++ b/code/interface/DMSDocumentInterface.php @@ -130,7 +130,7 @@ interface DMSDocumentInterface { * @abstract * @return String */ - function downloadLink(); + function getDownloadLink(); /** * Takes a File object or a String (path to a file) and copies it into the DMS, replacing the original document file diff --git a/tests/DMSTest.php b/tests/DMSTest.php index 4205761..5a616bf 100644 --- a/tests/DMSTest.php +++ b/tests/DMSTest.php @@ -125,7 +125,7 @@ class DMSTest extends FunctionalTest { // // //store the first document // $document = $dms->storeDocument(self::$testFile); -// $link = $document->downloadLink(); +// $link = $document->getDownloadLink(); // // Debug::Show($link); // $d=new DMSDocument_Controller();