mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
API-CHANGE: adding a method to add to the list of extensions that are allowed as Documents.
This commit is contained in:
parent
a032b8b717
commit
8f5c65d539
@ -4,6 +4,7 @@ DMSDocument_versions::$enable_versions = true;
|
||||
|
||||
DMSSiteTreeExtension::show_documents_tab(); //show the Documents tab on all pages
|
||||
DMSSiteTreeExtension::no_documents_tab(); //and don't exclude it from any pages
|
||||
DMSDocumentAddController::add_allowed_extensions(); //add an array of additional allowed extensions
|
||||
|
||||
define('DMS_DIR', 'dms');
|
||||
|
||||
@ -19,4 +20,5 @@ ShortcodeParser::get('default')->register('dms_document_link', array('DMSDocumen
|
||||
if (DMSDocument_versions::$enable_versions) {
|
||||
//using the same db relations for the versioned documents, as for the actual documents
|
||||
Config::inst()->update('DMSDocument_versions', 'db', DMSDocument::$db);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,18 @@ class DMSDocumentAddController extends LeftAndMain {
|
||||
static $required_permission_codes = 'CMS_ACCESS_AssetAdmin';
|
||||
static $menu_title = 'Edit Page';
|
||||
public static $tree_class = 'SiteTree';
|
||||
static $allowed_extensions = array();
|
||||
|
||||
/**
|
||||
* Add an array of additional allowed extensions
|
||||
* @static
|
||||
* @param $array
|
||||
*/
|
||||
static function add_allowed_extensions($array = null) {
|
||||
if (empty($array)) return;
|
||||
if (is_array($array)) self::$allowed_extensions = $array;
|
||||
else self::$allowed_extensions = array($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom currentPage() method to handle opening the 'root' folder
|
||||
@ -59,7 +71,9 @@ class DMSDocumentAddController extends LeftAndMain {
|
||||
$uploadField->setTemplate('AssetUploadField');
|
||||
$uploadField->setRecord($page);
|
||||
|
||||
$uploadField->getValidator()->setAllowedExtensions(array_filter(array_merge(File::$allowed_extensions,self::$allowed_extensions)));
|
||||
$exts = $uploadField->getValidator()->getAllowedExtensions();
|
||||
|
||||
asort($exts);
|
||||
$backlink = $this->Backlink();
|
||||
$done = "
|
||||
|
Loading…
Reference in New Issue
Block a user