mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
ENHANCEMENT: using a defined directory for the dms so you can change the directory, if you want
This commit is contained in:
parent
57063c1c48
commit
c72bbefabc
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
define('DMS_DIR', 'dms');
|
||||||
|
|
||||||
Object::add_extension('SiteTree','DMSSiteTreeExtension');
|
Object::add_extension('SiteTree','DMSSiteTreeExtension');
|
||||||
Object::add_extension('HtmlEditorField_Toolbar','DocumentHtmlEditorFieldToolbar');
|
Object::add_extension('HtmlEditorField_Toolbar','DocumentHtmlEditorFieldToolbar');
|
||||||
CMSMenu::remove_menu_item('DMSDocumentAddController');
|
CMSMenu::remove_menu_item('DMSDocumentAddController');
|
||||||
|
@ -23,8 +23,8 @@ class DMS implements DMSInterface {
|
|||||||
|
|
||||||
if (!file_exists($dmsPath . DIRECTORY_SEPARATOR . '.htaccess')) {
|
if (!file_exists($dmsPath . DIRECTORY_SEPARATOR . '.htaccess')) {
|
||||||
//restrict access to the storage folder
|
//restrict access to the storage folder
|
||||||
copy(BASE_PATH . DIRECTORY_SEPARATOR . 'dms' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . '.htaccess', $dmsPath . DIRECTORY_SEPARATOR . '.htaccess');
|
copy(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . '.htaccess', $dmsPath . DIRECTORY_SEPARATOR . '.htaccess');
|
||||||
copy(BASE_PATH . DIRECTORY_SEPARATOR . 'dms' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'web.config', $dmsPath . DIRECTORY_SEPARATOR . 'web.config');
|
copy(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'web.config', $dmsPath . DIRECTORY_SEPARATOR . 'web.config');
|
||||||
}
|
}
|
||||||
return $dms;
|
return $dms;
|
||||||
}
|
}
|
||||||
|
@ -505,8 +505,8 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
//include JS to handling showing and hiding of bottom "action" tabs
|
//include JS to handling showing and hiding of bottom "action" tabs
|
||||||
Requirements::javascript('dms/javascript/DMSDocumentCMSFields.js');
|
Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentCMSFields.js');
|
||||||
Requirements::css('dms/css/DMSDocumentCMSFields.css');
|
Requirements::css(DMS_DIR.'/css/DMSDocumentCMSFields.css');
|
||||||
|
|
||||||
$fields = new FieldList(); //don't use the automatic scaffolding, it is slow and unnecessary here
|
$fields = new FieldList(); //don't use the automatic scaffolding, it is slow and unnecessary here
|
||||||
|
|
||||||
@ -635,15 +635,15 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function Icon($ext) {
|
function Icon($ext) {
|
||||||
if(!Director::fileExists("dms/images/app_icons/{$ext}_32.png")) {
|
if(!Director::fileExists(DMS_DIR."/images/app_icons/{$ext}_32.png")) {
|
||||||
$ext = File::get_app_category($ext);
|
$ext = File::get_app_category($ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Director::fileExists("dms/images/app_icons/{$ext}_32.png")) {
|
if(!Director::fileExists(DMS_DIR."/images/app_icons/{$ext}_32.png")) {
|
||||||
$ext = "generic";
|
$ext = "generic";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "dms/images/app_icons/{$ext}_32.png";
|
return DMS_DIR."/images/app_icons/{$ext}_32.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,11 +26,11 @@ class DMSSiteTreeExtension extends DataExtension {
|
|||||||
if (in_array($this->owner->ClassName,self::$noDocumentsList)) return;
|
if (in_array($this->owner->ClassName,self::$noDocumentsList)) return;
|
||||||
|
|
||||||
//javascript to customize the grid field for the DMS document (overriding entwine in FRAMEWORK_DIR.'/javascript/GridField.js'
|
//javascript to customize the grid field for the DMS document (overriding entwine in FRAMEWORK_DIR.'/javascript/GridField.js'
|
||||||
Requirements::javascript('dms/javascript/DMSGridField.js');
|
Requirements::javascript(DMS_DIR.'/javascript/DMSGridField.js');
|
||||||
Requirements::css('dms/css/DMSMainCMS.css');
|
Requirements::css(DMS_DIR.'/css/DMSMainCMS.css');
|
||||||
|
|
||||||
//javascript for the link editor pop-up in TinyMCE
|
//javascript for the link editor pop-up in TinyMCE
|
||||||
Requirements::javascript("dms/javascript/DocumentHtmlEditorFieldToolbar.js");
|
Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js");
|
||||||
|
|
||||||
// Document listing
|
// Document listing
|
||||||
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
||||||
|
@ -8,17 +8,6 @@ class DMSDocumentAddController extends LeftAndMain {
|
|||||||
static $menu_title = 'Edit Page';
|
static $menu_title = 'Edit Page';
|
||||||
public static $tree_class = 'SiteTree';
|
public static $tree_class = 'SiteTree';
|
||||||
|
|
||||||
// public function upload($request) {
|
|
||||||
// $formHtml = $this->renderWith(array('AssetAdmin_UploadContent'));
|
|
||||||
// if($request->isAjax()) {
|
|
||||||
// return $formHtml;
|
|
||||||
// } else {
|
|
||||||
// return $this->customise(array(
|
|
||||||
// 'Content' => $formHtml
|
|
||||||
// ))->renderWith(array('AssetAdmin', 'LeftAndMain'));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom currentPage() method to handle opening the 'root' folder
|
* Custom currentPage() method to handle opening the 'root' folder
|
||||||
*/
|
*/
|
||||||
@ -55,7 +44,7 @@ class DMSDocumentAddController extends LeftAndMain {
|
|||||||
public function getEditForm($id = null, $fields = null) {
|
public function getEditForm($id = null, $fields = null) {
|
||||||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
|
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
|
||||||
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
||||||
Requirements::css('dms/css/DMSMainCMS.css');
|
Requirements::css(DMS_DIR.'/css/DMSMainCMS.css');
|
||||||
|
|
||||||
$page = $this->currentPage();
|
$page = $this->currentPage();
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ class DMSDocumentAddExistingField extends CompositeField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function Field($properties = array()) {
|
public function Field($properties = array()) {
|
||||||
Requirements::javascript('dms/javascript/DMSDocumentAddExistingField.js');
|
Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentAddExistingField.js');
|
||||||
Requirements::javascript("dms/javascript/DocumentHtmlEditorFieldToolbar.js");
|
Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js");
|
||||||
|
|
||||||
return $this->renderWith('DMSDocumentAddExistingField');
|
return $this->renderWith('DMSDocumentAddExistingField');
|
||||||
}
|
}
|
||||||
|
@ -171,10 +171,10 @@ class DMSUploadField extends UploadField {
|
|||||||
$useCustomTemplate = $this->getConfig('useDMSReplaceTemplate');
|
$useCustomTemplate = $this->getConfig('useDMSReplaceTemplate');
|
||||||
if (!empty($useCustomTemplate)) {
|
if (!empty($useCustomTemplate)) {
|
||||||
Requirements::block(FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js');
|
Requirements::block(FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js');
|
||||||
Requirements::javascript('dms/javascript/DMSUploadField_downloadtemplate.js');
|
Requirements::javascript(DMS_DIR.'/javascript/DMSUploadField_downloadtemplate.js');
|
||||||
} else {
|
} else {
|
||||||
//in the add dialog, add the addtemplate into the set of file that load
|
//in the add dialog, add the addtemplate into the set of file that load
|
||||||
Requirements::javascript('dms/javascript/DMSUploadField_addtemplate.js');
|
Requirements::javascript(DMS_DIR.'/javascript/DMSUploadField_addtemplate.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
|
@ -26,7 +26,7 @@ class DMSEmbargoTest extends SapphireTest {
|
|||||||
|
|
||||||
function testBasicEmbargo() {
|
function testBasicEmbargo() {
|
||||||
$oldDMSFolder = DMS::$dmsFolder;
|
$oldDMSFolder = DMS::$dmsFolder;
|
||||||
DMS::$dmsFolder = 'dms'; //sneakily setting the DMS folder to the folder where the test file lives
|
DMS::$dmsFolder = DMS_DIR; //sneakily setting the DMS folder to the folder where the test file lives
|
||||||
|
|
||||||
$doc = new DMSDocument();
|
$doc = new DMSDocument();
|
||||||
$doc->Filename = "DMS-test-lorum-file.pdf";
|
$doc->Filename = "DMS-test-lorum-file.pdf";
|
||||||
|
Loading…
Reference in New Issue
Block a user