- add publisher_name and publish_id

- extend DatasetExtension wirt PublisherName and PublishId
- adapt migrations
This commit is contained in:
Arno Kaimbacher 2019-09-17 12:55:01 +02:00
parent 68add9025f
commit f1728568c3
6 changed files with 44 additions and 35 deletions

View File

@ -371,9 +371,19 @@ class EditorController extends Controller
public function publishUpdate(Request $request, $id) public function publishUpdate(Request $request, $id)
{ {
$dataset = Dataset::findOrFail($id); $dataset = Dataset::findOrFail($id);
$max = Dataset::max('publish_id');
$publish_id = 0;
if ($max != null) {
$publish_id = $max +1;
} else {
$publish_id = $publish_id + 1;
}
$input = $request->all(); $input = $request->all();
$input['server_state'] = 'published'; $input['server_state'] = 'published';
$input['server_date_published'] = Carbon::now()->toDateTimeString(); // Produces something like "2019-03-11 12:25:00" $input['server_date_published'] = Carbon::now()->toDateTimeString(); // Produces something like "2019-03-11 12:25:00"
$input['publish_id'] = $publish_id;
if ($dataset->update($input)) { if ($dataset->update($input)) {
// event(new PageUpdated($page)); // event(new PageUpdated($page));

View File

@ -85,6 +85,8 @@ trait DatasetExtension
{ {
$fields = array( $fields = array(
"Id", "Id",
"PublisherName",
"PublishId",
"ContributingCorporation", "ContributingCorporation",
"CreatingCorporation", "CreatingCorporation",
"Language", "Language",

View File

@ -33,6 +33,8 @@ class Dataset extends Model
'language', 'language',
'server_state', 'server_state',
'server_date_published', 'server_date_published',
'publisher_name',
'publish_id',
'creating_corporation', 'creating_corporation',
'project_id', 'project_id',
'embargo_date', 'embargo_date',

View File

@ -19,6 +19,7 @@ class CreateDocumentsTable extends Migration
$table->string('creating_corporation', 255); $table->string('creating_corporation', 255);
$table->string('publisher_name', 255)->nullable(); $table->string('publisher_name', 255)->nullable();
$table->dateTime('embargo_date')->nullable(); $table->dateTime('embargo_date')->nullable();
$table->unsignedInteger('publish_id')->unique()->nullable();
$table->integer('project_id')->unsigned()->nullable(); $table->integer('project_id')->unsigned()->nullable();
$table->foreign('project_id')->references('id')->on('projects'); $table->foreign('project_id')->references('id')->on('projects');
$table->enum( $table->enum(

View File

@ -245,8 +245,6 @@
</fieldset> </fieldset>
<div :class="{'form-group':true, 'has-error':errors.has('step-1.rights')}"> <div :class="{'form-group':true, 'has-error':errors.has('step-1.rights')}">
{{-- <legend>Einräumung eines einfachen Nutzungsrechts</legend> --}}
<label for="rights"> <label for="rights">
<input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" v-validate="'required'" data-vv-scope="step-1"> <input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" v-validate="'required'" data-vv-scope="step-1">
terms and conditions terms and conditions

View File

@ -1,4 +1,4 @@
@extends('settings.layouts.app') @extends('settings.layouts.app')
@section('content') @section('content')
<div class="header"> <div class="header">
<h3 class="header-title"> <h3 class="header-title">
@ -17,12 +17,14 @@
</div> </div>
<div id="app1"> <div id="app1">
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.publishUpdate', $dataset->id], {!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.publishUpdate',
'id' => 'publishForm', 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) $dataset->id],
'id' => 'publishForm', 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' =>
'checkForm'])
!!} !!}
<fieldset id="fieldset-General"> <fieldset id="fieldset-General">
<h3>Selected Dataset</h3> <h3>Selected Dataset</h3>
<table style="margin-left: 2em"> <table style="margin-left: 2em">
<tbody> <tbody>
@ -35,43 +37,37 @@
</div> </div>
@endforeach @endforeach
<div class="authors"> <div class="authors">
@foreach($dataset->persons as $author) @foreach($dataset->persons as $author)
{{ $author->full_name }}
{{ $author->full_name }} @endforeach
@endforeach
</div> </div>
<input type="hidden" name="selected[]" value="49"> <input type="hidden" name="selected[]" value="49">
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="instruction">
Are you sure you want to publish the selected dataset? <div class="pure-u-1 pure-u-md-1-2 pure-div">
</div> {!! Form::label('publisher_name', 'Publisher Name') !!}
<table> {!! Form::text('publisher_name', 'Geologische Bundesanstalt Österreich', ['readonly', 'class' =>
<tbody><tr> 'pure-u-23-24', ]) !!}
<td>&nbsp;</td> </div>
<td> <div class="pure-controls instruction ">
<button type="submit" class="pure-button"> <p>
<i class="fa fa-share"></i> Are you sure you want to publish the selected dataset?
<span>Set published</span> </p>
</button> <button type="submit" class="pure-button">
{{-- <input type="submit" name="sureno" value="No"> --}} <i class="fa fa-share"></i>
</td> <span>Set published</span>
</tr> </button>
</tbody> {{-- <input type="submit" name="sureno" value="No"> --}}
</table>
</div>
</fieldset> </fieldset>
<br /> <br />
{{-- <div class="pure-controls">
<button type="submit" class="pure-button">
<i class="fa fa-share"></i>
<span>Set published</span>
</button>
</div> --}}
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@ -80,6 +76,6 @@
</div> </div>
@stop @stop
@section('after-scripts') @section('after-scripts')
@stop @stop