Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 2 additions & 36 deletions config/app_local.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,54 +666,20 @@

/**
* Upload configurations.
*
* 'files' and 'media' accept all mimes, so no configuration needed.
*/
// 'uploadAccepted' => [
// 'audio' => [
// 'audio/*',
// ],
// 'files' => [
// 'application/msword', // .doc, .dot
// 'application/pdf', // .pdf
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // .docx
// 'application/vnd.ms-excel', // .xls, .xlt, .xla
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx
// 'application/vnd.ms-powerpoint', // .ppt, .pot, .pps, .ppa
// 'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx
// 'application/x-mpegURL',
// 'audio/*',
// 'text/csv',
// 'text/html',
// 'text/plain',
// 'text/rtf',
// 'text/xml',
// 'image/*',
// 'video/*',
// ],
// 'images' => [
// 'image/*',
// ],
// 'videos' => [
// 'application/x-mpegURL',
// 'video/*',
// ],
// 'media' => [
// 'application/msword', // .doc, .dot
// 'application/pdf', // .pdf
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // .docx
// 'application/vnd.ms-excel', // .xls, .xlt, .xla
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx
// 'application/vnd.ms-powerpoint', // .ppt, .pot, .pps, .ppa
// 'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx
// 'application/x-mpegURL',
// 'audio/*',
// 'image/*',
// 'text/csv',
// 'text/html',
// 'text/plain',
// 'text/rtf',
// 'text/xml',
// 'video/*',
// ],
// ],
// 'uploadForbidden' => [
// 'mimetypes' => [
Expand Down
7 changes: 4 additions & 3 deletions resources/js/app/helpers/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default {
},

acceptMimeTypes(type) {
if (!BEDITA.uploadConfig?.accepted?.[type]) {
if (['files', 'media'].includes(type) || !BEDITA.uploadConfig?.accepted?.[type]) {
return '';
}

Expand Down Expand Up @@ -198,8 +198,9 @@ export default {

/** accepted mime types check */
const mimes = BEDITA.uploadConfig?.accepted;
if (mimes?.[objectType] && !this.checkAcceptedMime(mimes[objectType], fileType)) {
const msg = t`File type not accepted` + `: "${fileType}". ` + t`Accepted types` + `: "${mimes[objectType].join('", "')}".`;
const ot = objectType === 'media' ? this.getObjectTypeFromMime(fileType) : objectType;
if (ot !== 'files' && mimes?.[ot] && !this.checkAcceptedMime(mimes[ot], fileType)) {
const msg = t`File type not accepted` + `: "${fileType}". ` + t`Accepted types` + `: "${mimes[ot].join('", "')}".`;
BEDITA.warning(msg);

return false;
Expand Down
6 changes: 0 additions & 6 deletions src/View/Helper/SystemHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ class SystemHelper extends Helper
'application/x-mpegURL',
'video/*',
],
'media' => [
'application/x-mpegURL',
'audio/*',
'image/*',
'video/*',
],
];

/**
Expand Down
2 changes: 2 additions & 0 deletions templates/Element/Form/dropupload.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{# :accepted-drop="[`.from-relation-${relationName}`,isRelationWithMedia && 'from-files']"> #}
{% set ot = objectTypes|length == 1 ? objectTypes[0] : 'media' %}
<drop-upload
:object-type="{{ ot|json_encode }}"
placeholder="{{ __('Click or drop new files here') }}"
@new-relations="appendRelations"
v-if="isRelationWithMedia"
Expand Down
4 changes: 3 additions & 1 deletion templates/Element/Form/relation.twig
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@
</div>
<div class="mt-5">
{% if uploadableNum %}
{{ element(Element.dropupload(relationsSchema[relationName]['right'])) }}
{{ element(Element.dropupload(relationsSchema[relationName]['right']), {
'objectTypes': relationsSchema[relationName]['right']
}) }}
{% endif %}
<div>
<button v-if="isPanelOpen({{object.id|json_encode}})" @click.prevent.stop="closePanel()">
Expand Down
Loading