wizard for publishing: step 0

This commit is contained in:
Arno Kaimbacher 2019-03-19 18:04:41 +01:00
parent d9b26afb3f
commit 9d195c450e
10 changed files with 102 additions and 55 deletions

View File

@ -253,7 +253,7 @@ class RequestController extends Controller
*/
private function handleListRecords($oaiRequest)
{
$maxRecords = 20;//$this->_configuration->getMaxListRecords();
$maxRecords = 30;//$this->_configuration->getMaxListRecords();
$this->handlingOfLists($oaiRequest, $maxRecords);
}

View File

@ -326,36 +326,38 @@ class IndexController extends Controller
$licenses = $request->input('licenses');
$dataset->licenses()->sync($licenses);
$data_to_sync = [];
//store authors
if (isset($data['authors'])) {
$data_to_sync = [];
//$data_to_sync = [];
foreach ($request->get('authors') as $key => $person_id) {
$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;
}
$dataset->persons()->sync($data_to_sync);
//$dataset->persons()->sync($data_to_sync);
}
//store contributors
if (isset($data['contributors'])) {
$data_to_sync = [];
//$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;
}
$dataset->persons()->sync($data_to_sync);
//$dataset->persons()->sync($data_to_sync);
}
//store submitters
if (isset($data['submitters'])) {
$data_to_sync = [];
//$data_to_sync = [];
foreach ($request->get('submitters') as $key => $submitter_id) {
$pivot_data = ['role' => 'submitter', 'sort_order' => $key + 1];
$data_to_sync[$submitter_id] = $pivot_data;
}
$dataset->persons()->sync($data_to_sync);
//$dataset->persons()->sync($data_to_sync);
}
$dataset->persons()->sync($data_to_sync);
//save main title:

View File

@ -206,7 +206,7 @@ class QueryBuilder
$query = new SolrSearchQuery(SolrSearchQuery::ALL_DOCS);
$query->setStart("0");//$input['start']);
//$query->setRows($input['rows']);
$query->setRows("10");
$query->setRows("100");
$query->setSortField($input['sortField']);
$query->setSortOrder($input['sortOrder']);

View File

