ENHANCEMENT: only using special download template when displaying DMSUploadField in getCMSFields of GridField

This commit is contained in:
Julian Seidenberg 2012-08-07 17:11:05 +12:00
parent e682125a03
commit 7cfefdb953
2 changed files with 5 additions and 2 deletions

View File

@ -449,6 +449,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
//create upload field to replace document
$uploadField = new DMSUploadField('ReplaceFile', 'Replace file');
$uploadField->setConfig('allowedMaxFileNumber', 1);
$uploadField->setConfig('useDMSReplaceTemplate', 1);
$uploadField->setRecord($this);

View File

@ -164,8 +164,10 @@ class DMSUploadField extends UploadField {
$fields = parent::Field($properties);
//replace the download template with a new one
Requirements::block(FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js');
Requirements::javascript('dms/javascript/DMSUploadField_downloadtemplate.js');
if (!empty($this->getConfig('useDMSReplaceTemplate'))) {
Requirements::block(FRAMEWORK_DIR . '/javascript/UploadField_downloadtemplate.js');
Requirements::javascript('dms/javascript/DMSUploadField_downloadtemplate.js');
}
return $fields;
}