From 28a38da865c8860d77de69234034c9e3c6521df0 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Thu, 10 Jun 2021 16:15:01 +0200 Subject: [PATCH] - doi url for dc:identifier - readonly keywords with id for editor and submitter for edit forms --- .../Controllers/Oai/RequestController.php | 1 + .../Controllers/Publish/EditorController.php | 20 ++++++++++++------- .../Controllers/Publish/SubmitController.php | 19 +++++++++++------- public/datasetxml2oai-pmh.xslt | 10 ++++++++++ .../views/workflow/editor/_form.blade.php | 2 +- .../views/workflow/submitter/_form.blade.php | 2 +- 6 files changed, 38 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/Oai/RequestController.php b/app/Http/Controllers/Oai/RequestController.php index 4dea1da..25e545b 100644 --- a/app/Http/Controllers/Oai/RequestController.php +++ b/app/Http/Controllers/Oai/RequestController.php @@ -125,6 +125,7 @@ class RequestController extends Controller $this->proc->setParameter('', 'baseURL', url('/') . $uri[0]); $this->proc->setParameter('', 'repURL', url('/')); $this->proc->setParameter('', 'downloadLink', url('/') . '/file/download/'); + $this->proc->setParameter('', 'doiLink', 'https://doi.org/'); // $resumptionPath = $this->configuration->getResumptionTokenPath(); diff --git a/app/Http/Controllers/Publish/EditorController.php b/app/Http/Controllers/Publish/EditorController.php index 6b9a647..32a2e09 100644 --- a/app/Http/Controllers/Publish/EditorController.php +++ b/app/Http/Controllers/Publish/EditorController.php @@ -386,15 +386,21 @@ class EditorController extends Controller if (is_array($keywords) && count($keywords) > 0) { foreach ($keywords as $key => $formKeyword) { if (isset($formKeyword['id'])) { + // is readonly $subject = Subject::findOrFail($formKeyword['id']); - $subject->value = $formKeyword['value']; - $subject->type = $formKeyword['type']; - if ($subject->isDirty()) { - $subject->save(); - } + // $subject->value = $formKeyword['value']; + // $subject->type = $formKeyword['type']; + // if ($subject->isDirty()) { + // $subject->save(); + // } } else { - $subject = new Subject($formKeyword); - $dataset->subjects()->save($subject); + // $subject = new Subject($formKeyword); + // $dataset->subjects()->save($subject); + $keyword = Subject::firstOrCreate( + ['value' => $formKeyword['value'], 'language' => $formKeyword['language']], + $formKeyword + ); + $dataset->subjects()->attach($keyword); } } } diff --git a/app/Http/Controllers/Publish/SubmitController.php b/app/Http/Controllers/Publish/SubmitController.php index 58780c9..040feef 100644 --- a/app/Http/Controllers/Publish/SubmitController.php +++ b/app/Http/Controllers/Publish/SubmitController.php @@ -317,14 +317,19 @@ class SubmitController extends Controller foreach ($keywords as $key => $formKeyword) { if (isset($formKeyword['id'])) { $subject = Subject::findOrFail($formKeyword['id']); - $subject->value = $formKeyword['value']; - $subject->type = $formKeyword['type']; - if ($subject->isDirty()) { - $subject->save(); - } + // $subject->value = $formKeyword['value']; + // $subject->type = $formKeyword['type']; + // if ($subject->isDirty()) { + // $subject->save(); + // } } else { - $subject = new Subject($formKeyword); - $dataset->subjects()->save($subject); + // $subject = new Subject($formKeyword); + // $dataset->subjects()->save($subject); + $keyword = Subject::firstOrCreate( + ['value' => $formKeyword['value'], 'language' => $formKeyword['language']], + $formKeyword + ); + $dataset->subjects()->attach($keyword); } } } diff --git a/public/datasetxml2oai-pmh.xslt b/public/datasetxml2oai-pmh.xslt index f62274c..bcf8f34 100644 --- a/public/datasetxml2oai-pmh.xslt +++ b/public/datasetxml2oai-pmh.xslt @@ -24,6 +24,7 @@ + @@ -370,6 +371,9 @@ + + + @@ -561,6 +565,12 @@ + + + + + + diff --git a/resources/views/workflow/editor/_form.blade.php b/resources/views/workflow/editor/_form.blade.php index 8aaf968..05268c8 100644 --- a/resources/views/workflow/editor/_form.blade.php +++ b/resources/views/workflow/editor/_form.blade.php @@ -546,7 +546,7 @@ - {{-- {{ Form::text('keywords['.$keyword->id.'][value]', $keyword->value, ['class' => 'form-control', 'placeholder' => '[KEYWORD VALUE]']) }} --}} diff --git a/resources/views/workflow/submitter/_form.blade.php b/resources/views/workflow/submitter/_form.blade.php index 44424ab..be2856e 100644 --- a/resources/views/workflow/submitter/_form.blade.php +++ b/resources/views/workflow/submitter/_form.blade.php @@ -542,7 +542,7 @@ - {{-- {{ Form::text('keywords['.$keyword->id.'][value]', $keyword->value, ['class' => 'form-control', 'placeholder' => '[KEYWORD VALUE]']) }} --}}