- add ui for editor for publishing dois

- composer updates
- unit test with test credentials
This commit is contained in:
Arno Kaimbacher 2021-05-18 13:17:29 +02:00
parent 367dd328ef
commit b5abcef327
14 changed files with 422 additions and 102 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
namespace App\Http\Controllers\Publish; namespace App\Http\Controllers\Publish;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
@ -28,11 +29,40 @@ use Illuminate\Support\Facades\View;
use \Exception; use \Exception;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use App\Models\DatasetIdentifier;
use App\Models\Oai\OaiModelError;
use App\Exceptions\OaiModelException;
use App\Interfaces\DoiInterface;
class EditorController extends Controller class EditorController extends Controller
{ {
public function __construct() /**
* Holds xml representation of document information to be processed.
*
* @var \DomDocument Defaults to null.
*/
protected $xml = null;
/**
* Holds the stylesheet for the transformation.
*
* @var \DomDocument Defaults to null.
*/
protected $xslt = null;
/**
* Holds the xslt processor.
*
* @var \XSLTProcessor Defaults to null.
*/
protected $proc = null;
public function __construct(DoiInterface $DoiClient)
{ {
$this->doiClient = $DoiClient;
//$this->middleware('auth'); //$this->middleware('auth');
$this->xml = new \DomDocument();
$this->proc = new \XSLTProcessor();
} }
/** /**
@ -48,11 +78,12 @@ class EditorController extends Controller
$builder = Dataset::query(); $builder = Dataset::query();
//"select * from [documents] where [server_state] in (?) or ([server_state] = ? and [editor_id] = ?)" //"select * from [documents] where [server_state] in (?) or ([server_state] = ? and [editor_id] = ?)"
$datasets = $builder $datasets = $builder
->where('server_state', 'released') ->where('server_state', 'released')
// ->whereIn('server_state', ['released']) // ->whereIn('server_state', ['released'])
->orWhere(function ($query) use ($user_id) { ->orWhere(function ($query) use ($user_id) {
$query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed']) $query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed', 'published'])
->where('editor_id', $user_id); ->where('editor_id', $user_id)->doesntHave('identifier', 'and');
}) })
->orderBy('server_date_modified', 'desc') ->orderBy('server_date_modified', 'desc')
->get(); ->get();
@ -105,8 +136,10 @@ class EditorController extends Controller
$dataset->load('licenses', 'authors', 'contributors', 'titles', 'abstracts', 'files', 'coverage', 'subjects', 'references'); $dataset->load('licenses', 'authors', 'contributors', 'titles', 'abstracts', 'files', 'coverage', 'subjects', 'references');
$titleTypes = ['Main' => 'Main', 'Sub' => 'Sub', 'Alternative' => 'Alternative', 'Translated' => 'Translated', 'Other' => 'Other']; $titleTypes = ['Main' => 'Main', 'Sub' => 'Sub', 'Alternative' => 'Alternative', 'Translated' => 'Translated', 'Other' => 'Other'];
$descriptionTypes = ['Abstract' => 'Abstract', 'Methods' => 'Methods', 'Series_information' => 'Series_information', $descriptionTypes = [
'Technical_info' => 'Technical_info', 'Translated' => 'Translated', 'Other' => 'Other']; 'Abstract' => 'Abstract', 'Methods' => 'Methods', 'Series_information' => 'Series_information',
'Technical_info' => 'Technical_info', 'Translated' => 'Translated', 'Other' => 'Other'
];
$languages = DB::table('languages') $languages = DB::table('languages')
->where('active', true) ->where('active', true)
->pluck('part1', 'part1'); ->pluck('part1', 'part1');
@ -126,7 +159,7 @@ class EditorController extends Controller
$languages = DB::table('languages') $languages = DB::table('languages')
->where('active', true) ->where('active', true)
->pluck('part1', 'part1'); ->pluck('part1', 'part1');
$contributorTypes = Config::get('enums.contributor_types'); $contributorTypes = Config::get('enums.contributor_types');
$nameTypes = Config::get('enums.name_types'); $nameTypes = Config::get('enums.name_types');
@ -142,8 +175,10 @@ class EditorController extends Controller
$referenceTypes = ["rdr-id", "doi", "handle", "isbn", "issn", "url", "urn"]; $referenceTypes = ["rdr-id", "doi", "handle", "isbn", "issn", "url", "urn"];
$referenceTypes = array_combine($referenceTypes, $referenceTypes); $referenceTypes = array_combine($referenceTypes, $referenceTypes);
$relationTypes = ["IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues", $relationTypes = [
"IsNewVersionOf", "IsPartOf", "HasPart", "Compiles", "IsVariantFormOf"]; "IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues",
"IsNewVersionOf", "IsPartOf", "HasPart", "Compiles", "IsVariantFormOf"
];
$relationTypes = array_combine($relationTypes, $relationTypes); $relationTypes = array_combine($relationTypes, $relationTypes);
return View::make( return View::make(
@ -415,7 +450,8 @@ class EditorController extends Controller
$formCoverage $formCoverage
); );
} elseif (isset($data['coverage']) && $this->containsOnlyNull($data['coverage']) } elseif (isset($data['coverage']) && $this->containsOnlyNull($data['coverage'])
&& !is_null($dataset->coverage)) { && !is_null($dataset->coverage)
) {
$dataset->coverage()->delete(); $dataset->coverage()->delete();
} }
@ -592,4 +628,131 @@ class EditorController extends Controller
} }
throw new GeneralException(trans('exceptions.publish.publish.update_error')); throw new GeneralException(trans('exceptions.publish.publish.update_error'));
} }
/**
* Display the specified dataset for publishing.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function doi($id): \Illuminate\Contracts\View\View
{
$dataset = Dataset::query()
->with([
'titles',
'persons' => function ($query) {
$query->wherePivot('role', 'author');
},
])->findOrFail($id);
return View::make('workflow.editor.doi', [
'dataset' => $dataset,
]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function doiStore(Request $request, $publish_id)
{
$dataId = $publish_id; //$request->input('publish_id');
// Setup stylesheet
$this->loadStyleSheet(public_path() . '/prefixes/doi_datacite.xslt');
// set timestamp
$date = new \DateTime();
$unixTimestamp = $date->getTimestamp();
$this->proc->setParameter('', 'unixTimestamp', $unixTimestamp);
$prefix = "";
$base_domain = "";
$datacite_environment = config('tethys.datacite_environment');
if ($datacite_environment == "debug") {
$prefix = config('tethys.datacite_test_prefix');
$base_domain = config('tethys.test_base_domain');
} elseif ($datacite_environment == "production") {
$prefix = config('tethys.datacite_prefix');
$base_domain = config('tethys.base_domain');
}
// $prefix = config('tethys.datacite_prefix');
$this->proc->setParameter('', 'prefix', $prefix);
$repIdentifier = "tethys";
$this->proc->setParameter('', 'repIdentifier', $repIdentifier);
$this->xml->appendChild($this->xml->createElement('Datasets'));
$dataset = Dataset::where('publish_id', '=', $dataId)->firstOrFail();
if (is_null($dataset)) {
throw new OaiModelException('Dataset is not available for registering DOI!', OaiModelError::NORECORDSMATCH);
}
$dataset->fetchValues();
$xmlModel = new \App\Library\Xml\XmlModel();
$xmlModel->setModel($dataset);
$xmlModel->excludeEmptyFields();
$cache = ($dataset->xmlCache) ? $dataset->xmlCache : new \App\Models\XmlCache();
$xmlModel->setXmlCache($cache);
$domNode = $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0);
$node = $this->xml->importNode($domNode, true);
$this->addSpecInformation($node, 'data-type:' . $dataset->type);
$this->xml->documentElement->appendChild($node);
$xmlMeta = $this->proc->transformToXML($this->xml);
// Log::alert($xmlMeta);
//create doiValue and correspunfing landingpage of tehtys
$doiValue = $prefix . '/tethys.' . $dataset->publish_id;
// $appUrl = config('app.url');
$landingPageUrl = $base_domain . "/dataset/" . $dataset->publish_id;
$response = $this->doiClient->registerDoi($doiValue, $xmlMeta, $landingPageUrl);
// if operation successful, store dataste identifier
if ($response->getStatusCode() == 201) {
$doi = new DatasetIdentifier();
$doi['value'] = $doiValue; //$landingPageUrl;
$doi['dataset_id'] = $dataset->id;
$doi['type'] = "doi";
$doi['status'] = "findable";
if ($doi->save()) {
// update server_date_modified for triggering nex xml cache (doi interface)
$time = new \Illuminate\Support\Carbon();
$dataset->server_date_modified = $time;
$dataset->save();
return redirect()
->route('publish.workflow.editor.index')
->with('flash_message', 'You have successfully created a DOI for the dataset!');
}
} else {
$message = 'unexpected DataCite MDS response code ' . $response->getStatusCode();
// $this->log($message, 'err');
throw new GeneralException($message);
}
}
/**
* Load an xslt stylesheet.
*
* @return void
*/
private function loadStyleSheet($stylesheet)
{
$this->xslt = new \DomDocument;
$this->xslt->load($stylesheet);
$this->proc->importStyleSheet($this->xslt);
if (isset($_SERVER['HTTP_HOST'])) {
$this->proc->setParameter('', 'host', $_SERVER['HTTP_HOST']);
}
//$this->proc->setParameter('', 'server', $this->getRequest()->getBaseUrl());
}
private function addSpecInformation(\DOMNode $document, $information)
{
$setSpecAttribute = $this->xml->createAttribute('Value');
$setSpecAttributeValue = $this->xml->createTextNode($information);
$setSpecAttribute->appendChild($setSpecAttributeValue);
$setSpecElement = $this->xml->createElement('SetSpec');
//$setSpecElement =new \DOMElement("SetSpec");
$setSpecElement->appendChild($setSpecAttribute);
$document->appendChild($setSpecElement);
}
} }

