diff --git a/app/Http/Controllers/Publish/EditorController.php b/app/Http/Controllers/Publish/EditorController.php
index 56756c3..3a3159a 100644
--- a/app/Http/Controllers/Publish/EditorController.php
+++ b/app/Http/Controllers/Publish/EditorController.php
@@ -41,7 +41,9 @@ class EditorController extends Controller
->orWhere(function ($query) use ($user_id) {
$query->where('server_state', 'editor_accepted')
->where('editor_id', $user_id);
- })->get();
+ })
+ ->orderBy('server_state')
+ ->get();
return view('workflow.editor.index', compact('datasets'));
}
diff --git a/app/Http/Controllers/Publish/PublishController.php b/app/Http/Controllers/Publish/PublishController.php
new file mode 100644
index 0000000..6c9db35
--- /dev/null
+++ b/app/Http/Controllers/Publish/PublishController.php
@@ -0,0 +1,75 @@
+middleware('auth');
+ }
+
+ /**
+ * Display a listing of released and accepted datasets.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function index(): View
+ {
+ $user = Auth::user();
+ $userId = $user->id;
+
+ $builder = Dataset::query();
+ //"select * from [documents] where [server_state] in (?) or ([server_state] = ? and [editor_id] = ?)"
+ $datasets = $builder
+ ->where('server_state', 'reviewed')
+
+ ->get();
+ return view('workflow.publish.index', [
+ '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/ReviewController.php b/app/Http/Controllers/Publish/ReviewController.php
index d47a747..9d43810 100644
--- a/app/Http/Controllers/Publish/ReviewController.php
+++ b/app/Http/Controllers/Publish/ReviewController.php
@@ -95,8 +95,6 @@ class ReviewController extends Controller
$attributes = $fieldValue;
$value = "
";
foreach ($attributes as $property_name => $subValue) {
- // $fieldName = $property_name;
- // $fieldval = $subValue;
$value = $value . "" . $property_name . " : " . $subValue . " ";
}
$value = $value . " ";
@@ -118,9 +116,6 @@ class ReviewController extends Controller
public function reviewUpdate(Request $request, $id)
{
$dataset = Dataset::findOrFail($id);
-
-
-
$input = $request->all();
$input['server_state'] = 'reviewed';
@@ -134,7 +129,7 @@ class ReviewController extends Controller
}
//snakeToCamel
- public static function convertColumnToFieldname($columnname)
+ private static function convertColumnToFieldname($columnname)
{
//return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $columnname))));
return ucwords(str_replace(['-', '_'], ' ', $columnname));
diff --git a/app/Http/Controllers/Publish/SubmitController.php b/app/Http/Controllers/Publish/SubmitController.php
index 943c18d..2f680ba 100644
--- a/app/Http/Controllers/Publish/SubmitController.php
+++ b/app/Http/Controllers/Publish/SubmitController.php
@@ -25,7 +25,7 @@ class SubmitController extends Controller
$builder = Dataset::query();
$myDatasets = $builder
- ->orderBy('server_state')
+ ->orderBy('server_state')
->whereIn('server_state', ['inprogress', 'released', 'editor_accepted', 'approved', 'reviewed'])
->where('account_id', $user_id)
->with('user:id,login')
diff --git a/resources/views/settings/layouts/app.blade.php b/resources/views/settings/layouts/app.blade.php
index 7e435b6..6a22e02 100644
--- a/resources/views/settings/layouts/app.blade.php
+++ b/resources/views/settings/layouts/app.blade.php
@@ -113,6 +113,11 @@
@endpermission
+ @permission('dataset-publish-list')
+
+ @endpermission
{{--
diff --git a/resources/views/workflow/publish/index.blade.php b/resources/views/workflow/publish/index.blade.php
new file mode 100644
index 0000000..53de128
--- /dev/null
+++ b/resources/views/workflow/publish/index.blade.php
@@ -0,0 +1,78 @@
+@extends('settings.layouts.app')
+@section('content')
+
+
+
+
+
+
+
+ Dataset Title
+ ID
+ Server State
+ Editor
+ Reviewer
+
+
+
+
+ @foreach($datasets as $dataset)
+ @php
+ //if userid changed from last iteration, store new userid and change color
+ // $lastid = $detail->payment->userid;
+ if ($dataset->server_state == 'editor_accepted') {
+ $rowclass = 'editor_accepted';
+ } elseif ($dataset->server_state == 'released') {
+ $rowclass = 'released';
+ }
+ @endphp
+
+
+ @if ($dataset->titles()->first())
+ {{ $dataset->titles()->first()->value }}
+ @else
+ no title
+ @endif
+
+
+ {{ $dataset->id }}
+
+
+ {{ $dataset->server_state }}
+
+
+
+ {{ optional($dataset->editor)->login }}
+
+
+
+ {{ optional($dataset->reviewer)->login }}
+
+
+
+
+ @if ($dataset->server_state == "reviewed")
+
+
+ Publish
+
+ @endif
+
+ {{--
+ @if ($dataset->server_state == "unpublished")
+ Publish
+ @endif
+ --}}
+
+ @endforeach
+
+
+
+
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/workflow/publish/publish.blade.php b/resources/views/workflow/publish/publish.blade.php
new file mode 100644
index 0000000..d5972e0
--- /dev/null
+++ b/resources/views/workflow/publish/publish.blade.php
@@ -0,0 +1,85 @@
+@extends('settings.layouts.app')
+@section('content')
+
+
+
+
+
+
+
+
+ {!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.publish.publishUpdate', $dataset->id],
+ 'id' => 'publishForm', 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm'])
+ !!}
+
+
+
+ Selected Dataset
+
+
+
+ {{ $dataset->id }}
+
+ @foreach($dataset->titles as $title)
+
+ {{ $title->value }}
+
+ @endforeach
+
+ @foreach($dataset->persons as $author)
+
+ {{ $author->full_name }}
+
+ @endforeach
+
+
+
+
+
+
+
+ Are you sure you want to accept the selected dataset?
+
+
+
+
+
+
+ {{--
+
+
+ Set published
+
+
--}}
+
+ {!! Form::close() !!}
+
+
+
+
+
+
+@stop
+@section('after-scripts')
+@stop
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index a289de8..f374399 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -116,6 +116,20 @@ Route::group(
'as' => 'workflow.review.reviewUpdate', 'uses' => 'ReviewController@reviewUpdate',
]);
+ //publisher
+ Route::get('workflow/publish/index', [
+ 'middleware' => ['permission:dataset-publish-list'],
+ 'as' => 'workflow.publish.index', 'uses' => 'PublishController@index',
+ ]);
+ Route::get('workflow/publish/{id}', [
+ 'middleware' => ['permission:dataset-publish'],
+ 'as' => 'workflow.publish.publish', 'uses' => 'PublishController@publish',
+ ]);
+ Route::post('workflow/review/{id}', [
+ 'middleware' => ['permission:dataset-publish'],
+ 'as' => 'workflow.publish.publishUpdate', 'uses' => 'PublishController@publishUpdate',
+ ]);
+
Route::get('workflow/changestate/{id}/changestate/{targetState}', [
'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
]);