@ -22,12 +22,12 @@ trait DatasetExtension
protected $externalFields = array(
'TitleMain' => array(
'model' => Title::class,
'options' => array('type' => ['main', 'alternative', 'subtitle', 'other']),
'options' => array('type' => ['main', 'alternative', 'sub', 'translated', 'other']),
'fetch' => 'eager'
),
'TitleAbstract' => array(
'model' => Description::class,
'options' => array('type' => ['abstract', 'methods']),
'options' => array('type' => ['abstract', 'methods', 'technical_info', 'series_information', 'other']),
'fetch' => 'eager'
),
'Licence' => array(

12
composer.lock generated
View File

@ -4444,16 +4444,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.4.0",
"version": "3.4.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "379deb987e26c7cd103a7b387aea178baec96e48"
"reference": "5b4333b4010625d29580eb4a41f1e53251be6baa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
"reference": "379deb987e26c7cd103a7b387aea178baec96e48",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5b4333b4010625d29580eb4a41f1e53251be6baa",
"reference": "5b4333b4010625d29580eb4a41f1e53251be6baa",
"shasum": ""
},
"require": {
@ -4486,12 +4486,12 @@
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2018-12-19T23:57:18+00:00"
"time": "2019-03-19T03:22:27+00:00"
},
{
"name": "theseer/tokenizer",

File diff suppressed because one or more lines are too long

View File

@ -58,8 +58,8 @@
<!-- year -->
<xsl:variable name="year">
<xsl:choose>
<xsl:when test="/Opus/Rdr_Dataset/PublishedDate/@Year != ''">
<xsl:value-of select="/Opus/Rdr_Dataset/PublishedDate/@Year" />
<xsl:when test="/Opus/Rdr_Dataset/ServerDatePublished/@Year != ''">
<xsl:value-of select="/Opus/Rdr_Dataset/ServerDatePublished/@Year" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/Opus/Rdr_Dataset/@PublishedYear" />

View File

@ -10,7 +10,7 @@ function initialState() {
project_id: "",
creating_corporation: "GBA Repository",
language: "en",
language: "",
embargo_date: "",
belongs_to_bibliography: 0,
@ -55,6 +55,12 @@ const dataset = new Vue({
// };
// this.reset(json);
},
watch: {
language(val) {
this.title_main.language = val;
this.abstract_main.language = val;
}
},
methods: {
reset() {
Object.assign(this.$data, initialState());

View File

@ -59,7 +59,7 @@ const app = new Vue({
isModalVisible: false,
step: 1,
step: 0,
dataset: dataset
// dataset: {
// type: '',
@ -101,6 +101,17 @@ const app = new Vue({
return value || options.some((option) => option[testProp]);
}
});
// add the required rule
VeeValidate.Validator.extend('translatedLanguage', {
getMessage: field => 'The translated title must be in a language other than than the dataset language.',
validate: (value, [mainLanguage, type]) => {
if (type == "translated") {
return value !== mainLanguage;
}
return true;
}
});
},
mounted() {
//this.step = 2;
@ -134,7 +145,7 @@ const app = new Vue({
this.uploadedFiles = [];
this.uploadError = null;
this.dataset.reset();//reset methods will trigger property changed.
this.step = 1;
this.step = 0;
},
retry() {
// reset form to initial state

View File

@ -16,6 +16,38 @@
<main class="steps pure-form" enctype="multipart/form-data">
{{ csrf_field() }}
<div v-if="step === 0 && isInitial" data-vv-scope="step-0">
<fieldset id="fieldset-language">
<legend>Dataset Language</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Language', 'Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Language', $languages, null, ['placeholder' => '[language]', 'v-model' => 'dataset.language', "v-validate"
=> "'required'", 'data-vv-scope' => 'step-0']) !!}
</div>
<small id="languageHelp" class="pure-form-message-inline">select dataset main language</small>
</div>
</div>
</fieldset>
<br />
<div class="pure-controls">
<button @click.prevent="next('step-0')" class="pure-button button-small" :disabled="errors.any()">
<i class="fa fa-arrow-right"></i>
<span>Continue</span>
</button>
</div>
<div v-if="errors.items.length > 0">
<b>Please correct the following error(s):</b>
<ul class="alert validation-summary-errors">
<li style="margin-left:5px;" v-for="error in errors.items">@{{ error.msg }}</li>
</ul>
</div>
</div>
<div v-if="step === 1 && isInitial" data-vv-scope="step-1">
<h1>Step One: Mandatory Elements</h1>
@ -51,10 +83,11 @@
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('TitleLanguage', 'Title Language..') !!}
<div class="select pure-u-23-24">
{{-- <div class="select pure-u-23-24">
{!! Form::select('TitleMain[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.title_main.language',
"v-validate" => "'required'", "data-vv-as" => "Title Language", 'data-vv-scope' => 'step-1']) !!}
</div>
</div> --}}
{!! Form::text('TitleMain[Language]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.title_main.language', 'readonly']) !!}
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
@ -81,7 +114,9 @@
</td>
<td>
{!! Form::select('Title[Language]', $languages, null,
['placeholder' => '[language]', 'v-model' => 'item.language', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
['placeholder' => '[language]', 'v-model' => 'item.language',
"v-validate" => "{required: true, translatedLanguage: [dataset.language, item.type]}",
'data-vv-scope' => 'step-1']) !!}
</td>
<td>
<button class="pure-button button-small is-warning" @click.prevent="removeTitle(index)">-</button>
@ -102,10 +137,11 @@
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('AbstractLanguage', 'Abstract Language..') !!}
<div class="select pure-u-23-24">
{{-- <div class="select pure-u-23-24">
{!! Form::select('TitleAbstract[Language]', $languages, null, ['placeholder' => '--no language--', 'v-model' => 'dataset.abstract_main.language',
"v-validate" => "'required'", "data-vv-as" => "Abstract Language", 'data-vv-scope' => 'step-1']) !!}
</div>
</div> --}}
{!! Form::text('TitleAbstract[Language]', null, ['class' => 'pure-u-23-24', 'v-model' => 'dataset.abstract_main.language', 'readonly']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('AddtionalDescription', 'Add additional descriptions(s) ') !!}
@ -211,6 +247,10 @@
<br />
<div class="pure-controls">
<button @click.prevent="prev()" class="pure-button button-small">
<i class="fa fa-arrow-left"></i>
<span>Back</span>
</button>
<button @click.prevent="next('step-1')" class="pure-button button-small" :disabled="errors.any()">
<i class="fa fa-arrow-right"></i>
<span>Continue</span>
@ -394,19 +434,7 @@
<div v-if="step === 3 && isInitial" data-vv-scope="step-3">
<h1>Step 3: Other Elements</h1>
<fieldset id="fieldset-general">
<legend>Language</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('Language', 'Language..') !!}
<div class="select pure-u-23-24">
{!! Form::select('Language', $languages, null,
['placeholder' => '[language]', 'v-model' => 'dataset.language', "v-validate" => "'required'", 'data-vv-scope' => 'step-3']) !!}
</div>
<small id="languageHelp" class="pure-form-message-inline">language is optional</small>
</div>
</div>
</fieldset>
<fieldset id="fieldset-licenses">
<legend>Rights List</legend>