more metadata fields

This commit is contained in:
Arno Kaimbacher 2019-01-22 18:24:18 +01:00
parent b74927b5f2
commit bba029e74e
14 changed files with 288 additions and 100 deletions

View File

@ -49,19 +49,21 @@ class IndexController extends Controller
->get();
$languages = DB::table('languages')
->where('active', true)
->pluck('part2_t', 'part2_t');
->pluck('part1', 'part1');
// ->toArray();
// $persons = Person::where('status', 1)
// ->pluck('last_name', 'id');
$projects = Project::pluck('label', 'id');
$types = array(
'doi' => 'doi', 'handle' => 'handle', 'urn' => 'urn', 'std-doi' => 'std-doi',
'url' => 'url', 'isbn' => 'isbn', 'issn' => 'issn', 'rdr-id' => 'rdr-id'
);
$relations = array('updates' => 'updates', 'updated-by' => 'updated-by', 'other' => 'other');
$relatedIdentifierTypes = ["ARK", "arXiv", "bibcode", "DOI", "EAN13", "EISSN", "Handle", "IGSN", "ISBN", "ISSN", "ISTC", "LISSN", "LSID", "PMID", "PURL", "UPC", "URL", "URN"];
$relatedIdentifierTypes = array_combine($relatedIdentifierTypes, $relatedIdentifierTypes);
return view('publish.create-step1', compact('licenses', 'languages', 'projects', 'types', 'relations'));
$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);
$titleTypes = ['sub' => 'sub', 'alternative' => 'alternative', 'translated' => 'translated', 'other' => 'other'];
//$relationTypes = array('updates' => 'updates', 'updated-by' => 'updated-by', 'other' => 'other');
return view('publish.create-step1', compact('licenses', 'languages', 'projects', 'relatedIdentifierTypes', 'relationTypes', 'titleTypes'));
}
/**

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use Illuminate\View\View;
use Illuminate\Support\Facades\Config;
class FiletypeController extends Controller
{
// public function download($id)
// {
// //$report = $this->report->find($id);
// $file = File::findOrFail($id);
// $file_path = public_path('storage/' . $file->path_name);
// return response()->download($file_path, $file->label, ['Content-Type:' . $file->mime_type]);
// }
public function __construct()
{
$this->middleware('auth');
}
public function index(): View
{
$direction = 'asc'; // or desc
$fileextensions = Config::get('enums.filetypes_allowed');
return view('settings.filetype.index', compact('fileextensions'));
}
}

View File

@ -2,6 +2,7 @@
namespace App\Library\Xml;
use App\Models\Title;
use App\Models\Description;
use App\Models\License;
use App\Models\Person;
use App\Models\File;
@ -24,8 +25,8 @@ trait DatasetExtension
'fetch' => 'eager'
),
'TitleAbstract' => array(
'model' => Title::class,
'options' => array('type' => 'abstract'),
'model' => Description::class,
'options' => array('type' => ['abstract', 'methods']),
'fetch' => 'eager'
),
'Licence' => array(
@ -153,10 +154,10 @@ trait DatasetExtension
return $this;
}
public function getField($name)
{
return $this->_getField($name);
}
// public function getField($name)
// {
// return $this->_getField($name);
// }
/**
* Return a reference to an actual field.
@ -164,7 +165,7 @@ trait DatasetExtension
* @param string $name Name of the requested field.
* @return Field The requested field instance. If no such instance can be found, null is returned.
*/
protected function _getField($name)
protected function getField($name)
{
if (isset($this->fields[$name])) {
return $this->fields[$name];

View File

@ -6,7 +6,8 @@ use App\Library\Xml\DatasetExtension;
use App\Models\Collection;
use App\Models\License;
use App\Models\Project;
use App\Models\Title;
use App\Models\Description;
use App\Models\Titel;
use App\Models\Person;
use App\Models\XmlCache;
use App\Models\File;
@ -129,33 +130,28 @@ class Dataset extends Model
#endregion
#region title table:
public function titlesAbstracts()
{
return $this->hasMany(Title::class, 'document_id', 'id');
}
public function titles()
{
return $this->hasMany(Title::class, 'document_id', 'id')
->where('type', 'main');
return $this->hasMany(Titel::class, 'document_id', 'id');
}
public function addMainTitle(Title $title)
{
$title->type = 'main';
$this->titlesAbstracts()->save($title);
$this->titles()->save($title);
// $this->titles()->save($title, ['type' => 'main']);
}
/**
* Relation abstracts
*
* @return \App\Title
* @return \App\Description
*/
public function abstracts()
{
return $this->hasMany(Title::class, 'document_id', 'id')
->where('type', 'abstract');
return $this->hasMany(Description::class, 'document_id', 'id');
}
public function addMainAbstract(Title $title)
{
$title->type = 'abstract';

View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\Dataset;
class Description extends Model
{
protected $table = 'dataset_abstracts';
public $timestamps = false;
protected $fillable = [
];
public function dataset()
{
return $this->belongsTo(Dataset::class, 'document_id', 'id');
}
}

View File

@ -6,7 +6,7 @@ use App\Models\Dataset;
class Title extends Model
{
protected $table = 'document_title_abstracts';
protected $table = 'dataset_titles';
public $timestamps = false;

12
composer.lock generated
View File

@ -1234,16 +1234,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.1.1",
"version": "v4.2.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "8aae5b59b83bb4d0dbf07b0a835f2680a658f610"
"reference": "594bcae1fc0bccd3993d2f0d61a018e26ac2865a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8aae5b59b83bb4d0dbf07b0a835f2680a658f610",
"reference": "8aae5b59b83bb4d0dbf07b0a835f2680a658f610",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/594bcae1fc0bccd3993d2f0d61a018e26ac2865a",
"reference": "594bcae1fc0bccd3993d2f0d61a018e26ac2865a",
"shasum": ""
},
"require": {
@ -1259,7 +1259,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
"dev-master": "4.2-dev"
}
},
"autoload": {
@ -1281,7 +1281,7 @@
"parser",
"php"
],
"time": "2018-12-26T11:32:39+00:00"
"time": "2019-01-12T16:31:37+00:00"
},
{
"name": "paragonie/random_compat",

File diff suppressed because one or more lines are too long

View File

@ -31,6 +31,7 @@ function initialState() {
checkedLicenses: [], // [],
files: [],
references: [],
titles: [],
checkedContributors: [],
checkedSubmitters: [],

View File

@ -267,7 +267,7 @@ const app = new Vue({
Handles a change on the file upload
*/
addReference() {
let newReference = { value: '', label: '', relation: 'updates', type: 'rdr-id' };
let newReference = { value: '', label: '', relation: '', type: '' };
//this.dataset.files.push(uploadedFiles[i]);
this.dataset.references.push(newReference);
},
@ -277,6 +277,17 @@ const app = new Vue({
removeReference(key) {
this.dataset.references.splice(key, 1);
},
addTitle() {
let newTitle = { value: '', language: '', type: '' };
//this.dataset.files.push(uploadedFiles[i]);
this.dataset.titles.push(newTitle);
},
/*
Removes a selected reference
*/
removeTitle(key) {
this.dataset.titles.splice(key, 1);
},
filesChange(fieldName, fileList) {
this.fileCount = fileList.length
// this.dataset.files = this.$refs.files.files;

View File

@ -17,22 +17,106 @@
{{ csrf_field() }}
<div v-if="step === 1 && isInitial" data-vv-scope="step-1">
<h1>Step One</h1>
<h1>Step One: Mandatory Elements</h1>
<div class="form-group">
<legend>Datensatztyp</legend>
<legend>General</legend>
<div class="description hint">
<p>Bitte wählen Sie einen Datensatztyp aus der Liste aus.</p>
</div>
<p></p>
<div class="form-item">
{{-- <div class="form-item">
<label for="documentType">Datensatztyp<span class="required" title="Dieses Feld muss ausgefüllt werden."> *</span></label>
<div class="select" style="width:300px" title="Bitte wählen Sie einen Datensatztyp aus der Liste aus.">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'dataset.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</div>
</div> --}}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<label for="documentType">Datensatztyp<span class="required" title="Dieses Feld muss ausgefüllt werden."> *</span></label>
<div class="select pure-u-23-24" title="Bitte wählen Sie einen Datensatztyp aus der Liste aus.">
{!! Form::select('Type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --', 'v-model' =>
'dataset.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</div>
</div>
</div>
<fieldset id="fieldset-titles">
<legend>Title(s)</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleMain', 'Main Title ') !!}
{!! Form::text('TitleMain[Value]', null, ['class' => 'pure-u-23-24', 'v-model'
=> 'dataset.title_main.value', "v-validate" => "'required|min:3'", "data-vv-as" => "Main Title", 'data-vv-scope' => 'step-1']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleLanguage', 'Title Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('TitleMain[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.title_main.language',
"v-validate" => "'required'", "data-vv-as" => "Title Language", 'data-vv-scope' => 'step-1']) !!}
</div>
</div>
</div>
<button class="pure-button button-small" @click.prevent="addTitle()">+</button>
<table class="pure-table pure-table-horizontal" v-if="dataset.titles.length">
<thead>
<tr>
<th style="width: 20px;">Title</th>
<th>Type</th>
<th>Language</th>
<th style="width: 130px;"></th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in dataset.titles">
<td>
<input name="Title" class="form-control" placeholder="[TITLE]" v-model="item.value" v-validate="'required'" data-vv-scope="step-1" />
</td>
<td>
{!! Form::select('Title[Type]', $titleTypes, null,
['placeholder' => '[titleType]', 'v-model' => 'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</td>
<td>
{!! Form::select('Title[Relation]', $languages, null,
['placeholder' => '[language]', 'v-model' => 'item.language', 'data-vv-scope' => 'step-1']) !!}
</td>
<td>
<button class="pure-button button-small is-warning" @click.prevent="removeTitle(index)">-</button>
</td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset id="fieldset-general">
<legend>Creator(s)</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<my-autocomplete title="searching active person table" @person="onAddAuthor"></my-autocomplete>
{{--
<my-autocomplete :items="[ 'Apple', 'Banana', 'Orange', 'Mango', 'Pear', 'Peach', 'Grape', 'Tangerine', 'Pineapple']"></my-autocomplete> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<div class="pure-control-group checkboxlist">
<label v-for="(person, index) in dataset.persons" :for="person.id" class="pure-checkbox">
<input type="checkbox" name="persons" v-bind:value="person.id" v-model="dataset.checkedAuthors" class="form-check-input" data-vv-scope="step-1">
@{{ person.full_name }}
</label>
<br />
{{-- <span>Checked Authors: @{{ dataset.checkedAuthors }}</span> --}}
</div>
</div>
</div>
</fieldset>
<fieldset id="fieldset-publisher">
<legend>Publisher</legend>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('CreatingCorporation', 'Creating Corporation') !!}
{!! Form::text('CreatingCorporation', null, ['class' =>
'pure-u-23-24', 'v-model' => 'dataset.creating_corporation', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
</div>
</fieldset>
<div :class="{'form-group':true, 'has-error':errors.has('rights')}">
<legend>Einräumung eines einfachen Nutzungsrechts</legend>
@ -52,7 +136,7 @@
<span v-show="errors.has('step-1.rights')" class="text-danger">@{{ errors.first('step-1.rights') }}</span>
<span class="help-block">You must agree to continue</span> {{-- </div> --}}
<span class="help-block">You must agree to continue</span>
</div>
<br />
@ -71,19 +155,11 @@
</div>
<div v-if="step === 2 && isInitial" data-vv-scope="step-2">
<h1>Step Two</h1>
<h1>Step Two: Recommended Elements</h1>
<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('Person', 'Person..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Person', $persons, null, ['id' => 'type', 'placeholder' => '-- select person --']) !!}
</div>
</div> --}}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Type', 'Type..') !!}
<div class="select pure-u-23-24">
@ -106,12 +182,6 @@
</div> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('CreatingCorporation', 'Creating Corporation') !!}
{!! Form::text('CreatingCorporation', null, ['class' =>
'pure-u-23-24', 'v-model' => 'dataset.creating_corporation', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</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">
@ -219,7 +289,7 @@
</div>
</fieldset>
<fieldset id="fieldset-references">
<legend>Document references</legend>
<legend>Dataset references</legend>
<button class="pure-button button-small" @click.prevent="addReference()">Add Reference</button>
<table class="table table-hover" v-if="dataset.references.length">
<thead>
@ -234,15 +304,15 @@
<tbody>
<tr v-for="(item, index) in dataset.references">
<td>
<input name="Reference Value" class="form-control" v-model="item.value" v-validate="'required'" data-vv-scope="step-2" />
<input name="Reference Value" class="form-control" placeholder="[RELATED IDENTIFIER]" v-model="item.value" v-validate="'required'" data-vv-scope="step-2" />
</td>
<td>
{!! Form::select('Reference[Type]', $types, null,
['placeholder' => '--no type--', 'v-model' => 'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
{!! Form::select('Reference[Type]', $relatedIdentifierTypes, null,
['placeholder' => '[relatedIdentifierType]', 'v-model' => 'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
</td>
<td>
{!! Form::select('Reference[Relation]', $relations, null,
['placeholder' => '--no relation--', 'v-model' => 'item.relation', 'data-vv-scope' => 'step-2']) !!}
{!! Form::select('Reference[Relation]', $relationTypes, null,
['placeholder' => '[relationType]', 'v-model' => 'item.relation', 'data-vv-scope' => 'step-2']) !!}
</td>
<td>
<input name="Reference Label" class="form-control" v-model="item.label" v-validate="'required'" data-vv-scope="step-2" />
@ -276,28 +346,7 @@
</div>
<div v-if="step === 3 && isInitial" data-vv-scope="step-3">
<h1>Select authors, contributors, submitters</h1>
<fieldset id="fieldset-general">
<legend>Authors</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<my-autocomplete title="searching active person table" @person="onAddAuthor"></my-autocomplete>
{{--
<my-autocomplete :items="[ 'Apple', 'Banana', 'Orange', 'Mango', 'Pear', 'Peach', 'Grape', 'Tangerine', 'Pineapple']"></my-autocomplete> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
<div class="pure-control-group checkboxlist">
<label v-for="(person, index) in dataset.persons" :for="person.id" class="pure-checkbox">
<input type="checkbox" name="persons" v-bind:value="person.id" v-model="dataset.checkedAuthors" class="form-check-input" data-vv-scope="step-3">
@{{ person.full_name }}
</label>
<br />
<span>Checked Authors: @{{ dataset.checkedAuthors }}</span>
</div>
</div>
</div>
</fieldset>
<h1>Select contributors, submitters</h1>
<fieldset id="fieldset-general">
<legend>Contributors</legend>

View File

@ -0,0 +1,51 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-file"></i>
<span> File Extensions</span>
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-2-3">
<a class="pure-button button-small is-primary" href="{{ route('access.user.create') }}">
<i class="fa fa-plus-circle"></i>
<span>Create New File Extension</span>
</a>
<br><br>
@if ($message = Session::get('success'))
<div class="alert summary-success">
<p>{{ $message }}</p>
</div>
@endif
<table class="pure-table users">
<thead>
<tr>
<th>File Extensions</th>
<th width="280px">Action</th>
</tr>
</thead>
<tbody>
@foreach ($fileextensions as $key => $fileextension)
<tr>
<td>{{ $fileextension }}</td>
<td>
{{-- <a class="edit" href="{{ route('access.user.edit', $user->id) }}">&nbsp;Edit</a>
<span>&nbsp;</span>
<a class="delete" href="{{ route('access.user.destroy', $user->id) }}"><span>&nbsp;Delete</span></a> --}}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View File

@ -71,6 +71,10 @@
<a class="pure-menu-link" href="{{ route('settings.project') }}"><i class="fa fa-tasks"></i> Projects</a>
</li>
<li class="pure-menu-item {{ Route::is('settings.filetype') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ route('settings.filetype.index') }}"><i class="fa fa-archive"></i> Filetypes</a>
</li>
@permission('page')
<li class="{{ active_class(Active::checkUriPattern('settings/page*')) }}">
<a class="pure-menu-link" href="{{ route('settings.page.index') }}">

View File

@ -153,6 +153,31 @@ Route::group(['middleware' => ['permission:settings']], function () {
'as' => 'settings.file.download', 'uses' => 'Settings\FileController@download',
]);
//=================================================setting filetype=============================================
Route::get('/settings/filetype', [
'as' => 'settings.filetype.index', 'uses' => 'Settings\FiletypeController@index',
]);
// Route::get('/settings/collection/create', [
// 'as' => 'settings.collection.create', 'uses' => 'Settings\CollectionController@create',
// ]);
// Route::post('settings/collection/store', [
// 'as' => 'settings.collection.store', 'uses' => 'Settings\CollectionController@store',
// ]);
// Route::get('settings/collection/edit/{id}', [
// 'as' => 'settings.collection.edit', 'uses' => 'Settings\CollectionController@edit',
// ]);
// Route::patch('settings/collection/edit/{id}', [
// 'as' => 'settings.collection.update', 'uses' => 'Settings\CollectionController@update',
// ]);
// Route::get('settings/collection/show/{collection}', [
// 'as' => 'settings.collection.show', 'uses' => 'Settings\CollectionController@show',
// ]);
// Route::get('settings/collection/delete/{id}', [
// 'as' => 'settings.collection.delete', 'uses' => 'Settings\CollectionController@delete',
// ]);
//=================================================setting collection=============================================
Route::get('/settings/collection', [
'as' => 'settings.collection.index', 'uses' => 'Settings\CollectionController@index',