add geolocation for datacite metadata anf for backend

This commit is contained in:
Arno Kaimbacher 2019-01-07 11:16:18 +01:00
parent e7d8dc21a0
commit ba38fc1ed1
16 changed files with 3833 additions and 6047 deletions

View File

@ -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;
@ -345,6 +362,15 @@ class IndexController extends Controller
}
}
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);

View File

@ -53,11 +53,11 @@ class Dataset extends Model
}
/**
* Get the user that owns the phone.
* Get the geolocation that owns the dataset.
*/
public function geolocation()
{
return $this->belongsTo(GeolocationBox::class, 'dataset_id', 'id');
return $this->hasOne(GeolocationBox::class, 'dataset_id', 'id');
}
/**

View File

@ -15,7 +15,7 @@ class GeolocationBox extends Model
'xmin' => 'float',
'xmax' => 'float',
'ymin' => 'float',
'ymax' => 'float'
'ymax' => 'float',
];
public function dataset()

View File

@ -39,7 +39,7 @@ class Person extends Model
*/
public function getFullNameAttribute()
{
return $this->first_name . " " . $this->last_name;
return $this->first_name . " " . $this->last_name . " " . $this->date_of_birth;
}
public function scopeActive($query)

43
composer.lock generated
View File

@ -1176,16 +1176,16 @@
},
{
"name": "nesbot/carbon",
"version": "1.36.1",
"version": "1.36.2",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983"
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/63da8cdf89d7a5efe43aabc794365f6e7b7b8983",
"reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
"shasum": ""
},
"require": {
@ -1230,20 +1230,20 @@
"datetime",
"time"
],
"time": "2018-11-22T18:23:02+00:00"
"time": "2018-12-28T10:07:33+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.1.0",
"version": "v4.1.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "d0230c5c77a7e3cfa69446febf340978540958c0"
"reference": "8aae5b59b83bb4d0dbf07b0a835f2680a658f610"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0",
"reference": "d0230c5c77a7e3cfa69446febf340978540958c0",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8aae5b59b83bb4d0dbf07b0a835f2680a658f610",
"reference": "8aae5b59b83bb4d0dbf07b0a835f2680a658f610",
"shasum": ""
},
"require": {
@ -1281,7 +1281,7 @@
"parser",
"php"
],
"time": "2018-10-10T09:24:14+00:00"
"time": "2018-12-26T11:32:39+00:00"
},
{
"name": "paragonie/random_compat",
@ -4360,16 +4360,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.3.2",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
"reference": "379deb987e26c7cd103a7b387aea178baec96e48"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
"reference": "379deb987e26c7cd103a7b387aea178baec96e48",
"shasum": ""
},
"require": {
@ -4407,7 +4407,7 @@
"phpcs",
"standards"
],
"time": "2018-09-23T23:08:17+00:00"
"time": "2018-12-19T23:57:18+00:00"
},
{
"name": "theseer/tokenizer",
@ -4451,20 +4451,21 @@
},
{
"name": "webmozart/assert",
"version": "1.3.0",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "0df1908962e7a3071564e857d86874dad1ef204a"
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
"reference": "0df1908962e7a3071564e857d86874dad1ef204a",
"url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
@ -4497,7 +4498,7 @@
"check",
"validate"
],
"time": "2018-01-29T19:49:41+00:00"
"time": "2018-12-25T11:19:39+00:00"
}
],
"aliases": [],

9614
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,21 +9,20 @@
},
"devDependencies": {
"axios": "^0.18",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.22.0",
"bootstrap-sass": "^3.3.7",
"bootstrap-sass": "^3.4.0",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.1.14",
"lodash": "^4.17.10",
"vee-validate": "^2.1.0-beta.9",
"vue": "^2.5.7",
"vue-events": "^3.0.0",
"laravel-mix": "^4.0.13",
"leaflet": "^1.4.0",
"lodash": "^4.17.11",
"vee-validate": "^2.1.5",
"vue": "^2.5.21",
"vue-events": "^3.1.0",
"vue-template-compiler": "^2.5.21",
"vuetable-2": "^1.7.5"
},
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net-buttons": "^1.3.1"
"datatables.net": "^1.10.19",
"datatables.net-buttons": "^1.5.4"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"/js/app.js": "/js/app.js",
"/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js",
"/js/app.js": "/js/app.js",
"/js/lib.js": "/js/lib.js",
"/js/dataTable.js": "/js/dataTable.js"
}

View File

