diff --git a/app/Http/Controllers/Publish/EditorController.php b/app/Http/Controllers/Publish/EditorController.php
index e389d98..7cc9f18 100644
--- a/app/Http/Controllers/Publish/EditorController.php
+++ b/app/Http/Controllers/Publish/EditorController.php
@@ -10,6 +10,7 @@ use App\Models\License;
use App\Models\User;
use App\Models\Title;
use App\Models\Description;
+use App\Models\DatasetReference;
use App\Models\Subject;
use App\Models\File;
use Illuminate\Http\RedirectResponse;
@@ -91,7 +92,7 @@ class EditorController extends Controller
public function edit($id): View
{
$dataset = Dataset::findOrFail($id);
- $dataset->load('licenses', 'titles', 'abstracts', 'files', 'coverage', 'subjects');
+ $dataset->load('licenses', 'titles', 'abstracts', 'files', 'coverage', 'subjects', 'references');
$projects = Project::pluck('label', 'id');
@@ -111,10 +112,27 @@ class EditorController extends Controller
$checkeds = $dataset->licenses->pluck('id')->toArray();
$keywordTypes = ['uncontrolled' => 'uncontrolled', 'swd' => 'swd'];
+ $referenceTypes = ["rdr-id", "arXiv", "bibcode", "DOI", "EAN13", "EISSN", "Handle", "IGSN", "ISBN", "ISSN", "ISTC", "LISSN", "LSID", "PMID", "PURL", "UPC", "URL", "URN"];
+ $referenceTypes = array_combine($referenceTypes, $referenceTypes);
+
+ $relationTypes = ["IsCitedBy", "Cites", "IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues", "HasMetadata", "IsMetadataFor","IsNewVersionOf", "IsPreviousVersionOf", "IsPartOf", "HasPart", "IsReferencedBy", "References"];
+ // "IsDocumentedBy", "Documents", "IsCompiledBy", "Compiles", "IsVariantFormOf", "IsOriginalFormOf", "IsIdenticalTo", "IsReviewedBy", "Reviews", "IsDerivedFrom", "IsSourceOf"];
+ $relationTypes = array_combine($relationTypes, $relationTypes);
+
return view(
'workflow.editor.edit',
- compact('dataset', 'projects', 'options', 'checkeds', 'years', 'languages', 'keywordTypes')
+ compact(
+ 'dataset',
+ 'projects',
+ 'options',
+ 'checkeds',
+ 'years',
+ 'languages',
+ 'keywordTypes',
+ 'referenceTypes',
+ 'relationTypes'
+ )
);
}
@@ -180,6 +198,19 @@ class EditorController extends Controller
}
}
+ //save the references:
+ $references = $request->input('references');
+ if (is_array($references) && count($references) > 0) {
+ foreach ($references as $key => $formReference) {
+ $reference = DatasetReference::findOrFail($key);
+ $reference->value = $formReference['value'];
+ $reference->label = $formReference['label'];
+ $reference->type = $formReference['type'];
+ $reference->relation = $formReference['relation'];
+ $reference->save();
+ }
+ }
+
//save the keywords:
$keywords = $request->input('keywords');
if (is_array($keywords) && count($keywords) > 0) {
@@ -314,4 +345,42 @@ class EditorController extends Controller
}
throw new GeneralException(trans('exceptions.publish.review.update_error'));
}
+
+ /**
+ * Display the specified dataset for publishing.
+ *
+ * @param int $id
+ * @return \Illuminate\View\View
+ */
+ public function publish($id): View
+ {
+ $dataset = Dataset::query()
+ ->with([
+ 'titles',
+ 'persons' => function ($query) {
+ $query->wherePivot('role', 'author');
+ }
+ ])->findOrFail($id);
+
+ return view('workflow.editor.publish', [
+ 'dataset' => $dataset,
+ ]);
+ }
+
+ public function publishUpdate(Request $request, $id)
+ {
+ $dataset = Dataset::findOrFail($id);
+ $input = $request->all();
+ $input['server_state'] = 'published';
+ $time = new \Illuminate\Support\Carbon();
+ $input['server_date_published'] = $time;
+
+ if ($dataset->update($input)) {
+ // event(new PageUpdated($page));
+ return redirect()
+ ->route('publish.workflow.publish.index')
+ ->with('flash_message', 'You have successfully published the dataset!');
+ }
+ throw new GeneralException(trans('exceptions.publish.publish.update_error'));
+ }
}
diff --git a/app/Http/Controllers/Publish/PublishController.php b/app/Http/Controllers/Publish/PublishController.php
index 6c9db35..8e3c4d8 100644
--- a/app/Http/Controllers/Publish/PublishController.php
+++ b/app/Http/Controllers/Publish/PublishController.php
@@ -34,42 +34,4 @@ class PublishController extends Controller
'datasets' => $datasets,
]);
}
-
- /**
- * Display the specified dataset for publishing.
- *
- * @param int $id
- * @return \Illuminate\View\View
- */
- public function publish($id): View
- {
- $dataset = Dataset::query()
- ->with([
- 'titles',
- 'persons' => function ($query) {
- $query->wherePivot('role', 'author');
- }
- ])->findOrFail($id);
-
- return view('workflow.publish.publish', [
- 'dataset' => $dataset,
- ]);
- }
-
- public function publishUpdate(Request $request, $id)
- {
- $dataset = Dataset::findOrFail($id);
- $input = $request->all();
- $input['server_state'] = 'published';
- $time = new \Illuminate\Support\Carbon();
- $input['server_date_published'] = $time;
-
- if ($dataset->update($input)) {
- // event(new PageUpdated($page));
- return redirect()
- ->route('publish.workflow.publish.index')
- ->with('flash_message', 'You have successfully published the dataset!');
- }
- throw new GeneralException(trans('exceptions.publish.publish.update_error'));
- }
}
diff --git a/app/Http/Controllers/Publish/SubmitController.php b/app/Http/Controllers/Publish/SubmitController.php
index 25056a4..732df07 100644
--- a/app/Http/Controllers/Publish/SubmitController.php
+++ b/app/Http/Controllers/Publish/SubmitController.php
@@ -76,6 +76,9 @@ class SubmitController extends Controller
if ($dataset->reject_editor_note != null) {
$input['reject_editor_note'] = null;
}
+ if ($dataset->reject_reviewer_note != null) {
+ $input['reject_reviewer_note'] = null;
+ }
if ($dataset->update($input)) {
// event(new PageUpdated($page));
diff --git a/app/Models/Dataset.php b/app/Models/Dataset.php
index 3442919..901a684 100644
--- a/app/Models/Dataset.php
+++ b/app/Models/Dataset.php
@@ -41,7 +41,8 @@ class Dataset extends Model
'preferred_reviewer_email',
'reviewer_id',
'reject_reviewer_note',
- 'reject_editor_note'
+ 'reject_editor_note',
+ 'reviewer_note_visible'
];
//protected $guarded = [];
/**
@@ -301,4 +302,14 @@ class Dataset extends Model
return ($embargoDate->gt($now) == true);
}
+
+ public function getRemainingTimeAttribute()
+ {
+ $dateDiff =$this->server_date_modified->addDays(14);
+ if ($this->server_state == "approved") {
+ return Carbon::now()->diffInDays($dateDiff, false);
+ } else {
+ return 0;
+ }
+ }
}
diff --git a/resources/views/settings/layouts/app.blade.php b/resources/views/settings/layouts/app.blade.php
index 88c5115..3ed79b4 100644
--- a/resources/views/settings/layouts/app.blade.php
+++ b/resources/views/settings/layouts/app.blade.php
@@ -113,17 +113,11 @@
@endpermission
- @permission('dataset-publish-list')
+ {{-- @permission('dataset-publish-list')
- @endpermission
- {{--
- --}}
+ @endpermission --}}
@endrole
diff --git a/resources/views/workflow/editor/_form.blade.php b/resources/views/workflow/editor/_form.blade.php
index 15434c0..7fd53f8 100644
--- a/resources/views/workflow/editor/_form.blade.php
+++ b/resources/views/workflow/editor/_form.blade.php
@@ -186,6 +186,50 @@
+