diff --git a/Admin/Install/Media.install.json b/Admin/Install/Media.install.json new file mode 100644 index 0000000..6558de2 --- /dev/null +++ b/Admin/Install/Media.install.json @@ -0,0 +1,9 @@ +[ + { + "type": "collection", + "create_directory": true, + "name": "Comments", + "virtualPath": "/Modules", + "user": 1 + } +] \ No newline at end of file diff --git a/Admin/Install/Media.php b/Admin/Install/Media.php new file mode 100644 index 0000000..9bf581f --- /dev/null +++ b/Admin/Install/Media.php @@ -0,0 +1,43 @@ + __DIR__ . '/Media.install.json']); + } +} diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 3be94a1..2e38f5c 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -182,6 +182,20 @@ final class ApiController extends Controller $comment->setRef($request->getData('ref') !== null ? (int) $request->getData('ref') : null); $comment->setList((int) ($request->getData('list') ?? 0)); + if (!empty($uploadedFiles = $request->getFiles() ?? [])) { + $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( + [''], + $uploadedFiles, + $request->header->account, + __DIR__ . '/../../../Modules/Media/Files/Modules/Comments', + '/Modules/Comments', + ); + + foreach ($uploaded as $media) { + $comment->addMedia($media); + } + } + return $comment; } diff --git a/Docs/Dev/img/er.png b/Docs/Dev/img/er.png new file mode 100644 index 0000000..d328e3c Binary files /dev/null and b/Docs/Dev/img/er.png differ diff --git a/Theme/Backend/Components/Comment/list.tpl.php b/Theme/Backend/Components/Comment/list.tpl.php index db63edd..dddb219 100755 --- a/Theme/Backend/Components/Comment/list.tpl.php +++ b/Theme/Backend/Components/Comment/list.tpl.php @@ -57,11 +57,13 @@ foreach ($comments as $comment) : ?>
-
- content; ?> -
+
content; ?>
+ getMedia(); foreach ($files as $file) : ?> + printHtml($file->name); ?> + + printHtml( \sprintf('%3$s %2$s %1$s', $comment->createdBy->name1, $comment->createdBy->name2, $comment->createdBy->name3) ); ?> diff --git a/info.json b/info.json index bde3394..a290875 100755 --- a/info.json +++ b/info.json @@ -21,6 +21,7 @@ "Editor": "1.0.0" }, "providing": { + "Media": "1.0.0" }, "load": [ ]