1. use Astrotomic\Translatable\Translatable instead of Dimsav\Translatable\Translatable

2. index of all my datasets is nun nach dem Attribut "server_date_modifued" sortiert
"Date of last modification wird angezeigt"
3. composer updates
4. 3 Möglichkeiten nachdem ein Datensatz angelegt wurde: Edit, submit, delete
5. edit form for submitter
This commit is contained in:
Arno Kaimbacher 2019-08-27 11:15:23 +02:00
parent 590c0812fe
commit ec9a95098e
23 changed files with 1757 additions and 854 deletions

View File

@ -488,7 +488,8 @@ class IndexController extends Controller
return response()->json(array( return response()->json(array(
'success' => true, 'success' => true,
//'redirect' => route('settings.document.edit', ['id' => $dataset->server_state]), //'redirect' => route('settings.document.edit', ['id' => $dataset->server_state]),
'redirect' => route('publish.workflow.submit.release', ['id' => $dataset->id]), 'release' => route('publish.workflow.submit.release', ['id' => $dataset->id]),
'delete' => route('publish.workflow.submit.delete', ['id' => $dataset->id]),
)); ));
} else { } else {
//TODO Handle validation error //TODO Handle validation error

View File

@ -10,6 +10,15 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\View\View; use Illuminate\View\View;
// for edit actions:
use App\Models\Project;
use Illuminate\Support\Facades\DB;
use App\Models\License;
use App\Http\Requests\DocumentRequest;
use Illuminate\Support\Facades\Validator;
use App\Models\Title;
use App\Models\Description;
use App\Models\File;
class SubmitController extends Controller class SubmitController extends Controller
{ {
@ -25,8 +34,9 @@ class SubmitController extends Controller
$builder = Dataset::query(); $builder = Dataset::query();
$myDatasets = $builder $myDatasets = $builder
->orderBy('server_state') //->orderBy('server_state')
->whereIn('server_state', ['inprogress', 'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer']) ->whereIn('server_state', ['inprogress',
'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer'])
->where('account_id', $user_id) ->where('account_id', $user_id)
->with('user:id,login') ->with('user:id,login')
->orderBy('server_date_modified', 'desc') ->orderBy('server_date_modified', 'desc')
@ -36,6 +46,188 @@ class SubmitController extends Controller
]); ]);
} }
/**
* 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', 'coverage', 'subjects', 'references');
$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();
$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.submitter.edit',
compact(
'dataset',
'projects',
'options',
'checkeds',
'years',
'languages',
'keywordTypes',
'referenceTypes',
'relationTypes'
)
);
}
//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
{
$rules = [
'type' => 'required|min:5',
'coverage.xmin' => [
'nullable',
'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'
],
'coverage.ymin' => [
'nullable',
'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'
],
'coverage.xmax' => [
'nullable',
'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'
],
'coverage.ymax' => [
'nullable',
'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'
],
];
$validator = Validator::make($request->all(), $rules);
if ($validator->passes()) {
$dataset = Dataset::findOrFail($id);
$data = $request->all();
$input = $request->except('abstracts', 'licenses', 'titles', 'coverage', '_method', '_token');
$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();
}
}
//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) {
foreach ($keywords as $key => $formKeyword) {
$subject = Subject::findOrFail($key);
$subject->value = $formKeyword['value'];
$subject->type = $formKeyword['type'];
$subject->save();
}
}
//save the files:
$files = $request->input('files');
if (is_array($files) && count($files) > 0) {
foreach ($files as $key => $formFile) {
$file = File::findOrFail($key);
$file->label = $formFile['label'];
$file->save();
}
}
// save coverage
if (isset($data['coverage'])) {
$formCoverage = $request->input('coverage');
$coverage = $dataset->coverage()->updateOrCreate(
['dataset_id' => $dataset->id],
$formCoverage
);
}
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.submit.index');
}
} else {
//TODO Handle validation error
//pass validator errors as errors object for ajax response
// return response()->json([
// 'success' => false,
// 'errors' => $validator->errors()->all(),
// ], 422);
return back()
->withErrors($validator->errors()->all());
}
throw new GeneralException(trans('exceptions.backend.dataset.update_error'));
}
/** /**
* Display the specified resource. * Display the specified resource.
* *
@ -89,13 +281,28 @@ class SubmitController extends Controller
throw new GeneralException(trans('exceptions.publish.release.update_error')); throw new GeneralException(trans('exceptions.publish.release.update_error'));
} }
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function delete($id): View
{
$dataset = Dataset::with('user:id,login')->findOrFail($id);
return view('workflow.submitter.delete', [
'dataset' => $dataset
]);
}
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function delete($id): RedirectResponse public function deleteUpdate($id): RedirectResponse
{ {
$dataset = Dataset::with('files')->findOrFail($id); $dataset = Dataset::with('files')->findOrFail($id);
if ($dataset->server_state == "inprogress" || $dataset->server_state == "rejected_editor") { if ($dataset->server_state == "inprogress" || $dataset->server_state == "rejected_editor") {

View File

@ -6,9 +6,10 @@ namespace App\Models;
use App\Models\ModelTrait; use App\Models\ModelTrait;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Dimsav\Translatable\Translatable; use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
use Astrotomic\Translatable\Translatable;// use Dimsav\Translatable\Translatable;
class Page extends Model class Page extends Model implements TranslatableContract
{ {
use ModelTrait; use ModelTrait;
use Translatable; // 2. To add translation methods use Translatable; // 2. To add translation methods

View File

@ -4,7 +4,6 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
// models/CountryTranslation.php
class PageTranslation extends Model class PageTranslation extends Model
{ {
public $timestamps = false; public $timestamps = false;

View File

@ -9,8 +9,8 @@
"type": "project", "type": "project",
"require": { "require": {
"php": "^7.1.3", "php": "^7.1.3",
"astrotomic/laravel-translatable": "^11.1",
"davejamesmiller/laravel-breadcrumbs": "5.x", "davejamesmiller/laravel-breadcrumbs": "5.x",
"dimsav/laravel-translatable": "9.*",
"felixkiss/uniquewith-validator": "^3.1", "felixkiss/uniquewith-validator": "^3.1",
"fideloper/proxy": "^4.0", "fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*", "laravel/framework": "5.6.*",

514
composer.lock generated

File diff suppressed because it is too large Load Diff

1363
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,22 +12,22 @@
"bootstrap-sass": "^3.4.0", "bootstrap-sass": "^3.4.0",
"cross-env": "^5.1", "cross-env": "^5.1",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"laravel-mix": "^4.0.16", "laravel-mix": "^4.1.2",
"leaflet": "^1.5.1", "leaflet": "^1.5.1",
"leaflet-draw": "^1.0.4", "leaflet-draw": "^1.0.4",
"lodash": "^4.17.11", "lodash": "^4.17.15",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
"npm-font-open-sans": "^1.1.0", "npm-font-open-sans": "^1.1.0",
"purecss-sass": "^1.0.0", "purecss-sass": "^1.0.1",
"resolve-url-loader": "^2.3.2", "resolve-url-loader": "^2.3.2",
"sass-loader": "^7.1.0", "sass-loader": "^7.3.1",
"vee-validate": "^2.2.11", "vee-validate": "^2.2.15",
"vue": "^2.5.21", "vue": "^2.5.21",
"vue-events": "^3.1.0", "vue-events": "^3.1.0",
"vue-template-compiler": "^2.5.21", "vue-template-compiler": "^2.5.21",
"vue-toast-notification": "0.0.2", "vue-toast-notification": "0.0.2",
"vuedraggable": "^2.23.0", "vuedraggable": "^2.23.0",
"vuejs-datetimepicker": "^1.1.11", "vuejs-datetimepicker": "^1.1.12",
"vuetable-2": "^1.7.5" "vuetable-2": "^1.7.5"
}, },
"dependencies": { "dependencies": {

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

File diff suppressed because one or more lines are too long

34
public/css/app1.css vendored

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

@ -84,7 +84,8 @@ const app = new Vue({
currentStatus: null, currentStatus: null,
uploadFieldName: 'photos', uploadFieldName: 'photos',
fileCount: 0, fileCount: 0,
redirectLink: null, releaseLink: null,
deleteLink: null,
isModalVisible: false, isModalVisible: false,
@ -208,8 +209,11 @@ const app = new Vue({
// this.dataset.reset();//reset methods will trigger property changed. // this.dataset.reset();//reset methods will trigger property changed.
// this.step = 1; // this.step = 1;
}, },
editNewDataset() { releaseNewDataset() {
window.location = this.redirectLink; window.location = this.releaseLink;
},
deleteNewDataset() {
window.location = this.deleteLink;
}, },
resetDropbox() { resetDropbox() {
// reset form to initial state // reset form to initial state
@ -369,7 +373,8 @@ const app = new Vue({
// this.items = response.data; // this.items = response.data;
//Vue.set(app.skills, 1, "test55"); //Vue.set(app.skills, 1, "test55");
_this.currentStatus = STATUS_SUCCESS; _this.currentStatus = STATUS_SUCCESS;
_this.redirectLink = response.data.redirect; _this.releaseLink = response.data.release;
_this.deleteLink = response.data.delete;
// if (response.data.redirect) { // if (response.data.redirect) {
// window.location = response.data.redirect; // window.location = response.data.redirect;
// } // }

View File

@ -690,13 +690,21 @@
<!--SUCCESS--> <!--SUCCESS-->
<div v-if="isSuccess"> <div v-if="isSuccess">
<h2>Uploaded @{{ dataset.files.length }} file(s) successfully.</h2> <h2>Uploaded @{{ dataset.files.length }} file(s) successfully.</h2>
<p> {{-- <p>
<a href="javascript:void(0)" @click="reset()" class="pure-button button-small">Upload new Dataset</a> <a href="javascript:void(0)" @click="reset()" class="pure-button button-small">Upload new Dataset</a>
</p> </p> --}}
<p> <p>
{{-- <a href="javascript:void(0)" @click="editNewDataset()" class="pure-button button-small">@{{ redirectLink }}</a> --}} {{-- <a href="javascript:void(0)" @click="editNewDataset()" class="pure-button button-small">@{{ redirectLink }}</a> --}}
<a href="javascript:void(0)" @click="editNewDataset()" class="pure-button button-small">Release your submitted dataset</a> <a href="javascript:void(0)" @click="releaseNewDataset()" class="pure-button button-small">
<i class="fa fa-share"></i>
<span>Release</span>
</a>
<a href="javascript:void(0)" @click="deleteNewDataset()" class="pure-button button-small">
<i class="fa fa-trash"></i>
<span>Delete</span>
</a>
</p> </p>
<ul class="list-unstyled"> <ul class="list-unstyled">
{{-- <li v-for="item in uploadedFiles"> {{-- <li v-for="item in uploadedFiles">
<img :src="item.url" class="img-responsive img-thumbnail" :alt="item.originalName"> <img :src="item.url" class="img-responsive img-thumbnail" :alt="item.originalName">

View File

@ -66,7 +66,7 @@
@elseif ($dataset->server_state == "editor_accepted" || $dataset->server_state == "rejected_reviewer") @elseif ($dataset->server_state == "editor_accepted" || $dataset->server_state == "rejected_reviewer")
<a href="{{ URL::route('publish.workflow.editor.edit', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.editor.edit', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
<span>Edit</span> {{-- <span>Edit</span> --}}
</a> </a>
<a href="{{ URL::route('publish.workflow.editor.approve', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.editor.approve', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i> <i class="fa fa-share"></i>

View File

@ -0,0 +1,305 @@
<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('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-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('reject_reviewer_note', 'editor reject note..') !!}
{{-- {!! Form::select('server_state', Config::get('enums.server_states'), null, ['id' => 'server_state', 'placeholder' => '-- select server state --']) !!} --}}
{!! Form::textarea('reject_editor_note', null, ['class'=>'pure-u-23-24','readonly']) !!}
</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 class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('creating_corporation', 'Creating Corporation') !!}
{!! Form::text('creating_corporation', null, ['class' =>
'pure-u-23-24', 'v-model' => 'dataset.creating_corporation', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</div>
</div>
</fieldset>
<fieldset id="fieldset-geolocation">
<legend>Coverage: Geolocation, Elevation, Depth, Time</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('xmin', 'xmin: ') !!}
{!! Form::text('coverage[xmin]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.xmin']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('ymin', 'ymin: ') !!}
{!! Form::text('coverage[ymin]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.ymin']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('xmax', 'xmax: ') !!}
{!! Form::text('coverage[xmax]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.xmax']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('ymax', 'ymax: ') !!}
{!! Form::text('coverage[ymax]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.ymax']) !!}
</div>
@if (isset($dataset->elevation_absolut))
<div v-show="elevation === 'absolut'" class="pure-u-1 pure-u-md-1">
{!! Form::label('elevation_absolut', 'elevation absolut: ') !!}
{!! Form::text('coverage[elevation_absolut]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.elevation_absolut', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationAbsolut ? 'required|integer' : '' " ]) !!}
</div>
@elseif (isset($dataset->elevation_min) && isset($dataset->elevation_max))
<div v-show="elevation === 'range'" class="pure-u-1 pure-u-md-1">
{!! Form::label('elevation_min', 'elevation min: ') !!}
{!! Form::text('coverage[elevation_min]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.elevation_min', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationRange ? 'required|integer' : '' "]) !!}
</div>
<div v-show="elevation === 'range'" class="pure-u-1 pure-u-md-1">
{!! Form::label('elevation_max', 'elevation max: ') !!}
{!! Form::text('coverage[elevation_max]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.elevation_max', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationRange ? 'required|integer' : '' "]) !!}
</div>
@endif
@if (isset($dataset->depth_absolut))
<div v-show="elevation === 'absolut'" class="pure-u-1 pure-u-md-1">
{!! Form::label('depth_absolut', 'depth absolut: ') !!}
{!! Form::text('coverage[depth_absolut]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.depth_absolut', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationAbsolut ? 'required|integer' : '' " ]) !!}
</div>
@elseif (isset($dataset->elevation_min) && isset($dataset->elevation_max))
<div v-show="elevation === 'range'" class="pure-u-1 pure-u-md-1">
{!! Form::label('depth_min', 'depth min: ') !!}
{!! Form::text('coverage[depth_min]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.depth_min', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationRange ? 'required|integer' : '' "]) !!}
</div>
<div v-show="elevation === 'range'" class="pure-u-1 pure-u-md-1">
{!! Form::label('depth_max', 'depth max: ') !!}
{!! Form::text('coverage[depth_max]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.depth_max', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationRange ? 'required|integer' : '' "]) !!}
</div>
@endif
@if (isset($dataset->depth_absolut))
<div v-show="elevation === 'absolut'" class="pure-u-1 pure-u-md-1">
{!! Form::label('time_absolut', 'time absolut: ') !!}
{!! Form::text('coverage[time_absolut]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.time_absolut', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationAbsolut ? 'required|integer' : '' " ]) !!}
</div>
@elseif (isset($dataset->elevation_min) && isset($dataset->elevation_max))
<div v-show="elevation === 'range'" class="pure-u-1 pure-u-md-1">
{!! Form::label('time_min', 'time min: ') !!}
{!! Form::text('coverage[time_min]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.time_min', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationRange ? 'required|integer' : '' "]) !!}
</div>
<div v-show="elevation === 'range'" class="pure-u-1 pure-u-md-1">
{!! Form::label('time_max', 'time max: ') !!}
{!! Form::text('coverage[time_max]', null,
['class' => 'pure-u-23-24', 'v-model' => 'dataset.coverage.time_max', 'data-vv-scope' => 'step-2', "v-validate" => "this.isElevationRange ? 'required|integer' : '' "]) !!}
</div>
@endif,
</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..') }}
{{ Form::text('titles['.$title->id.'][language]', $title->language, ['placeholder' => '--no language--', 'class' => 'pure-u-23-24', 'readonly']) }}
</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..') }}
{{ Form::text('abstracts['.$abstract->id.'][language]', $abstract->language, ['placeholder' => '--no language--', 'class' => 'pure-u-23-24', 'readonly']) }}
</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-references">
<legend>Dataset References</legend>
{{-- <table class="table table-hover" v-if="dataset.keywords.length"> --}}
@if ($dataset->references->count() > 0)
<table id="references" class="pure-table pure-table-horizontal">
<thead>
<tr>
<th style="width: 20px;">Reference value</th>
<th style="width: 20px;">Label</th>
<th>Type</th>
<th>Relation</th>
<th style="width: 130px;"></th>
</tr>
</thead>
<tbody>
{{-- <tr v-for="(item, index) in dataset.keywords"> --}}
@foreach($dataset->references as $key => $reference)
<tr>
<td>
{{ Form::text('references['.$reference->id.'][value]', $reference->value, ['class' => 'form-control', 'placeholder' => '[REFERENCE VALUE]']) }}
</td>
<td>
{{ Form::text('references['.$reference->id.'][label]', $reference->label, ['class' => 'form-control', 'placeholder' => '[REFERENCE LABEL]']) }}
</td>
<td>
{!! Form::select('references['.$reference->id.'][type]', $referenceTypes, $reference->type, ['placeholder' => '[reference type]', 'v-model' =>
'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</td>
<td>
{!! Form::select('references['.$reference->id.'][relation]', $relationTypes, $reference->relation, ['placeholder' => '[relation type]', 'v-model' =>
'item.relation', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</td>
<td>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<span>...there are no references</span>
@endif
</fieldset>
<fieldset id="fieldset-keywords">
<legend>Dataset Keywords</legend>
{{-- <table class="table table-hover" v-if="dataset.keywords.length"> --}}
@if ($dataset->subjects->count() > 0)
<table id="keywords" class="pure-table pure-table-horizontal">
<thead>
<tr>
<th style="width: 20px;">Keyword</th>
<th>Type</th>
<th style="width: 130px;"></th>
</tr>
</thead>
<tbody>
{{-- <tr v-for="(item, index) in dataset.keywords"> --}}
@foreach($dataset->subjects as $key => $keyword)
<tr>
<td>
{{-- <input name="Keyword Value" class="form-control" placeholder="[KEYWORD VALUE]" v-model="item.value" v-validate="'required'"
data-vv-scope="step-2" /> --}}
{{ Form::text('keywords['.$keyword->id.'][value]', $keyword->value, ['class' => 'form-control', 'placeholder' => '[KEYWORD VALUE]']) }}
</td>
<td>
{!! Form::select('keywords['.$keyword->id.'][type]', $keywordTypes, $keyword->type, ['placeholder' => '[keyword type]', 'v-model' =>
'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</td>
<td>
{{-- <button class="pure-button button-small is-warning" @click.prevent="removeKeyword(index)">Remove</button> --}}
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<span>...there are no keywords</span>
@endif
</fieldset>
<fieldset id="fieldset-files">
<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 }} --}}
{{ Form::text('files['.$file->id.'][label]', $file->label, ['class' => 'form-control', 'placeholder' => '[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

@ -0,0 +1,55 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-share"></i> Delete saved datasets
</h3>
</div>
<div class="header">
<h3 class="header-title">
Delete the created dataset again
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1">
<div>
<a href="{{ route('publish.workflow.submit.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.submit.deleteUpdate', $dataset->id], 'id' => 'releaseForm',
'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-1">
<label>Do you really want to delete the dataset?</label>
</div>
</div>
</fieldset>
<br />
<div class="pure-controls">
<button :disabled="errors.any()" type="submit" class="pure-button">
<i class="fa fa-trash"></i>
<span>Delete</span>
</button>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@stop

View File

@ -0,0 +1,28 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<span>Edit 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.submit.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.submit.update', $dataset->id], 'class' => 'pure-form', 'enctype' => 'multipart/form-data' ]) !!}
@include('workflow/submitter/_form', ['submitButtonText' => 'Edit Dataset', 'bookLabel' => 'Edit Dataset.'])
@include('errors._errors')
{!! Form::close() !!}
</div>
</div>
</div>
@stop

View File

@ -14,6 +14,7 @@
<th>Dataset Title</th> <th>Dataset Title</th>
<th>Owner</th> <th>Owner</th>
<th>Server State</th> <th>Server State</th>
<th>Date of last modification</th>
<th></th> <th></th>
</thead> </thead>
@ -27,7 +28,7 @@
} elseif ($dataset->server_state == 'released') { } elseif ($dataset->server_state == 'released') {
$rowclass = 'released'; $rowclass = 'released';
} }
elseif ($dataset->server_state == 'editor_accepted') { elseif ($dataset->server_state == 'editor_accepted' || $dataset->server_state == 'rejected_reviewer') {
$rowclass = 'editor_accepted'; $rowclass = 'editor_accepted';
} elseif ($dataset->server_state == 'approved') { } elseif ($dataset->server_state == 'approved') {
$rowclass = 'approved'; $rowclass = 'approved';
@ -35,7 +36,9 @@
$rowclass = 'reviewed'; $rowclass = 'reviewed';
} elseif ($dataset->server_state == 'rejected_editor') { } elseif ($dataset->server_state == 'rejected_editor') {
$rowclass = 'rejected_editor'; $rowclass = 'rejected_editor';
} } else {
$rowclass = "";
}
@endphp @endphp
<tr class="{{ $rowclass }}"> <tr class="{{ $rowclass }}">
<td> <td>
@ -55,16 +58,22 @@
<td> <td>
{{ $dataset->server_state }} {{ $dataset->server_state }}
</td> </td>
<td>
{{ $dataset->server_date_modified }}
</td>
<td> <td>
@if ($dataset->server_state == "inprogress" || $dataset->server_state == "rejected_editor") @if ($dataset->server_state == "inprogress" || $dataset->server_state == "rejected_editor")
<a href="{{ URL::route('publish.workflow.submit.edit', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i>
</a>
<a href="{{ URL::route('publish.workflow.submit.release', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.submit.release', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i> <i class="fa fa-share"></i>
<span>Release</span> <span>Release</span>
</a> </a>
<a href="{{ URL::route('publish.workflow.delete', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.submit.delete', $dataset->id) }}" class="pure-button">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
<span>Delete</span> {{-- <span>Delete</span> --}}
</a> </a>
@endif @endif

View File

@ -59,6 +59,14 @@ Route::group(
'middleware' => ['permission:dataset-list'], 'middleware' => ['permission:dataset-list'],
'as' => 'workflow.submit.index', 'uses' => 'SubmitController@index', 'as' => 'workflow.submit.index', 'uses' => 'SubmitController@index',
]); ]);
Route::get('workflow/submit/edit/{id}', [
'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'],
'as' => 'workflow.submit.edit', 'uses' => 'SubmitController@edit',
]);
Route::post('workflow/submit/edit/{id}', [
'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'],
'as' => 'workflow.submit.update', 'uses' => 'SubmitController@update',
]);
Route::get('workflow/submit/release/{id}', [ Route::get('workflow/submit/release/{id}', [
'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'], 'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'],
'as' => 'workflow.submit.release', 'uses' => 'SubmitController@release', 'as' => 'workflow.submit.release', 'uses' => 'SubmitController@release',
@ -67,9 +75,13 @@ Route::group(
'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'], 'middleware' => ['permission:dataset-submit', 'isUserDatasetAdmin:true'],
'as' => 'workflow.submit.releaseUpdate', 'uses' => 'SubmitController@releaseUpdate', 'as' => 'workflow.submit.releaseUpdate', 'uses' => 'SubmitController@releaseUpdate',
]); ]);
Route::get('workflow/delete/{id}', [ Route::get('workflow/submit/delete/{id}', [
'middleware' => ['isUserDatasetAdmin:true'], 'middleware' => ['isUserDatasetAdmin:true'],
'as' => 'workflow.delete', 'uses' => 'SubmitController@delete', 'as' => 'workflow.submit.delete', 'uses' => 'SubmitController@delete',
]);
Route::post('workflow/submit/delete/{id}', [
'middleware' => ['isUserDatasetAdmin:true'],
'as' => 'workflow.submit.deleteUpdate', 'uses' => 'SubmitController@deleteUpdate',
]); ]);
//editor //editor