ENHANCEMENT: using a defined directory for the dms so you can change the directory, if you want

This commit is contained in:
Julian Seidenberg 2012-11-21 10:22:40 +13:00
parent 57063c1c48
commit c72bbefabc
8 changed files with 18 additions and 27 deletions

View File

@ -1,4 +1,6 @@
<?php
define('DMS_DIR', 'dms');
Object::add_extension('SiteTree','DMSSiteTreeExtension');
Object::add_extension('HtmlEditorField_Toolbar','DocumentHtmlEditorFieldToolbar');
CMSMenu::remove_menu_item('DMSDocumentAddController');

View File

@ -23,8 +23,8 @@ class DMS implements DMSInterface {
if (!file_exists($dmsPath . DIRECTORY_SEPARATOR . '.htaccess')) {
//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' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'web.config', $dmsPath . DIRECTORY_SEPARATOR . 'web.config');
copy(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . '.htaccess', $dmsPath . DIRECTORY_SEPARATOR . '.htaccess');
copy(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'web.config', $dmsPath . DIRECTORY_SEPARATOR . 'web.config');
}
return $dms;
}

View File

@ -505,8 +505,8 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
function getCMSFields() {
//include JS to handling showing and hiding of bottom "action" tabs
Requirements::javascript('dms/javascript/DMSDocumentCMSFields.js');
Requirements::css('dms/css/DMSDocumentCMSFields.css');
Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentCMSFields.js');
Requirements::css(DMS_DIR.'/css/DMSDocumentCMSFields.css');
$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
*/
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);
}
if(!Director::fileExists("dms/images/app_icons/{$ext}_32.png")) {
if(!Director::fileExists(DMS_DIR."/images/app_icons/{$ext}_32.png")) {
$ext = "generic";
}
return "dms/images/app_icons/{$ext}_32.png";
return DMS_DIR."/images/app_icons/{$ext}_32.png";
}
/**

View File

@ -26,11 +26,11 @@ class DMSSiteTreeExtension extends DataExtension {
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'
Requirements::javascript('dms/javascript/DMSGridField.js');
Requirements::css('dms/css/DMSMainCMS.css');
Requirements::javascript(DMS_DIR.'/javascript/DMSGridField.js');
Requirements::css(DMS_DIR.'/css/DMSMainCMS.css');
//javascript for the link editor pop-up in TinyMCE
Requirements::javascript("dms/javascript/DocumentHtmlEditorFieldToolbar.js");
Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js");
// Document listing
$gridFieldConfig = GridFieldConfig::create()->addComponents(

View File

@ -8,17 +8,6 @@ class DMSDocumentAddController extends LeftAndMain {
static $menu_title = 'Edit Page';
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
*/
@ -55,7 +44,7 @@ class DMSDocumentAddController extends LeftAndMain {
public function getEditForm($id = null, $fields = null) {
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
Requirements::css('dms/css/DMSMainCMS.css');
Requirements::css(DMS_DIR.'/css/DMSMainCMS.css');
$page = $this->currentPage();

View File

@ -40,8 +40,8 @@ class DMSDocumentAddExistingField extends CompositeField {
}
public function Field($properties = array()) {
Requirements::javascript('dms/javascript/DMSDocumentAddExistingField.js');
Requirements::javascript("dms/javascript/DocumentHtmlEditorFieldToolbar.js");
Requirements::javascript(DMS_DIR.'/javascript/DMSDocumentAddExistingField.js');
Requirements::javascript(DMS_DIR."/javascript/DocumentHtmlEditorFieldToolbar.js");
return $this->renderWith('DMSDocumentAddExistingField');
}

View File

@ -171,10 +171,10 @@ class DMSUploadField extends UploadField {
$useCustomTemplate = $this->getConfig('useDMSReplaceTemplate');
if (!empty($useCustomTemplate)) {
Requirements::block(FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js');
Requirements::javascript('dms/javascript/DMSUploadField_downloadtemplate.js');
Requirements::javascript(DMS_DIR.'/javascript/DMSUploadField_downloadtemplate.js');
} else {
//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;

View File

@ -26,7 +26,7 @@ class DMSEmbargoTest extends SapphireTest {
function testBasicEmbargo() {
$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->Filename = "DMS-test-lorum-file.pdf";