- 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

@ -17,8 +17,10 @@
</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">
@ -36,9 +38,7 @@
@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">
@ -46,32 +46,28 @@
</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">
{!! Form::label('publisher_name', 'Publisher Name') !!}
{!! Form::text('publisher_name', 'Geologische Bundesanstalt Österreich', ['readonly', 'class' =>
'pure-u-23-24', ]) !!}
</div> </div>
<table> <div class="pure-controls instruction ">
<tbody><tr> <p>
<td>&nbsp;</td> Are you sure you want to publish the selected dataset?
<td> </p>
<button type="submit" class="pure-button"> <button type="submit" class="pure-button">
<i class="fa fa-share"></i> <i class="fa fa-share"></i>
<span>Set published</span> <span>Set published</span>
</button> </button>
{{-- <input type="submit" name="sureno" value="No"> --}} {{-- <input type="submit" name="sureno" value="No"> --}}
</td>
</tr> </div>
</tbody>
</table>
</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>