View File

@ -7,6 +7,7 @@ use App\Models\License;
use App\Models\Person; use App\Models\Person;
use App\Models\File; use App\Models\File;
use App\Models\Coverage; use App\Models\Coverage;
use App\Models\DatasetIdentifier;
use App\Models\Subject; use App\Models\Subject;
use App\Models\DatasetReference; use App\Models\DatasetReference;
@ -70,6 +71,11 @@ trait DatasetExtension
'relation' => 'references', 'relation' => 'references',
'fetch' => 'eager' 'fetch' => 'eager'
), ),
'Identifier' => array(
'model' => DatasetIdentifier::class,
'relation' => 'identifier',
'fetch' => 'eager'
),
'Subject' => array( 'Subject' => array(
'model' => Subject::class, 'model' => Subject::class,
'relation' => 'subjects', 'relation' => 'subjects',

View File

@ -13,6 +13,7 @@ use App\Models\Project;
use App\Models\Title; use App\Models\Title;
use App\Models\User; use App\Models\User;
use App\Models\XmlCache; use App\Models\XmlCache;
use App\Models\DatasetIdentifier;
use Carbon\Carbon; use Carbon\Carbon;
// use App\Models\GeolocationBox; // use App\Models\GeolocationBox;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -96,6 +97,14 @@ class Dataset extends Model
return $this->belongsTo(Project::class, 'project_id', 'id'); return $this->belongsTo(Project::class, 'project_id', 'id');
} }
/**
* Get the doi indentifier that owns the dataset.
*/
public function identifier()
{
return $this->hasOne(DatasetIdentifier::class, 'dataset_id', 'id');
}
/** /**
* Get the account that the dataset belongs to * Get the account that the dataset belongs to
*/ */

