- add author during publishing

- defining geolocation is bidirectional
This commit is contained in:
Arno Kaimbacher 2019-06-26 19:01:22 +02:00
parent 0dc6ca034e
commit 4f8ef4fc30
6 changed files with 243 additions and 125 deletions

View File

@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Validator;
use App\Models\DatasetReference;
use App\Models\Subject;
use App\Models\Page;
use App\Models\Person;
use Illuminate\Support\Facades\Auth;
use App\Models\Coverage;
@ -326,10 +327,16 @@ class IndexController extends Controller
//store authors
if (isset($data['authors'])) {
//$data_to_sync = [];
foreach ($request->get('authors') as $key => $person_id) {
foreach ($request->get('authors') as $key => $person) {
$pivot_data = ['role' => 'author', 'sort_order' => $key + 1];
// if ($galery_id == $request->get('mainPicture')) $pivot_data = ['main' => 1];
$data_to_sync[$person_id] = $pivot_data;
if (isset($person['id'])) {
//$data_to_sync[$person['id']] = $pivot_data;
$dataset->persons()->attach($person['id'], $pivot_data);
} else {
$dataPerson = new Person($person);
$dataset->persons()->save($dataPerson, $pivot_data);
}
}
//$dataset->persons()->sync($data_to_sync);
}
@ -339,7 +346,8 @@ class IndexController extends Controller
//$data_to_sync = [];
foreach ($request->get('contributors') as $key => $contributor_id) {
$pivot_data = ['role' => 'contributor', 'sort_order' => $key + 1];
$data_to_sync[$contributor_id] = $pivot_data;
//$data_to_sync[$contributor_id] = $pivot_data;
$dataset->persons()->attach(contributor_id, $pivot_data);
}
//$dataset->persons()->sync($data_to_sync);
}
@ -353,7 +361,7 @@ class IndexController extends Controller
// }
// //$dataset->persons()->sync($data_to_sync);
// }
$dataset->persons()->sync($data_to_sync);
//$dataset->persons()->sync($data_to_sync);
//save main title:
@ -467,7 +475,7 @@ class IndexController extends Controller
return response()->json(array(
'success' => true,
//'redirect' => route('settings.document.edit', ['id' => $dataset->server_state]),
'redirect' => route('settings.document.edit', ['id' => $dataset->id]),
'redirect' => route('publish.workflow.submit.release', ['id' => $dataset->id]),
));
} else {
//TODO Handle validation error

181
composer.lock generated
View File

@ -123,6 +123,7 @@
"laravel",
"translation"
],
"abandoned": "astrotomic/laravel-translatable",
"time": "2019-06-03T06:52:37+00:00"
},
{
@ -341,16 +342,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.8",
"version": "2.1.9",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "c26463ff9241f27907112fbcd0c86fa670cfef98"
"reference": "128cc721d771ec2c46ce59698f4ca42b73f71b25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c26463ff9241f27907112fbcd0c86fa670cfef98",
"reference": "c26463ff9241f27907112fbcd0c86fa670cfef98",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/128cc721d771ec2c46ce59698f4ca42b73f71b25",
"reference": "128cc721d771ec2c46ce59698f4ca42b73f71b25",
"shasum": ""
},
"require": {
@ -394,7 +395,7 @@
"validation",
"validator"
],
"time": "2019-05-16T22:02:54+00:00"
"time": "2019-06-23T10:14:27+00:00"
},
{
"name": "erusev/parsedown",
@ -954,16 +955,16 @@
},
{
"name": "league/flysystem",
"version": "1.0.52",
"version": "1.0.53",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "c5a5097156387970e6f0ccfcdf03f752856f3391"
"reference": "08e12b7628f035600634a5e76d95b5eb66cea674"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/c5a5097156387970e6f0ccfcdf03f752856f3391",
"reference": "c5a5097156387970e6f0ccfcdf03f752856f3391",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/08e12b7628f035600634a5e76d95b5eb66cea674",
"reference": "08e12b7628f035600634a5e76d95b5eb66cea674",
"shasum": ""
},
"require": {
@ -1034,7 +1035,7 @@
"sftp",
"storage"
],
"time": "2019-05-20T20:21:14+00:00"
"time": "2019-06-18T20:09:29+00:00"
},
{
"name": "mcamara/laravel-localization",
@ -1328,6 +1329,52 @@
],
"time": "2018-07-02T15:55:56+00:00"
},
{
"name": "psr/cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"time": "2016-08-06T20:24:11+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",
@ -1750,16 +1797,16 @@
},
{
"name": "symfony/console",
"version": "v4.2.9",
"version": "v4.2.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "7a293c9a4587a92e6a0e81edb0bea54071b1b99d"
"reference": "79860cda331a2edb497c72ee487ed75c484ab75e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/7a293c9a4587a92e6a0e81edb0bea54071b1b99d",
"reference": "7a293c9a4587a92e6a0e81edb0bea54071b1b99d",
"url": "https://api.github.com/repos/symfony/console/zipball/79860cda331a2edb497c72ee487ed75c484ab75e",
"reference": "79860cda331a2edb497c72ee487ed75c484ab75e",
"shasum": ""
},
"require": {
@ -1818,24 +1865,26 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-05-09T09:19:46+00:00"
"time": "2019-06-13T10:57:15+00:00"
},
{
"name": "symfony/contracts",
"version": "v1.1.3",
"version": "v1.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/contracts.git",
"reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5"
"reference": "3f3f796d5f24a098a9da62828b8daa1b11494c1b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/contracts/zipball/2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
"reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
"url": "https://api.github.com/repos/symfony/contracts/zipball/3f3f796d5f24a098a9da62828b8daa1b11494c1b",
"reference": "3f3f796d5f24a098a9da62828b8daa1b11494c1b",
"shasum": ""
},
"require": {
"php": "^7.1.3"
"php": "^7.1.3",
"psr/cache": "^1.0",
"psr/container": "^1.0"
},
"replace": {
"symfony/cache-contracts": "self.version",
@ -1845,13 +1894,9 @@
"symfony/translation-contracts": "self.version"
},
"require-dev": {
"psr/cache": "^1.0",
"psr/container": "^1.0",
"symfony/polyfill-intl-idn": "^1.10"
},
"suggest": {
"psr/cache": "When using the Cache contracts",
"psr/container": "When using the Service contracts",
"psr/event-dispatcher": "When using the EventDispatcher contracts",
"symfony/cache-implementation": "",
"symfony/event-dispatcher-implementation": "",
@ -1897,11 +1942,11 @@
"interoperability",
"standards"
],
"time": "2019-06-05T13:28:50+00:00"
"time": "2019-06-20T06:46:26+00:00"
},
{
"name": "symfony/css-selector",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -1954,16 +1999,16 @@
},
{
"name": "symfony/debug",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "4e025104f1f9adb1f7a2d14fb102c9986d6e97c6"
"reference": "d8f4fb38152e0eb6a433705e5f661d25b32c5fcd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/4e025104f1f9adb1f7a2d14fb102c9986d6e97c6",
"reference": "4e025104f1f9adb1f7a2d14fb102c9986d6e97c6",
"url": "https://api.github.com/repos/symfony/debug/zipball/d8f4fb38152e0eb6a433705e5f661d25b32c5fcd",
"reference": "d8f4fb38152e0eb6a433705e5f661d25b32c5fcd",
"shasum": ""
},
"require": {
@ -2006,20 +2051,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2019-05-30T16:10:05+00:00"
"time": "2019-06-19T15:27:09+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.4.28",
"version": "v3.4.29",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "a088aafcefb4eef2520a290ed82e4374092a6dff"
"reference": "f18fdd6cc7006441865e698420cee26bac94741f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a088aafcefb4eef2520a290ed82e4374092a6dff",
"reference": "a088aafcefb4eef2520a290ed82e4374092a6dff",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f18fdd6cc7006441865e698420cee26bac94741f",
"reference": "f18fdd6cc7006441865e698420cee26bac94741f",
"shasum": ""
},
"require": {
@ -2069,20 +2114,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2019-04-02T08:51:52+00:00"
"time": "2019-06-25T07:45:31+00:00"
},
{
"name": "symfony/finder",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176"
"reference": "33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176",
"reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176",
"url": "https://api.github.com/repos/symfony/finder/zipball/33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a",
"reference": "33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a",
"shasum": ""
},
"require": {
@ -2118,20 +2163,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2019-05-26T20:47:49+00:00"
"time": "2019-06-13T11:03:18+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "b7e4945dd9b277cd24e93566e4da0a87956392a9"
"reference": "e1b507fcfa4e87d192281774b5ecd4265370180d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/b7e4945dd9b277cd24e93566e4da0a87956392a9",
"reference": "b7e4945dd9b277cd24e93566e4da0a87956392a9",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e1b507fcfa4e87d192281774b5ecd4265370180d",
"reference": "e1b507fcfa4e87d192281774b5ecd4265370180d",
"shasum": ""
},
"require": {
@ -2173,7 +2218,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2019-06-06T10:05:02+00:00"
"time": "2019-06-26T09:25:00+00:00"
},
{
"name": "symfony/http-kernel",
@ -2264,7 +2309,7 @@
},
{
"name": "symfony/mime",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
@ -2616,7 +2661,7 @@
},
{
"name": "symfony/process",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
@ -2665,16 +2710,16 @@
},
{
"name": "symfony/routing",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "9b31cd24f6ad2cebde6845f6daa9c6d69efe2465"
"reference": "2ef809021d72071c611b218c47a3bf3b17b7325e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/9b31cd24f6ad2cebde6845f6daa9c6d69efe2465",
"reference": "9b31cd24f6ad2cebde6845f6daa9c6d69efe2465",
"url": "https://api.github.com/repos/symfony/routing/zipball/2ef809021d72071c611b218c47a3bf3b17b7325e",
"reference": "2ef809021d72071c611b218c47a3bf3b17b7325e",
"shasum": ""
},
"require": {
@ -2737,20 +2782,20 @@
"uri",
"url"
],
"time": "2019-06-05T09:16:20+00:00"
"time": "2019-06-26T13:54:39+00:00"
},
{
"name": "symfony/translation",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "5dda505e5f65d759741dfaf4e54b36010a4b57aa"
"reference": "934ab1d18545149e012aa898cf02e9f23790f7a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/5dda505e5f65d759741dfaf4e54b36010a4b57aa",
"reference": "5dda505e5f65d759741dfaf4e54b36010a4b57aa",
"url": "https://api.github.com/repos/symfony/translation/zipball/934ab1d18545149e012aa898cf02e9f23790f7a0",
"reference": "934ab1d18545149e012aa898cf02e9f23790f7a0",
"shasum": ""
},
"require": {
@ -2813,20 +2858,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2019-06-03T20:27:40+00:00"
"time": "2019-06-13T11:03:18+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.3.1",
"version": "v4.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "f974f448154928d2b5fb7c412bd23b81d063f34b"
"reference": "45d6ef73671995aca565a1aa3d9a432a3ea63f91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f974f448154928d2b5fb7c412bd23b81d063f34b",
"reference": "f974f448154928d2b5fb7c412bd23b81d063f34b",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/45d6ef73671995aca565a1aa3d9a432a3ea63f91",
"reference": "45d6ef73671995aca565a1aa3d9a432a3ea63f91",
"shasum": ""
},
"require": {
@ -2889,7 +2934,7 @@
"debug",
"dump"
],
"time": "2019-06-05T02:08:12+00:00"
"time": "2019-06-17T17:37:00+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -3865,16 +3910,16 @@
},
{
"name": "phpunit/phpunit",
"version": "7.5.12",
"version": "7.5.13",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c"
"reference": "b9278591caa8630127f96c63b598712b699e671c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c",
"reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b9278591caa8630127f96c63b598712b699e671c",
"reference": "b9278591caa8630127f96c63b598712b699e671c",
"shasum": ""
},
"require": {
@ -3945,7 +3990,7 @@
"testing",
"xunit"
],
"time": "2019-05-28T11:59:40+00:00"
"time": "2019-06-19T12:01:51+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",