@ -16,9 +16,8 @@
*
* @category Application
* @package Module_Oai
* @author Michael Lang <lang@zib.de>
* @author Jens Schwidder <schwidder@zib.de>
* @copyright Copyright (c) 2008-2016, OPUS 4 development team
* @author Arno Kaimbacher <arno.kaimbacher@geologie.ac.at>
* @copyright Copyright (c) 2018-2019, GBA RDR development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/
-->
@ -100,14 +99,22 @@
</xsl:template>
<xsl:template match="GeolocationBox" mode="oai_datacite">
<geoLocation>
<geoLocationBox>
<westBoundLongitude><xsl:value-of select="@Xmin" /></westBoundLongitude>
<eastBoundLongitude><xsl:value-of select="@Xmax" /></eastBoundLongitude>
<southBoundLatitude><xsl:value-of select="@Ymin" /></southBoundLatitude>
<northBoundLatitude><xsl:value-of select="@Ymax" /></northBoundLatitude>
</geoLocationBox>
</geoLocation>
<geoLocation>
<geoLocationBox>
<westBoundLongitude>
<xsl:value-of select="@Xmin" />
</westBoundLongitude>
<eastBoundLongitude>
<xsl:value-of select="@Xmax" />
</eastBoundLongitude>
<southBoundLatitude>
<xsl:value-of select="@Ymin" />
</southBoundLatitude>
<northBoundLatitude>
<xsl:value-of select="@Ymax" />
</northBoundLatitude>
</geoLocationBox>
</geoLocation>
</xsl:template>
<xsl:template match="TitleAbstract" mode="oai_datacite">

View File

@ -1,44 +1,62 @@
<script>
// <script>
import Vue from "vue";
let dataset = new Vue({
//outside of the component:
function initialState() {
return {
type: "",
state: "",
rights: null,
project_id: "",
creating_corporation: "GBA",
embargo_date: "",
belongs_to_bibliography: 0,
title_main: {
value: "",
language: ""
},
abstract_main: {
value: "",
language: ""
},
geolocation: {
xmin: "",
ymin: "",
xmax: "",
ymax: ""
},
checkedAuthors: [],
checkedLicenses: [], // [],
files: [],
references: [],
checkedContributors: [],
checkedSubmitters: [],
persons: [],
contributors: [],
submitters: []
};
}
const dataset = new Vue({
data: function() {
return {
type: "",
state: "",
rights: null,
project_id: "",
creating_corporation: "GBA",
embargo_date: "",
belongs_to_bibliography: 0,
title_main: {
value: "",
language: ""
},
abstract_main: {
value: "",
language: ""
},
checkedAuthors: [],
checkedLicenses: [], // [],
files: [],
references: [],
checkedContributors: [],
checkedSubmitters: [],
persons: [],
contributors: [],
submitters: []
};
return initialState();
},
created() {
let json = JSON.stringify(this.$data);
this.reset = () => {
Object.assign(this.$data, JSON.parse(json));
};
created: function() {
// let json = JSON.stringify(this.$data);
// this.reset = () => {
// Object.assign(this.$data, JSON.parse(json));
// };
// this.reset(json);
},
methods: {
reset() {
Object.assign(this.$data, initialState());
}
}
});
export { dataset };
export default dataset;
//export { dataset };
</script>

View File

@ -30,7 +30,7 @@ import axios from 'axios';
//Vue.component('my-autocomplete', require('./components/MyAutocomplete.vue'));
import MyAutocomplete from './components/MyAutocomplete.vue';
import VeeValidate from 'vee-validate';
import { dataset } from './components/Dataset';
import dataset from './components/Dataset';
// import { Validator } from 'vee-validate';
Vue.use(VeeValidate);
@ -179,6 +179,11 @@ const app = new Vue({
formData.append('abstract_main[value]', this.dataset.abstract_main.value);
formData.append('abstract_main[language]', this.dataset.abstract_main.language);
formData.append('geolocation[xmin]', this.dataset.geolocation.xmin);
formData.append('geolocation[ymin]', this.dataset.geolocation.ymin);
formData.append('geolocation[xmax]', this.dataset.geolocation.xmax);
formData.append('geolocation[ymax]', this.dataset.geolocation.ymax);
for (var i = 0; i < this.dataset.checkedLicenses.length; i++) {
formData.append('licenses[' + i + ']', this.dataset.checkedLicenses[i]);
}

View File

@ -139,6 +139,32 @@
</div>
</fieldset>
<fieldset id="fieldset-titles">
<legend>Bounding Box</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Xmin', 'xmin: ') !!}
{!! Form::text('GeoLocation[xmin]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.geolocation.xmin']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Ymin', 'ymin: ') !!}
{!! Form::text('GeoLocation[ymin]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.geolocation.ymin']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Xmax', 'xmax: ') !!}
{!! Form::text('GeoLocation[xmax]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.geolocation.xmax']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Ymax', 'ymax: ') !!}
{!! Form::text('GeoLocation[ymax]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.geolocation.ymax']) !!}
</div>
</div>
</fieldset>
<fieldset id="fieldset-titles">
<legend>Main Title & Abstract</legend>
<div class="pure-g">