View File

@ -14,6 +14,6 @@ class DatasetIdentifier extends Model
*/ */
public function dataset() public function dataset()
{ {
return $this->belongsTo(Dataset::class, 'document_id', 'id'); return $this->belongsTo(Dataset::class, 'dataset_id', 'id');
} }
} }

View File

@ -7,7 +7,8 @@
namespace App\Providers; namespace App\Providers;
use App\Tethys\Utils\DoiService; use App\Tethys\Utils\DoiClient;
use App\Interfaces\DoiInterface;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class DoiServiceProvider extends ServiceProvider class DoiServiceProvider extends ServiceProvider
@ -33,12 +34,12 @@ class DoiServiceProvider extends ServiceProvider
{ {
// //
$this->app->singleton('App\Interfaces\DoiInterface', function ($app) { $this->app->singleton('App\Interfaces\DoiInterface', function ($app) {
return new DoiService(); return new DoiClient();
}); });
} }
public function provides() public function provides()
{ {
return [DoiService::class]; return [DoiClient::class];
} }
} }

View File

@ -10,20 +10,24 @@ class DoiClient implements DoiInterface
private $username; private $username;
private $password; private $password;
private $serviceUrl; private $serviceUrl;
private $prefix;
private $base_domain;
public function __construct() public function __construct()
{ {
$datacite_environment = "production"; //config('tethys.datacite_environment'); $datacite_environment = config('tethys.datacite_environment');
if ($datacite_environment == "debug") { if ($datacite_environment == "debug") {
$this->username = config('tethys.datacite_test_username'); $this->username = config('tethys.datacite_test_username');
$this->password = config('tethys.datacite_test_password'); $this->password = config('tethys.datacite_test_password');
$this->serviceUrl = config('tethys.test_datacite_service_url'); $this->serviceUrl = config('tethys.datacite_test_service_url');
$this->prefix = config('tethys.datacite_prefix'); $this->prefix = config('tethys.datacite_test_prefix');
$this->base_domain = config('tethys.test_base_domain');
} elseif ($datacite_environment == "production") { } elseif ($datacite_environment == "production") {
$this->username = config('tethys.datacite_username'); $this->username = config('tethys.datacite_username');
$this->password = config('tethys.datacite_password'); $this->password = config('tethys.datacite_password');
$this->serviceUrl = config('tethys.datacite_service_url'); $this->serviceUrl = config('tethys.datacite_service_url');
$this->prefix = config('tethys.datacite_prefix'); $this->prefix = config('tethys.datacite_prefix');
$this->base_domain = config('tethys.base_domain');
} }
if (is_null($this->username) || is_null($this->password) || is_null($this->serviceUrl)) { if (is_null($this->username) || is_null($this->password) || is_null($this->serviceUrl)) {
$message = 'missing configuration settings to properly initialize DOI client'; $message = 'missing configuration settings to properly initialize DOI client';
@ -45,6 +49,7 @@ class DoiClient implements DoiInterface
{ {
// Schritt 1: Metadaten als XML registrieren // Schritt 1: Metadaten als XML registrieren
// state draft
$response = null; $response = null;
$url = $this->serviceUrl . '/metadata/' . $doiValue; $url = $this->serviceUrl . '/metadata/' . $doiValue;
try { try {
@ -79,7 +84,7 @@ class DoiClient implements DoiInterface
} }
// Schritt 2: Register the DOI name // Schritt 2: Register the DOI name
// DOI und URL der Frontdoor des zugehörigen Dokuments übergeben // DOI und URL der Frontdoor des zugehörigen Dokuments übergeben: state findable
$url = $this->serviceUrl . '/doi/' . $doiValue; $url = $this->serviceUrl . '/doi/' . $doiValue;
try { try {
$client = new Client( $client = new Client(
@ -199,7 +204,7 @@ class DoiClient implements DoiInterface
public function updateMetadataForDoi($doiValue, $newMeta) public function updateMetadataForDoi($doiValue, $newMeta)
{ {
$response = null; $response = null;
$url = $this->serviceUrl . '/metadata/' . $doiValue; $url = $this->serviceUrl . '/metadata/' . $doiValue;
try { try {
$client = new Client([ $client = new Client([
'auth' => [$this->username, $this->password], 'auth' => [$this->username, $this->password],

102
composer.lock generated
View File

@ -1359,16 +1359,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v6.20.26", "version": "v6.20.27",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "0117d797dc1ab64b1f88d4f6b966380ea7def091" "reference": "92c0417e60efc39bc556ba5dfc9b20a56f7848fb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/0117d797dc1ab64b1f88d4f6b966380ea7def091", "url": "https://api.github.com/repos/laravel/framework/zipball/92c0417e60efc39bc556ba5dfc9b20a56f7848fb",
"reference": "0117d797dc1ab64b1f88d4f6b966380ea7def091", "reference": "92c0417e60efc39bc556ba5dfc9b20a56f7848fb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1508,7 +1508,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-04-28T14:38:32+00:00" "time": "2021-05-11T14:00:28+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -1652,16 +1652,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "1.6.1", "version": "1.6.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "2651c497f005de305c7ba3f232cbd87b8c00ee8c" "reference": "7d70d2f19c84bcc16275ea47edabee24747352eb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2651c497f005de305c7ba3f232cbd87b8c00ee8c", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/7d70d2f19c84bcc16275ea47edabee24747352eb",
"reference": "2651c497f005de305c7ba3f232cbd87b8c00ee8c", "reference": "7d70d2f19c84bcc16275ea47edabee24747352eb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1749,7 +1749,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-08T16:08:00+00:00" "time": "2021-05-12T11:39:41+00:00"
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
@ -2076,16 +2076,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.47.0", "version": "2.48.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "606262fd8888b75317ba9461825a24fc34001e1e" "reference": "d3c447f21072766cddec3522f9468a5849a76147"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/606262fd8888b75317ba9461825a24fc34001e1e", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3c447f21072766cddec3522f9468a5849a76147",
"reference": "606262fd8888b75317ba9461825a24fc34001e1e", "reference": "d3c447f21072766cddec3522f9468a5849a76147",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2165,7 +2165,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-13T21:54:02+00:00" "time": "2021-05-07T10:08:30+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@ -3016,16 +3016,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v4.4.22", "version": "v4.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "36bbd079b69b94bcc9c9c9e1e37ca3b1e7971625" "reference": "1ab187ac21d41d7d34a4f529091a1f5d0bb2924f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/36bbd079b69b94bcc9c9c9e1e37ca3b1e7971625", "url": "https://api.github.com/repos/symfony/console/zipball/1ab187ac21d41d7d34a4f529091a1f5d0bb2924f",
"reference": "36bbd079b69b94bcc9c9c9e1e37ca3b1e7971625", "reference": "1ab187ac21d41d7d34a4f529091a1f5d0bb2924f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3085,7 +3085,7 @@
"description": "Eases the creation of beautiful and testable command line interfaces", "description": "Eases the creation of beautiful and testable command line interfaces",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v4.4.22" "source": "https://github.com/symfony/console/tree/v4.4.23"
}, },
"funding": [ "funding": [
{ {
@ -3101,7 +3101,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-16T17:32:19+00:00" "time": "2021-05-10T12:53:15+00:00"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
@ -3306,16 +3306,16 @@
}, },
{ {
"name": "symfony/error-handler", "name": "symfony/error-handler",
"version": "v4.4.22", "version": "v4.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/error-handler.git", "url": "https://github.com/symfony/error-handler.git",
"reference": "76603a8df8e001436df80758eb03a8baa5324175" "reference": "21d75bfbdfdd3581a7f97080deb98926987f14a7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/76603a8df8e001436df80758eb03a8baa5324175", "url": "https://api.github.com/repos/symfony/error-handler/zipball/21d75bfbdfdd3581a7f97080deb98926987f14a7",
"reference": "76603a8df8e001436df80758eb03a8baa5324175", "reference": "21d75bfbdfdd3581a7f97080deb98926987f14a7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3355,7 +3355,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code", "description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/error-handler/tree/v4.4.22" "source": "https://github.com/symfony/error-handler/tree/v4.4.23"
}, },
"funding": [ "funding": [
{ {
@ -3371,7 +3371,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-02T07:50:12+00:00" "time": "2021-05-02T20:47:26+00:00"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
@ -3537,16 +3537,16 @@
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v4.4.20", "version": "v4.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "2543795ab1570df588b9bbd31e1a2bd7037b94f6" "reference": "67b77716f517e3f864759232e1201e7aa2ab0e82"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/2543795ab1570df588b9bbd31e1a2bd7037b94f6", "url": "https://api.github.com/repos/symfony/finder/zipball/67b77716f517e3f864759232e1201e7aa2ab0e82",
"reference": "2543795ab1570df588b9bbd31e1a2bd7037b94f6", "reference": "67b77716f517e3f864759232e1201e7aa2ab0e82",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3578,7 +3578,7 @@
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/finder/tree/v4.4.20" "source": "https://github.com/symfony/finder/tree/v4.4.23"
}, },
"funding": [ "funding": [
{ {
@ -3594,7 +3594,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-02-12T10:48:09+00:00" "time": "2021-05-09T09:13:09+00:00"
}, },
{ {
"name": "symfony/http-client-contracts", "name": "symfony/http-client-contracts",
@ -3676,16 +3676,16 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v4.4.22", "version": "v4.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "1a6f87ef99d05b1bf5c865b4ef7992263e1cb081" "reference": "2ffb43bd6c589a274ee1e93a5fd6b7ef1577b9c5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/1a6f87ef99d05b1bf5c865b4ef7992263e1cb081", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2ffb43bd6c589a274ee1e93a5fd6b7ef1577b9c5",
"reference": "1a6f87ef99d05b1bf5c865b4ef7992263e1cb081", "reference": "2ffb43bd6c589a274ee1e93a5fd6b7ef1577b9c5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3724,7 +3724,7 @@
"description": "Defines an object-oriented layer for the HTTP specification", "description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-foundation/tree/v4.4.22" "source": "https://github.com/symfony/http-foundation/tree/v4.4.23"
}, },
"funding": [ "funding": [
{ {
@ -3740,20 +3740,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-30T12:05:50+00:00" "time": "2021-05-05T07:40:41+00:00"
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v4.4.22", "version": "v4.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/http-kernel.git",
"reference": "cd2e325fc34a4a5bbec91eecf69dda8ee8c5ea4f" "reference": "95bb42312503a212f4467529bac8735f01226ff9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/cd2e325fc34a4a5bbec91eecf69dda8ee8c5ea4f", "url": "https://api.github.com/repos/symfony/http-kernel/zipball/95bb42312503a212f4467529bac8735f01226ff9",
"reference": "cd2e325fc34a4a5bbec91eecf69dda8ee8c5ea4f", "reference": "95bb42312503a212f4467529bac8735f01226ff9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3828,7 +3828,7 @@
"description": "Provides a structured process for converting a Request into a Response", "description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-kernel/tree/v4.4.22" "source": "https://github.com/symfony/http-kernel/tree/v4.4.23"
}, },
"funding": [ "funding": [
{ {
@ -3844,7 +3844,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-01T14:38:48+00:00" "time": "2021-05-12T13:13:32+00:00"
}, },
{ {
"name": "symfony/mime", "name": "symfony/mime",
@ -4807,16 +4807,16 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v4.4.21", "version": "v4.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "eb8f5428cc3b40d6dffe303b195b084f1c5fbd14" "reference": "ff6e63c7b5de874464642969968f61f8dc649ac3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/eb8f5428cc3b40d6dffe303b195b084f1c5fbd14", "url": "https://api.github.com/repos/symfony/translation/zipball/ff6e63c7b5de874464642969968f61f8dc649ac3",
"reference": "eb8f5428cc3b40d6dffe303b195b084f1c5fbd14", "reference": "ff6e63c7b5de874464642969968f61f8dc649ac3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4875,7 +4875,7 @@
"description": "Provides tools to internationalize your application", "description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/translation/tree/v4.4.21" "source": "https://github.com/symfony/translation/tree/v4.4.23"
}, },
"funding": [ "funding": [
{ {
@ -4891,7 +4891,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-03-23T16:25:01+00:00" "time": "2021-04-28T06:59:52+00:00"
}, },
{ {
"name": "symfony/translation-contracts", "name": "symfony/translation-contracts",

View File

@ -2,12 +2,21 @@
return [ return [
'repoid' => 3156505, 'repoid' => 3156505,
'ccBaseuri' => 'https://creativecommons.org/licenses/|/3.0/', 'ccBaseuri' => 'https://creativecommons.org/licenses/|/3.0/',
'datacite_environment' => env('DATACITE_ENVIRONMENT'),
'datacite_username' => env('DATACITE_USERNAME'), 'datacite_username' => env('DATACITE_USERNAME'),
// 'datacite_test_username' => env('DATACITE_TEST_USERNAME'), 'datacite_test_username' => env('DATACITE_TEST_USERNAME'),
'datacite_password' => env('DATACITE_PASSWORD'), 'datacite_password' => env('DATACITE_PASSWORD'),
// 'datacite_test_password' => env('DATACITE_TEST_PASSWORD'), 'datacite_test_password' => env('DATACITE_TEST_PASSWORD'),
'datacite_service_url' => env('DATACITE_SERVICE_URL'),
// 'datacite_test_service_url' => env('DATACITE_TEST_SERVICE_URL'),
'datacite_prefix' => env('DATACITE_PREFIX'), 'datacite_prefix' => env('DATACITE_PREFIX'),
'base_domain' => 'https://www.tethys.at/', 'datacite_test_prefix' => env('DATACITE_TEST_PREFIX'),
'datacite_service_url' => env('DATACITE_SERVICE_URL'),
'datacite_test_service_url' => env('DATACITE_TEST_SERVICE_URL'),
'base_domain' => env('BASE_DOMAIN', 'https://tethys.at'),
'test_base_domain' => env('TEST_BASE_DOMAIN')
]; ];

View File

@ -7,4 +7,14 @@ php artisan make:controller DOIController --resource --model "Models\DatasetIden
composer require guzzlehttp/guzzle composer require guzzlehttp/guzzle
php artisan make:migration create_dataset_identifiers_table --table="dataset_identifiers" php artisan make:migration create_dataset_identifiers_table --table="dataset_identifiers"
make php unit tests:
php artisan test --testsuite=Feature
via composer:
composer test
siehe https://doi.datacite.org/repositories/tuw.tethys/dois (angemeldet)
e.g. https://doi.org/10.24341/tethys.1

View File

@ -28,27 +28,35 @@
* xml as required by the OAI-PMH protocol. * xml as required by the OAI-PMH protocol.
*/ */
--> -->
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:php="http://php.net/xsl" exclude-result-prefixes="php"> xmlns:php="http://php.net/xsl" exclude-result-prefixes="php">
<xsl:output method="xml" indent="yes" /> <xsl:output method="xml" indent="yes" />
<xsl:template match="Rdr_Dataset" mode="oai_datacite"> <xsl:template match="Rdr_Dataset" mode="oai_datacite">
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.3/metadata.xsd"> xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.3/metadata.xsd">
<!-- <isReferenceQuality>true</isReferenceQuality> <!-- <isReferenceQuality>true</isReferenceQuality>
<schemaVersion>4.3</schemaVersion> <schemaVersion>4.3</schemaVersion>
<datacentreSymbol>RDR.GBA</datacentreSymbol> --> <datacentreSymbol>RDR.GBA</datacentreSymbol> -->
<identifier> <xsl:choose>
<xsl:text>oai:</xsl:text> <xsl:when test="Identifier">
<xsl:value-of select="$repIdentifier" /> <xsl:apply-templates name="Identifier" mode="oai_datacite" />
<xsl:text>:</xsl:text> </xsl:when>
<xsl:value-of select="@PublishId" /> <xsl:otherwise>
</identifier> <identifier>
<xsl:text>oai:</xsl:text>
<xsl:value-of select="$repIdentifier" />
<xsl:text>:</xsl:text>
<xsl:value-of select="@PublishId" />
</identifier>
</xsl:otherwise>
</xsl:choose>
<!--<datacite:creator>--> <!--<datacite:creator>-->
<creators> <creators>
<xsl:apply-templates select="PersonAuthor" mode="oai_datacite" /> <xsl:apply-templates select="PersonAuthor" mode="oai_datacite" />
@ -122,7 +130,7 @@
</resource> </resource>
</xsl:template> </xsl:template>
<xsl:template name="RdrDate2" mode="oai_datacite" <xsl:template name="RdrDate2" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<xsl:if test="EmbargoDate and ($unixTimestamp &lt; EmbargoDate/@UnixTimestamp)"> <xsl:if test="EmbargoDate and ($unixTimestamp &lt; EmbargoDate/@UnixTimestamp)">
<date> <date>
@ -148,7 +156,7 @@
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="Coverage" mode="oai_datacite" <xsl:template match="Coverage" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<geoLocation> <geoLocation>
<geoLocationBox> <geoLocationBox>
@ -168,7 +176,7 @@
</geoLocation> </geoLocation>
</xsl:template> </xsl:template>
<xsl:template match="TitleAbstract" mode="oai_datacite" <xsl:template match="TitleAbstract" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<description> <description>
<xsl:attribute name="xml:lang"> <xsl:attribute name="xml:lang">
@ -182,7 +190,7 @@
<xsl:value-of select="@Value" /> <xsl:value-of select="@Value" />
</description> </description>
</xsl:template> </xsl:template>
<xsl:template match="TitleAbstractAdditional" mode="oai_datacite" <xsl:template match="TitleAbstractAdditional" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<description> <description>
<xsl:attribute name="xml:lang"> <xsl:attribute name="xml:lang">
@ -196,8 +204,15 @@
<xsl:value-of select="@Value" /> <xsl:value-of select="@Value" />
</description> </description>
</xsl:template> </xsl:template>
<xsl:template match="Identifier" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4">
<identifier identifierType="DOI">
<xsl:value-of select="@Value" />
</identifier>
</xsl:template>
<xsl:template match="TitleMain" mode="oai_datacite" <xsl:template match="TitleMain" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<title> <title>
<xsl:if test="@Language != ''"> <xsl:if test="@Language != ''">
@ -213,7 +228,7 @@
<xsl:value-of select="@Value"/> <xsl:value-of select="@Value"/>
</title> </title>
</xsl:template> </xsl:template>
<xsl:template match="TitleAdditional" mode="oai_datacite" <xsl:template match="TitleAdditional" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<title> <title>
<xsl:if test="@Language != ''"> <xsl:if test="@Language != ''">
@ -230,7 +245,7 @@
</title> </title>
</xsl:template> </xsl:template>
<xsl:template match="Subject" mode="oai_datacite" <xsl:template match="Subject" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<subject> <subject>
<xsl:if test="@Language != ''"> <xsl:if test="@Language != ''">
@ -242,18 +257,18 @@
</subject> </subject>
</xsl:template> </xsl:template>
<xsl:template name="AlternateIdentifier" mode="oai_datacite" <xsl:template name="AlternateIdentifier" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<alternateIdentifier > <alternateIdentifier >
<xsl:attribute name="alternateIdentifierType"> <xsl:attribute name="alternateIdentifierType">
<xsl:text>url</xsl:text> <xsl:text>url</xsl:text>
</xsl:attribute> </xsl:attribute>
<!-- <xsl:variable name="identifier" select="concat($repURL, '/dataset/', @Id)" /> --> <!-- <xsl:variable name="identifier" select="concat($repURL, '/dataset/', @Id)" /> -->
<xsl:value-of select="@landingpage"/> <xsl:value-of select="@landingpage"/>
</alternateIdentifier > </alternateIdentifier >
</xsl:template> </xsl:template>
<xsl:template match="Reference" mode="oai_datacite" <xsl:template match="Reference" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<relatedIdentifier> <relatedIdentifier>
<xsl:attribute name="relatedIdentifierType"> <xsl:attribute name="relatedIdentifierType">
@ -266,7 +281,7 @@
</relatedIdentifier> </relatedIdentifier>
</xsl:template> </xsl:template>
<xsl:template match="PersonContributor" mode="oai_datacite" <xsl:template match="PersonContributor" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<contributor> <contributor>
<xsl:if test="@ContributorType != ''"> <xsl:if test="@ContributorType != ''">
@ -285,7 +300,7 @@
</contributor> </contributor>
</xsl:template> </xsl:template>
<xsl:template match="PersonAuthor" mode="oai_datacite" <xsl:template match="PersonAuthor" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<creator> <creator>
<creatorName> <creatorName>
@ -323,14 +338,14 @@
</creator> </creator>
</xsl:template> </xsl:template>
<xsl:template match="File/@MimeType" mode="oai_datacite" <xsl:template match="File/@MimeType" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<format> <format>
<xsl:value-of select="." /> <xsl:value-of select="." />
</format> </format>
</xsl:template> </xsl:template>
<xsl:template match="Licence" mode="oai_datacite" <xsl:template match="Licence" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<rights> <rights>
<xsl:if test="@LinkLicence != ''"> <xsl:if test="@LinkLicence != ''">

View File

@ -42,6 +42,12 @@
<div class="tab-pane content-metadata active" id="one"> <div class="tab-pane content-metadata active" id="one">
@if($dataset->identifier()->exists())
<p class="dataset__abstract" v-if="dataset.subject && dataset.subject.length > 0">
DOI: {{ $dataset->identifier->value }}
</p>
@endif
@if($dataset->additionalTitles()->exists()) @if($dataset->additionalTitles()->exists())
<p class="dataset__abstract"> <p class="dataset__abstract">
Zusätzliche Titel: Zusätzliche Titel:

View File

@ -0,0 +1,81 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-share"></i> DOI for published dataset
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1">
<div>
<a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div id="app1">
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.doiStore',
$dataset->publish_id],
'id' => 'doiForm', 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' =>
'checkForm'])
!!}
<fieldset id="fieldset-General">
<h3>Selected Dataset</h3>
<table style="margin-left: 2em">
<tbody>
<tr>
<td style="vertical-align: top; padding-right: 1em">{{ $dataset->id }}</td>
<td>
@foreach($dataset->titles as $title)
<div class="title" style="font-weight: bold">
{{ $title->value }}
</div>
@endforeach
<div class="authors">
@foreach($dataset->persons as $author)
{{ $author->full_name }}
@endforeach
</div>
<input type="hidden" name="selected[]" value="49">
</td>
</tr>
</tbody>
</table>
{{--
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('publisher_name', 'Publisher Name') !!}
{!! Form::text('publisher_name', 'Geologische Bundesanstalt (GBA)', ['readonly', 'class' =>
'pure-u-23-24', ]) !!}
</div> --}}
<div class="pure-controls instruction ">
<p>
Are you sure you want to make a DOI for the selected dataset?
</p>
<button type="submit" class="pure-button">
<i class="fa fa-share"></i>
<span>Make DOI</span>
</button>
</div>
</fieldset>
<br />
{!! Form::close() !!}
</div>
</div>
</div>
@stop
@section('after-scripts')
@stop

View File

@ -32,7 +32,9 @@
$rowclass = 'reviewed'; $rowclass = 'reviewed';
}elseif ($dataset->server_state == 'released') { }elseif ($dataset->server_state == 'released') {
$rowclass = 'released'; $rowclass = 'released';
} } elseif ($dataset->server_state == 'published') {
$rowclass = 'released';
}
@endphp @endphp
<tr class="{{ $rowclass }}"> <tr class="{{ $rowclass }}">
<td> <td>
@ -80,6 +82,11 @@
<a href="{{ URL::route('publish.workflow.editor.publishUpdate', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.editor.publishUpdate', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
<span>Publish</span> <span>Publish</span>
</a>
@elseif ($dataset->server_state == "published" && ! $dataset->identifier()->exists())
<a href="{{ URL::route('publish.workflow.editor.doi', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i>
<span>Make DOI</span>
</a> </a>
@endif @endif
</td> </td>

View File

@ -139,6 +139,14 @@ Route::group(
'middleware' => ['permission:dataset-publish'], 'middleware' => ['permission:dataset-publish'],
'as' => 'workflow.editor.publishUpdate', 'uses' => 'EditorController@publishUpdate', 'as' => 'workflow.editor.publishUpdate', 'uses' => 'EditorController@publishUpdate',
]); ]);
Route::get('workflow/editor/doi/{id}', [
'middleware' => ['permission:dataset-publish'],
'as' => 'workflow.editor.doi', 'uses' => 'EditorController@doi',
]);
Route::post('workflow/editor/doi/{publish_id}', [
'middleware' => ['permission:dataset-publish'],
'as' => 'workflow.editor.doiStore', 'uses' => 'EditorController@doiStore',
]);
//reviewer //reviewer
Route::get('workflow/review/index', [ Route::get('workflow/review/index', [