From 35e71a13c39789149e8e684551b615e2f384fc5b Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Mon, 18 May 2020 19:36:31 +0200 Subject: [PATCH] - composer updates - Formatierungsfehler bei Coverage im XML-Output von dc:coverage wurde behoben - DataCite: AlternateIdentifier zeigt nun die Landing Page zum Datensatz an - statt "Datum der Freischaltung" wird nun "Embargo-Ende" auf der Landing Page angezeigt - Projekte werden nun bei der OAI-ListSets-Abfrage angezeigt siehe: https://repository.geologie.ac.at/oai?verb=ListSets - Abstand vor dem Titel in den Suchergebnissen --- .../Controllers/Oai/RequestController.php | 45 +++++++++++++++++-- composer.json | 2 +- composer.lock | 22 ++++----- public/css/search_style.css | 1 + public/datasetxml2oai-pmh.xslt | 7 +-- public/prefixes/oai_datacite.xslt | 17 ++++++- .../views/frontend/dataset/show.blade.php | 4 +- 7 files changed, 76 insertions(+), 22 deletions(-) diff --git a/app/Http/Controllers/Oai/RequestController.php b/app/Http/Controllers/Oai/RequestController.php index 1b9c684..4e518ff 100644 --- a/app/Http/Controllers/Oai/RequestController.php +++ b/app/Http/Controllers/Oai/RequestController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Oai; use App\Exceptions\OaiModelException; use App\Http\Controllers\Controller; use App\Models\Dataset; +use App\Models\Project; use App\Models\Oai\Configuration as OaiModelConfiguration; use App\Models\Oai\OaiModelError; use App\Models\Oai\ResumptionTokens; @@ -118,6 +119,7 @@ class RequestController extends Controller // set OAI base url $uri = explode('?', $_SERVER['REQUEST_URI'], 2); $this->proc->setParameter('', 'baseURL', url('/') . $uri[0]); + $this->proc->setParameter('', 'repURL', url('/')); // $resumptionPath = $this->configuration->getResumptionTokenPath(); @@ -298,12 +300,13 @@ class RequestController extends Controller //$oaiSets = new Oai_Model_Sets(); $sets = array( - 'bibliography:true' => 'Set for bibliographic entries', - 'bibliography:false' => 'Set for non-bibliographic entries', + // 'bibliography:true' => 'Set for bibliographic entries', + // 'bibliography:false' => 'Set for non-bibliographic entries', ); $sets = array_merge( $sets, - $this->getSetsForDocumentTypes() + $this->getSetsForDocumentTypes(), + $this->getSetsForProjects(), ); //$sets = $this->getSetsForDocumentTypes(); @@ -387,12 +390,21 @@ class RequestController extends Controller $finder->whereIn('server_state', $this->deliveringDocumentStates); if (array_key_exists('set', $oaiRequest)) { $setarray = explode(':', $oaiRequest['set']); + if ($setarray[0] == 'data-type') { if (count($setarray) === 2 and !empty($setarray[1])) { $finder->where('type', $setarray[1]); } + } elseif ($setarray[0] == 'project') { + if (count($setarray) === 2 and !empty($setarray[1])) { + // $finder->where('type', $setarray[1]); + $finder->whereHas('project', function ($q) use ($setarray) { + $q->where('label', $setarray[1]); + }); + } } } + $totalIds = $finder->count(); $reldocIds = $finder->pluck('id')->toArray(); } @@ -522,6 +534,31 @@ class RequestController extends Controller return $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0); } + /** + * Returns oai sets for projects. + * @return array + */ + private function getSetsForProjects() + { + $setSpecPattern = self::SET_SPEC_PATTERN; + $sets = array(); + + $projects = Project::pluck('name', 'label')->toArray(); + foreach ($projects as $doctype => $row) { + if (0 == preg_match("/^$setSpecPattern$/", $doctype)) { + $msg = "Invalid SetSpec (doctype='" . $doctype . "')." + . " Allowed characters are [$setSpecPattern]."; + Log::error("OAI-PMH: $msg"); + continue; + } + + $setSpec = 'project:' . $doctype; + // $count = $row['count']; + $sets[$setSpec] = "Set for project '$doctype'"; + } + return $sets; + } + /** * Returns oai sets for document types. * @return array @@ -576,7 +613,7 @@ class RequestController extends Controller $identify = $sxe->addChild('Identify'); $identify->addChild('repositoryName', "Data Research Repository"); - $identify->addChild('baseURL', "http://tethys.geologie.ac.at/"); + $identify->addChild('baseURL', "https://tethys.at/"); $identify->addChild('protocolVersion', '2.0'); $identify->addChild('adminEmail', 'repository@geologie.ac.at'); //$identify->addChild('earliestDatestamp', '2017-04-07'); diff --git a/composer.json b/composer.json index aaeb053..9f9ae02 100755 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "davejamesmiller/laravel-breadcrumbs": "5.x", "felixkiss/uniquewith-validator": "^3.1", "fideloper/proxy": "^4.0", - "laravel/framework": "^6.0", + "laravel/framework": "^6.2", "laravel/tinker": "^1.0", "laravelcollective/html": "^6.1", "mcamara/laravel-localization": "^1.3", diff --git a/composer.lock b/composer.lock index d71f015..d64d55f 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7b170cd659a0ccd3c23b01d9b459f749", + "content-hash": "413b881be459667c601f26e12d21c034", "packages": [ { "name": "arifhp86/laravel-clear-expired-cache-file", @@ -1030,16 +1030,16 @@ }, { "name": "laravelcollective/html", - "version": "v6.1.0", + "version": "v6.1.1", "source": { "type": "git", "url": "https://github.com/LaravelCollective/html.git", - "reference": "64f2268bf41bf02b3a9dd3c30f102e934d721664" + "reference": "895115187e6fca81350a0b1152b5804f52a8ac28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LaravelCollective/html/zipball/64f2268bf41bf02b3a9dd3c30f102e934d721664", - "reference": "64f2268bf41bf02b3a9dd3c30f102e934d721664", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/895115187e6fca81350a0b1152b5804f52a8ac28", + "reference": "895115187e6fca81350a0b1152b5804f52a8ac28", "shasum": "" }, "require": { @@ -1094,7 +1094,7 @@ ], "description": "HTML and Form Builders for the Laravel Framework", "homepage": "https://laravelcollective.com", - "time": "2020-03-02T16:41:28+00:00" + "time": "2020-05-17T20:19:55+00:00" }, { "name": "league/commonmark", @@ -1198,16 +1198,16 @@ }, { "name": "league/flysystem", - "version": "1.0.68", + "version": "1.0.69", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "3e4198372276ec99ac3409a21d7c9d1ced9026e4" + "reference": "7106f78428a344bc4f643c233a94e48795f10967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3e4198372276ec99ac3409a21d7c9d1ced9026e4", - "reference": "3e4198372276ec99ac3409a21d7c9d1ced9026e4", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/7106f78428a344bc4f643c233a94e48795f10967", + "reference": "7106f78428a344bc4f643c233a94e48795f10967", "shasum": "" }, "require": { @@ -1284,7 +1284,7 @@ "type": "other" } ], - "time": "2020-05-12T20:33:44+00:00" + "time": "2020-05-18T15:13:39+00:00" }, { "name": "mcamara/laravel-localization", diff --git a/public/css/search_style.css b/public/css/search_style.css index bd53b00..fdd025c 100644 --- a/public/css/search_style.css +++ b/public/css/search_style.css @@ -65,6 +65,7 @@ section.search { .record-elem .h4, .record-elem h4 { font-size: 16px; letter-spacing: .05em; + margin-top: 8px; } .record-detail h1, .record-detail p, .record-elem h4, diff --git a/public/datasetxml2oai-pmh.xslt b/public/datasetxml2oai-pmh.xslt index 216c854..0950fe5 100644 --- a/public/datasetxml2oai-pmh.xslt +++ b/public/datasetxml2oai-pmh.xslt @@ -38,6 +38,7 @@ + @@ -394,7 +395,7 @@ )" /> - + @@ -402,7 +403,7 @@ - + @@ -410,7 +411,7 @@ - + diff --git a/public/prefixes/oai_datacite.xslt b/public/prefixes/oai_datacite.xslt index aaf01ac..ffd1c40 100644 --- a/public/prefixes/oai_datacite.xslt +++ b/public/prefixes/oai_datacite.xslt @@ -82,6 +82,11 @@ Dataset + + + + + @@ -237,6 +242,17 @@ + + + + url + + + + + + @@ -269,7 +285,6 @@ - diff --git a/resources/views/frontend/dataset/show.blade.php b/resources/views/frontend/dataset/show.blade.php index 34dd615..ed66300 100644 --- a/resources/views/frontend/dataset/show.blade.php +++ b/resources/views/frontend/dataset/show.blade.php @@ -113,10 +113,10 @@

Size: {{ $dataset->files()->count() }}

@if($dataset->embargo_date != null) -

Datum der Freischaltung: +

Embargo-Ende: {{ $dataset->embargo_date->toDateString() }}

{{-- @else -

Datum der Freischaltung: -

--}} +

Embargo-Ende: -

--}} @endif @if($dataset->hasEmbargoPassed() == true)