From 7cfefdb953f84075aede3f77b65d23f3eef9e311 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Tue, 7 Aug 2012 17:11:05 +1200 Subject: [PATCH] ENHANCEMENT: only using special download template when displaying DMSUploadField in getCMSFields of GridField --- code/DMSDocument.php | 1 + code/cms/DMSUploadField.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/DMSDocument.php b/code/DMSDocument.php index 696f1e1..e17bce4 100644 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -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); diff --git a/code/cms/DMSUploadField.php b/code/cms/DMSUploadField.php index 62efe8f..5fab3e2 100644 --- a/code/cms/DMSUploadField.php +++ b/code/cms/DMSUploadField.php @@ -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; }