diff --git a/lib/Controller/PublicationsController.php b/lib/Controller/PublicationsController.php index 68e34e0b..879dd590 100644 --- a/lib/Controller/PublicationsController.php +++ b/lib/Controller/PublicationsController.php @@ -330,6 +330,8 @@ public function update(string|int $id, ObjectService $objectService, ElasticSear } + $this->createPublicationFile(objectService: $objectService, publication: $returnData); + // get post from requests return new JSONResponse($returnData); } @@ -439,11 +441,15 @@ public function createPublicationFile(ObjectService $objectService, ?array $publ // Save the uploaded file $filePath = "Publicaties/$publicationFolder/$filename"; + $this->fileService->deleteFile(filePath: $filePath); $created = $this->fileService->uploadFile( content: file_get_contents(filename: $filename), filePath: $filePath ); + // Todo: +// return $this->fileService->createShareLink(path: $filePath); + if ($created === false) { // return new JSONResponse(data: ['error' => "Failed to upload file. This file: $filePath might already exist"], statusCode: 400); return false; diff --git a/lib/Templates/publication.html.twig b/lib/Templates/publication.html.twig index cae00e9e..31e98837 100644 --- a/lib/Templates/publication.html.twig +++ b/lib/Templates/publication.html.twig @@ -4,7 +4,14 @@
Referentie: {{ publication.reference }}
Samenvatting: {{ publication.summary }}
Beschrijving: {{ publication.description }}
-Key | Value | diff --git a/src/dialogs/publication/ArchivePublicationDialog.vue b/src/dialogs/publication/ArchivePublicationDialog.vue index 0adfd4cd..733773e0 100644 --- a/src/dialogs/publication/ArchivePublicationDialog.vue +++ b/src/dialogs/publication/ArchivePublicationDialog.vue @@ -68,6 +68,9 @@ export default { ArchivePublication() { this.loading = true publicationStore.publicationItem.status = 'archived' + publicationStore.publicationItem.catalogi = publicationStore.publicationItem?.catalogi?.id?.toString() + publicationStore.publicationItem.metaData = publicationStore.publicationItem?.metaData?.id?.toString() + fetch( `/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`, { diff --git a/src/dialogs/publication/DepublishPublicationDialog.vue b/src/dialogs/publication/DepublishPublicationDialog.vue index 7426a657..3f9dad51 100644 --- a/src/dialogs/publication/DepublishPublicationDialog.vue +++ b/src/dialogs/publication/DepublishPublicationDialog.vue @@ -69,6 +69,9 @@ export default { this.loading = true publicationStore.publicationItem.status = 'retracted' publicationStore.publicationItem.published = '' + publicationStore.publicationItem.catalogi = publicationStore.publicationItem?.catalogi?.id?.toString() + publicationStore.publicationItem.metaData = publicationStore.publicationItem?.metaData?.id?.toString() + fetch( `/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`, { diff --git a/src/dialogs/publication/PublishPublicationDialog.vue b/src/dialogs/publication/PublishPublicationDialog.vue index b33e6616..f664a9d2 100644 --- a/src/dialogs/publication/PublishPublicationDialog.vue +++ b/src/dialogs/publication/PublishPublicationDialog.vue @@ -68,6 +68,9 @@ export default { PublishPublication() { this.loading = true publicationStore.publicationItem.status = 'published' + publicationStore.publicationItem.catalogi = publicationStore.publicationItem?.catalogi?.id?.toString() + publicationStore.publicationItem.metaData = publicationStore.publicationItem?.metaData?.id?.toString() + fetch( `/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`, { diff --git a/src/dialogs/publicationData/DeletePublicationDataDialog.vue b/src/dialogs/publicationData/DeletePublicationDataDialog.vue index 70a4e9c5..d4f7fa1b 100644 --- a/src/dialogs/publicationData/DeletePublicationDataDialog.vue +++ b/src/dialogs/publicationData/DeletePublicationDataDialog.vue @@ -67,6 +67,9 @@ export default { methods: { DeleteProperty() { const publication = publicationStore.publicationItem + publication.catalogi = publication.catalogi?.id?.toString() + publication.metaData = publication.metaData?.id?.toString() + delete publication?.data[publicationStore.publicationDataKey] this.loading = true diff --git a/src/modals/publication/EditPublicationModal.vue b/src/modals/publication/EditPublicationModal.vue index 6f1674ba..787364f2 100644 --- a/src/modals/publication/EditPublicationModal.vue +++ b/src/modals/publication/EditPublicationModal.vue @@ -183,6 +183,8 @@ export default { body: JSON.stringify({ ...this.publicationItem, id: this.publicationItem.id.toString(), + catalogi: this.publicationItem.catalogi?.id?.toString(), + metaData: this.publicationItem.metaData?.id?.toString() }), }, ) diff --git a/src/modals/publicationData/AddPublicationDataModal.vue b/src/modals/publicationData/AddPublicationDataModal.vue index 627f367b..1a35e02b 100644 --- a/src/modals/publicationData/AddPublicationDataModal.vue +++ b/src/modals/publicationData/AddPublicationDataModal.vue @@ -91,6 +91,9 @@ export default { const bodyData = publicationStore.publicationItem bodyData.data[this.key] = this.value delete bodyData.publicationDate + bodyData.catalogi = bodyData?.catalogi?.id?.toString() + bodyData.metaData = bodyData?.metaData?.id?.toString() + fetch( `/index.php/apps/opencatalogi/api/publications/${publicationStore.publicationItem.id}`, { diff --git a/src/modals/publicationData/EditPublicationDataModal.vue b/src/modals/publicationData/EditPublicationDataModal.vue index b2b66126..eefbb795 100644 --- a/src/modals/publicationData/EditPublicationDataModal.vue +++ b/src/modals/publicationData/EditPublicationDataModal.vue @@ -112,8 +112,8 @@ export default { response.json().then((data) => { this.publication = data // this.publication.data = JSON.stringify(data.data) - this.catalogi.value = [data.catalogi] - this.metaData.value = [data.metaData] + this.catalogi.value = [data.catalogi?.id] + this.metaData.value = [data.metaData?.id] }) this.publicationLoading = false }) @@ -183,6 +183,8 @@ export default { body: JSON.stringify({ ...publicationStore.publicationItem, id: publicationStore.publicationItem.id.toString(), + catalogi: publicationStore.publicationItem?.catalogi?.id?.toString(), + metaData: publicationStore.publicationItem?.metaData?.id?.toString(), }), }, ) diff --git a/src/views/publications/PublicationDetail.vue b/src/views/publications/PublicationDetail.vue index 83c99954..ca4fb24f 100644 --- a/src/views/publications/PublicationDetail.vue +++ b/src/views/publications/PublicationDetail.vue @@ -447,8 +447,8 @@ export default { handler(newPublicationItem, oldPublicationItem) { if (!this.upToDate || JSON.stringify(newPublicationItem) !== JSON.stringify(oldPublicationItem)) { this.publication = publicationStore.publicationItem - this.fetchCatalogi(publicationStore.publicationItem.catalogi?.id) - this.fetchMetaData(publicationStore.publicationItem.metaData?.id) + this.fetchCatalogi(this.publication.catalogi?.id) + this.fetchMetaData(this.publication.metaData?.id) publicationStore.publicationItem && this.fetchData(publicationStore.publicationItem.id) } }, @@ -460,8 +460,8 @@ export default { this.publication = publicationStore.publicationItem - this.fetchCatalogi(publicationStore.publicationItem.catalogi?.id, true) - this.fetchMetaData(publicationStore.publicationItem.metaData?.id, true) + this.fetchCatalogi(this.publication.catalogi?.id, true) + this.fetchMetaData(this.publication.metaData?.id, true) publicationStore.publicationItem && this.fetchData(publicationStore.publicationItem.id) },
---|