Go to file
2016-02-17 05:52:13 +13:00
_config Further updates for 3.1 compatibility. 2013-04-15 14:03:58 +12:00
.tx Transifex translation support 2013-07-08 12:53:17 +02:00
code Fixed issue with folder path not being stored with document. Value must be set as a string before being saved to the database. 2016-01-21 18:39:50 -06:00
css Fix issues with document actions panel ui in cms 2014-07-10 09:44:13 +10:00
images ENHANCEMENT: Add styling to Embargo and expiry fields. Change date format to dd-mm-yyyy 2012-08-16 16:18:41 +12:00
javascript Fix issues with document actions panel ui in cms 2014-07-10 09:44:13 +10:00
lang Updated master strings 2014-02-10 23:06:48 +13:00
resources ENHANCEMENT: protecting the "dms-assets" folder from web access 2012-08-07 11:16:10 +12:00
scss Fix issues with document actions panel ui in cms 2014-07-10 09:44:13 +10:00
templates Sort documents on front-end - Fixes #44 2015-02-03 15:54:06 +13:00
tests Converted to PSR-2 2015-12-18 07:48:37 +13:00
_config.php Move shortcode handling into a new class. 2013-10-09 20:23:50 +11:00
.editorconfig Added standard .editorconfig file 2015-12-17 10:21:22 +13:00
.gitattributes Added standard .gitattributes file 2016-01-16 17:51:31 +13:00
.gitignore Make DMSDocument methods chainable. PHPDoc cleanup. 2014-01-10 15:21:50 +13:00
.scrutinizer.yml Added standard Scrutinizer config 2016-02-17 05:52:13 +13:00
.travis.yml Move to new travis containerised infrastructure 2015-07-21 11:10:19 +01:00
code-of-conduct.md Added standard code of conduct file 2016-02-16 12:28:21 +13:00
composer.json suggested syntax fix 2015-10-07 16:34:01 +13:00
config.rb ENHANCEMENT: adding scss stlying 2012-08-01 16:12:11 +12:00
README.md MINOR: adding reference to tags module for DMS 2014-05-19 12:54:16 +12:00

Document Management Module (DMS)

Build Status

Overview

The module adds a new DMSDocument model which allows management of large amounts of files, and their relations to pages. In contrast to the File model built into SilverStripe core, it aims to wrap storage and access concerns in a generic API, which allows more fine-grained control over how the documents are managed and exposed through the website.

Additionally, documents are stored and managed as part of a page instead of away in a separate assets store.

Read more about the DMS module in this blog post on silverstripe.org

Features:

  • Relation of documents to pages
  • Management and upload of documents within a page context in the CMS
  • Metadata management through the powerful GridField and UploadField core APIs
  • Configurable tags for documents
  • Download via SilverStripe controller (rather than filesystem URLs)
  • Access control based on PHP logic, and page relations
  • Replacement of existing files

Documents on the Filesystem

While the DMS architecture allows for remote storage of files, the default implementation (the DMS class) stores them locally. Relations to pages and tags are persisted as many-many relationships through the SilverStripe ORM.

File locations in this implementation are structured into subfolders, in order to avoid exceeding filesystem limits. The file name is a composite based on its database ID and the original file name. The exact location shouldn't be relied on by custom logic, but rather retrieved through the API (DMSDocument->getLink()).

Example:

dms-assets/
	0/
		1234~myfile.pdf
	1/
		2345~myotherfile.pdf

Requirements

Configuration

The file location is set via the DMS::$dmsFolder static, and points to a location in the webroot.

Usage

Add a simple include to any of your .ss templates to display the DMSDocuments associated with the current page on the front-end.

<% include Documents %>

Create Documents

Create by relative path:

$dms = DMS::getDMSInstance();
$doc = $dms->storeDocument('assets/myfile.pdf');

Create from an existing File record:

$dms = DMS::getDMSInstance();
$file = File::get()->byID(99);
$doc = $dms->storeDocument($file);

Note: Both operations copy the existing file.

Download Documents

$dms = DMS::getDMSInstance();
$docs = $dms->getByTag('priority', 'important')->First();
$link = $doc->getLink();

Manage Page Relations

// Find documents by page
$dms = DMS::getDMSInstance();
$page = SiteTree::get()->filter('URLSegment', 'home')->First();
$docs = $dms->getByPage($page);

// Add documents to page

Manage Tags

// Find documents by tag
$dms = DMS::getDMSInstance();
$docs = $dms->getByTag('priority', 'important');

// Add tag to existing document
$doc = Document::get()->byID(99);
$doc->addTag('priority', 'low');

// Supports multiple values for tags
$doc->addTag('category', 'keyboard');
$doc->addTag('category', 'input device');

// Removing tags is abstracted as well
$doc->removeTag('category', 'keyboard'); 
$doc->removeTag('category', 'input device'); 
$doc->removeAllTags();

Contributing

Translations

Translations of the natural language strings are managed through a third party translation interface, transifex.com. Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to the project source code.

Please use https://www.transifex.com/projects/p/silverstripe-dms/ to contribute translations, rather than sending pull requests with YAML files.

See the "i18n" topic on doc.silverstripe.org for more details.