add geolocation for datacite metadata anf for backend
This commit is contained in:
parent
e7d8dc21a0
commit
ba38fc1ed1
16 changed files with 3833 additions and 6047 deletions
|
@ -17,6 +17,7 @@ use Illuminate\Support\Facades\Response;
|
|||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Models\DatasetReference;
|
||||
use App\Models\GeolocationBox;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
|
@ -236,6 +237,22 @@ class IndexController extends Controller
|
|||
'title_main.language' => 'required',
|
||||
'abstract_main.value' => 'required|min:4',
|
||||
'abstract_main.language' => 'required',
|
||||
'geolocation.xmin' => [
|
||||
'nullable',
|
||||
'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'
|
||||
],
|
||||
'geolocation.ymin' => [
|
||||
'nullable',
|
||||
'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'
|
||||
],
|
||||
'geolocation.xmax' => [
|
||||
'nullable',
|
||||
'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'
|
||||
],
|
||||
'geolocation.ymax' => [
|
||||
'nullable',
|
||||
'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'
|
||||
],
|
||||
];
|
||||
if (null != $request->file('files')) {
|
||||
$files = count($request->file('files')) - 1;
|
||||
|
@ -344,6 +361,15 @@ class IndexController extends Controller
|
|||
$dataset->references()->save($dataReference);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['geolocation'])) {
|
||||
$formGeolocation = $request->input('geolocation');
|
||||
if ($formGeolocation['xmin'] !== '' && $formGeolocation['ymin'] !== '' &&
|
||||
$formGeolocation['xmax'] !== '' && $formGeolocation['ymax'] !== '') {
|
||||
$geolocation = new GeolocationBox($formGeolocation);
|
||||
$dataset->geolocation()->save($geolocation);
|
||||
}
|
||||
}
|
||||
|
||||
// $error = 'Always throw this error';
|
||||
// throw new \Exception($error);
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue