diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 7f9dce4..8fc7e5b 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -95,7 +95,14 @@ final class ApiController extends Controller */ public function apiMediaUpload(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - // todo: this is really messy because i don't use formdata object. media first get's uploaded but nothing is done with the form data + /** + * @todo Orange-Management/Modules#202 + * Consider to use FormData + * Form data is currently submitted in two steps if it contains media files. + * 1. Upload media data + * 2. Submit form data + * Consider to use `FormData` in order to submit media files and form data at the same time. + */ $uploads = $this->uploadFiles( $request->getData('name') ?? '', $request->getFiles(), diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 3673c39..3257827 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -115,6 +115,11 @@ final class BackendController extends Controller * * @return RenderableInterface * + * @todo Orange-Management/Modules#208 + * Improve the media list + * 1. Collections should show their content + * 2. The first page should show an overview (Modules, Users, ...?) + * * @since 1.0.0 * @codeCoverageIgnore */ @@ -139,6 +144,11 @@ final class BackendController extends Controller * * @return RenderableInterface * + * @todo Orange-Management/Modules#208 + * Improve the media list + * 1. Collections should show their content + * 2. The first page should show an overview (Modules, Users, ...?) + * * @since 1.0.0 * @codeCoverageIgnore */ @@ -156,10 +166,6 @@ final class BackendController extends Controller ); $view->setTemplate('/Modules/Media/Theme/Backend/media-list'); - - // todo: currently the $media list only contains elements from the path but it should also include all - // the collection elements which might be the same but maybe some are not in the same virtualPath!!! - // the *unique* merge should be done through the ids! } $view->addData('media', $media); diff --git a/Models/Upload.js b/Models/Upload.js index 617f4c7..ed91fea 100644 --- a/Models/Upload.js +++ b/Models/Upload.js @@ -139,12 +139,28 @@ export class Upload { return this.files.length; }; - // todo: maybe do file upload together with data upload in FormData. - // let the module forward the files to the media module?! + /** + * Upload data from form + * + * @param {string} formId Form id + * + * @return {void} + * + * @todo Orange-Management/Modules#202 + * Consider to use FormData + * Form data is currently submitted in two steps if it contains media files. + * 1. Upload media data + * 2. Submit form data + * Consider to use `FormData` in order to submit media files and form data at the same time. + * + * @since 1.0.0 + */ upload (formId) { - // TODO: validate file type + file size - + /** + * @todo Orange-Management/Modules#207 + * Validate file type and file size on the frontend before uploading + */ const request = new Request(), formData = new FormData(), self = this; diff --git a/Models/UploadFile.php b/Models/UploadFile.php index 366d72a..0fbacd9 100644 --- a/Models/UploadFile.php +++ b/Models/UploadFile.php @@ -117,7 +117,6 @@ class UploadFile $result[$key]['status'] = UploadStatus::OK; if (!isset($f['error'])) { - // TODO: handle wrong parameters $result[$key]['status'] = UploadStatus::WRONG_PARAMETERS; return $result; @@ -135,7 +134,6 @@ class UploadFile return $result; } - // TODO: do I need pecl fileinfo? if (!empty($this->allowedTypes) && ($ext = \array_search($f['type'], $this->allowedTypes, true)) === false) { $result[$key]['status'] = UploadStatus::WRONG_EXTENSION; @@ -206,12 +204,27 @@ class UploadFile $result[$key]['nonce'] = $nonce; } + /** + * @todo Orange-Management/Modules#203 + * Automatically enable image interlacing + * Interlacing png images currently messes up the images. + */ /* if ($this->isInterlaced && \in_array($extension, FileUtils::IMAGE_EXTENSION)) { - // todo: interlacing somehow messes up some images (tested with logo.png from assets) //$this->interlace($extension, $dest); } + */ + /** + * @todo Orange-Management/Modules#204 + * Automatically change the file encoding of text files + * Basic text files should be converted to utf-8. E.g. + * * csv + * * log + * * txt + * * ... + */ + /* if ($encoding !== '') { // changing encoding bugs out image files //FileUtils::changeFileEncoding($dest, $encoding);