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);
$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('publish.create-step1', compact('licenses', 'languages', 'projects', 'types', 'relations'));
$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;