mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Disabled metadata upload in AssetAdmin by default, configurable through AssetAdmin::$metadata_upload_enabled. Feature needs UI review. (from r101106)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111636 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
da16a507ae
commit
c49b38f615
@ -34,6 +34,15 @@ class AssetAdmin extends LeftAndMain {
|
|||||||
'BatchActionsForm'
|
'BatchActionsForm'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean Enables upload of additional textual information
|
||||||
|
* alongside each file (through multifile.js), which makes
|
||||||
|
* batch changes easier.
|
||||||
|
*
|
||||||
|
* CAUTION: This is an unstable API which might change.
|
||||||
|
*/
|
||||||
|
public static $metadata_upload_enabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
* Return fake-ID "root" if no ID is found (needed to upload files into the root-folder)
|
||||||
*/
|
*/
|
||||||
@ -99,9 +108,13 @@ JS
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Needs to be enabled through {@link AssetAdmin::$metadata_upload_enabled}
|
||||||
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
function UploadMetadataHtml() {
|
function UploadMetadataHtml() {
|
||||||
|
if(!self::$metadata_upload_enabled) return;
|
||||||
|
|
||||||
$fields = singleton('File')->uploadMetadataFields();
|
$fields = singleton('File')->uploadMetadataFields();
|
||||||
|
|
||||||
// Return HTML with markers for easy replacement
|
// Return HTML with markers for easy replacement
|
||||||
@ -217,7 +230,7 @@ JS
|
|||||||
if($valid) {
|
if($valid) {
|
||||||
$newFile = $folder->addUploadToFolder($tmpFile);
|
$newFile = $folder->addUploadToFolder($tmpFile);
|
||||||
|
|
||||||
if (isset($processedData[$filePostId])) {
|
if(self::$metadata_upload_enabled && isset($processedData[$filePostId])) {
|
||||||
$fileObject = DataObject::get_by_id('File', $newFile);
|
$fileObject = DataObject::get_by_id('File', $newFile);
|
||||||
$metadataForm = new Form($this, 'MetadataForm', $fileObject->uploadMetadataFields(), new FieldSet());
|
$metadataForm = new Form($this, 'MetadataForm', $fileObject->uploadMetadataFields(), new FieldSet());
|
||||||
$metadataForm->loadDataFrom($processedData[$filePostId]);
|
$metadataForm->loadDataFrom($processedData[$filePostId]);
|
||||||
|
@ -21,9 +21,11 @@
|
|||||||
<body>
|
<body>
|
||||||
<% if CanUpload %>
|
<% if CanUpload %>
|
||||||
$UploadForm
|
$UploadForm
|
||||||
<div id="metadataFormTemplate" style="display:none">
|
<% if UploadMetadataHtml %>
|
||||||
$UploadMetadataHtml
|
<div id="metadataFormTemplate" style="display:none">
|
||||||
</div>
|
$UploadMetadataHtml
|
||||||
|
</div>
|
||||||
|
<% end_if %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% _t('PERMFAILED','You do not have permission to upload files into this folder.') %>
|
<% _t('PERMFAILED','You do not have permission to upload files into this folder.') %>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
4
thirdparty/multifile/multifile.css
vendored
4
thirdparty/multifile/multifile.css
vendored
@ -69,14 +69,14 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#Form_UploadForm_FilesList div {
|
#Form_UploadForm_FilesList .fileBox {
|
||||||
width: auto;
|
width: auto;
|
||||||
border: 1px solid #F1EFE2;
|
border: 1px solid #F1EFE2;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#Form_UploadForm_FilesList div .delete:hover {
|
#Form_UploadForm_FilesList .fileBox .delete:hover {
|
||||||
background: red;
|
background: red;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
2
thirdparty/multifile/multifile.js
vendored
2
thirdparty/multifile/multifile.js
vendored
@ -215,7 +215,7 @@ function MultiSelector( list_target, max, upload_button ){
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultiSelectorObserver.subscribe('onBeforeCreateRow', function(data) {
|
MultiSelectorObserver.subscribe('onBeforeCreateRow', function(data) {
|
||||||
if (jQuery('#metadataFormTemplate')) {
|
if (jQuery('#metadataFormTemplate').length) {
|
||||||
var parameters = jQuery('#metadataFormTemplate').clone(true);
|
var parameters = jQuery('#metadataFormTemplate').clone(true);
|
||||||
parameters.get(0).id = '';
|
parameters.get(0).id = '';
|
||||||
parameters.find(":input[name!='']").each(function(i) { this.name = this.name.replace(/__X__/g, data[0]); });
|
parameters.find(":input[name!='']").each(function(i) { this.name = this.name.replace(/__X__/g, data[0]); });
|
||||||
|
Loading…
Reference in New Issue
Block a user