Compare commits
77 commits
Author | SHA1 | Date | |
---|---|---|---|
|
394fe97858 | ||
6a534bb526 | |||
|
7d1406ee5c | ||
|
50ceeb193b | ||
6156bdf0c6 | |||
|
8ea540a88c | ||
|
1b2e77d907 | ||
|
c4d74ca631 | ||
|
a53a996f85 | ||
|
577d988aef | ||
|
84b3954c23 | ||
dfe76d1a36 | |||
46a68e5418 | |||
526b48b06e | |||
995967b734 | |||
|
4fc8661a00 | ||
|
2e1cca030b | ||
76b351fb73 | |||
25ea8d40e1 | |||
|
3004e5bb9b | ||
a31a3e22a3 | |||
3aef68f98d | |||
|
8e7960aa8e | ||
|
27d95ddd70 | ||
840bdffd2d | |||
28a38da865 | |||
d80a8ab3f4 | |||
|
604e6ba8d7 | ||
|
2040a9d260 | ||
|
35601144c8 | ||
b15e832776 | |||
75b37368e4 | |||
105e31dbbd | |||
37c0b5e637 | |||
1a387965c6 | |||
9138090e14 | |||
da06f84659 | |||
e9b8240f11 | |||
8d8fafd3db | |||
06279be213 | |||
b6338b0543 | |||
|
00bea6885e | ||
|
a68b7b34cf | ||
|
5c49f899e5 | ||
|
b10ee96b43 | ||
5585b9d04a | |||
9601389d83 | |||
|
b335bd7e9c | ||
bcbd05d7d8 | |||
|
4e44d9d996 | ||
b5abcef327 | |||
367dd328ef | |||
691d824a4f | |||
e7738f432b | |||
8f0b12fbf0 | |||
9b6a6469d7 | |||
|
7f9bd089b1 | ||
|
5bbb3c5876 | ||
|
c649af199c | ||
|
4bc66213a4 | ||
|
390b2396eb | ||
|
30afb3b1f8 | ||
|
ecaf2b5790 | ||
|
07c0c8b7db | ||
|
65e581892f | ||
|
2bf8cb82b5 | ||
|
24fc329924 | ||
87fff27527 | |||
|
385ae20a1b | ||
|
9d736aa2b7 | ||
|
77fb177f5e | ||
|
3125df767b | ||
|
f62f812a0d | ||
|
5c3c2fdda6 | ||
836d3e660f | |||
|
4a6c69100a | ||
|
64faf73564 |
215 changed files with 28292 additions and 16296 deletions
1
.babelrc
1
.babelrc
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"plugins": [
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
["@babel/plugin-proposal-private-methods", { "loose": true }],
|
||||
["@babel/plugin-proposal-class-properties", { "loose": true }]
|
||||
]
|
||||
}
|
|
@ -3,17 +3,20 @@ APP_DEBUG=true
|
|||
APP_KEY=SomeRandomString
|
||||
APP_URL=YourUrl
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=pgsql
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=tethys
|
||||
DB_USERNAME=trethys_admin
|
||||
DB_USERNAME=tethys_admin
|
||||
DB_PASSWORD=secret
|
||||
DB_SCHEMA=gba
|
||||
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=cookie
|
||||
QUEUE_DRIVER=sync
|
||||
FILESYSTEM_DRIVER=public
|
||||
|
||||
SOLR_HOST=solr.host.at
|
||||
SOLR_CORE=test_data
|
||||
SOLR_HOST=localhost
|
||||
SOLR_CORE=tethys_data
|
|
@ -7,6 +7,12 @@
|
|||
"settings": {
|
||||
// "phpfmt.php_bin": "\"C:\\ProgramData\\scoop\\apps\\php-nts\\current\\php.exe\"",
|
||||
"phpfmt.php_bin": "php",
|
||||
"phpfmt.psr2": true
|
||||
"phpfmt.psr2": true,
|
||||
"phpcs.standard": "PSR2",
|
||||
"phpcs.executablePath": "C:\\Users\\arno\\scoop\\apps\\composer\\current\\home\\vendor\\bin\\phpcs",
|
||||
"phpsab.standard": "PSR2",
|
||||
"phpsab.executablePathCBF": "C:\\Users\\arno\\scoop\\apps\\composer\\current\\home\\vendor\\bin\\phpcbf.bat",
|
||||
"phpsab.executablePathCS":"C:\\Users\\arno\\scoop\\apps\\composer\\current\\home\\vendor\\bin\\phpcs.bat",
|
||||
"phpsab.snifferEnable": true
|
||||
}
|
||||
}
|
|
@ -63,5 +63,6 @@ class DatasetState extends Command
|
|||
'server_date_modified' => DB::raw('now()')
|
||||
]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,5 +29,6 @@ class Inspire extends Command
|
|||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,11 @@ namespace App\Console\Commands;
|
|||
use Illuminate\Console\Command;
|
||||
use App\Models\Dataset;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Library\Search\SolariumAdapter;
|
||||
use \Exception;
|
||||
|
||||
|
||||
class SolrIndexBuilder extends Command
|
||||
{
|
||||
/**
|
||||
|
@ -43,16 +48,21 @@ class SolrIndexBuilder extends Command
|
|||
// update statistics table
|
||||
foreach ($datasets as $dataset) {
|
||||
$datasetId = $dataset->id;
|
||||
$time = new \Illuminate\Support\Carbon();
|
||||
$dataset->server_date_modified = $time;
|
||||
$dataset->save();
|
||||
// try {
|
||||
// // Opus_Search_Service::selectIndexingService('onDocumentChange')
|
||||
// $service = new SolariumAdapter("solr", config('solarium'));
|
||||
// $service->addDatasetsToIndex($dataset);
|
||||
// } catch (Exception $e) {
|
||||
// Log::debug(__METHOD__ . ': ' . 'Indexing document ' . $datasetId . ' failed: ' . $e->getMessage());
|
||||
// }
|
||||
// $time = new \Illuminate\Support\Carbon();
|
||||
// $dataset->server_date_modified = $time;
|
||||
// $dataset->save();
|
||||
// Log::debug(__METHOD__ . ': ' . 'Adding index job for dataset ' . $datasetId . '.');
|
||||
|
||||
try {
|
||||
// Opus_Search_Service::selectIndexingService('onDocumentChange')
|
||||
$service = new SolariumAdapter("solr", config('solarium'));
|
||||
$service->addDatasetsToIndex($dataset);
|
||||
} catch (Exception $e) {
|
||||
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
56
app/Console/Commands/UpdateSolrDataset.php
Normal file
56
app/Console/Commands/UpdateSolrDataset.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Dataset;
|
||||
use App\Library\Search\SolariumAdapter;
|
||||
use \Exception;
|
||||
|
||||
class UpdateSolrDataset extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'update:dataset {dataset : The ID of the dataset}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update solr dataset with given ID';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$datasetId = $this->argument('dataset');
|
||||
$dataset = Dataset::find($datasetId);
|
||||
// $this->info($dataset->authors->implode('full_name', ', '));
|
||||
|
||||
try {
|
||||
// Opus_Search_Service::selectIndexingService('onDocumentChange')
|
||||
$service = new SolariumAdapter("solr", config('solarium'));
|
||||
$service->addDatasetsToIndex($dataset);
|
||||
} catch (Exception $e) {
|
||||
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
|
@ -12,10 +13,11 @@ class Kernel extends ConsoleKernel
|
|||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
'App\Console\Commands\Inspire',
|
||||
'App\Console\Commands\DatasetState',
|
||||
'App\Console\Commands\SolrIndexBuilder',
|
||||
'App\Console\Commands\Log\ClearLogFile'
|
||||
\App\Console\Commands\Inspire::class,
|
||||
\App\Console\Commands\DatasetState::class,
|
||||
\App\Console\Commands\SolrIndexBuilder::class,
|
||||
\App\Console\Commands\Log\ClearLogFile::class,
|
||||
\App\Console\Commands\UpdateSolrDataset::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<?php namespace App\Exceptions;
|
||||
<?php
|
||||
|
||||
use Exception;
|
||||
namespace App\Exceptions;
|
||||
|
||||
// use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
@ -12,7 +15,19 @@ class Handler extends ExceptionHandler
|
|||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException'
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -20,22 +35,24 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
return parent::report($e);
|
||||
return parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param \Throwable $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function render($request, Exception $ex)
|
||||
public function render($request, Throwable $ex)
|
||||
{
|
||||
if ($ex instanceof \Illuminate\Auth\Access\AuthorizationException) {
|
||||
// return $this->errorResponse($exception->getMessage(), 403);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Get an associative array with localeCodes as keys and translated URLs of current page as value
|
||||
*/
|
||||
* Get an associative array with localeCodes as keys and translated URLs of current page as value
|
||||
*/
|
||||
function getLocalizedURLArray()
|
||||
{
|
||||
$localesOrdered = LaravelLocalization::getLocalesOrder();
|
||||
|
@ -11,3 +11,19 @@ function getLocalizedURLArray()
|
|||
}
|
||||
return $localizedURLs;
|
||||
}
|
||||
|
||||
function get_domain($host)
|
||||
{
|
||||
$myhost = strtolower(trim($host));
|
||||
$count = substr_count($myhost, '.');
|
||||
if ($count === 2) {
|
||||
if (strlen(explode('.', $myhost)[1]) > 3) {
|
||||
$myhost = explode('.', $myhost, 2)[1];
|
||||
}
|
||||
|
||||
} else if ($count > 2) {
|
||||
$myhost = get_domain(explode('.', $myhost, 2)[1]);
|
||||
}
|
||||
$myhost = preg_replace( "#^[^:/.]*[:/]+#i", "", $myhost);
|
||||
return $myhost;
|
||||
}
|
||||
|
|
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
|
@ -19,14 +19,4 @@ class ForgotPasswordController extends Controller
|
|||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
|
@ -25,7 +28,7 @@ class LoginController extends Controller
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/settings';
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
@ -34,17 +37,23 @@ class LoginController extends Controller
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest', ['except' => 'logout']);
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
// public function logout(Request $request)
|
||||
// {
|
||||
// $this->guard()->logout();
|
||||
|
||||
// $request->session()->flush();
|
||||
|
||||
// $request->session()->regenerate();
|
||||
|
||||
// return redirect('/');
|
||||
// }
|
||||
/**
|
||||
* Logout trait
|
||||
*
|
||||
* @author Yugo <dedy.yugo.purwanto@gmail.com>
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
protected function logout(Request $request)
|
||||
{
|
||||
$this->guard()->logout();
|
||||
$request->session()->flush();
|
||||
$request->session()->regenerate();
|
||||
$frontend = config('tethys.frontend');
|
||||
|
||||
return redirect($frontend);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
|
@ -27,7 +29,7 @@ class RegisterController extends Controller
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/';
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
@ -48,9 +50,9 @@ class RegisterController extends Controller
|
|||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => 'required|max:255',
|
||||
'email' => 'required|email|max:255|unique:users',
|
||||
'password' => 'required|min:6|confirmed',
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -65,7 +67,7 @@ class RegisterController extends Controller
|
|||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
|
@ -25,15 +26,5 @@ class ResetPasswordController extends Controller
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
}
|
||||
|
|
42
app/Http/Controllers/Auth/VerificationController.php
Normal file
42
app/Http/Controllers/Auth/VerificationController.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
//use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
abstract class Controller extends BaseController
|
||||
{
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Session;
|
||||
use App;
|
||||
// use Illuminate\Http\Request;
|
||||
// use Illuminate\Support\Facades\Input;
|
||||
// use Illuminate\Support\Facades\Session;
|
||||
// use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
|
|
|
@ -26,6 +26,39 @@ class PagesController extends Controller
|
|||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function showDoi($dataset_prefix, $id): View
|
||||
{
|
||||
//$dataset = Dataset::findOrFail($id);
|
||||
$dataset = Dataset::where('publish_id', '=', $id)->firstOrFail();
|
||||
$dataset->load('titles');
|
||||
$dataset->load('abstracts');
|
||||
|
||||
// $authors = $dataset->persons()
|
||||
// ->wherePivot('role', 'author')
|
||||
// ->orderBy('link_documents_persons.sort_order', 'desc')
|
||||
// ->get();
|
||||
|
||||
// $contributors = $dataset->persons()
|
||||
// ->wherePivot('role', 'contributor')
|
||||
// ->orderBy('link_documents_persons.sort_order', 'desc')
|
||||
// ->get();
|
||||
|
||||
// $submitters = $dataset->persons()
|
||||
// ->wherePivot('role', 'submitter')
|
||||
// ->orderBy('link_documents_persons.sort_order', 'desc')
|
||||
// ->get();
|
||||
|
||||
// $authors = $dataset->persons()
|
||||
// ->wherePivot('role', 'author')
|
||||
// ->orderBy('link_documents_persons.sort_order', 'desc')
|
||||
// ->get();
|
||||
|
||||
// return view('frontend.dataset.show', compact('dataset', 'authors', 'contributors', 'submitters'));
|
||||
|
||||
return view('frontend.dataset.show', compact('dataset'));
|
||||
//return view('frontend.dataset.show', compact('id'));//wenn über solr
|
||||
}
|
||||
|
||||
public function show($id): View
|
||||
{
|
||||
//$dataset = Dataset::findOrFail($id);
|
||||
|
|
|
@ -31,7 +31,10 @@ class SitelinkController extends Controller
|
|||
// }
|
||||
// }, $years);
|
||||
$this->ids = array();
|
||||
return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
|
||||
return view(
|
||||
'frontend.sitelink.index',
|
||||
['years' => $this->years, 'documents' => $this->ids]
|
||||
);
|
||||
}
|
||||
|
||||
public function listDocs($year)
|
||||
|
@ -50,7 +53,7 @@ class SitelinkController extends Controller
|
|||
->whereYear('server_date_published', '>=', $from)
|
||||
->whereYear('server_date_published', '<', $until);
|
||||
|
||||
$documents = $select->orderBy('publish_id', 'asc')
|
||||
$documents = $select->orderBy('publish_id')
|
||||
->get();
|
||||
|
||||
//$this->years = Dataset::select(DB::raw('YEAR(server_date_modified) as server_date_modified'))
|
||||
|
@ -63,8 +66,10 @@ class SitelinkController extends Controller
|
|||
//$select->select('id');
|
||||
//$this->ids = $select->pluck('id');
|
||||
//return view('rdr.sitelink.index')->with(['years'=> $this->years,'ids'=> $this->ids]);
|
||||
return view('frontend.sitelink.index')
|
||||
->with(['years' => $this->years, 'documents' => $documents]);
|
||||
return view(
|
||||
'frontend.sitelink.index',
|
||||
['years' => $this->years, 'documents' => $documents]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use \Exception;
|
||||
use Carbon\Carbon;
|
||||
// use Illuminate\Support\Carbon;
|
||||
use \Illuminate\Support\Carbon;
|
||||
|
||||
class RequestController extends Controller
|
||||
{
|
||||
|
@ -25,7 +26,7 @@ class RequestController extends Controller
|
|||
*/
|
||||
private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too
|
||||
//private $xMetaDissRestriction = array('doctoralthesis', 'habilitation');
|
||||
const SET_SPEC_PATTERN = '[A-Za-z0-9\-_\.!~\*\'\(\)]+';
|
||||
const SET_SPEC_PATTERN = '[A-Za-zäöüÄÖÜß0-9\-_\.!~\*\'\(\)]+';
|
||||
|
||||
/**
|
||||
* Holds xml representation of document information to be processed.
|
||||
|
@ -105,7 +106,9 @@ class RequestController extends Controller
|
|||
//$xml = $this->doc->asXML();
|
||||
return response($xml) //->view('rss', array('rss'=>$this->rss))
|
||||
->header('Content-Type', 'application/xml')
|
||||
->header('charset', 'utf-8');
|
||||
->header('charset', 'utf-8')
|
||||
->header('Access-Control-Allow-Origin', '*')
|
||||
->header('Access-Control-Allow-Methods', 'GET');
|
||||
}
|
||||
|
||||
private function __handleRequest(array $oaiRequest)
|
||||
|
@ -121,9 +124,14 @@ class RequestController extends Controller
|
|||
$this->proc->setParameter('', 'unixTimestamp', $unixTimestamp);
|
||||
|
||||
// set OAI base url
|
||||
$frontend = config('tethys.frontend');
|
||||
$uri = explode('?', $_SERVER['REQUEST_URI'], 2);
|
||||
$this->proc->setParameter('', 'baseURL', url('/') . $uri[0]);
|
||||
// $this->proc->setParameter('', 'baseURL', url('/') . $uri[0]);
|
||||
$this->proc->setParameter('', 'baseURL', $frontend. '/oai');// . $uri[0]);
|
||||
$this->proc->setParameter('', 'repURL', url('/'));
|
||||
$this->proc->setParameter('', 'downloadLink', url('/') . '/file/download/');
|
||||
$this->proc->setParameter('', 'doiLink', 'https://doi.org/');
|
||||
$this->proc->setParameter('', 'doiPrefix', 'info:eu-repo/semantics/altIdentifier/doi/');
|
||||
|
||||
// $resumptionPath = $this->configuration->getResumptionTokenPath();
|
||||
|
||||
|
@ -145,9 +153,10 @@ class RequestController extends Controller
|
|||
$this->handleIllegalVerb();
|
||||
}
|
||||
} else {
|
||||
$oaiRequest['verb'] = 'Identify';
|
||||
$this->proc->setParameter('', 'oai_verb', $oaiRequest['verb']);
|
||||
$this->doc = $this->handleIdentify();
|
||||
// $oaiRequest['verb'] = 'Identify';
|
||||
// $this->proc->setParameter('', 'oai_verb', $oaiRequest['verb']);
|
||||
// $this->doc = $this->handleIdentify();
|
||||
throw new OaiModelException('The verb provided in the request is illegal.', OaiModelError::BADVERB);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,8 +193,15 @@ class RequestController extends Controller
|
|||
{
|
||||
$repIdentifier = "tethys.at";
|
||||
$this->proc->setParameter('', 'repIdentifier', $repIdentifier);
|
||||
|
||||
// Identifier references metadata Urn, not plain Id!
|
||||
// Currently implemented as 'oai:foo.bar.de:{docId}' or 'urn:nbn...-123'
|
||||
if (!array_key_exists('identifier', $oaiRequest)) {
|
||||
throw new OaiModelException(
|
||||
'The prefix of the identifier argument is unknown.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
$dataId = $this->getDocumentIdByIdentifier($oaiRequest['identifier']);
|
||||
|
||||
$dataset = null;
|
||||
|
@ -203,6 +219,11 @@ class RequestController extends Controller
|
|||
$metadataPrefix = null;
|
||||
if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
|
||||
$metadataPrefix = $oaiRequest['metadataPrefix'];
|
||||
} else {
|
||||
throw new OaiModelException(
|
||||
'The prefix of the metadata argument is unknown.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
$this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
|
||||
|
||||
|
@ -305,6 +326,7 @@ class RequestController extends Controller
|
|||
|
||||
//$oaiSets = new Oai_Model_Sets();
|
||||
$sets = array(
|
||||
'open_access' => 'Set for open access licenses',
|
||||
// 'bibliography:true' => 'Set for bibliographic entries',
|
||||
// 'bibliography:false' => 'Set for non-bibliographic entries',
|
||||
);
|
||||
|
@ -363,10 +385,10 @@ class RequestController extends Controller
|
|||
$reldocIds = array();
|
||||
|
||||
$metadataPrefix = null;
|
||||
if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
|
||||
$metadataPrefix = $oaiRequest['metadataPrefix'];
|
||||
}
|
||||
$this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
|
||||
// if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
|
||||
// $metadataPrefix = $oaiRequest['metadataPrefix'];
|
||||
// }
|
||||
// $this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
|
||||
|
||||
$tokenWorker = new ResumptionTokens();
|
||||
$tokenWorker->setResumptionPath($tokenTempPath);
|
||||
|
@ -390,6 +412,16 @@ class RequestController extends Controller
|
|||
// else no resumptionToken is given
|
||||
} else {
|
||||
// no resumptionToken is given
|
||||
if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
|
||||
$metadataPrefix = $oaiRequest['metadataPrefix'];
|
||||
} else {
|
||||
throw new OaiModelException(
|
||||
'The prefix of the metadata argument is unknown.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
$this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
|
||||
|
||||
$finder = Dataset::query();
|
||||
// add server state restrictions
|
||||
$finder->whereIn('server_state', $this->deliveringDocumentStates);
|
||||
|
@ -407,6 +439,92 @@ class RequestController extends Controller
|
|||
$q->where('label', $setarray[1]);
|
||||
});
|
||||
}
|
||||
} elseif (!empty($setarray[0]) && $setarray[0] == 'open_access') {
|
||||
$openAccessLicences = ["CC-BY-4.0", "CC-BY-SA-4.0"];
|
||||
$finder->whereHas('licenses', function ($q) use ($openAccessLicences) {
|
||||
$q->whereIn('name', $openAccessLicences);
|
||||
// $q->where('name', '=', "CC-BY-4.0")->orWhere('name', '=',"CC-BY-SA-4.0");
|
||||
});
|
||||
//$test = $finder->toSql();
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('from', $oaiRequest) && array_key_exists('until', $oaiRequest)) {
|
||||
$from = $oaiRequest['from'];
|
||||
$fromDate = Carbon::parse($from);
|
||||
$until = $oaiRequest['until'];
|
||||
$untilDate = \Illuminate\Support\Carbon::parse($until);
|
||||
if (strlen($from) != strlen($until)) {
|
||||
throw new OaiModelException(
|
||||
'The request has different granularities for the from and until parameters.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
if ($fromDate->hour == 0) {
|
||||
$fromDate = $fromDate->startOfDay();
|
||||
$untilDate = $untilDate->endOfDay();
|
||||
}
|
||||
$finder->where('server_date_published', '>=', $fromDate)
|
||||
->where('server_date_published', '<=', $untilDate);
|
||||
// $test = $finder->toSql();
|
||||
} elseif (array_key_exists('until', $oaiRequest) && !array_key_exists('from', $oaiRequest)) {
|
||||
$until = $oaiRequest['until'];
|
||||
try {
|
||||
$untilDate = \Illuminate\Support\Carbon::parse($until);
|
||||
if ($untilDate->hour == 0) {
|
||||
$untilDate = $untilDate->endOfDay();
|
||||
}
|
||||
// if (strtotime($untilDate) > 0) {
|
||||
$earliestPublicationDate = Dataset::earliestPublicationDate()->server_date_published;
|
||||
if ($earliestPublicationDate->gt($untilDate)) {
|
||||
throw new OaiModelException(
|
||||
"earliestDatestamp is greater than given until date.
|
||||
The given values results in an empty list.",
|
||||
OaiModelError::NORECORDSMATCH
|
||||
);
|
||||
} else {
|
||||
$finder->where('server_date_published', '<=', $untilDate);
|
||||
$test = $finder->toSql();
|
||||
}
|
||||
} catch (OaiModelException $e) {
|
||||
throw new OaiModelException(
|
||||
"earliestDatestamp is greater than given until date.
|
||||
The given values results in an empty list.",
|
||||
OaiModelError::NORECORDSMATCH
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
throw new OaiModelException(
|
||||
'The until date argument is not valid.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
} elseif (array_key_exists('from', $oaiRequest) && !array_key_exists('until', $oaiRequest)) {
|
||||
$from = $oaiRequest['from'];
|
||||
try {
|
||||
$fromDate = \Illuminate\Support\Carbon::parse($from);
|
||||
if ($fromDate->hour == 0) {
|
||||
$fromDate = $fromDate->startOfDay();
|
||||
}
|
||||
// if (strtotime($fromDate) > 0) {
|
||||
$now = new Carbon();
|
||||
if ($fromDate->gt($now)) {
|
||||
throw new OaiModelException(
|
||||
"Given from date is greater than now. The given values results in an empty list.",
|
||||
OaiModelError::NORECORDSMATCH
|
||||
);
|
||||
} else {
|
||||
$finder->where('server_date_published', '>=', $fromDate);
|
||||
}
|
||||
} catch (OaiModelException $e) {
|
||||
throw new OaiModelException(
|
||||
"Given from date is greater than now. The given values results in an empty list.",
|
||||
OaiModelError::NORECORDSMATCH
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
throw new OaiModelException(
|
||||
'The from date argument is not valid.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,6 +566,7 @@ class RequestController extends Controller
|
|||
$this->setParamResumption($res, $cursor, $totalIds);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameters for resumptionToken-line.
|
||||
*
|
||||
|
@ -457,7 +576,8 @@ class RequestController extends Controller
|
|||
*/
|
||||
private function setParamResumption($res, $cursor, $totalIds)
|
||||
{
|
||||
$tomorrow = str_replace('+00:00', 'Z', Carbon::now()->addHour(1)->setTimeZone('UTC'));
|
||||
// $tomorrow = str_replace('+00:00', 'Z', Carbon::now()->addHour(1)->setTimeZone('UTC'));
|
||||
$tomorrow = Carbon::now()->addDay(1)->toIso8601ZuluString();
|
||||
$this->proc->setParameter('', 'dateDelete', $tomorrow);
|
||||
$this->proc->setParameter('', 'res', $res);
|
||||
$this->proc->setParameter('', 'cursor', $cursor);
|
||||
|
@ -502,7 +622,9 @@ class RequestController extends Controller
|
|||
*/
|
||||
private function addLandingPageAttribute(\DOMNode $document, $dataid)
|
||||
{
|
||||
$url = route('frontend.dataset.show', $dataid);
|
||||
// $url = route('frontend.dataset.show', $dataid);
|
||||
$base_domain = config('tethys.base_domain');
|
||||
$url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid;
|
||||
|
||||
$owner = $document->ownerDocument;
|
||||
$attr = $owner->createAttribute('landingpage');
|
||||
|
@ -623,7 +745,7 @@ class RequestController extends Controller
|
|||
$identify->addChild('protocolVersion', '2.0');
|
||||
$identify->addChild('adminEmail', 'repository@geologie.ac.at');
|
||||
//$identify->addChild('earliestDatestamp', '2017-04-07');
|
||||
$identify->addChild('earliestDatestamp', $earliestDateFromDb);
|
||||
$identify->addChild('earliestDatestamp', $earliestDateFromDb->toDateString());
|
||||
$identify->addChild('deletedRecord', 'persistent');
|
||||
|
||||
//$description = $identify->addChild('description');
|
||||
|
|
324
app/Http/Controllers/Publish/DoiController.php
Normal file
324
app/Http/Controllers/Publish/DoiController.php
Normal file
|
@ -0,0 +1,324 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Publish;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Interfaces\DoiInterface;
|
||||
use App\Models\Dataset;
|
||||
use App\Models\DatasetIdentifier;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Oai\OaiModelError;
|
||||
use App\Exceptions\OaiModelException;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use App\Exceptions\GeneralException;
|
||||
use App\Library\Search\SolariumAdapter;
|
||||
use \Exception;
|
||||
|
||||
class DoiController extends Controller
|
||||
{
|
||||
protected $doiService;
|
||||
protected $LaudatioUtils;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* DOIController constructor.
|
||||
* @param DoiInterface $DOIService
|
||||
*/
|
||||
public function __construct(DoiInterface $DoiClient)
|
||||
{
|
||||
$this->doiClient = $DoiClient;
|
||||
|
||||
$this->xml = new \DomDocument();
|
||||
$this->proc = new \XSLTProcessor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
// public function index()
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
public function index(): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$datasets = Dataset::query()
|
||||
->has('identifier')
|
||||
->orderByDesc('server_date_modified')
|
||||
->get();
|
||||
return View::make('workflow.doi.index', [
|
||||
'datasets' => $datasets,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$dataId = $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 = 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 = $appUrl . "/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;
|
||||
$doi['dataset_id'] = $dataset->id;
|
||||
$doi['type'] = "doi";
|
||||
$doi['status'] = "registered";
|
||||
$doi->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\DatasetIdentifier $doi
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(DatasetIdentifier $doi)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\DatasetIdentifier $doi
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$dataset = Dataset::query()
|
||||
->with([
|
||||
'titles',
|
||||
'persons' => function ($query) {
|
||||
$query->wherePivot('role', 'author');
|
||||
},
|
||||
])->findOrFail($id);
|
||||
|
||||
return View::make('workflow.doi.edit', [
|
||||
'dataset' => $dataset,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\DatasetIdentifier $doi
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(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);
|
||||
$this->addAlternateLandingPageAttribute($domNode, $dataset->publish_id);
|
||||
$node = $this->xml->importNode($domNode, true);
|
||||
$this->addSpecInformation($node, 'data-type:' . $dataset->type);
|
||||
|
||||
$this->xml->documentElement->appendChild($node);
|
||||
$newXmlMeta = $this->proc->transformToXML($this->xml);
|
||||
// Log::alert($xmlMeta);
|
||||
//create doiValue and correspunfing landingpage of tehtys
|
||||
$doiValue = $prefix . '/tethys.' . $dataset->publish_id;
|
||||
|
||||
$response = $this->doiClient->updateMetadataForDoi($doiValue, $newXmlMeta);
|
||||
// if operation successful, store dataste identifier
|
||||
if ($response->getStatusCode() == 201) {
|
||||
$doi = $dataset->identifier;
|
||||
// $doi['value'] = $doiValue;
|
||||
// $doi['type'] = "doi";
|
||||
// $doi['status'] = "findable";
|
||||
// $doi->save();
|
||||
$doi->touch();
|
||||
try {
|
||||
$service = new SolariumAdapter("solr", config('solarium'));
|
||||
$service->addDatasetsToIndex($dataset);
|
||||
} catch (Exception $e) {
|
||||
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()
|
||||
->route('publish.workflow.doi.index')
|
||||
->with('flash_message', 'You have successfully updated a DOI for the dataset!');
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the landingpage attribute to Rdr_Dataset XML output.
|
||||
*
|
||||
* @param \DOMNode $document Rdr_Dataset XML serialisation
|
||||
* @param string $docid Id of the dataset
|
||||
* @return void
|
||||
*/
|
||||
private function addAlternateLandingPageAttribute(\DOMNode $document, $dataid)
|
||||
{
|
||||
$base_domain = config('tethys.base_domain');
|
||||
$url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid;
|
||||
|
||||
$owner = $document->ownerDocument;
|
||||
$attr = $owner->createAttribute('landingpage');
|
||||
$attr->appendChild($owner->createTextNode($url));
|
||||
$document->appendChild($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\DatasetIdentifier $doi
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(DatasetIdentifier $doi)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Publish;
|
||||
|
||||
use App\Exceptions\GeneralException;
|
||||
|
@ -17,7 +18,7 @@ use App\Models\User;
|
|||
use App\Rules\RdrFilesize;
|
||||
use App\Rules\RdrFiletypes;
|
||||
// use Illuminate\View\View;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
@ -27,12 +28,43 @@ use Illuminate\Support\Facades\Validator;
|
|||
use Illuminate\Support\Facades\View;
|
||||
use \Exception;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Models\DatasetIdentifier;
|
||||
use App\Models\Oai\OaiModelError;
|
||||
use App\Exceptions\OaiModelException;
|
||||
use App\Interfaces\DoiInterface;
|
||||
use App\Library\Search\SolariumAdapter;
|
||||
|
||||
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->xml = new \DomDocument('1.0', 'UTF-8');
|
||||
$this->proc = new \XSLTProcessor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,13 +80,14 @@ class EditorController extends Controller
|
|||
$builder = Dataset::query();
|
||||
//"select * from [documents] where [server_state] in (?) or ([server_state] = ? and [editor_id] = ?)"
|
||||
$datasets = $builder
|
||||
|
||||
->where('server_state', 'released')
|
||||
// ->whereIn('server_state', ['released'])
|
||||
->orWhere(function ($query) use ($user_id) {
|
||||
$query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed'])
|
||||
->where('editor_id', $user_id);
|
||||
$query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed', 'published'])
|
||||
->where('editor_id', $user_id)->doesntHave('identifier', 'and');
|
||||
})
|
||||
->orderBy('server_date_modified', 'desc')
|
||||
->orderByDesc('server_date_modified')
|
||||
->get();
|
||||
// return View::make('workflow.editor.index', compact('datasets'));
|
||||
return View::make('workflow.editor.index', [
|
||||
|
@ -105,8 +138,10 @@ class EditorController extends Controller
|
|||
$dataset->load('licenses', 'authors', 'contributors', 'titles', 'abstracts', 'files', 'coverage', 'subjects', 'references');
|
||||
|
||||
$titleTypes = ['Main' => 'Main', 'Sub' => 'Sub', 'Alternative' => 'Alternative', 'Translated' => 'Translated', 'Other' => 'Other'];
|
||||
$descriptionTypes = ['Abstract' => 'Abstract', 'Methods' => 'Methods', 'Series_information' => 'Series_information',
|
||||
'Technical_info' => 'Technical_info', 'Translated' => 'Translated', 'Other' => 'Other'];
|
||||
$descriptionTypes = [
|
||||
'Abstract' => 'Abstract', 'Methods' => 'Methods', 'Series_information' => 'Series_information',
|
||||
'Technical_info' => 'Technical_info', 'Translated' => 'Translated', 'Other' => 'Other'
|
||||
];
|
||||
$languages = DB::table('languages')
|
||||
->where('active', true)
|
||||
->pluck('part1', 'part1');
|
||||
|
@ -126,8 +161,9 @@ class EditorController extends Controller
|
|||
$languages = DB::table('languages')
|
||||
->where('active', true)
|
||||
->pluck('part1', 'part1');
|
||||
|
||||
|
||||
$contributorTypes = Config::get('enums.contributor_types');
|
||||
$nameTypes = Config::get('enums.name_types');
|
||||
|
||||
// $options = License::all('id', 'name_long');
|
||||
$licenses = License::select('id', 'name_long', 'link_licence')
|
||||
|
@ -138,11 +174,13 @@ class EditorController extends Controller
|
|||
|
||||
$keywordTypes = ['uncontrolled' => 'uncontrolled', 'swd' => 'swd'];
|
||||
|
||||
$referenceTypes = ["rdr-id", "doi", "handle", "isbn", "issn", "url", "urn"];
|
||||
$referenceTypes = ["DOI", "Handle", "ISBN", "ISSN", "URL", "URN"];
|
||||
$referenceTypes = array_combine($referenceTypes, $referenceTypes);
|
||||
|
||||
$relationTypes = ["IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues",
|
||||
"IsNewVersionOf", "IsPartOf", "HasPart", "Compiles", "IsVariantFormOf"];
|
||||
$relationTypes = [
|
||||
"IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues",
|
||||
"IsNewVersionOf", "IsPartOf", "HasPart", "Compiles", "IsVariantFormOf"
|
||||
];
|
||||
$relationTypes = array_combine($relationTypes, $relationTypes);
|
||||
|
||||
return View::make(
|
||||
|
@ -152,6 +190,7 @@ class EditorController extends Controller
|
|||
'titleTypes',
|
||||
'descriptionTypes',
|
||||
'contributorTypes',
|
||||
'nameTypes',
|
||||
'languages',
|
||||
'messages',
|
||||
'projects',
|
||||
|
@ -252,7 +291,7 @@ class EditorController extends Controller
|
|||
} else {
|
||||
$dataPerson = new Person($person);
|
||||
$dataPerson->status = true;
|
||||
$dataPerson->name_type = "Organizational";
|
||||
// $dataPerson->name_type = "Organizational";
|
||||
$dataset->persons()->save($dataPerson, $pivot_data);
|
||||
}
|
||||
$index++;
|
||||
|
@ -275,7 +314,7 @@ class EditorController extends Controller
|
|||
} else {
|
||||
$dataPerson = new Person($person);
|
||||
$dataPerson->status = true;
|
||||
$dataPerson->name_type = "Organizational";
|
||||
// $dataPerson->name_type = "Organizational";
|
||||
$dataset->persons()->save($dataPerson, $pivot_data);
|
||||
}
|
||||
$index++;
|
||||
|
@ -348,15 +387,21 @@ class EditorController extends Controller
|
|||
if (is_array($keywords) && count($keywords) > 0) {
|
||||
foreach ($keywords as $key => $formKeyword) {
|
||||
if (isset($formKeyword['id'])) {
|
||||
// is readonly
|
||||
$subject = Subject::findOrFail($formKeyword['id']);
|
||||
$subject->value = $formKeyword['value'];
|
||||
$subject->type = $formKeyword['type'];
|
||||
if ($subject->isDirty()) {
|
||||
$subject->save();
|
||||
}
|
||||
// $subject->value = $formKeyword['value'];
|
||||
// $subject->type = $formKeyword['type'];
|
||||
// if ($subject->isDirty()) {
|
||||
// $subject->save();
|
||||
// }
|
||||
} else {
|
||||
$subject = new Subject($formKeyword);
|
||||
$dataset->subjects()->save($subject);
|
||||
// $subject = new Subject($formKeyword);
|
||||
// $dataset->subjects()->save($subject);
|
||||
$keyword = Subject::firstOrCreate(
|
||||
['value' => $formKeyword['value'], 'language' => $formKeyword['language']],
|
||||
$formKeyword
|
||||
);
|
||||
$dataset->subjects()->attach($keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +458,8 @@ class EditorController extends Controller
|
|||
$formCoverage
|
||||
);
|
||||
} elseif (isset($data['coverage']) && $this->containsOnlyNull($data['coverage'])
|
||||
&& !is_null($dataset->coverage)) {
|
||||
&& !is_null($dataset->coverage)
|
||||
) {
|
||||
$dataset->coverage()->delete();
|
||||
}
|
||||
|
||||
|
@ -590,4 +636,157 @@ class EditorController extends Controller
|
|||
}
|
||||
throw new GeneralException(trans('exceptions.publish.publish.update_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified dataset for publishing.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function doiCreate($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);
|
||||
$this->addAlternateLandingPageAttribute($domNode, $dataset->publish_id);
|
||||
$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;
|
||||
$landingPageUrl = 'https://doi.' . get_domain($base_domain) . "/" . $prefix . "/tethys." . $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()) {
|
||||
// touch unnecessary, save() also updates datasat modified date
|
||||
// $doi->touch();
|
||||
$dataset = Dataset::where('publish_id', '=', $dataId)->firstOrFail();
|
||||
// add to solr
|
||||
try {
|
||||
$service = new SolariumAdapter("solr", config('solarium'));
|
||||
$service->addDatasetsToIndex($dataset);
|
||||
} catch (Exception $e) {
|
||||
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the landingpage attribute to Rdr_Dataset XML output.
|
||||
*
|
||||
* @param \DOMNode $document Rdr_Dataset XML serialisation
|
||||
* @param string $docid Id of the dataset
|
||||
* @return void
|
||||
*/
|
||||
private function addAlternateLandingPageAttribute(\DOMNode $document, $dataid)
|
||||
{
|
||||
$base_domain = config('tethys.base_domain');
|
||||
$url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid;
|
||||
|
||||
$owner = $document->ownerDocument;
|
||||
$attr = $owner->createAttribute('landingpage');
|
||||
$attr->appendChild($owner->createTextNode($url));
|
||||
$document->appendChild($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an xslt stylesheet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function loadStyleSheet($stylesheet)
|
||||
{
|
||||
$this->xslt = new \DomDocument('1.0', 'UTF-8');
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ use Illuminate\Support\Facades\DB;
|
|||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
|
@ -60,7 +61,8 @@ class IndexController extends Controller
|
|||
->pluck('help_text', 'metadata_element');
|
||||
|
||||
$projects = Project::pluck('label', 'id');
|
||||
$relatedIdentifierTypes = ["doi", "handle", "isbn", "issn", "url", "urn"];
|
||||
// $relatedIdentifierTypes = ["doi", "handle", "isbn", "issn", "url", "urn"];
|
||||
$relatedIdentifierTypes = ["DOI", "Handle", "ISBN", "ISSN", "URL", "URN"];
|
||||
$relatedIdentifierTypes = array_combine($relatedIdentifierTypes, $relatedIdentifierTypes);
|
||||
|
||||
$relationTypes = ["IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues",
|
||||
|
@ -76,6 +78,7 @@ class IndexController extends Controller
|
|||
|
||||
$page = Page::query()->where('page_slug', 'terms-and-conditions')->firstOrFail();
|
||||
|
||||
$nameTypes = Config::get('enums.name_types');
|
||||
$contributorTypes = Config::get('enums.contributor_types');
|
||||
|
||||
//$relationTypes = array('updates' => 'updates', 'updated-by' => 'updated-by', 'other' => 'other');
|
||||
|
@ -91,6 +94,7 @@ class IndexController extends Controller
|
|||
'titleTypes',
|
||||
'keywordTypes',
|
||||
'descriptionTypes',
|
||||
'nameTypes',
|
||||
'contributorTypes',
|
||||
'page'
|
||||
)
|
||||
|
@ -340,7 +344,8 @@ class IndexController extends Controller
|
|||
$file = $uploadedFile['file'];
|
||||
$label = urldecode($uploadedFile['label']);
|
||||
$sorting = $uploadedFile['sorting'];
|
||||
$fileName = "file-" . time() . '.' . $file->getClientOriginalExtension();
|
||||
// $fileName = "file-" . time() . '.' . $file->getClientOriginalExtension();
|
||||
$fileName = "file-" . Str::uuid()->toString() . '.' . $file->getClientOriginalExtension();
|
||||
$mimeType = $file->getMimeType();
|
||||
$datasetFolder = 'files/' . $dataset->id;
|
||||
$path = $file->storeAs($datasetFolder, $fileName);
|
||||
|
@ -378,7 +383,7 @@ class IndexController extends Controller
|
|||
} else {
|
||||
$dataPerson = new Person($person);
|
||||
$dataPerson->status = true;
|
||||
$dataPerson->name_type = "Personal";
|
||||
// $dataPerson->name_type = "Personal";
|
||||
$dataset->persons()->save($dataPerson, $pivot_data);
|
||||
}
|
||||
}
|
||||
|
@ -475,8 +480,13 @@ class IndexController extends Controller
|
|||
//save keywords
|
||||
if (isset($data['keywords'])) {
|
||||
foreach ($request->get('keywords') as $key => $keyword) {
|
||||
$dataKeyword = new Subject($keyword);
|
||||
$dataset->subjects()->save($dataKeyword);
|
||||
// $dataKeyword = new Subject($keyword);
|
||||
// $dataset->subjects()->save($dataKeyword);
|
||||
$keyword = Subject::firstOrCreate(
|
||||
['value' => $keyword['value'], 'language' => $keyword['language']],
|
||||
$keyword
|
||||
);
|
||||
$dataset->subjects()->attach($keyword);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class ReviewController extends Controller
|
|||
$fieldval = $fieldValue->{$property_name};
|
||||
$value = $value . $fieldName . ": " . $fieldval . "; ";
|
||||
}
|
||||
} elseif ($fieldValue instanceof \Carbon\Carbon) {
|
||||
} elseif ($fieldValue instanceof \Illuminate\Support\Carbon) {
|
||||
$value = $value . " Year " . $fieldValue->year;
|
||||
$value = $value . " Month " . $fieldValue->month;
|
||||
$value = $value . " Day " . $fieldValue->day;
|
||||
|
|
|
@ -47,7 +47,7 @@ class SubmitController extends Controller
|
|||
'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer'])
|
||||
->where('account_id', $user_id)
|
||||
->with('user:id,login')
|
||||
->orderBy('server_date_modified', 'desc')
|
||||
->orderByDesc('server_date_modified')
|
||||
->get();
|
||||
return View::make('workflow.submitter.index', [
|
||||
'datasets' => $myDatasets,
|
||||
|
@ -78,6 +78,7 @@ class SubmitController extends Controller
|
|||
->pluck('part1', 'part1');
|
||||
|
||||
$contributorTypes = Config::get('enums.contributor_types');
|
||||
$nameTypes = Config::get('enums.name_types');
|
||||
|
||||
$messages = DB::table('messages')
|
||||
->pluck('help_text', 'metadata_element');
|
||||
|
@ -104,7 +105,7 @@ class SubmitController extends Controller
|
|||
|
||||
$keywordTypes = ['uncontrolled' => 'uncontrolled', 'swd' => 'swd'];
|
||||
|
||||
$referenceTypes = ["rdr-id", "doi", "handle", "isbn", "issn", "url", "urn"];
|
||||
$referenceTypes = ["DOI", "Handle", "ISBN", "ISSN", "URL", "URN"];
|
||||
$referenceTypes = array_combine($referenceTypes, $referenceTypes);
|
||||
|
||||
$relationTypes = ["IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues",
|
||||
|
@ -118,6 +119,7 @@ class SubmitController extends Controller
|
|||
'titleTypes',
|
||||
'descriptionTypes',
|
||||
'contributorTypes',
|
||||
'nameTypes',
|
||||
'languages',
|
||||
'messages',
|
||||
'projects',
|
||||
|
@ -218,7 +220,7 @@ class SubmitController extends Controller
|
|||
} else {
|
||||
$dataPerson = new Person($person);
|
||||
$dataPerson->status = true;
|
||||
$dataPerson->name_type = "Organizational";
|
||||
// $dataPerson->name_type = "Organizational";
|
||||
$dataset->persons()->save($dataPerson, $pivot_data);
|
||||
}
|
||||
$index++;
|
||||
|
@ -241,7 +243,7 @@ class SubmitController extends Controller
|
|||
} else {
|
||||
$dataPerson = new Person($person);
|
||||
$dataPerson->status = true;
|
||||
$dataPerson->name_type = "Organizational";
|
||||
// $dataPerson->name_type = "Organizational";
|
||||
$dataset->persons()->save($dataPerson, $pivot_data);
|
||||
}
|
||||
$index++;
|
||||
|
@ -315,14 +317,19 @@ class SubmitController extends Controller
|
|||
foreach ($keywords as $key => $formKeyword) {
|
||||
if (isset($formKeyword['id'])) {
|
||||
$subject = Subject::findOrFail($formKeyword['id']);
|
||||
$subject->value = $formKeyword['value'];
|
||||
$subject->type = $formKeyword['type'];
|
||||
if ($subject->isDirty()) {
|
||||
$subject->save();
|
||||
}
|
||||
// $subject->value = $formKeyword['value'];
|
||||
// $subject->type = $formKeyword['type'];
|
||||
// if ($subject->isDirty()) {
|
||||
// $subject->save();
|
||||
// }
|
||||
} else {
|
||||
$subject = new Subject($formKeyword);
|
||||
$dataset->subjects()->save($subject);
|
||||
// $subject = new Subject($formKeyword);
|
||||
// $dataset->subjects()->save($subject);
|
||||
$keyword = Subject::firstOrCreate(
|
||||
['value' => $formKeyword['value'], 'language' => $formKeyword['language']],
|
||||
$formKeyword
|
||||
);
|
||||
$dataset->subjects()->attach($keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
namespace App\Http\Controllers\Settings\Access;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\NewUser;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
@ -28,7 +30,7 @@ class UserController extends Controller
|
|||
//}
|
||||
|
||||
$users = User::with('roles')
|
||||
->orderBy('id', 'DESC')
|
||||
->orderByDesc('id')
|
||||
->paginate(5);
|
||||
return view('settings.access.user.user', compact('users'))
|
||||
->with('i', ($request->input('page', 1) - 1) * 5);
|
||||
|
@ -81,6 +83,18 @@ class UserController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// inform main admin about new user
|
||||
$adminUser = User::where('email', config('mail.mailadmin'))->first();
|
||||
if ($adminUser) {
|
||||
// Mail::to("receiver@example.com")->send(new DemoEmail($objDemo));
|
||||
$details = [
|
||||
'title' => 'New user ',
|
||||
'admin_name' => $adminUser->login,
|
||||
'email' => $user->email,
|
||||
];
|
||||
Mail::to($adminUser->email)->send(new NewUser($details));
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('access.user.index')
|
||||
->with('success', 'User has been created successfully');
|
||||
|
@ -149,7 +163,7 @@ class UserController extends Controller
|
|||
$errors = new \Illuminate\Support\MessageBag();
|
||||
|
||||
if (array_key_exists('current_password', $input)) {
|
||||
// if user is not admin he must enter old_password if a new password is defined
|
||||
// if user is not admin he must enter old_password if a new password is defined
|
||||
if (!Auth::user()->hasRole('Administrator') && $input['current_password'] == null && $input['password'] != null) {
|
||||
//ModelState.AddModelError("OldPassword", Resources.User_Edit_OldPasswordEmpty);
|
||||
//$flash_message = 'Current password should not be empty.';
|
||||
|
@ -158,7 +172,6 @@ class UserController extends Controller
|
|||
$valid = false;
|
||||
}
|
||||
|
||||
|
||||
if ($input['current_password'] != null && $this->validateUser($user->id, $input['current_password']) == false) {
|
||||
//$flash_message = 'Password does not match the current password.';
|
||||
$errors->add('your_custom_error', 'Password does not match the current password.');
|
||||
|
@ -166,8 +179,6 @@ class UserController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//$input = $request->only(['login', 'email', 'password']); //Retreive the name, email and password fields
|
||||
if ($valid == true) {
|
||||
$user->login = $input['login'];
|
||||
|
@ -175,7 +186,7 @@ class UserController extends Controller
|
|||
if ($input['password']) {
|
||||
$user->password = Hash::make($input['password']);
|
||||
}
|
||||
|
||||
|
||||
$user->save();
|
||||
|
||||
$roles = $request['roles']; //Retreive all roles
|
||||
|
@ -194,8 +205,8 @@ class UserController extends Controller
|
|||
// ->with('flash_message', 'User successfully edited.');
|
||||
}
|
||||
return back()
|
||||
->withInput($input)
|
||||
->withErrors($errors);
|
||||
->withInput($input)
|
||||
->withErrors($errors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ class LicenseController extends Controller
|
|||
//$languages = Language::where('active', true)->pluck('part2_t');
|
||||
$languages = DB::table('languages')
|
||||
->where('active', true)
|
||||
->pluck('part2_t', 'part2_t');
|
||||
->pluck('part1', 'part1');
|
||||
|
||||
return view('settings.license.edit', compact('license', 'languages'));
|
||||
}
|
||||
|
|
|
@ -37,8 +37,9 @@ class Kernel extends HttpKernel
|
|||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
'bindings',
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -53,10 +54,12 @@ class Kernel extends HttpKernel
|
|||
//'auth' => 'App\Http\Middleware\Authenticate',
|
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
// 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
|
||||
// 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
|
||||
// 'perm' => \App\Http\Middleware\PermissionMiddleware::class,
|
||||
|
|
|
@ -11,6 +11,6 @@ class EncryptCookies extends BaseEncrypter
|
|||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
'XDEBUG_SESSION'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Session;
|
||||
use App;
|
||||
use Config;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\App;
|
||||
// use Illuminate\Support\Facades\Config;
|
||||
// use Illuminate\Http\RedirectResponse;
|
||||
use Mcamara\LaravelLocalization\LanguageNegotiator;
|
||||
|
||||
class LocaleSessionRedirect extends LaravelLocalizationMiddlewareBase
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
@ -14,10 +15,17 @@ class RedirectIfAuthenticated
|
|||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
public function handle($request, Closure $next, $guards = [null])
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/home');
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
// if (Auth::guard($guard)->check()) {
|
||||
// return redirect('/home');
|
||||
// }
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
@ -19,6 +19,7 @@ class TrimStrings extends BaseTrimmer
|
|||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
|
29
app/Http/Middleware/TrustProxies.php
Normal file
29
app/Http/Middleware/TrustProxies.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
// use Fideloper\Proxy\TrustProxies as Middleware
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
|
@ -11,6 +11,6 @@ class VerifyCsrfToken extends Middleware
|
|||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
'oai*',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -27,8 +27,13 @@ class CollectionRequest extends Request
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:255',
|
||||
'role_id' => 'required',
|
||||
'name' => [
|
||||
'required',
|
||||
'max:255',
|
||||
],
|
||||
'role_id' => [
|
||||
'required',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,13 @@ class DocumentRequest extends Request
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'type' => 'required|min:3',
|
||||
'server_state' => 'required',
|
||||
'type' => [
|
||||
'required',
|
||||
'min:3',
|
||||
],
|
||||
'server_state' => [
|
||||
'required',
|
||||
],
|
||||
// 'author' => 'required|min:4',
|
||||
// 'stock' => 'required|integer',
|
||||
// 'year' => 'required|integer|min:4'
|
||||
|
|
|
@ -24,15 +24,40 @@ class LicenseRequest extends Request
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'desc_text' => 'max:4000',
|
||||
'language' => 'max:3',
|
||||
'link_licence' => 'required|url:max:255',
|
||||
'link_logo' => 'url|max:255',
|
||||
'mime_type' => 'max:30',
|
||||
'name_long' => 'required|min:5|max:255',
|
||||
'sort_order' => 'required|integer',
|
||||
'active' => 'required|boolean',
|
||||
'pod_allowed' => 'required|boolean'
|
||||
'desc_text' => [
|
||||
'max:4000',
|
||||
],
|
||||
'language' => [
|
||||
'max:3',
|
||||
],
|
||||
'link_licence' => [
|
||||
'required',
|
||||
'url:max:255',
|
||||
],
|
||||
'link_logo' => [
|
||||
'url',
|
||||
'max:255',
|
||||
],
|
||||
'mime_type' => [
|
||||
'max:30',
|
||||
],
|
||||
'name_long' => [
|
||||
'required',
|
||||
'min:5',
|
||||
'max:255',
|
||||
],
|
||||
'sort_order' => [
|
||||
'required',
|
||||
'integer',
|
||||
],
|
||||
'active' => [
|
||||
'required',
|
||||
'boolean',
|
||||
],
|
||||
'pod_allowed' => [
|
||||
'required',
|
||||
'boolean',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,10 @@ class UpdatePageRequest extends Request
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'en_title' => 'required|max:191'
|
||||
'en_title' => [
|
||||
'required',
|
||||
'max:191',
|
||||
],
|
||||
// 'description_en' => 'required'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class PeminjamanRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class PeriodeRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'days' => 'required|integer'
|
||||
];
|
||||
}
|
||||
}
|
|
@ -24,17 +24,45 @@ class CreatePersonRequest extends Request
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'academic_title' => 'nullable|min:2|max:255',
|
||||
'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth',
|
||||
'first_name' => 'required|min:3|max:255',
|
||||
'email' => 'required|email|max:50|unique:persons,email',
|
||||
'academic_title' => [
|
||||
'nullable',
|
||||
'min:2',
|
||||
'max:255',
|
||||
],
|
||||
'last_name' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:255',
|
||||
'unique_with:persons,first_name,date_of_birth',
|
||||
],
|
||||
'first_name' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:255',
|
||||
],
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
'max:50',
|
||||
'unique:persons,email',
|
||||
],
|
||||
// 'email' => [
|
||||
// 'required', 'email', 'max:100',
|
||||
// Rule::unique('persons')->ignore($user->id),
|
||||
// ],
|
||||
'identifier_orcid' => 'nullable|min:19|max:50',
|
||||
'status' => 'required|boolean',
|
||||
'date_of_birth' => 'nullable|date'
|
||||
'identifier_orcid' => [
|
||||
'nullable',
|
||||
'min:19',
|
||||
'max:50',
|
||||
],
|
||||
'status' => [
|
||||
'required',
|
||||
'boolean',
|
||||
],
|
||||
'date_of_birth' => [
|
||||
'nullable',
|
||||
'date',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,17 +26,45 @@ class EditPersonRequest extends Request
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'academic_title' => 'nullable|min:2|max:255',
|
||||
'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth',
|
||||
'first_name' => 'required|min:3|max:255',
|
||||
'email' => 'required|email|max:50|unique:persons,email',
|
||||
'academic_title' => [
|
||||
'nullable',
|
||||
'min:2',
|
||||
'max:255',
|
||||
],
|
||||
'last_name' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:255',
|
||||
'unique_with:persons,first_name,date_of_birth',
|
||||
],
|
||||
'first_name' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:255',
|
||||
],
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
'max:50',
|
||||
'unique:persons,email',
|
||||
],
|
||||
// 'email' => [
|
||||
// 'required', 'email', 'max:100',
|
||||
// Rule::unique('persons')->ignore($user->id),
|
||||
// ],
|
||||
'identifier_orcid' => 'nullable|min:19|max:50',
|
||||
'status' => 'required|boolean',
|
||||
'date_of_birth' => 'nullable|date'
|
||||
'identifier_orcid' => [
|
||||
'nullable',
|
||||
'min:19',
|
||||
'max:50',
|
||||
],
|
||||
'status' => [
|
||||
'required',
|
||||
'boolean',
|
||||
],
|
||||
'date_of_birth' => [
|
||||
'nullable',
|
||||
'date',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,19 @@ class ProjectRequest extends Request
|
|||
{
|
||||
return [
|
||||
|
||||
'name' => 'required|min:3|max:255',
|
||||
'label' => 'required|min:3|max:20',
|
||||
'description' => 'required'
|
||||
'name' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:255',
|
||||
],
|
||||
'label' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:20',
|
||||
],
|
||||
'description' => [
|
||||
'required',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class ShelfRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'shelf' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
16
app/Interfaces/DoiInterface.php
Normal file
16
app/Interfaces/DoiInterface.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by Visual Studio Code.
|
||||
* User: kaiarn
|
||||
* Date: 19.02.2021
|
||||
*/
|
||||
namespace App\Interfaces;
|
||||
|
||||
interface DoiInterface
|
||||
{
|
||||
public function registerDoi($doiValue, $xmlMeta, $landingPageUrl);
|
||||
public function getMetadataForDoi($identifier);
|
||||
public function updateMetadataForDoi($identifier, $new_meta);
|
||||
public function deleteMetadataForDoi($identifier);
|
||||
// public function deleteDoiByCurlRequest($doi);
|
||||
}
|
|
@ -4,10 +4,12 @@ namespace App\Library\Search;
|
|||
|
||||
//use App\Library\Util\SolrSearchQuery;
|
||||
use App\Library\Search\SearchResult;
|
||||
use App\Library\Util\SearchParameter;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Library\Search\SolariumDocument;
|
||||
use App\Library\Util\SearchParameter;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Solarium\Core\Client\Adapter\Curl;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use \Solarium\QueryType\Select\Query\Query;
|
||||
|
||||
class SolariumAdapter
|
||||
|
@ -22,7 +24,11 @@ class SolariumAdapter
|
|||
public function __construct($serviceName, $options)
|
||||
{
|
||||
$this->options = $options;
|
||||
$this->client = new \Solarium\Client($options);
|
||||
$adapter = new Curl();
|
||||
$dispatcher = new EventDispatcher();
|
||||
|
||||
$this->client = new \Solarium\Client($adapter, $dispatcher, $options);
|
||||
// $this->client = new \Solarium\Client($options);
|
||||
|
||||
// ensure service is basically available
|
||||
$ping = $this->client->createPing();
|
||||
|
@ -61,25 +67,30 @@ class SolariumAdapter
|
|||
$slices = array_chunk($datasets, 16);
|
||||
// update documents of every chunk in a separate request
|
||||
foreach ($slices as $slice) {
|
||||
// get an update query instance
|
||||
$update = $this->client->createUpdate();
|
||||
|
||||
$updateDocs = array_map(function ($rdrDoc) use ($builder, $update) {
|
||||
$solarium_document = $update->createDocument();
|
||||
$solarium_document = $update->createDocument();
|
||||
return $builder->toSolrUpdateDocument($rdrDoc, $solarium_document);
|
||||
}, $slice);
|
||||
|
||||
// adding the document to the update query
|
||||
// add the documents and a commit command to the update query
|
||||
$update->addDocuments($updateDocs);
|
||||
// Then commit the update:
|
||||
$update->addCommit();
|
||||
$result = $this->client->update($update);
|
||||
$update->addCommit();
|
||||
|
||||
// this executes the query and returns the result
|
||||
$result = $this->client->update($update);
|
||||
echo '<b>Update query executed</b><br/>';
|
||||
echo 'Query status: ' . $result->getStatus() . '<br/>';
|
||||
echo 'Query time: ' . $result->getQueryTime();
|
||||
|
||||
//$this->execute($update, 'failed updating slice of documents');
|
||||
}
|
||||
|
||||
// finally commit all updates
|
||||
// $update = $this->client->createUpdate();
|
||||
|
||||
|
||||
// $update->addCommit();
|
||||
|
||||
// $this->execute($update, 'failed committing update of documents');
|
||||
|
@ -95,7 +106,7 @@ class SolariumAdapter
|
|||
|
||||
foreach ($documents as $document) {
|
||||
if (!($document instanceof Dataset)) {
|
||||
throw new InvalidArgumentException("invalid dataset in provided set");
|
||||
throw new \InvalidArgumentException("invalid dataset in provided set");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +207,7 @@ class SolariumAdapter
|
|||
$result = null;
|
||||
try {
|
||||
$result = $this->client->execute($query);
|
||||
} catch (\Solarium\Exception\HttpException $e) {
|
||||
} catch (\Solarium\Exception\HttpException$e) {
|
||||
sprintf('%s: %d %s', $actionText, $e->getCode(), $e->getStatusMessage());
|
||||
} finally {
|
||||
return $result;
|
||||
|
@ -207,7 +218,7 @@ class SolariumAdapter
|
|||
// }
|
||||
}
|
||||
|
||||
protected function processQuery(\Solarium\QueryType\Select\Query\Query $query): SearchResult
|
||||
protected function processQuery(\Solarium\QueryType\Select\Query\Query$query): SearchResult
|
||||
{
|
||||
// send search query to service
|
||||
$request = $this->execute($query, 'failed querying search engine');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Library\Search;
|
||||
|
||||
use App\Models\Dataset;
|
||||
use Solarium\QueryType\Update\Query\Document\Document;
|
||||
use Solarium\QueryType\Update\Query\Document;
|
||||
use Solarium\QueryType\Update\Query\Document\DocumentInterface;
|
||||
|
||||
class SolariumDocument extends SolrDocumentXslt
|
||||
|
@ -13,10 +13,10 @@ class SolariumDocument extends SolrDocumentXslt
|
|||
parent::__construct($options);
|
||||
}
|
||||
|
||||
public function toSolrUpdateDocument(Dataset $rdrDataset, DocumentInterface $solrDoc)
|
||||
public function toSolrUpdateDocument(Dataset $rdrDataset, $solrDoc)
|
||||
{
|
||||
if (!($solrDoc instanceof Document)) {
|
||||
throw new \Exception('provided Solr document must be instance of Solarium Update Document');
|
||||
throw new \Exception(get_class($solrDoc) . 'provided Solr document must be instance of Solarium Update Document');
|
||||
}
|
||||
|
||||
// convert Opus document to Solr XML document for supporting custom transformations
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace App\Library\Util;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Describes local document as a match in context of a related search query.
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Models\License;
|
|||
use App\Models\Person;
|
||||
use App\Models\File;
|
||||
use App\Models\Coverage;
|
||||
use App\Models\DatasetIdentifier;
|
||||
use App\Models\Subject;
|
||||
use App\Models\DatasetReference;
|
||||
|
||||
|
@ -33,7 +34,7 @@ trait DatasetExtension
|
|||
),
|
||||
'TitleAbstract' => array(
|
||||
'model' => Description::class,
|
||||
'options' => array('type' => ['Abstract']),
|
||||
'options' => array('type' => ['Abstract', 'Translated']),
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
'TitleAbstractAdditional' => array(
|
||||
|
@ -50,7 +51,7 @@ trait DatasetExtension
|
|||
'PersonAuthor' => array(
|
||||
'model' => Person::class,
|
||||
'through' => 'link_documents_persons',
|
||||
'pivot' => array('role' => 'author'),
|
||||
'pivot' => array('role' => 'author', 'sort_order' => 'sort_order'),
|
||||
//'sort_order' => array('sort_order' => 'ASC'), // <-- We need a sorted authors list.
|
||||
//'sort_field' => 'SortOrder',
|
||||
'relation' => 'persons',
|
||||
|
@ -59,7 +60,7 @@ trait DatasetExtension
|
|||
'PersonContributor' => array(
|
||||
'model' => Person::class,
|
||||
'through' => 'link_documents_persons',
|
||||
'pivot' => array('role' => 'contributor', 'contributor_type' => 'contributor_type'),
|
||||
'pivot' => array('role' => 'contributor', 'contributor_type' => 'contributor_type', 'sort_order' => 'sort_order'),
|
||||
// 'sort_order' => array('sort_order' => 'ASC'), // <-- We need a sorted authors list.
|
||||
//'sort_field' => 'SortOrder',
|
||||
'relation' => 'persons',
|
||||
|
@ -70,8 +71,14 @@ trait DatasetExtension
|
|||
'relation' => 'references',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
'Identifier' => array(
|
||||
'model' => DatasetIdentifier::class,
|
||||
'relation' => 'identifier',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
'Subject' => array(
|
||||
'model' => Subject::class,
|
||||
'through' => 'link_dataset_subjects',
|
||||
'relation' => 'subjects',
|
||||
'fetch' => 'eager'
|
||||
),
|
||||
|
@ -227,7 +234,7 @@ trait DatasetExtension
|
|||
if (true === empty($fieldval)) {
|
||||
$fieldval = null;
|
||||
} else {
|
||||
$fieldval = new \Carbon\Carbon($fieldval);
|
||||
$fieldval = new \Illuminate\Support\Carbon($fieldval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,12 +298,13 @@ trait DatasetExtension
|
|||
//$through = $this->externalFields[$fieldname]['through'];
|
||||
$rows = $this->{$relation}()->wherePivot('role', $pivotValue)->get();
|
||||
//$rows = $this->{$relation}()->get();
|
||||
//$rows = $this->belongsToMany($modelclass, $through, 'document_id')->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);
|
||||
})->get();
|
||||
})->orderBy('id')->get();
|
||||
}
|
||||
|
||||
foreach ($rows as $row) {
|
||||
|
|
|
@ -157,7 +157,7 @@ class Strategy
|
|||
|
||||
if ($value instanceof \Illuminate\Database\Eloquent\Model) {
|
||||
$this->_mapModelAttributes($value, $dom, $childNode);
|
||||
} elseif ($value instanceof \Carbon\Carbon) {
|
||||
} elseif ($value instanceof \Illuminate\Support\Carbon) {
|
||||
$this->_mapDateAttributes($value, $dom, $childNode);
|
||||
} elseif (is_array($value)) {
|
||||
$this->_mapArrayAttributes($value, $dom, $childNode);
|
||||
|
@ -181,7 +181,7 @@ class Strategy
|
|||
return $dom->createElement($fieldName);
|
||||
}
|
||||
|
||||
protected function _mapDateAttributes(\Carbon\Carbon $model, DOMDocument $dom, \DOMNode $rootNode)
|
||||
protected function _mapDateAttributes(\Illuminate\Support\Carbon $model, DOMDocument $dom, \DOMNode $rootNode)
|
||||
{
|
||||
$rootNode->setAttribute("Year", $model->year);
|
||||
$rootNode->setAttribute("Month", $model->month);
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
namespace App\Listeners;
|
||||
|
||||
// use Illuminate\Queue\InteractsWithQueue;
|
||||
// use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use App\Events\Dataset\DatasetUpdated as DatasetUpdatedEvent;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Library\Search\SolariumAdapter;
|
||||
use \Exception;
|
||||
|
||||
class DatasetUpdated
|
||||
{
|
||||
|
@ -59,10 +58,8 @@ class DatasetUpdated
|
|||
// Opus_Search_Service::selectIndexingService('onDocumentChange')
|
||||
$service = new SolariumAdapter("solr", config('solarium'));
|
||||
$service->addDatasetsToIndex($dataset);
|
||||
} catch (Opus_Search_Exception $e) {
|
||||
Log::debug(__METHOD__ . ': ' . 'Indexing document ' . $documentId . ' failed: ' . $e->getMessage());
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::warning(__METHOD__ . ': ' . $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Log::warning(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
36
app/Mail/NewUser.php
Normal file
36
app/Mail/NewUser.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class NewUser extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $details;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($details)
|
||||
{
|
||||
$this->details = $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this
|
||||
->subject('Mail from www.tethys.at')
|
||||
->view('emails.newUserEmail');
|
||||
}
|
||||
}
|
|
@ -3,10 +3,13 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Models\Dataset;
|
||||
|
||||
class Collection extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public $timestamps = false;
|
||||
//mass assignable
|
||||
protected $fillable = [
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Models\Collection;
|
||||
use App\Models\Dataset;
|
||||
// use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class CollectionRole extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'collections_roles';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DateTimeInterface;
|
||||
|
||||
class Coverage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'coverage';
|
||||
public $timestamps = true;
|
||||
protected $dateFormat = 'Y-m-d H:i:s';
|
||||
|
@ -47,6 +50,16 @@ class Coverage extends Model
|
|||
{
|
||||
$this->attributes['time_max'] = empty($date) ? null : \Illuminate\Support\Carbon::createFromFormat('Y-m-d H:i:s', $date);
|
||||
}
|
||||
/**
|
||||
* Prepare a date for array / JSON serialization.
|
||||
*
|
||||
* @param \DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* relationship to dataset
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Library\Xml\DatasetExtension;
|
||||
use App\Models\Collection;
|
||||
use App\Models\Coverage;
|
||||
|
@ -13,13 +14,14 @@ use App\Models\Project;
|
|||
use App\Models\Title;
|
||||
use App\Models\User;
|
||||
use App\Models\XmlCache;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\DatasetIdentifier;
|
||||
use Illuminate\Support\Carbon;
|
||||
// use App\Models\GeolocationBox;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Dataset extends Model
|
||||
{
|
||||
use DatasetExtension;
|
||||
use DatasetExtension, HasFactory;
|
||||
protected $table = 'documents';
|
||||
|
||||
//public $timestamps = false; //default true
|
||||
|
@ -96,6 +98,14 @@ class Dataset extends Model
|
|||
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
|
||||
*/
|
||||
|
@ -152,7 +162,8 @@ class Dataset extends Model
|
|||
return $this
|
||||
->persons()
|
||||
//->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->wherePivot('role', 'author');
|
||||
->wherePivot('role', 'author')
|
||||
->orderBy('link_documents_persons.sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,7 +188,8 @@ class Dataset extends Model
|
|||
return $this
|
||||
->persons()
|
||||
// ->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->wherePivot('role', 'contributor');
|
||||
->wherePivot('role', 'contributor')
|
||||
->orderBy('link_documents_persons.sort_order');
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -249,9 +261,13 @@ class Dataset extends Model
|
|||
return $this->hasMany(\App\Models\DatasetReference::class, 'document_id', 'id');
|
||||
}
|
||||
|
||||
// public function subjects()
|
||||
// {
|
||||
// return $this->hasMany(\App\Models\Subject::class, 'document_id', 'id');
|
||||
// }
|
||||
public function subjects()
|
||||
{
|
||||
return $this->hasMany(\App\Models\Subject::class, 'document_id', 'id');
|
||||
return $this->belongsToMany(\App\Models\Subject::class, 'link_dataset_subjects', 'document_id', 'subject_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -285,7 +301,7 @@ class Dataset extends Model
|
|||
$result = Dataset::select('server_date_published')
|
||||
->where('server_date_published', '<>', null)
|
||||
->where('server_state', 'published')
|
||||
->orderBy('server_date_published', 'asc')
|
||||
->orderBy('server_date_published')
|
||||
->first();
|
||||
//->server_date_published;
|
||||
return $result;
|
||||
|
|
26
app/Models/DatasetIdentifier.php
Normal file
26
app/Models/DatasetIdentifier.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class DatasetIdentifier extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'dataset_identifiers';
|
||||
protected $guarded = array();
|
||||
public $timestamps = true;
|
||||
|
||||
// See the array called $touches? This is where you put all the relationships you want to get
|
||||
// updated_at as soon as this Model is updated
|
||||
protected $touches = ['dataset'];
|
||||
|
||||
/**
|
||||
* The dataset that belong to the DocumentIdentifier.
|
||||
*/
|
||||
public function dataset()
|
||||
{
|
||||
return $this->belongsTo(Dataset::class, 'dataset_id', 'id');
|
||||
}
|
||||
}
|
|
@ -4,9 +4,11 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class DatasetReference extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'document_references';
|
||||
public $timestamps = false;
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Description extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'dataset_abstracts';
|
||||
public $timestamps = false;
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@ namespace App\Models;
|
|||
use App\Models\Dataset;
|
||||
use App\Models\HashValue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class File extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'document_files';
|
||||
public $timestamps = true;
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ namespace App\Models;
|
|||
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class GeolocationBox extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'geolocation_box';
|
||||
public $timestamps = false;
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@ namespace App\Models;
|
|||
|
||||
use App\Models\File;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class HashValue extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'file_hashvalues';
|
||||
public $timestamps = false;
|
||||
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Language extends Model
|
||||
{
|
||||
|
||||
use HasFactory;
|
||||
//protected $table = 'languages';
|
||||
public $timestamps = false;
|
||||
|
||||
|
|
|
@ -3,14 +3,17 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class License extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'document_licences';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'name_long',
|
||||
'name',
|
||||
'language',
|
||||
'link_licence',
|
||||
'link_logo',
|
||||
|
@ -19,10 +22,15 @@ class License extends Model
|
|||
'comment_internal',
|
||||
'mime_type',
|
||||
'sort_order',
|
||||
'language',
|
||||
'active',
|
||||
'pod_allowed'
|
||||
];
|
||||
|
||||
// See the array called $touches? This is where you put all the relationships you want to get
|
||||
// updated_at as soon as this Model is updated
|
||||
protected $touches = ['datasets'];
|
||||
|
||||
public function datasets()
|
||||
{
|
||||
return $this->belongsToMany(Dataset::class, 'link_documents_licences', 'licence_id', 'document_id');
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Message extends Model
|
||||
{
|
||||
//
|
||||
use HasFactory;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class MimeType extends Model
|
||||
{
|
||||
|
||||
use HasFactory;
|
||||
protected $table = 'mime_types';
|
||||
|
||||
// for using $input = $request->all();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Models\Oai;
|
||||
|
||||
use App\Exceptions\OaiModelException;
|
||||
|
||||
class OaiModelError
|
||||
{
|
||||
/**
|
||||
|
@ -35,7 +37,7 @@ class OaiModelError
|
|||
public static function mapCode($code)
|
||||
{
|
||||
if (false === array_key_exists($code, self::$oaiErrorCodes)) {
|
||||
throw new Oai_Model_Exception("Unknown oai error code $code");
|
||||
throw new OaiModelException("Unknown oai error code $code");
|
||||
}
|
||||
return self::$oaiErrorCodes[$code];
|
||||
}
|
||||
|
|
|
@ -8,9 +8,11 @@ use App\Models\User;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract;
|
||||
use Astrotomic\Translatable\Translatable;// use Dimsav\Translatable\Translatable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Page extends Model implements TranslatableContract
|
||||
{
|
||||
use HasFactory;
|
||||
use ModelTrait;
|
||||
use Translatable; // 2. To add translation methods
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class PageTranslation extends Model
|
||||
{
|
||||
Use HasFactory;
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['title', 'description'];
|
||||
protected $guarded = ['id'];
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Person extends Model
|
||||
{
|
||||
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'academic_title',
|
||||
'date_of_birth',
|
||||
|
@ -15,10 +17,13 @@ class Person extends Model
|
|||
'email',
|
||||
'identifier_orcid',
|
||||
'status',
|
||||
'name_type'
|
||||
'name_type',
|
||||
];
|
||||
|
||||
protected $table = 'persons';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $appends = ['full_name'];
|
||||
|
||||
public function documents()
|
||||
|
@ -39,7 +44,7 @@ class Person extends Model
|
|||
*/
|
||||
public function getFullNameAttribute()
|
||||
{
|
||||
return $this->first_name . " " . $this->last_name . " " . $this->date_of_birth;
|
||||
return $this->first_name.' '.$this->last_name.' '.$this->date_of_birth;
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
|
|
|
@ -3,10 +3,11 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Project extends Model
|
||||
{
|
||||
|
||||
use HasFactory;
|
||||
//protected $table = 'projects';
|
||||
|
||||
// for using $input = $request->all();
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Zizaco\Entrust\EntrustRole;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Role extends EntrustRole
|
||||
{
|
||||
use HasFactory;
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
|
|
@ -4,16 +4,23 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Subject extends Model
|
||||
{
|
||||
protected $table = 'document_subjects';
|
||||
Use HasFactory;
|
||||
// protected $table = 'document_subjects';
|
||||
protected $table = 'dataset_subjects';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['value', 'type', 'language'];
|
||||
|
||||
public function dataset()
|
||||
// public function dataset()
|
||||
// {
|
||||
// return $this->belongsTo(Dataset::class, 'document_id', 'id');
|
||||
// }
|
||||
public function datasets()
|
||||
{
|
||||
return $this->belongsTo(Dataset::class, 'document_id', 'id');
|
||||
return $this->belongsToMany(Dataset::class, 'link_dataset_subjects', 'subject_id', 'document_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Title extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'dataset_titles';
|
||||
public $timestamps = false;
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
// use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Zizaco\Entrust\Traits\EntrustUserTrait;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Collection;
|
||||
|
@ -12,7 +14,7 @@ use App\Models\Dataset;
|
|||
class User extends Authenticatable
|
||||
{
|
||||
// use Authenticatable, CanResetPassword, Authorizable;
|
||||
use Notifiable;
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
// use HasRoles;
|
||||
use EntrustUserTrait;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace App\Observers;
|
|||
use App\Models\Dataset;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Library\Search\SolariumAdapter;
|
||||
use \Exception;
|
||||
|
||||
class DatasetObserver
|
||||
{
|
||||
|
@ -92,10 +93,8 @@ class DatasetObserver
|
|||
// Opus_Search_Service::selectIndexingService('onDocumentChange')
|
||||
$service = new SolariumAdapter("solr", config('solarium'));
|
||||
$service->addDatasetsToIndex($dataset);
|
||||
} catch (Opus_Search_Exception $e) {
|
||||
Log::debug(__METHOD__ . ': ' . 'Indexing document ' . $datasetId . ' failed: ' . $e->getMessage());
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::warning(__METHOD__ . ': ' . $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Log::error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
|
|
45
app/Providers/DoiServiceProvider.php
Normal file
45
app/Providers/DoiServiceProvider.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Visual Studio Code.
|
||||
* User: kaiarn
|
||||
* Date: 19.02.21
|
||||
*/
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Tethys\Utils\DoiClient;
|
||||
use App\Interfaces\DoiInterface;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class DoiServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
$this->app->singleton(\App\Interfaces\DoiInterface::class, function ($app) {
|
||||
return new DoiClient();
|
||||
});
|
||||
}
|
||||
|
||||
public function provides()
|
||||
{
|
||||
return [DoiClient::class];
|
||||
}
|
||||
}
|
|
@ -11,8 +11,8 @@ class EventServiceProvider extends ServiceProvider
|
|||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\Event' => [
|
||||
'App\Listeners\EventListener',
|
||||
\App\Events\Event::class => [
|
||||
\App\Listeners\EventListener::class,
|
||||
],
|
||||
\App\Events\Dataset\DatasetUpdated::class => [
|
||||
\App\Listeners\DatasetUpdated::class,
|
||||
|
|
|
@ -3,12 +3,24 @@ namespace App\Providers;
|
|||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/settings';
|
||||
|
||||
/**
|
||||
* This namespace is applied to the controller routes in your routes file.
|
||||
* If specified, this namespace is automatically applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
|
@ -24,7 +36,19 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
// parent::boot();
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
// Route::prefix('api')
|
||||
Route::middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
|
||||
//
|
||||
}
|
||||
|
@ -72,4 +96,17 @@ class RouteServiceProvider extends ServiceProvider
|
|||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace App\Providers;
|
|||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Solarium\Client;
|
||||
use Solarium\Core\Client\Adapter\Curl;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
class SolariumServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -18,6 +20,9 @@ class SolariumServiceProvider extends ServiceProvider
|
|||
public function register()
|
||||
{
|
||||
$this->app->bind(Client::class, function ($app) {
|
||||
|
||||
$adapter = new Curl();
|
||||
$dispatcher = new EventDispatcher();
|
||||
// $config = config('solarium');
|
||||
$config = array(
|
||||
'endpoint' => array(
|
||||
|
@ -30,7 +35,7 @@ class SolariumServiceProvider extends ServiceProvider
|
|||
)
|
||||
);
|
||||
//return new Client($config);
|
||||
return new Client($config);
|
||||
return new Client($adapter, $dispatcher, $config);
|
||||
//return new Client($app['config']['solarium']);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
|
@ -102,7 +103,7 @@ class RdrFilesize implements Rule
|
|||
private function getSize($attribute, $value)
|
||||
{
|
||||
if (is_numeric($value) && $hasNumeric) {
|
||||
return array_get($this->data, $attribute);
|
||||
return Arr::get($this->data, $attribute);
|
||||
} elseif (is_array($value)) {
|
||||
return count($value);
|
||||
} elseif ($value instanceof File) {
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\User;
|
||||
use Validator;
|
||||
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
|
||||
|
||||
class Registrar implements RegistrarContract
|
||||
{
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
public function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => 'required|max:255',
|
||||
'email' => 'required|email|max:255|unique:users',
|
||||
'password' => 'required|confirmed|min:6',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return User
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
273
app/Tethys/Utils/DoiClient.php
Normal file
273
app/Tethys/Utils/DoiClient.php
Normal file
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
namespace App\Tethys\Utils;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Interfaces\DoiInterface;
|
||||
|
||||
class DoiClient implements DoiInterface
|
||||
{
|
||||
private $username;
|
||||
private $password;
|
||||
private $serviceUrl;
|
||||
private $prefix;
|
||||
private $base_domain;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$datacite_environment = config('tethys.datacite_environment');
|
||||
if ($datacite_environment == "debug") {
|
||||
$this->username = config('tethys.datacite_test_username');
|
||||
$this->password = config('tethys.datacite_test_password');
|
||||
$this->serviceUrl = config('tethys.datacite_test_service_url');
|
||||
$this->prefix = config('tethys.datacite_test_prefix');
|
||||
$this->base_domain = config('tethys.test_base_domain');
|
||||
} elseif ($datacite_environment == "production") {
|
||||
$this->username = config('tethys.datacite_username');
|
||||
$this->password = config('tethys.datacite_password');
|
||||
$this->serviceUrl = config('tethys.datacite_service_url');
|
||||
$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)) {
|
||||
$message = 'missing configuration settings to properly initialize DOI client';
|
||||
Log::error($message);
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a DOI with the given identifier
|
||||
*
|
||||
* @param string $identifier The desired DOI identifier e.g. '10.5072/tethys.999',
|
||||
* @param $xmlMeta
|
||||
* @param $landingPageUrl e.g. https://www.tethys.at/dataset/1
|
||||
*
|
||||
* @return GuzzleHttp\Psr7\Response The http response in the form of a Guzzle response
|
||||
*/
|
||||
public function registerDoi($doiValue, $xmlMeta, $landingPageUrl)
|
||||
{
|
||||
|
||||
// Schritt 1: Metadaten als XML registrieren
|
||||
// state draft
|
||||
$response = null;
|
||||
$url = $this->serviceUrl . '/metadata/' . $doiValue;
|
||||
try {
|
||||
$client = new Client([
|
||||
'auth' => [$this->username, $this->password],
|
||||
// 'base_uri' => $url,
|
||||
'verify' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/xml;charset=UTF-8',
|
||||
],
|
||||
// 'body' => $xmlMeta,
|
||||
]);
|
||||
// Provide the body as a string.
|
||||
$response = $client->request('PUT', $url, [
|
||||
'body' => $xmlMeta,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$message = 'request to ' . $url . ' failed with ' . $e->getMessage();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
// Response Codes
|
||||
// 201 Created: operation successful
|
||||
// 401 Unauthorised: no login
|
||||
// 403 Forbidden: login problem, quota exceeded
|
||||
// 415 Wrong Content Type : Not including content type in the header.
|
||||
// 422 Unprocessable Entity : invalid XML
|
||||
if ($response->getStatusCode() != 201) {
|
||||
$message = 'unexpected DataCite MDS response code ' . $response->getStatusCode();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
|
||||
// Schritt 2: Register the DOI name
|
||||
// DOI und URL der Frontdoor des zugehörigen Dokuments übergeben: state findable
|
||||
$url = $this->serviceUrl . '/doi/' . $doiValue;
|
||||
try {
|
||||
$client = new Client(
|
||||
[
|
||||
'auth' => [$this->username, $this->password],
|
||||
'verify' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'text/plain;charset=UTF-8',
|
||||
],
|
||||
]
|
||||
);
|
||||
$data = "doi=$doiValue\nurl=" . $landingPageUrl;
|
||||
// $client->setRawData($data, 'text/plain;charset=UTF-8');
|
||||
$response = $client->request('PUT', $url, [
|
||||
'body' => $data,
|
||||
'headers' => [
|
||||
'Content-Type' => 'text/plain;charset=UTF-8',
|
||||
],
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$message = 'request to ' . $url . ' failed with ' . $e->getMessage();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
// Response Codes
|
||||
// 201 Created: operation successful
|
||||
// 400 Bad Request: request body must be exactly two lines: DOI and URL; wrong domain, wrong prefix;
|
||||
// 401 Unauthorised: no login
|
||||
// 403 Forbidden: login problem, quota exceeded
|
||||
// 412 Precondition failed: metadata must be uploaded first.
|
||||
|
||||
// $this->log('DataCite response status code (expected 201): ' . $response->getStatus());
|
||||
// $this->log('DataCite response body: ' . $response->getBody());
|
||||
|
||||
if ($response->getStatusCode() != 201) {
|
||||
$message = 'unexpected DataCite MDS response code ' . $response->getStatusCode();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/* Response Status Codes
|
||||
* 200 OK: operation successful
|
||||
* 204 No Content : DOI is known to DataCite Metadata Store (MDS), but is not minted (or not resolvable e.g. due
|
||||
* to handle's latency)
|
||||
* 401 Unauthorized: no login
|
||||
* 403 Login problem or dataset belongs to another party
|
||||
* 404 Not Found: DOI does not exist in our database (e.g. registration pending)
|
||||
*
|
||||
* @param $doiValue
|
||||
* @param $landingPageURL
|
||||
*
|
||||
* @return bool Methode liefert true, wenn die DOI erfolgreich registiert wurde und die Prüfung positiv ausfällt.
|
||||
*
|
||||
* @throws ClientException
|
||||
*
|
||||
*/
|
||||
public function checkDoi($doiValue, $landingPageURL): bool
|
||||
{
|
||||
$response = null;
|
||||
$url = $this->serviceUrl . '/doi/' . $doiValue;
|
||||
try {
|
||||
$client = new Client([
|
||||
'base_uri' => $this->serviceUrl . '/doi/' . $doiValue,
|
||||
'auth' => [$this->username, $this->password],
|
||||
'verify' => false,
|
||||
]);
|
||||
$response = $client->request('GET');
|
||||
} catch (\Exception $e) {
|
||||
$message = 'request to ' . $url . ' failed with ' . $e->getMessage();
|
||||
Log::error($message);
|
||||
// throw new \Exception($message);
|
||||
return false;
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
// in $body steht die URL zur Frontdoor, die mit der DOI verknüpft wurde
|
||||
$body = $response->getBody();
|
||||
|
||||
// $this->log('DataCite response status code (expected 200): ' . $statusCode);
|
||||
// $this->log('DataCite response body (expected ' . $landingPageURL . '): ' . $body);
|
||||
|
||||
return ($statusCode == 200 && $landingPageURL == $body);
|
||||
}
|
||||
|
||||
public function getMetadataForDoi($doiValue)
|
||||
{
|
||||
$response = null;
|
||||
$url = $this->serviceUrl . '/metadata/' . $doiValue;
|
||||
try {
|
||||
$client = new Client([
|
||||
'auth' => [$this->username, $this->password],
|
||||
'base_uri' => $url,
|
||||
'verify' => false,
|
||||
]);
|
||||
$response = $client->request('GET');
|
||||
} catch (\Exception $e) {
|
||||
$message = 'request to ' . $url . ' failed with ' . $e->getMessage();
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
// Response Codes
|
||||
// 200 OK: operation successful;
|
||||
// 204 No Content: the DOI is known to DataCite Metadata Store (MDS), but no metadata have been registered;
|
||||
// 401 Unauthorised: no login
|
||||
// 403 Forbidden: permission problem or dataset belongs to another party;
|
||||
// 404 Not Found: DOI does not exist in our database.
|
||||
// 422 Unprocessable Entity Metadata failed validation against the DataCite Schema.
|
||||
if ($response->getStatusCode() != 200) {
|
||||
$message = 'unexpected DataCite MDS response code ' . $response->getStatusCode();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function updateMetadataForDoi($doiValue, $newMeta)
|
||||
{
|
||||
$response = null;
|
||||
$url = $this->serviceUrl . '/metadata/' . $doiValue;
|
||||
try {
|
||||
$client = new Client([
|
||||
'auth' => [$this->username, $this->password],
|
||||
// 'base_uri' => $url,
|
||||
'verify' => false,
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/xml;charset=UTF-8',
|
||||
],
|
||||
// 'body' => $xmlMeta,
|
||||
]);
|
||||
// Provide the body as a string.
|
||||
$response = $client->request('PUT', $url, [
|
||||
'body' => $newMeta,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$message = 'request to ' . $url . ' failed with ' . $e->getMessage();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
// Response Codes
|
||||
// 201 Created: operation successful
|
||||
// 401 Unauthorised: no login
|
||||
// 403 Forbidden: login problem, quota exceeded
|
||||
// 415 Wrong Content Type : Not including content type in the header.
|
||||
// 422 Unprocessable Entity : invalid XML
|
||||
if ($response->getStatusCode() != 201) {
|
||||
$message = 'unexpected DataCite MDS response code ' . $response->getStatusCode();
|
||||
// $this->log($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Markiert den Datensatz zur übergebenen DOI als inaktiv - Status registered (not findable)
|
||||
*
|
||||
* @param $doiValue
|
||||
*
|
||||
* @throws ClientException
|
||||
*/
|
||||
public function deleteMetadataForDoi($doiValue)
|
||||
{
|
||||
$response = null;
|
||||
$url = $this->serviceUrl . '/metadata/' . $doiValue;
|
||||
try {
|
||||
$client = new Client([
|
||||
'base_uri' => $url,
|
||||
'auth' => [$this->username, $this->password],
|
||||
'verify' => false,
|
||||
]);
|
||||
$response = $client->request('DELETE');
|
||||
} catch (\Exception $e) {
|
||||
$message = 'request to ' . $url . ' failed with ' . $e->getMessage();
|
||||
Log::error($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
|
||||
// $this->log('DataCite response status code (expected 200): ' . $response->getStatus());
|
||||
|
||||
if ($response->getStatusCode() != 200) {
|
||||
$message = 'unexpected DataCite MDS response code ' . $response->getStatusCode();
|
||||
Log::error($message, 'err');
|
||||
throw new DoiClientException($message);
|
||||
}
|
||||
}
|
||||
}
|
7
app/Tethys/Utils/DoiClientException.php
Normal file
7
app/Tethys/Utils/DoiClientException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Tethys\Utils;
|
||||
|
||||
class DoiClientException extends \Exception
|
||||
{
|
||||
}
|
|
@ -1,42 +1,47 @@
|
|||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"php": "^7.3||^8.0",
|
||||
"arifhp86/laravel-clear-expired-cache-file": "^0.0.4",
|
||||
"astrotomic/laravel-translatable": "^11.1",
|
||||
"davejamesmiller/laravel-breadcrumbs": "5.x",
|
||||
"diglactic/laravel-breadcrumbs": "7.2",
|
||||
"doctrine/dbal": "^3.3",
|
||||
"felixkiss/uniquewith-validator": "^3.1",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"laravel/framework": "^6.2",
|
||||
"laravel/tinker": "^2.0",
|
||||
"gghughunishvili/entrust": "4.0",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^8.75",
|
||||
"laravel/tinker": "^2.5",
|
||||
"laravel/ui": "^3.4",
|
||||
"laravelcollective/html": "^6.1",
|
||||
"mcamara/laravel-localization": "^1.3",
|
||||
"solarium/solarium": "^3.8",
|
||||
"yajra/laravel-datatables-oracle": "^9.0",
|
||||
"halpdesk/zizaco-entrust-laravel-6.0": "^1.9"
|
||||
"solarium/solarium": "^6.1",
|
||||
"yajra/laravel-datatables-oracle": "^9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "^1.8",
|
||||
"phpunit/phpunit": "^7.0"
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5.10"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"app/Helpers/utils.php",
|
||||
"app/Constants/constants.php"
|
||||
],
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories"
|
||||
],
|
||||
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
@ -45,6 +50,10 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"@php artisan clear-compiled"
|
||||
],
|
||||
|
@ -52,12 +61,12 @@
|
|||
"php -r \"copy('.env.example', '.env');\"",
|
||||
"@php artisan key:generate --ansi"
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
]
|
||||
"test": "php vendor/phpunit/phpunit/phpunit --testsuite Feature"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.3"
|
||||
},
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"optimize-autoloader": true
|
||||
|
|
5296
composer.lock
generated
5296
composer.lock
generated
File diff suppressed because it is too large
Load diff
110
config/app.php
110
config/app.php
|
@ -2,7 +2,7 @@
|
|||
|
||||
return [
|
||||
|
||||
/*
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -11,13 +11,13 @@ return [
|
|||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'workspacePath' => storage_path() . DIRECTORY_SEPARATOR . "workspace",
|
||||
|
||||
'name' => env('APP_NAME', 'App'),
|
||||
|
||||
/*
|
||||
'name' => env('APP_NAME', 'Tethys'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -26,10 +26,10 @@ return [
|
|||
| running in. This may determine how you prefer to configure various
|
||||
| services your application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|
@ -39,7 +39,7 @@ return [
|
|||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
|
||||
|
@ -52,9 +52,10 @@ return [
|
|||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
'alias_url' => env('ALIAS_URL'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -65,7 +66,7 @@ return [
|
|||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
// https://www.php.net/manual/en/timezones.europe.php
|
||||
'timezone' => 'Europe/Vienna',
|
||||
|
||||
|
@ -78,7 +79,7 @@ return [
|
|||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
|
@ -91,7 +92,7 @@ return [
|
|||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
|
@ -104,7 +105,7 @@ return [
|
|||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY', 'SomeRandomString'),
|
||||
|
||||
|
@ -121,7 +122,7 @@ return [
|
|||
|
|
||||
| Available Settings: "single", "daily", "syslog", "errorlog"
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
// 'log' => 'single',
|
||||
// //debug, info, notice, warning, error, critical, alert, emergency.
|
||||
|
@ -136,7 +137,7 @@ return [
|
|||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
|
@ -167,7 +168,7 @@ return [
|
|||
'Illuminate\Validation\ValidationServiceProvider',
|
||||
'Illuminate\View\ViewServiceProvider',
|
||||
|
||||
/*
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
// 'Illuminate\Html\HtmlServiceProvider',
|
||||
|
@ -178,15 +179,15 @@ return [
|
|||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
'App\Providers\AppServiceProvider',
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
'App\Providers\ConfigServiceProvider',
|
||||
'App\Providers\EventServiceProvider',
|
||||
'App\Providers\RouteServiceProvider',
|
||||
// List off others providers...
|
||||
App\Providers\SolariumServiceProvider::class,
|
||||
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\ConfigServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
// List off others providers...
|
||||
App\Providers\SolariumServiceProvider::class,
|
||||
App\Providers\DoiServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
|
@ -199,55 +200,56 @@ return [
|
|||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'aliases' => [
|
||||
|
||||
'App' => 'Illuminate\Support\Facades\App',
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Arr' => Illuminate\Support\Arr::class,
|
||||
'Artisan' => 'Illuminate\Support\Facades\Artisan',
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => 'Illuminate\Support\Facades\Bus',
|
||||
'Cache' => 'Illuminate\Support\Facades\Cache',
|
||||
'Config' => 'Illuminate\Support\Facades\Config',
|
||||
'Cookie' => 'Illuminate\Support\Facades\Cookie',
|
||||
'Crypt' => 'Illuminate\Support\Facades\Crypt',
|
||||
'DB' => 'Illuminate\Support\Facades\DB',
|
||||
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
|
||||
'Event' => 'Illuminate\Support\Facades\Event',
|
||||
'File' => 'Illuminate\Support\Facades\File',
|
||||
'Bus' => 'Illuminate\Support\Facades\Bus',
|
||||
'Cache' => 'Illuminate\Support\Facades\Cache',
|
||||
'Config' => 'Illuminate\Support\Facades\Config',
|
||||
'Cookie' => 'Illuminate\Support\Facades\Cookie',
|
||||
'Crypt' => 'Illuminate\Support\Facades\Crypt',
|
||||
'DB' => 'Illuminate\Support\Facades\DB',
|
||||
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
|
||||
'Event' => 'Illuminate\Support\Facades\Event',
|
||||
'File' => 'Illuminate\Support\Facades\File',
|
||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||
'Hash' => 'Illuminate\Support\Facades\Hash',
|
||||
'Input' => 'Illuminate\Support\Facades\Input',
|
||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||
'Input' => Illuminate\Support\Facades\Input::class,
|
||||
// 'Inspiring' => 'Illuminate\Foundation\Inspiring',
|
||||
'Lang' => 'Illuminate\Support\Facades\Lang',
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => 'Illuminate\Support\Facades\Mail',
|
||||
'Mail' => 'Illuminate\Support\Facades\Mail',
|
||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||
'Password' => 'Illuminate\Support\Facades\Password',
|
||||
'Queue' => 'Illuminate\Support\Facades\Queue',
|
||||
'Redirect' => 'Illuminate\Support\Facades\Redirect',
|
||||
'Redis' => 'Illuminate\Support\Facades\Redis',
|
||||
'Request' => 'Illuminate\Support\Facades\Request',
|
||||
'Response' => 'Illuminate\Support\Facades\Response',
|
||||
'Route' => 'Illuminate\Support\Facades\Route',
|
||||
'Schema' => 'Illuminate\Support\Facades\Schema',
|
||||
'Session' => 'Illuminate\Support\Facades\Session',
|
||||
'Storage' => 'Illuminate\Support\Facades\Storage',
|
||||
'URL' => 'Illuminate\Support\Facades\URL',
|
||||
'Password' => 'Illuminate\Support\Facades\Password',
|
||||
'Queue' => 'Illuminate\Support\Facades\Queue',
|
||||
'Redirect' => 'Illuminate\Support\Facades\Redirect',
|
||||
'Redis' => 'Illuminate\Support\Facades\Redis',
|
||||
'Request' => 'Illuminate\Support\Facades\Request',
|
||||
'Response' => 'Illuminate\Support\Facades\Response',
|
||||
'Route' => 'Illuminate\Support\Facades\Route',
|
||||
'Schema' => 'Illuminate\Support\Facades\Schema',
|
||||
'Session' => 'Illuminate\Support\Facades\Session',
|
||||
'Storage' => 'Illuminate\Support\Facades\Storage',
|
||||
'URL' => 'Illuminate\Support\Facades\URL',
|
||||
'Validator' => 'Illuminate\Support\Facades\Validator',
|
||||
'View' => 'Illuminate\Support\Facades\View',
|
||||
'View' => 'Illuminate\Support\Facades\View',
|
||||
|
||||
/*
|
||||
/*
|
||||
* Third Party Aliases
|
||||
*/
|
||||
// 'Form' => 'Illuminate\Html\FormFacade',
|
||||
// 'HTML' => 'Illuminate\Html\HtmlFacade',
|
||||
// 'Form' => 'Collective\Html\FormFacade',
|
||||
// 'Html' => 'Collective\Html\HtmlFacade',
|
||||
'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs::class,
|
||||
// 'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs::class,
|
||||
'Breadcrumbs' => Diglactic\Breadcrumbs\Breadcrumbs::class,
|
||||
//'Datatables' => Yajra\DataTables\Facades\DataTables::class
|
||||
|
||||
],
|
||||
|
|
|
@ -63,9 +63,9 @@ return [
|
|||
*/
|
||||
|
||||
// Manager
|
||||
'manager-class' => DaveJamesMiller\Breadcrumbs\BreadcrumbsManager::class,
|
||||
'manager-class' => Diglactic\Breadcrumbs\Manager::class,
|
||||
|
||||
// Generator
|
||||
'generator-class' => DaveJamesMiller\Breadcrumbs\BreadcrumbsGenerator::class,
|
||||
'generator-class' => Diglactic\Breadcrumbs\Generator::class,
|
||||
|
||||
];
|
||||
|
|
|
@ -45,6 +45,18 @@ return [
|
|||
*/
|
||||
|
||||
'connections' => [
|
||||
'testing' => [
|
||||
'driver' => 'pgsql',
|
||||
'host' => env('DB_HOST', 'pgsql'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE'),
|
||||
'username' => env('DB_USERNAME'),
|
||||
'password' => env('DB_PASSWORD'),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'schema' => env('DB_SCHEMA', 'public'),
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
|
@ -56,9 +68,9 @@ return [
|
|||
'driver' => 'pgsql',
|
||||
'host' => env('DB_HOST', 'pgsql'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'repository'),
|
||||
'username' => env('DB_USERNAME', 'opus4admin'),
|
||||
'password' => env('DB_PASSWORD', 'opus4admin007'),
|
||||
'database' => env('DB_DATABASE'),
|
||||
'username' => env('DB_USERNAME'),
|
||||
'password' => env('DB_PASSWORD'),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'schema' => env('DB_SCHEMA', 'public'),
|
||||
|
@ -68,10 +80,10 @@ return [
|
|||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'host' => env('DB_HOST', 'zontik\test'),
|
||||
'database' => env('DB_DATABASE', 'opusdb'),
|
||||
'username' => env('DB_USERNAME', 'opus4'),
|
||||
'password' => env('DB_PASSWORD', 'opus4007'),
|
||||
'host' => env('DB_HOST'),
|
||||
'database' => env('DB_DATABASE'),
|
||||
'username' => env('DB_USERNAME'),
|
||||
'password' => env('DB_PASSWORD'),
|
||||
'prefix' => '',
|
||||
],
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ return [
|
|||
| the role if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'role' => 'App\Models\Role',
|
||||
'role' => App\Models\Role::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -51,7 +51,7 @@ return [
|
|||
| Update the User if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'user' => 'App\Models\User',
|
||||
'user' => App\Models\User::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -95,7 +95,7 @@ return [
|
|||
| Update the permission if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'permission' => 'App\Models\Permission',
|
||||
'permission' => App\Models\Permission::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -26,6 +26,10 @@ return [
|
|||
"png" => "image/png",
|
||||
"jpg|jpeg|jpe" => "image/jpeg",
|
||||
],
|
||||
'name_types' => [
|
||||
'personal' => 'Personal',
|
||||
'organizational' => 'Organizational',
|
||||
],
|
||||
'contributor_types' => [
|
||||
'contact_person' => 'ContactPerson',
|
||||
'data_collector' => 'DataCollector',
|
||||
|
|
|
@ -54,7 +54,10 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'from' => ['address' => env('MAIL_FROM', null), 'name' => 'Hasan Doha'],
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -67,7 +70,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'encryption' => 'tls',
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -95,6 +98,8 @@ return [
|
|||
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
|
||||
'mailadmin' => env('MAIL_ADMIN', 'hello@example.com'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sendmail System Path
|
||||
|
@ -106,19 +111,48 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||
// 'sendmail' => '/usr/sbin/sendmail -bs',
|
||||
|
||||
'sendmail' => 'sendmail -bs',
|
||||
|
||||
/*
|
||||
'stream' => [
|
||||
'ssl' => [
|
||||
'allow_self_signed' => true,
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail "Pretend"
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When this option is enabled, e-mail will not actually be sent over the
|
||||
| web and will instead be written to your application's logs files so
|
||||
| you may inspect the message. This is great for local development.
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'pretend' => false,
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using the "log" driver, you may specify the logging channel
|
||||
| if you prefer to keep mail messages separate from other log entries
|
||||
| for simpler reading. Otherwise, the default channel will be used.
|
||||
|
|
||||
*/
|
||||
|
||||
'log_channel' => env('MAIL_LOG_CHANNEL'),
|
||||
|
||||
];
|
||||
|
|
|
@ -16,7 +16,7 @@ return [
|
|||
'workspacePath' => public_path() . DIRECTORY_SEPARATOR . "workspace",
|
||||
|
||||
'max' => [
|
||||
'listidentifiers' => 15,
|
||||
'listrecords' => 15
|
||||
'listidentifiers' => 100,
|
||||
'listrecords' => 100
|
||||
],
|
||||
];
|
||||
|
|
|
@ -30,7 +30,7 @@ return [
|
|||
],
|
||||
|
||||
'stripe' => [
|
||||
'model' => 'App\Models\User',
|
||||
'model' => App\Models\User::class,
|
||||
'secret' => '',
|
||||
],
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'connection' => null,
|
||||
'connection' => env('SESSION_CONNECTION', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -86,6 +86,21 @@ return [
|
|||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using one of the framework's cache driven session backends you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|
@ -147,8 +162,23 @@ return [
|
|||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you if it can not be done securely.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'secure' => false,
|
||||
'secure' => env('SESSION_SECURE_COOKIE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" since this is a secure default value.
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
||||
|
|
|
@ -5,7 +5,7 @@ return [
|
|||
'repository' => [
|
||||
'host' => env('SOLR_HOST', 'repository.geologie.ac.at'),
|
||||
'port' => env('SOLR_PORT', '8983'),
|
||||
'path' => env('SOLR_PATH', '/solr/'),
|
||||
'path' => env('SOLR_PATH', '/'),
|
||||
'core' => env('SOLR_CORE', 'rdr_data')
|
||||
]
|
||||
],
|
||||
|
|
23
config/tethys.php
Normal file
23
config/tethys.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
return [
|
||||
'repoid' => 3156505,
|
||||
'ccBaseuri' => 'https://creativecommons.org/licenses/|/3.0/',
|
||||
|
||||
'datacite_environment' => env('DATACITE_ENVIRONMENT'),
|
||||
|
||||
'datacite_username' => env('DATACITE_USERNAME'),
|
||||
'datacite_test_username' => env('DATACITE_TEST_USERNAME'),
|
||||
|
||||
'datacite_password' => env('DATACITE_PASSWORD'),
|
||||
'datacite_test_password' => env('DATACITE_TEST_PASSWORD'),
|
||||
|
||||
'datacite_prefix' => env('DATACITE_PREFIX'),
|
||||
'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'),
|
||||
'frontend' => env('FRONTEND', 'https://tethys.at')
|
||||
];
|
0
database/seeds/.gitkeep → database/factories/ModelFactory.php
Executable file → Normal file
0
database/seeds/.gitkeep → database/factories/ModelFactory.php
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
editor.link_modal.header
Reference in a new issue