File diff suppressed because one or more lines are too long

View File

@ -71,6 +71,9 @@ import "leaflet-draw";
//const L = window.L;
export default {
inject: {
$validator: '$validator'
},
props: {
geolocation: {
type: Object

View File

@ -266,9 +266,21 @@ const app = new Vue({
formData.append('licenses[' + i + ']', this.dataset.checkedLicenses[i]);
}
for (var i = 0; i < this.dataset.checkedAuthors.length; i++) {
formData.append('authors[' + i + ']', this.dataset.checkedAuthors[i]);
for (var i = 0; i < this.dataset.persons.length; i++) {
let person = this.dataset.persons[i];
formData.append('authors[' + i + '][first_name]', person.first_name);
formData.append('authors[' + i + '][last_name]', person.last_name);
formData.append('authors[' + i + '][email]', person.email);
formData.append('authors[' + i + '][identifier_orcid]', person.identifier_orcid);
formData.append('authors[' + i + '][status]', person.status);
if (person.id !== undefined) {
formData.append('authors[' + i + '][id]', person.id)
}
}
// for (var i = 0; i < this.dataset.checkedAuthors.length; i++) {
// formData.append('authors[' + i + ']', this.dataset.checkedAuthors[i]);
// }
for (var i = 0; i < this.dataset.checkedContributors.length; i++) {
formData.append('contributors[' + i + ']', this.dataset.checkedContributors[i]);
}
@ -430,10 +442,18 @@ const app = new Vue({
// }
},
addNewAuthor() {
let newAuthor = { status: 0, first_name: '', last_name: '', email: '', academic_title: '', identifier_orcid: '' };
this.dataset.persons.push(newAuthor);
},
removeAuthor(key) {
this.dataset.persons.splice(key, 1);
},
onAddAuthor(person) {
//if person is not in person array
//if (this.persons.includes(person) == false) {
if (this.dataset.persons.filter(e => e.id === person.id).length == 0) {
//person.sort_order = this.dataset.persons.length;
this.dataset.persons.push(person);
this.dataset.checkedAuthors.push(person.id);
}

View File

@ -187,7 +187,7 @@
{{--
<my-autocomplete :items="[ 'Apple', 'Banana', 'Orange', 'Mango', 'Pear', 'Peach', 'Grape', 'Tangerine', 'Pineapple']"></my-autocomplete> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{-- <div class="pure-u-1 pure-u-md-1-2 pure-div">
<div class="pure-control-group checkboxlist">
<input name="persons" v-model="dataset.checkedAuthors" type="hidden" class="form-check-input" v-validate="'required'" data-vv-as="Creator" data-vv-scope="step-1">
<label v-for="(person, index) in dataset.persons" :for="person.id" class="pure-checkbox">
@ -195,10 +195,46 @@
@{{ person.full_name }}
</label>
<br />
{{-- <span>Checked Authors: @{{ dataset.checkedAuthors }}</span> --}}
</div>
</div> --}}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('additionalCreators', 'Add additional creator(s) if creator is not in database') !!}
<button class="pure-button button-small" @click.prevent="addNewAuthor()">+</button>
</div>
<table class="pure-table pure-table-horizontal" v-if="dataset.persons.length">
<thead>
<tr>
<th>Index</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Orcid</th>
<th style="width: 130px;"></th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in dataset.persons" v-bind:key="item.sort_order" v-bind:class="[item.status==1 ? 'activeClass' : 'inactiveClass']" >
<td>@{{ index }}</td>
<td>
<input name="first_name" class="form-control" placeholder="[FIRST NAME]" v-model="item.first_name" v-bind:readonly="item.status==1" v-validate="'required'" data-vv-scope="step-1" />
</td>
<td>
<input name="last_name" class="form-control" placeholder="[LAST NAME]" v-model="item.last_name" v-bind:readonly="item.status==1" v-validate="'required'" data-vv-scope="step-1" />
</td>
<td>
<input name="email" class="form-control" placeholder="[EMAIL]" v-model="item.email" v-validate="'required|email'" v-bind:readonly="item.status==1" v-validate="'required'" data-vv-scope="step-1" />
</td>
<td>
<input name="identifier_orcid" class="form-control" placeholder="[ORCID]" v-model="item.identifier_orcid" v-bind:readonly="item.status==1" data-vv-scope="step-1" />
<small id="orcidHelp" class="pure-form-message-inline">ORCID is optional</small>
</td>
<td>
<button class="pure-button button-small is-warning" @click.prevent="removeAuthor(index)">-</button>
</td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset id="fieldset-contributors">
@ -419,11 +455,11 @@
<div class="pure-u-1 pure-u-md-1">
<label for="time-option-one" class="pure-radio">
<input id="time-option-one" type="radio" v-model="time" value="absolut">
absolut time
absolut time (dd.MM.yyyy HH:mm:ss)
</label>
<label for="time-option-two" class="pure-radio">
<input id="time-option-two" type="radio" v-model="time" value="range">
time range
time range (dd.MM.yyyy HH:mm:ss)
</label>
<label for="time-option-three" class="pure-radio">
<input id="time-option-three" type="radio" v-model="time" value="no_time">
@ -551,8 +587,6 @@
<div v-if="step === 3 && isInitial" data-vv-scope="step-3">
<h1>Step 3: Other Elements</h1>
<fieldset id="fieldset-licenses">
<legend>Rights List</legend>
@ -679,7 +713,8 @@
<a href="javascript:void(0)" @click="reset()" class="pure-button button-small">Upload new Dataset</a>
</p>
<p>
<a href="javascript:void(0)" @click="editNewDataset()" class="pure-button button-small">@{{ redirectLink }}</a>
{{-- <a href="javascript:void(0)" @click="editNewDataset()" class="pure-button button-small">@{{ redirectLink }}</a> --}}
<a href="javascript:void(0)" @click="editNewDataset()" class="pure-button button-small">Release your submitted dataset</a>
</p>
<ul class="list-unstyled">
{{-- <li v-for="item in uploadedFiles">
@ -726,6 +761,13 @@
.has-error .help-block {
display: block;
}
.activeClass {
background-color: aquamarine;
}
.inactiveClass {
background-color: orange;
}
</style>