- capitalize type attribute for datacite standard

- DatasetExtension filter persons
This commit is contained in:
Arno Kaimbacher 2019-09-16 13:47:30 +02:00
parent 84deb7c457
commit 69f6f250b9
9 changed files with 41 additions and 29 deletions

View File

@ -62,11 +62,11 @@ class IndexController extends Controller
$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'];
$titleTypes = ['sub' => 'Sub', 'alternative' => 'Alternative', 'translated' => 'Translated', 'other' => 'Other'];
$keywordTypes = ['uncontrolled' => 'uncontrolled'];
$descriptionTypes = ['methods' => 'methods', 'series_information' => 'series_information', 'technical_info' => 'technical_info', 'translated' => 'translated', 'other' => 'other'];
$descriptionTypes = ['methods' => 'Methods', 'series_information' => 'Series_information', 'technical_info' => 'Technical_info', 'translated' => 'Translated', 'other' => 'Other'];
$page = Page::query()->where('page_slug', 'terms-and-conditions')->firstOrFail();

View File

@ -268,11 +268,13 @@ trait DatasetExtension
//$licenses = $select->with('datasets')->get();
//$rows = $supplier->datasets;
$rows = $this->{$relation};
//if (isset($this->externalFields[$fieldname]['pivot']))
//{
// $pivArray = $this->externalFields[$fieldname]['pivot'];
// $rows = $rows->wherePivot('role', $pivArray['role']);
//}
if (isset($this->externalFields[$fieldname]['pivot'])) {
$pivArray = $this->externalFields[$fieldname]['pivot'];
$pivotValue = $pivArray['role'];
//$through = $this->externalFields[$fieldname]['through'];
$rows = $this->{$relation}()->wherePivot('role', $pivotValue)->get();
//$rows = $this->belongsToMany($modelclass, $through, 'document_id')->wherePivot('role', $pivotValue)->get();
}
} else {
$rows = $select->whereHas('dataset', function ($q) use ($datasetId) {
$q->where('id', $datasetId);
@ -287,10 +289,15 @@ trait DatasetExtension
$objArray = [];
foreach ($attributes as $property_name) {
$fieldName = self::convertColumnToFieldname($property_name);
// $field =new Field($fieldName);
$fieldval = $row->{$property_name};
// $field->setValue($fieldval);
// $this->_mapField($field, $dom, $rootNode);
$fieldval = "";
if ($fieldName == "Type") {
$fieldval = ucfirst($row->{$property_name});
} else {
// $field =new Field($fieldName);
$fieldval = $row->{$property_name};
// $field->setValue($fieldval);
// $this->_mapField($field, $dom, $rootNode);
}
$objArray[$fieldName] = $fieldval;
}
$result[] = $objArray;

View File

@ -24,7 +24,7 @@ class Person extends Model
public function documents()
{
return $this->belongsToMany(Dataset::class, 'link_documents_persons', 'person_id', 'document_id')
->withPivot('role');
->withPivot('role', 'sort_order', 'allow_email_contact');
}
// public function scopeNotLimit($query)

24
composer.lock generated
View File

@ -3958,16 +3958,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.15",
"version": "7.5.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d79c053d972856b8b941bb233e39dc521a5093f0"
"reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d79c053d972856b8b941bb233e39dc521a5093f0",
"reference": "d79c053d972856b8b941bb233e39dc521a5093f0",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/316afa6888d2562e04aeb67ea7f2017a0eb41661",
"reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661",
"shasum": ""
},
"require": {
@ -4027,8 +4027,8 @@
"authors": [
{
"name": "Sebastian Bergmann",
"role": "lead",
"email": "sebastian@phpunit.de"
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
@ -4038,7 +4038,7 @@
"testing",
"xunit"
],
"time": "2019-08-21T07:05:16+00:00"
"time": "2019-09-14T09:08:39+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -4260,16 +4260,16 @@
},
{
"name": "sebastian/exporter",
"version": "3.1.1",
"version": "3.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "06a9a5947f47b3029d76118eb5c22802e5869687"
"reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/06a9a5947f47b3029d76118eb5c22802e5869687",
"reference": "06a9a5947f47b3029d76118eb5c22802e5869687",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e",
"reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e",
"shasum": ""
},
"require": {
@ -4323,7 +4323,7 @@
"export",
"exporter"
],
"time": "2019-08-11T12:43:14+00:00"
"time": "2019-09-14T09:02:43+00:00"
},
{
"name": "sebastian/global-state",

View File

@ -27,7 +27,7 @@ class CreatePersonsTable extends Migration
$table->string('identifier_misc', 50)->nullable();
$table->boolean('status')->nullable()->default(1);
$table->integer('registered_at')->nullable();
$table->string('name_type', 50)->nullable();
$table->enum('name_type', ['author', 'contributor', 'other'])->nullable();
});
Schema::create('link_documents_persons', function (Blueprint $table) {

View File

@ -20,7 +20,7 @@ class CreateDatasetTitlesTable extends Migration
$table->foreign('document_id')->references('id')->on('documents')
->onUpdate('cascade')->onDelete('cascade');
$table->enum('type', ['main' => 'main', 'sub' => 'sub', 'alternative' => 'alternative', 'translated' => 'translated', 'other' => 'other']);
$table->enum('type', ['main' => 'Main', 'sub' => 'sub', 'Alternative' => 'alternative', 'translated' => 'Translated', 'other' => 'Other']);
$table->string('value', 255);
$table->string('language', 3);
});

View File

@ -22,7 +22,7 @@ class CreateDatasetAbstractsTable extends Migration
$table->enum(
'type',
['abstract' => 'abstract', 'methods' => 'methods', 'series_information' => 'series_information', 'technical_info' => 'technical_info', 'translated' => 'translated', 'other' => 'other']
['abstract' => 'Abstract', 'methods' => 'Methods', 'series_information' => 'Series_information', 'technical_info' => 'Technical_info', 'translated' => 'Translated', 'other' => 'Other']
);
$table->string('value', 255);
$table->string('language', 3);

View File

@ -141,7 +141,7 @@
<xsl:value-of select="@Language" />
</xsl:attribute>
</xsl:if>
<xsl:if test="@Type != '' and @Type != 'main'">
<xsl:if test="@Type != '' and @Type != 'Main'">
<xsl:attribute name="titleType">
<xsl:value-of select="@Type" />
</xsl:attribute>
@ -153,6 +153,11 @@
<xsl:template match="PersonContributor" mode="oai_datacite">
<contributor>
<contributorName>
<xsl:if test="@NameType != ''">
<xsl:attribute name="nameType">
<xsl:value-of select="@NameType" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@LastName" />
</contributorName>
</contributor>

View File

@ -40,7 +40,7 @@
<div class="pure-control-group">
{!! Form::label('name_type', 'Name Type') !!}
<div class="select form-control">
{!! Form::select('name_type', ['personal' => 'personal', 'organizational' => 'organizational'], null, ['id' => 'name_type', 'placeholder' => '-- no name type --']) !!}
{!! Form::select('name_type', ['personal' => 'Personal', 'organizational' => 'Organizational'], null, ['id' => 'name_type', 'placeholder' => '-- no name type --']) !!}
</div>
<small id="nameTypeHelp" class="pure-form-message-inline">name type is optional</small>
</div>