publication workflow: review

This commit is contained in:
Arno Kaimbacher 2019-04-11 18:52:10 +02:00
parent 5df9b0beef
commit ad982a1ac5
26 changed files with 724 additions and 161 deletions

View File

@ -0,0 +1,219 @@
<?php
namespace App\Http\Controllers\Publish;
use App\Exceptions\GeneralException;
use App\Http\Requests\DocumentRequest;
use App\Http\Controllers\Controller;
use App\Models\Dataset;
use App\Models\Project;
use App\Models\License;
use App\Models\User;
use App\Models\Title;
use App\Models\Description;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use Illuminate\Support\Facades\DB;
class EditorController extends Controller
{
public function __construct()
{
//$this->middleware('auth');
}
/**
* Display a listing of released and accepted datasets.
*
* @return \Illuminate\Http\Response
*/
public function index(): View
{
$user = Auth::user();
$user_id = $user->id;
$builder = Dataset::query();
//"select * from [documents] where [server_state] in (?) or ([server_state] = ? and [editor_id] = ?)"
$datasets = $builder
->where('server_state', 'released')
// ->whereIn('server_state', ['released'])
->orWhere(function ($query) use ($user_id) {
$query->where('server_state', 'editor_accepted')
->where('editor_id', $user_id);
})->get();
return view('workflow.editor.index', compact('datasets'));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function accept($id): View
{
$dataset = Dataset::with('user:id,login')->findOrFail($id);
return view('workflow.editor.accept', [
'dataset' => $dataset,
]);
}
public function acceptUpdate(Request $request, $id)
{
$dataset = Dataset::findOrFail($id);
try {
$dataset->setServerState("editor_accepted");
$user = Auth::user();
$dataset->editor()->associate($user)->save();
$dataset->save();
// return redirect()->back();
return redirect()->route('publish.workflow.editor.index');
} catch (Exception $e) {
throw new GeneralException(trans('exceptions.publish.accept.update_error'));
}
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id): View
{
$dataset = Dataset::findOrFail($id);
$dataset->load('licenses', 'titles', 'abstracts', 'files');
$projects = Project::pluck('label', 'id');
$datum = date('Y-m-d');
$nowYear = substr($datum, 0, 4);
$years = array();
for ($jahr = 1990; $jahr <= $nowYear; $jahr++) {
$years[$jahr] = $jahr;
}
$languages = DB::table('languages')
->where('active', true)
->pluck('part1', 'part1');
//$options = License::all();
$options = License::all('id', 'name_long');
$checkeds = $dataset->licenses->pluck('id')->toArray();
return view(
'workflow.editor.edit',
compact('dataset', 'projects', 'options', 'checkeds', 'years', 'languages')
);
}
//https://stackoverflow.com/questions/17480200/using-laravel-how-do-i-create-a-view-that-will-update-a-one-to-many-relationshi?rq=1
// https://laravel.io/forum/06-11-2014-how-to-save-eloquent-model-with-relations-in-one-go
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(DocumentRequest $request, $id): RedirectResponse
{
$dataset = Dataset::findOrFail($id);
//$input = $request->all();
$input = $request->except('abstracts', 'licenses', 'titles', '_method', '_token');
// foreach ($input as $key => $value) {
// $dataset[$key] = $value;
// }
//$dataset->update($input);
// $dataset->type = $input['type'];
// $dataset->thesis_year_accepted = $input['thesis_year_accepted'];
// $dataset->project_id = $input['project_id'];
// $dataset->save();
$licenses = $request->input('licenses');
//$licenses = $input['licenses'];
$dataset->licenses()->sync($licenses);
//save the titles:
$titles = $request->input('titles');
if (is_array($titles) && count($titles) > 0) {
foreach ($titles as $key => $formTitle) {
$title = Title::findOrFail($key);
$title->value = $formTitle['value'];
$title->language = $formTitle['language'];
$title->save();
}
}
//save the abstracts:
$abstracts = $request->input('abstracts');
if (is_array($abstracts) && count($abstracts) > 0) {
foreach ($abstracts as $key => $formAbstract) {
$abstract = Description::findOrFail($key);
$abstract->value = $formAbstract['value'];
$abstract->language = $formAbstract['language'];
$abstract->save();
}
}
if (!$dataset->isDirty(dataset::UPDATED_AT)) {
$time = new \Illuminate\Support\Carbon();
$dataset->setUpdatedAt($time);
}
// $dataset->save();
if ($dataset->update($input)) {
//event(new DatasetUpdated($dataset));
session()->flash('flash_message', 'You have updated 1 dataset!');
return redirect()->route('publish.workflow.editor.index');
}
throw new GeneralException(trans('exceptions.backend.dataset.update_error'));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function approve($id): View
{
$dataset = Dataset::with('user:id,login')->findOrFail($id);
$reviewers = User::whereHas('roles', function ($q) {
$q->where('name', 'reviewer');
})->pluck('login', 'id');
return view('workflow.editor.approve', [
'dataset' => $dataset,
'reviewers' => $reviewers,
]);
}
public function approveUpdate(Request $request, $id)
{
// $dataset = Dataset::findOrFail($id);
// try {
// $dataset->setServerState("approved");
// $user = Auth::user();
// $dataset->reviewer()->associate($user)->save();
// $dataset->save();
// // return redirect()->back();
// return redirect()->route('publish.workflow.editor.index');
// } catch (Exception $e) {
// throw new GeneralException(trans('exceptions.publish.approve.update_error'));
// }
$dataset = Dataset::findOrFail($id);
$input = $request->all();
$input['server_state'] = 'approved';
if ($dataset->update($input)) {
// event(new PageUpdated($page));
return redirect()
->route('publish.workflow.editor.index')
->with('flash_message', 'You have approved one dataset!');
}
throw new GeneralException(trans('exceptions.publish.approve.update_error'));
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers\Publish;
use App\Exceptions\GeneralException;
use App\Http\Controllers\Controller;
use App\Models\Dataset;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class ReviewController extends Controller
{
public function __construct()
{
//$this->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', 'approved')
->where('reviewer_id', $userId)
->get();
return view('workflow.review.index', compact('datasets'));
}
}

View File

@ -2,10 +2,6 @@
namespace App\Http\Controllers\Publish; namespace App\Http\Controllers\Publish;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
// use App\Http\Requests\ProjectRequest;
// use App\Models\Project;
// use Illuminate\Http\RedirectResponse;
// use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Dataset; use App\Models\Dataset;
use App\Models\User; use App\Models\User;
@ -15,7 +11,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\View\View; use Illuminate\View\View;
class WorkflowController extends Controller class SubmitController extends Controller
{ {
public function __construct() public function __construct()
{ {
@ -29,11 +25,11 @@ class WorkflowController extends Controller
$builder = Dataset::query(); $builder = Dataset::query();
$myDatasets = $builder $myDatasets = $builder
->whereIn('server_state', ['inprogress', 'released', 'editor_accepted']) ->whereIn('server_state', ['inprogress', 'released', 'editor_accepted', 'approved'])
->where('account_id', $user_id) ->where('account_id', $user_id)
->with('user:id,login') ->with('user:id,login')
->get(); ->get();
return view('workflow.index', [ return view('workflow.submitter.index', [
'datasets' => $myDatasets, 'datasets' => $myDatasets,
]); ]);
} }
@ -47,16 +43,13 @@ class WorkflowController extends Controller
public function release($id): View public function release($id): View
{ {
$dataset = Dataset::with('user:id,login')->findOrFail($id); $dataset = Dataset::with('user:id,login')->findOrFail($id);
// $editors = User::whereHas('roles', function ($q) {
// $q->where('login', 'admin');
// })->pluck('login', 'id');
$editors = User::with(['roles' => function ($query) {
$query->where('name', 'editor');
}])
->pluck('login', 'id');
//$editors = Role::where('name', 'reviewer')->first()->users;
return view('workflow.release', [ $editors = User::whereHas('roles', function ($q) {
$q->where('name', 'editor');
})->pluck('login', 'id');
//$editors = Role::where('name', 'editor')->first()->users()->get();
return view('workflow.submitter.release', [
'dataset' => $dataset, 'dataset' => $dataset,
'editors' => $editors, 'editors' => $editors,
]); ]);
@ -110,82 +103,6 @@ class WorkflowController extends Controller
} }
} }
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function editorIndex()
{
$user = Auth::user();
$user_id = $user->id;
$builder = Dataset::query();
$datasets = $builder
//->where('server_state', 'inprogress')
->whereIn('server_state', ['released'])
//->where('server_state', 'editor_accepted')
->orWhere(function ($query) use ($user_id) {
$query->where('server_state', 'editor_accepted')
->where('editor_id', $user_id);
})
->get();
return view('workflow.editor_index', compact('datasets'));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function accept($id): View
{
$dataset = Dataset::with('user:id,login')->findOrFail($id);
// $editors = User::whereHas('roles', function ($q) {
// $q->where('login', 'admin');
// })->pluck('login', 'id');
$editors = User::with(['roles' => function ($query) {
$query->where('name', 'editor');
}])
->pluck('login', 'id');
//$editors = Role::where('name', 'reviewer')->first()->users;
return view('workflow.accept', [
'dataset' => $dataset,
'editors' => $editors,
]);
}
public function acceptUpdate(Request $request, $id)
{
$dataset = Dataset::findOrFail($id);
try {
$dataset->setServerState("editor_accepted");
$user = Auth::user();
$dataset->editor()->associate($user)->save();
$dataset->save();
return redirect()->back();
//return redirect()->route('settings.review.index');
} catch (Exception $e) {
throw new GeneralException(trans('exceptions.publish.accept.update_error'));
}
}
// public function release()
// {
// $user = Auth::user();
// $user_id = $user->id;
// $builder = Dataset::query();
// $datasets = $builder
// ->where('server_state', 'inprogress')
// ->where('account_id', $user_id)
// ->get();
// return view('workflow.release', compact('datasets'));
// }
public function changestate($id, $targetState) public function changestate($id, $targetState)
{ {
// $docId = $this->getRequest()->getParam('docId'); // $docId = $this->getRequest()->getParam('docId');

View File

@ -36,7 +36,9 @@ class Dataset extends Model
'project_id', 'project_id',
'embargo_date', 'embargo_date',
'belongs_to_bibliography', 'belongs_to_bibliography',
'editor_id' 'editor_id',
'preferred_editor',
'reviewer_id'
]; ];
//protected $guarded = []; //protected $guarded = [];
/** /**
@ -96,13 +98,21 @@ class Dataset extends Model
} }
/** /**
* Get the account that the dataset belongs to * Get the editor of the dataset
*/ */
public function editor() public function editor()
{ {
return $this->belongsTo(User::class, 'editor_id', 'id'); return $this->belongsTo(User::class, 'editor_id', 'id');
} }
/**
* Get the editor of the dataset
*/
public function reviewer()
{
return $this->belongsTo(User::class, 'reviewer_id', 'id');
}
public function collections() public function collections()
{ {
return $this return $this

24
composer.lock generated
View File

@ -3183,20 +3183,20 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.9.0", "version": "1.9.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "78af75148f9fdd34ea727c8b529a9b4a8f7b740c" "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/78af75148f9fdd34ea727c8b529a9b4a8f7b740c", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72",
"reference": "78af75148f9fdd34ea727c8b529a9b4a8f7b740c", "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2" "php": "^7.1"
}, },
"replace": { "replace": {
"myclabs/deep-copy": "self.version" "myclabs/deep-copy": "self.version"
@ -3204,8 +3204,6 @@
"require-dev": { "require-dev": {
"doctrine/collections": "^1.0", "doctrine/collections": "^1.0",
"doctrine/common": "^2.6", "doctrine/common": "^2.6",
"phpstan/phpstan": "^0.9.2",
"phpstan/phpstan-phpunit": "^0.9.4",
"phpunit/phpunit": "^7.1" "phpunit/phpunit": "^7.1"
}, },
"type": "library", "type": "library",
@ -3229,7 +3227,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2018-10-30T00:14:44+00:00" "time": "2019-04-07T13:18:21+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
@ -4452,16 +4450,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.4.1", "version": "3.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "5b4333b4010625d29580eb4a41f1e53251be6baa" "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5b4333b4010625d29580eb4a41f1e53251be6baa", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
"reference": "5b4333b4010625d29580eb4a41f1e53251be6baa", "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4499,7 +4497,7 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2019-03-19T03:22:27+00:00" "time": "2019-04-10T23:49:02+00:00"
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -939,16 +939,23 @@ textarea.large, input.large {
.pure-table tr.inprogress { .pure-table tr.inprogress {
padding: 0.8em; padding: 0.8em;
background-color: paleturquoise; background-color: paleturquoise;
color: gray;
} }
.pure-table tr.released { .pure-table tr.released {
background-color: greenyellow; background-color: greenyellow;
color: gray;
} }
.pure-table tr.editor_accepted { .pure-table tr.editor_accepted {
padding: 0.8em; padding: 0.8em;
background-color: lightblue; background-color: lightblue;
color: gray;
} }
.pure-table tr.approved {
padding: 0.8em;
background-color: rgb(86, 86, 241);
color: whitesmoke;
}
.help { .help {

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
{ {
"/backend/publish/approveDataset.js": "/backend/publish/approveDataset.js",
"/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js", "/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js",
"/backend/publish/releaseDataset.js": "/backend/publish/releaseDataset.js", "/backend/publish/releaseDataset.js": "/backend/publish/releaseDataset.js",
"/js/app.js": "/js/app.js", "/js/app.js": "/js/app.js",

View File

@ -0,0 +1,32 @@
// releaseDataset.js
import Vue from 'vue';
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate);
const app = new Vue({
el: '#app1',
data() {
return {
dataset: {
firstName: '',
reviewer_id: ''
},
submitted: false
}
},
methods: {
checkForm(e) {
// Log entire model to console
// console.log(this.dataset);
this.submitted = true;
this.$validator.validate().then(result => {
if (result) {
console.log('From Submitted!');
document.getElementById("approveForm").submit();
return;
}
});
}
}
});

View File

@ -10,7 +10,7 @@ const app = new Vue({
return { return {
dataset: { dataset: {
firstName: '', firstName: '',
editor_id: '' preferred_editor: ''
}, },
submitted: false submitted: false
} }

View File

@ -14,11 +14,14 @@ return [
*/ */
'publish' => [ 'publish' => [
'release' => [ 'release' => [
'update_error' => 'There was a problem rleasing this dataset. Please try again.', 'update_error' => 'There was a problem releasing this dataset. Please try again.',
], ],
'accept' => [ 'accept' => [
'update_error' => 'There was a problem accepting this dataset. Please try again.', 'update_error' => 'There was a problem accepting this dataset. Please try again.',
], ],
'approve' => [
'update_error' => 'There was a problem approving this dataset. Please try again.',
],
], ],
'backend' => [ 'backend' => [

View File

@ -103,8 +103,13 @@
</li> </li>
@endpermission @endpermission
@permission('dataset-editor-list') @permission('dataset-editor-list')
<li class="pure-menu-item {{ Route::is('publish.workflow.editorIndex') ? 'active' : '' }}"> <li class="pure-menu-item {{ Route::is('publish.workflow.editor.index') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.editorIndex') }}"><i class="fa fa-upload"></i> EDITOR PAGE: Released datasets</a> <a class="pure-menu-link" href="{{ URL::route('publish.workflow.editor.index') }}"><i class="fa fa-upload"></i> EDITOR PAGE: Released datasets</a>
</li>
@endpermission
@permission('dataset-review-list')
<li class="pure-menu-item {{ Route::is('publish.workflow.review.index') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review.index') }}"><i class="fa fa-upload"></i> REVIEW PAGE: Approved datasets</a>
</li> </li>
@endpermission @endpermission
{{-- <li class="pure-menu-item {{ Route::is('publish.workflow.release') ? 'active' : '' }}"> {{-- <li class="pure-menu-item {{ Route::is('publish.workflow.release') ? 'active' : '' }}">

View File

@ -32,9 +32,16 @@
</script> </script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.js"></script>
{{-- <script src="https://cloud.tinymce.com/5/tinymce.min.js"></script> --}}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#desc_markup').summernote(); $('#desc_markup').summernote();
// tinymce.init({
// selector: "#desc_markup",
// plugins: "code",
// // toolbar: "code",
// menubar: "tools"
// });
}); });
</script> </script>
@endsection @endsection

View File

@ -0,0 +1,137 @@
<fieldset id="fieldset-General">
<legend>General</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('type', 'Type..') !!}
<div class="select pure-u-23-24">
{!! Form::select('type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --']) !!}
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('server_state', 'Status..') !!}
{{-- {!! Form::select('server_state', Config::get('enums.server_states'), null, ['id' => 'server_state', 'placeholder' => '-- select server state --']) !!} --}}
{!! Form::text('server_state', null, ['class'=>'pure-u-23-24','readonly']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('project_id', 'Project..') !!}
<div class="select pure-u-23-24">
{!! Form::select('project_id', $projects, null, ['id' => 'project_id', 'placeholder' => '--no project--']) !!}
</div>
<small id="projectHelp" class="pure-form-message-inline">project is optional</small>
</div>
{{-- <div class="pure-control-group">
{!! Form::label('shelf_id', 'Shelf..') !!}
{!! Form::select('shelf_id', $shelves, null, ['id' => 'shelf_id']) !!}
</div> --}}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('embargo_date', 'Embargo Date') !!}
{!! Form::date('embargo_date', null, ['placeholder' => date('y-m-d'), 'class' => 'pure-u-23-24']) !!}
<small id="projectHelp" class="pure-form-message-inline">embargo_date is optional</small>
</div>
</div>
</fieldset>
<fieldset id="fieldset-titles">
<legend>Title</legend>
<div class="pure-g">
@foreach($dataset->titles as $key => $title)
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('title', 'Title ' .($key+1).':') }}
<!-- Notice this is an array now: -->
{{ Form::text('titles['.$title->id.'][value]', $title->value, ['class' => 'pure-u-23-24']) }}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('language', 'Language..') }}
<div class="select pure-u-23-24">
{{ Form::select('titles['.$title->id.'][language]', $languages, $title->language, ['placeholder' => '--no language--']) }}
</div>
</div>
@endforeach
</div>
</fieldset>
<fieldset id="fieldset-abstracts">
<legend>Abstract</legend>
<div class="pure-g">
@foreach($dataset->abstracts as $key => $abstract)
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('abstract', 'Abstract ' .($key+1).':') }}
<!-- Notice this is an array now: -->
{{ Form::textarea('abstracts['.$abstract->id.'][value]', $abstract->value, ['class' => 'pure-u-23-24', 'size' => '70x6']) }}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('language', 'Language..') }}
<div class="select pure-u-23-24">
{{ Form::select('abstracts['.$abstract->id.'][language]', $languages, $abstract->language, ['placeholder' => '--no language--']) }}
</div>
</div>
@endforeach
</div>
</fieldset>
<fieldset id="fieldset-licenses">
<legend>Licenses</legend>
{{-- <div class="form-group">
{!! Form::label('licenses[]', 'Licenses..') !!}
{!! Form::select('licenses[]', $options, array_pluck($dataset->licenses, 'id'), ['multiple' ]) !!}
</div> --}}
<div class="pure-control-group checkboxlist">
@foreach ($options as $license)
<label for={{"license". $license->id }} class="pure-checkbox">
<input name="licenses[]" value={{ $license->id }} {{ (in_array($license->id, $checkeds)) ? 'checked=checked' : '' }} type="checkbox" class="form-check-input">
{{ $license->name_long }}
</label>
<!--{!! Form::checkbox('licenses[]', $license->id, in_array($license->id, $checkeds) ? true : false) !!}
{!! Form::label('license' . $license->id, $license->name_long) !!}-->
@endforeach
</div>
</fieldset>
<fieldset id="fieldset-abstracts">
<legend>Files</legend>
<table id="items" class="pure-table pure-table-horizontal">
<thead>
<tr>
<th>Path Name</th>
<th>Label</th>
</tr>
</thead>
<tbody>
@foreach($dataset->files as $key => $file)
<tr>
<td>
@if($file->exists() === true)
<a href="{{ route('settings.file.download', ['id' => $file->id]) }}"> {{ $file->path_name }} </a>
@else
<span class="alert">missing file: {{ $file->path_name }}</span>
@endif
</td>
<td> {{ $file->label }} </td>
</tr>
@endforeach
</tbody>
</table>
</fieldset>
<br />
<div class="pure-controls">
<button type="submit" class="pure-button button-small">
<i class="fa fa-save"></i>
<span>{!! $submitButtonText !!}</span>
</button>
</div>

View File

@ -16,21 +16,20 @@
<div class="pure-u-1 pure-u-md-1"> <div class="pure-u-1 pure-u-md-1">
<div> <div>
<a href="{{ route('publish.workflow.editorIndex') }}" class="pure-button button-small"> <a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i> <i class="fa fa-chevron-left"></i>
<span>BACK</span> <span>BACK</span>
</a> </a>
</div> </div>
<div id="app1"> <div id="app1">
@php @php
//if userid changed from last iteration, store new userid and change color // if ($dataset->editor->id == Auth::user()->id) {
// $lastid = $detail->payment->userid; // $userIsDesiredEditor = true;
if ($dataset->editor->id == Auth::user()->id) { // } else {
$userIsDesiredEditor = true; // $userIsDesiredEditor = false;
} else { // $message = 'you are not the desired editor, but you can still accept the dataset';
$userIsDesiredEditor = false; // }
$message = 'you are not the desired editor, but you can still accept the dataset'; $message = 'If you are not the desired editor, you can still accept the dataset!!';
}
@endphp @endphp
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.acceptUpdate', $dataset->id], 'id' => 'acceptForm', {!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.acceptUpdate', $dataset->id], 'id' => 'acceptForm',
@ -41,10 +40,10 @@
<div class="pure-u-1 pure-u-md-1-1 pure-div"> <div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('editor_id', 'preferred editor:') !!} {!! Form::label('editor_id', 'preferred editor:') !!}
{!! $dataset->editor->login !!} {!! $dataset->preferred_editor !!}
@if($userIsDesiredEditor == false)
<span class="help is-danger"> {!! $message !!}</span> <span class="help is-danger"> {!! $message !!}</span>
@endif
{{-- <span class="help is-danger" v-if="errors.has('editor_id')" v-text="errors.first('editor_id')"></span> --}} {{-- <span class="help is-danger" v-if="errors.has('editor_id')" v-text="errors.first('editor_id')"></span> --}}
</div> </div>

View File

@ -0,0 +1,60 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-share"></i> Approve corrected datasets
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1">
<div>
<a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div id="app1">
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.approveUpdate', $dataset->id], 'id' => 'approveForm',
'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) !!}
<fieldset id="fieldset-General">
<legend>General</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('reviewer_id', 'reviewer:') !!}
<div class="select pure-u-23-24">
{!! Form::select('reviewer_id', $reviewers, null, ['id' => 'reviewer_id', 'placeholder' => '-- select reviewer --', 'v-model' =>
'dataset.reviewer_id', "v-validate" => "'required'"]) !!}
</div>
<span class="help is-danger" v-if="errors.has('reviewer_id')" v-text="errors.first('reviewer_id')"></span>
</div>
</div>
</fieldset>
<br />
<div class="pure-controls">
<button :disabled="errors.any()" type="submit" class="pure-button">
<i class="fa fa-share"></i>
<span>Approve</span>
</button>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@stop
@section('after-scripts') {{--
<script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{--
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>--}} {{--
<script type="text/javascript" src="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
<script type="text/javascript" src="{{ asset('backend/publish/approveDataset.js') }}"></script>
@stop

View File

@ -0,0 +1,28 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<span>Correct Dataset</span>
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-3-3">
<div>
<a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div>
{!! Form::model($dataset, ['method' => 'POST', 'route' => ['publish.workflow.editor.update', $dataset->id], 'class' => 'pure-form', 'enctype' => 'multipart/form-data' ]) !!}
@include('workflow/editor/_form', ['submitButtonText' => 'Edit Dataset', 'bookLabel' => 'Edit Dataset.'])
@include('errors._errors')
{!! Form::close() !!}
</div>
</div>
</div>
@stop

View File

@ -2,7 +2,7 @@
@section('content') @section('content')
<div class="header"> <div class="header">
<h3 class="header-title"> <h3 class="header-title">
<i class="fa fa-file"></i>EDITOR PAGE: Approve released datasets <i class="fa fa-file"></i> EDITOR PAGE: Approve released datasets
</h3> </h3>
</div> </div>
@ -44,7 +44,8 @@
{{ $dataset->server_state }} {{ $dataset->server_state }}
</td> </td>
@if ($dataset->server_state == "released") @if ($dataset->server_state == "released")
<td>Preferred editor: {{ optional($dataset->editor)->login }} </td> {{-- <td>Preferred editor: {{ optional($dataset->editor)->login }} </td> --}}
<td>Preferred editor: {{ $dataset->preferred_editor }} </td>
@elseif ($dataset->server_state == "editor_accepted") @elseif ($dataset->server_state == "editor_accepted")
<td>in approvement by {{ optional($dataset->editor)->login }} </td> <td>in approvement by {{ optional($dataset->editor)->login }} </td>
@endif @endif
@ -52,14 +53,18 @@
<td> <td>
@if ($dataset->server_state == "released") @if ($dataset->server_state == "released")
<a href="{{ URL::route('publish.workflow.accept', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.accept', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i> <i class="fa fa-check"></i>
<span>Accept editor task</span> <span>Accept editor task</span>
</a> </a>
{{-- <a href="{{ URL::route('publish.workflow.delete', $dataset->id) }}" class="pure-button"> @elseif ($dataset->server_state == "editor_accepted")
<i class="fa fa-trash"></i> <a href="{{ URL::route('publish.workflow.editor.edit', $dataset->id) }}" class="pure-button">
<span>Reject</span> <i class="fa fa-edit"></i>
</a> --}} <span>Improve/Edit</span>
</a>
<a href="{{ URL::route('publish.workflow.editor.approve', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i>
<span>Approve</span>
</a>
@endif @endif
</td> </td>
{{-- <td> {{-- <td>

View File

@ -0,0 +1,71 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-file"></i> REVIEW PAGE: Review approved datasets assigned to you
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1">
<table class="pure-table pure-table-horizontal">
<thead>
<th>Dataset Title</th>
<th>ID</th>
<th>Server State</th>
<th>Editor</th>
<th></th>
</thead>
<tbody>
@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
<tr>
<td>
@if ($dataset->titles()->first())
{{ $dataset->titles()->first()->value }}
@else
no title
@endif
</td>
<td>
{{ $dataset->id }}
</td>
<td>
{{ $dataset->server_state }}
</td>
@if ($dataset->server_state == "approved")
<td>editor: {{ optional($dataset->editor)->login }}</td>
@endif
<td>
@if ($dataset->server_state == "approved")
<a class="pure-button">
<i class="fa fa-check"></i>
<span>Review</span>
</a>
@endif
</td>
{{-- <td>
@if ($dataset->server_state == "unpublished")
<a href="{{ URL::route('publish.review.changestate',['id' => $dataset->id, 'targetState' => 'published']) }}" class="pure-button button-small is-success">Publish</a>
@endif
</td> --}}
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View File

@ -29,6 +29,8 @@
} }
elseif ($dataset->server_state == 'editor_accepted') { elseif ($dataset->server_state == 'editor_accepted') {
$rowclass = 'editor_accepted'; $rowclass = 'editor_accepted';
} elseif ($dataset->server_state == 'approved') {
$rowclass = 'approved';
} }
@endphp @endphp
<tr class="{{ $rowclass }}"> <tr class="{{ $rowclass }}">

View File

@ -29,12 +29,15 @@
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div"> <div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('editor_id', 'preferred editor:') !!} {!! Form::label('preferred_editor', 'preferred editor:') !!}
<div class="select pure-u-23-24">
{!! Form::select('editor_id', $editors, null, ['id' => 'editor_id', 'placeholder' => '-- select editor --', 'v-model' => {{-- {!! Form::select('editor_id', $editors, null, ['id' => 'editor_id', 'placeholder' => '-- select editor --', 'v-model' =>
'dataset.editor_id', "v-validate" => "'required'"]) !!} 'dataset.editor_id', "v-validate" => "'required'"]) !!} --}}
</div> {!! Form::text('preferred_editor', null, ['id' => 'preferred_editor', 'class'=>'pure-u-23-24',
<span class="help is-danger" v-if="errors.has('editor_id')" v-text="errors.first('editor_id')"></span> 'placeholder' => '-- enter name of preferred editor --',
'v-model' => 'dataset.preferred_editor', "v-validate" => "'required|min:3|max:20'"]) !!}
<span class="help is-danger" v-if="errors.has('preferred_editor')" v-text="errors.first('preferred_editor')"></span>
</div> </div>
</div> </div>

View File

@ -57,39 +57,59 @@ Route::group(
Route::get('workflow/index', [ Route::get('workflow/index', [
'middleware' => ['permission:dataset-list'], 'middleware' => ['permission:dataset-list'],
'as' => 'workflow.index', 'uses' => 'WorkflowController@index', 'as' => 'workflow.index', 'uses' => 'SubmitController@index',
]); ]);
Route::get('workflow/release/{id}', [ Route::get('workflow/release/{id}', [
'middleware' => ['permission:dataset-create', 'isUserDatasetAdmin:true'], 'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'],
'as' => 'workflow.release', 'uses' => 'WorkflowController@release', 'as' => 'workflow.release', 'uses' => 'SubmitController@release',
]); ]);
Route::post('workflow/release/{id}', [ Route::post('workflow/release/{id}', [
'middleware' => ['permission:dataset-create', 'isUserDatasetAdmin:true'], 'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'],
'as' => 'workflow.releaseUpdate', 'uses' => 'WorkflowController@releaseUpdate', 'as' => 'workflow.releaseUpdate', 'uses' => 'SubmitController@releaseUpdate',
]); ]);
Route::get('workflow/delete/{id}', [ Route::get('workflow/delete/{id}', [
'middleware' => ['isUserDatasetAdmin:true'], 'middleware' => ['isUserDatasetAdmin:true'],
'as' => 'workflow.delete', 'uses' => 'WorkflowController@delete', 'as' => 'workflow.delete', 'uses' => 'SubmitController@delete',
]); ]);
// Route::get('workflow/release/{id}', [
// 'as' => 'workflow.release', 'uses' => 'WorkflowController@release',
// ]);
Route::get('workflow/editor_index', [ //editor
Route::get('workflow/editor/index', [
'middleware' => ['permission:dataset-editor-list'], 'middleware' => ['permission:dataset-editor-list'],
'as' => 'workflow.editorIndex', 'uses' => 'WorkflowController@editorIndex', 'as' => 'workflow.editor.index', 'uses' => 'EditorController@index',
]); ]);
Route::get('workflow/accept/{id}', [ Route::get('workflow/accept/{id}', [
'middleware' => ['permission:dataset-accept'], 'middleware' => ['permission:dataset-accept'],
'as' => 'workflow.accept', 'uses' => 'WorkflowController@accept', 'as' => 'workflow.accept', 'uses' => 'EditorController@accept',
]); ]);
Route::post('workflow/accept/{id}', [ Route::post('workflow/accept/{id}', [
'middleware' => ['permission:dataset-accept'], 'middleware' => ['permission:dataset-accept'],
'as' => 'workflow.acceptUpdate', 'uses' => 'WorkflowController@acceptUpdate', 'as' => 'workflow.acceptUpdate', 'uses' => 'EditorController@acceptUpdate',
]);
Route::get('workflow/edit/{id}', [
'middleware' => ['permission:dataset-editor-update'],
'as' => 'workflow.editor.edit', 'uses' => 'EditorController@edit',
]);
Route::post('workflow/edit/{id}', [
'middleware' => ['permission:dataset-editor-update'],
'as' => 'workflow.editor.update', 'uses' => 'EditorController@update',
]);
Route::get('workflow/approve/{id}', [
'middleware' => ['permission:dataset-approve'],
'as' => 'workflow.editor.approve', 'uses' => 'EditorController@approve',
]);
Route::post('workflow/approve/{id}', [
'middleware' => ['permission:dataset-approve'],
'as' => 'workflow.editor.approveUpdate', 'uses' => 'EditorController@approveUpdate',
]);
//reviewer
Route::get('workflow/review/index', [
'middleware' => ['permission:dataset-review-list'],
'as' => 'workflow.review.index', 'uses' => 'ReviewController@index',
]); ]);
Route::get('workflow/changestate/{id}/changestate/{targetState}', [ Route::get('workflow/changestate/{id}/changestate/{targetState}', [
'as' => 'review.changestate', 'uses' => 'WorkflowController@changestate', 'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
]); ]);
} }
); );

View File

@ -18,6 +18,7 @@ mix.js('resources/assets/js/datasetPublish.js', 'public/backend/publish')
.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/lib.js', 'public/js') .js('resources/assets/js/lib.js', 'public/js')
.js('resources/assets/js/releaseDataset.js', 'public/backend/publish') .js('resources/assets/js/releaseDataset.js', 'public/backend/publish')
.js('resources/assets/js/approveDataset.js', 'public/backend/publish')
.scripts([ .scripts([
'node_modules/datatables.net/js/jquery.dataTables.js', 'node_modules/datatables.net/js/jquery.dataTables.js',
'node_modules/datatables.net-buttons/js/dataTables.buttons.js', 'node_modules/datatables.net-buttons/js/dataTables.buttons.js',