Fix conflict while merging with develop.

This commit is contained in:
Mateus Machado Luna 2019-02-27 09:27:22 -03:00
commit 8da15fdade
19 changed files with 308 additions and 142 deletions

View File

@ -1167,9 +1167,11 @@ export default {
} }
// Obtains collection name // Obtains collection name
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => { this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName; this.collectionName = collectionName;
}); });
}
// Obtains if collection allow items comments // Obtains if collection allow items comments
this.fetchCollectionAllowComments(this.collectionId).then((collectionAllowComments) => { this.fetchCollectionAllowComments(this.collectionId).then((collectionAllowComments) => {

View File

@ -154,13 +154,14 @@
</button> </button>
</div> </div>
<div class="control"> <div class="control">
<button <a
type="button" type="button"
v-if="editForm.url != undefined && editForm.url!= ''" v-if="editForm.url != undefined && editForm.url!= ''"
class="button is-secondary" class="button is-secondary"
target="_blank"
:href="editForm.url"> :href="editForm.url">
{{ $i18n.get('see') + ' ' + $i18n.get('term') }} {{ $i18n.get('label_view_term') }}
</button> </a>
</div> </div>
<div class="control"> <div class="control">
<button <button

View File

@ -603,10 +603,11 @@ export default {
// Obtains collection name // Obtains collection name
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => { this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName; this.collectionName = collectionName;
}); });
}
// Sets modal callback function // Sets modal callback function
this.$refs.filterTypeModal.onCancel = () => { this.$refs.filterTypeModal.onCancel = () => {
this.onCancelFilterTypeSelection(); this.onCancelFilterTypeSelection();

View File

@ -220,7 +220,6 @@
<div class="field is-grouped form-submit"> <div class="field is-grouped form-submit">
<b-select <b-select
id="mappers-options-dropdown" id="mappers-options-dropdown"
class="button is-secondary"
:placeholder="$i18n.get('instruction_select_a_mapper')"> :placeholder="$i18n.get('instruction_select_a_mapper')">
<option <option
v-for="metadatum_mapper in metadatum_mappers" v-for="metadatum_mapper in metadatum_mappers"
@ -835,10 +834,12 @@ export default {
}); });
// Obtains collection name // Obtains collection name
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => { this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName; this.collectionName = collectionName;
}); });
} }
}
} }
</script> </script>
@ -1280,10 +1281,6 @@ export default {
} }
} }
#mappers-options-dropdown {
background-color: transparent;
color: #fff;
}
} }

View File

@ -11,8 +11,9 @@
getFirstItem() + getFirstItem() +
$i18n.get('info_to') + $i18n.get('info_to') +
getLastItemNumber() + getLastItemNumber() +
$i18n.get('info_of') + totalItems + '.' $i18n.get('info_of')
}} }}
<span :class="{ 'has-text-warning': collectionTotalItems > totalItems }">{{ totalItems + '.' }}</span>
</div> </div>
<div class="items-per-page"> <div class="items-per-page">
<b-field <b-field
@ -94,6 +95,20 @@ export default {
}, },
totalPages(){ totalPages(){
return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage)); return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage));
},
collectionTotalItems() {
let collectionTotalItemsObject = this.getCollectionTotalItems().total_items;
if (collectionTotalItemsObject) {
switch(this.getStatus()) {
case 'draft':
return collectionTotalItemsObject.draft;
case 'trash':
return collectionTotalItemsObject.trash;
default:
return collectionTotalItemsObject.publish + collectionTotalItemsObject.private;
}
} else
return this.totalItems;
} }
}, },
watch: { watch: {
@ -103,11 +118,15 @@ export default {
} }
}, },
methods: { methods: {
...mapGetters('collection', [
'getCollectionTotalItems'
]),
...mapGetters('search', [ ...mapGetters('search', [
'getTotalItems', 'getTotalItems',
'getPage', 'getPage',
'getItemsPerPage', 'getItemsPerPage',
'getPostQuery' 'getPostQuery',
'getStatus'
]), ]),
onChangeItemsPerPage(value) { onChangeItemsPerPage(value) {
if( this.itemsPerPage == value){ if( this.itemsPerPage == value){

View File

@ -29,8 +29,9 @@
v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)" v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
class="is-hidden-mobile" class="is-hidden-mobile"
id="filter-menu-compress-button" id="filter-menu-compress-button"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
:aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')" :aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed"> @click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
<span class="icon"> <span class="icon">
<i <i
@ -45,8 +46,9 @@
v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)" v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
class="is-hidden-tablet" class="is-hidden-tablet"
id="filter-menu-compress-button-mobile" id="filter-menu-compress-button-mobile"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
:aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')" :aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
@click="isFilterModalActive = !isFilterModalActive"> @click="isFilterModalActive = !isFilterModalActive">
<span class="icon"> <span class="icon">
<i <i
@ -64,7 +66,7 @@
role="region" role="region"
aria-labelledby="filters-label-landmark" aria-labelledby="filters-label-landmark"
:style="{ top: searchControlHeight + 'px' }" :style="{ top: searchControlHeight + 'px' }"
v-if="!isFiltersMenuCompressed && v-show="!isFiltersMenuCompressed &&
!openAdvancedSearch && !openAdvancedSearch &&
!(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)" !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
class="filters-menu tainacan-form is-hidden-mobile"> class="filters-menu tainacan-form is-hidden-mobile">
@ -240,7 +242,7 @@
ref="displayedMetadataDropdown" ref="displayedMetadataDropdown"
:mobile-modal="true" :mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'" :disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show"> class="show metadata-options-dropdown">
<button <button
:aria-label="$i18n.get('label_displayed_metadata')" :aria-label="$i18n.get('label_displayed_metadata')"
class="button is-white" class="button is-white"
@ -277,15 +279,15 @@
<!-- Change OrderBy Select and Order Button--> <!-- Change OrderBy Select and Order Button-->
<div class="search-control-item"> <div class="search-control-item">
<b-field> <b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-dropdown <b-dropdown
:mobile-modal="true" :mobile-modal="true"
:disabled="totalItems <= 0"
@input="onChangeOrderBy($event)"> @input="onChangeOrderBy($event)">
<button <button
:aria-label="$i18n.get('label_sorting')" :aria-label="$i18n.get('label_sorting')"
class="button is-white" class="button is-white"
slot="trigger"> slot="trigger">
<span>{{ $i18n.get('label_sorting') }}</span> <span>{{ orderByName }}</span>
<span class="icon"> <span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" /> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span> </span>
@ -293,12 +295,9 @@
<b-dropdown-item <b-dropdown-item
aria-controls="items-list-results" aria-controls="items-list-results"
role="button" role="button"
:class="{ 'is-active': metadatum != undefined && orderBy == metadatum.slug }" :class="{ 'is-active': (orderBy != 'meta_value' && orderBy != 'meta_value_num' && orderBy == metadatum.slug) || ((orderBy == 'meta_value' || orderBy == 'meta_value_num') && metaKey == metadatum.id) }"
v-for="metadatum of sortingMetadata" v-for="metadatum of sortingMetadata"
v-if=" v-if="metadatum != undefined"
totalItems > 0 &&
metadatum != undefined
"
:value="metadatum" :value="metadatum"
:key="metadatum.slug"> :key="metadatum.slug">
{{ metadatum.name }} {{ metadatum.name }}
@ -326,21 +325,21 @@
<button <button
aria-controls="items-list-results" aria-controls="items-list-results"
class="button is-white is-small" class="button is-white is-small"
:aria-label="$i18n.get('label_sort_ascending')" :aria-label="$i18n.get('label_sort_descending')"
:disabled="totalItems <= 0 || order == 'DESC'" :disabled="totalItems <= 0 || order == 'DESC'"
@click="onChangeOrder()"> @click="onChangeOrder()">
<span class="icon is-small gray-icon"> <span class="icon is-small gray-icon">
<i class="tainacan-icon tainacan-icon-sortascending"/> <i class="tainacan-icon tainacan-icon-sortdescending"/>
</span> </span>
</button> </button>
<button <button
aria-controls="items-list-results" aria-controls="items-list-results"
:disabled="totalItems <= 0 || order == 'ASC'" :disabled="totalItems <= 0 || order == 'ASC'"
:aria-label="$i18n.get('label_sort_descending')" :aria-label="$i18n.get('label_sort_ascending')"
class="button is-white is-small" class="button is-white is-small"
@click="onChangeOrder()"> @click="onChangeOrder()">
<span class="icon is-small gray-icon"> <span class="icon is-small gray-icon">
<i class="tainacan-icon tainacan-icon-sortdescending"/> <i class="tainacan-icon tainacan-icon-sortascending"/>
</span> </span>
</button> </button>
</b-field> </b-field>
@ -351,20 +350,21 @@
v-if="isOnTheme" v-if="isOnTheme"
class="search-control-item"> class="search-control-item">
<b-field> <b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':&nbsp; ' }}</label>
<b-dropdown <b-dropdown
@change="onChangeViewMode($event)" @change="onChangeViewMode($event)"
:mobile-modal="true" :mobile-modal="true"
position="is-bottom-left" position="is-bottom-left"
:aria-label="$i18n.get('label_view_mode')"> :aria-label="$i18n.get('label_view_mode')">
<button <button
:aria-label="$i18n.get('label_view_mode')" :aria-label="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
class="button is-white" class="button is-white"
slot="trigger"> slot="trigger">
<span <span
class="gray-icon view-mode-icon" class="gray-icon view-mode-icon"
v-if="registeredViewModes[viewMode] != undefined" v-if="registeredViewModes[viewMode] != undefined"
v-html="registeredViewModes[viewMode].icon"/> v-html="registeredViewModes[viewMode].icon"/>
<span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}</span> <span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization') }}</span>
<span class="icon"> <span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" /> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span> </span>
@ -389,6 +389,7 @@
v-if="!isOnTheme" v-if="!isOnTheme"
class="search-control-item"> class="search-control-item">
<b-field> <b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':' }}</label>
<b-dropdown <b-dropdown
@change="onChangeAdminViewMode($event)" @change="onChangeAdminViewMode($event)"
:mobile-modal="true" :mobile-modal="true"
@ -399,7 +400,7 @@
class="button is-white" class="button is-white"
slot="trigger"> slot="trigger">
<span> <span>
<span class="icon is-small gray-icon"> <span class="view-mode-icon icon is-small gray-icon">
<i <i
:class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined), :class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined),
'tainacan-icon-viewcards' : adminViewMode == 'cards', 'tainacan-icon-viewcards' : adminViewMode == 'cards',
@ -409,7 +410,7 @@
class="tainacan-icon"/> class="tainacan-icon"/>
</span> </span>
</span> </span>
&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }} &nbsp;&nbsp;&nbsp;{{ adminViewMode != undefined ? $i18n.get('label_' + adminViewMode) : $i18n.get('label_table') }}
<span class="icon"> <span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" /> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span> </span>
@ -560,7 +561,7 @@
:open-form-advanced-search="openFormAdvancedSearch" :open-form-advanced-search="openFormAdvancedSearch"
:is-do-search="isDoSearch"/> :is-do-search="isDoSearch"/>
<div class="advanced-searh-form-submit"> <div class="advanced-search-form-submit">
<p <p
v-if="advancedSearchResults" v-if="advancedSearchResults"
class="control"> class="control">
@ -883,6 +884,27 @@
}, },
showLoading() { showLoading() {
return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata; return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata;
},
metaKey() {
return this.getMetaKey();
},
orderByName() {
if (this.getOrderByName() != null && this.getOrderByName() != undefined && this.getOrderByName() != '') {
return this.getOrderByName();
} else {
for (let metadatum of this.sortingMetadata) {
if (
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
)
return metadatum.name;
}
}
} }
}, },
components: { components: {
@ -930,10 +952,12 @@
'getSearchQuery', 'getSearchQuery',
'getStatus', 'getStatus',
'getOrderBy', 'getOrderBy',
'getOrderByName',
'getOrder', 'getOrder',
'getViewMode', 'getViewMode',
'getTotalItems', 'getTotalItems',
'getAdminViewMode', 'getAdminViewMode',
'getMetaKey'
]), ]),
onSwipeFiltersMenu($event) { onSwipeFiltersMenu($event) {
if (this.registeredViewModes[this.viewMode] == undefined || if (this.registeredViewModes[this.viewMode] == undefined ||
@ -1493,7 +1517,7 @@
} }
} }
.advanced-searh-form-submit { .advanced-search-form-submit {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
padding-right: $page-side-padding; padding-right: $page-side-padding;
@ -1653,6 +1677,14 @@
flex-basis: 100%; flex-basis: 100%;
} }
.label {
font-size: 0.875rem;
font-weight: normal;
margin-top: 3px;
margin-bottom: 2px;
cursor: default;
}
.button { .button {
display: flex; display: flex;
align-items: center; align-items: center;
@ -1673,8 +1705,9 @@
} }
.view-mode-icon { .view-mode-icon {
margin-right: 4px !important; margin-right: 3px !important;
margin-top: 1px; margin-top: 1px;
margin-left: 6px !important;
} }
.dropdown-menu { .dropdown-menu {
@ -1684,7 +1717,7 @@
padding: 0; padding: 0;
.metadata-options-container { .metadata-options-container {
max-height: 240px; max-height: 288px;
overflow: auto; overflow: auto;
} }
.dropdown-item { .dropdown-item {
@ -1696,7 +1729,7 @@
.dropdown-item-apply { .dropdown-item-apply {
width: 100%; width: 100%;
border-top: 1px solid #efefef; border-top: 1px solid #efefef;
padding: 8px 12px 2px 12px; padding: 8px 12px;
text-align: right; text-align: right;
} }
.dropdown-item-apply .button { .dropdown-item-apply .button {

View File

@ -20,6 +20,7 @@
<!-- Sorting options ---- --> <!-- Sorting options ---- -->
<b-field class="header-item"> <b-field class="header-item">
<label class="label">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-select <b-select
class="sorting-select" class="sorting-select"
:disabled="taxonomies.length <= 0" :disabled="taxonomies.length <= 0"
@ -167,7 +168,7 @@
order: 'asc', order: 'asc',
ordeBy: 'date', ordeBy: 'date',
sortingOptions: [ sortingOptions: [
{ label: this.$i18n.get('label_title'), value: 'title' }, { label: this.$i18n.get('label_name'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' }, { label: this.$i18n.get('label_creation_date'), value: 'date' },
] ]
} }
@ -315,6 +316,11 @@
.header-item .button .icon i{ .header-item .button .icon i{
width: 100%; width: 100%;
} }
.header-item .label{
font-weight: normal;
font-size: 0.875rem;
margin-top: 3px;
}
@media screen and (max-width: 769px) { @media screen and (max-width: 769px) {
height: 60px; height: 60px;

View File

@ -84,8 +84,10 @@
<span <span
@click="updateSearch()" @click="updateSearch()"
class="icon is-right"> class="icon is-right">
<span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-search"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-search"/>
</span> </span>
</span>
</div> </div>
</div> </div>
<!-- <button <!-- <button
@ -96,7 +98,11 @@
{{ $i18n.get('advanced_search') }} {{ $i18n.get('advanced_search') }}
</button> --> </button> -->
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3> <h3
id="filters-label-landmark"
class="has-text-weight-semibold">
{{ $i18n.get('filters') }}
</h3>
<button <button
v-if="!isLoadingFilters && v-if="!isLoadingFilters &&
((filters.length >= 0 && ((filters.length >= 0 &&
@ -211,17 +217,26 @@
v-if="!isOnTheme || (registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].dynamic_metadata)" v-if="!isOnTheme || (registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].dynamic_metadata)"
class="search-control-item"> class="search-control-item">
<b-dropdown <b-dropdown
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: (totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? (adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? $i18n.get('info_current_view_mode_metadata_not_allowed') : $i18n.get('info_cant_select_metadata_without_items') : '',
autoHide: false,
placement: 'auto-start'
}"
ref="displayedMetadataDropdown" ref="displayedMetadataDropdown"
:mobile-modal="true" :mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'" :disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show"> class="show metadata-options-dropdown">
<button <button
class="button is-white"
:aria-label="$i18n.get('label_displayed_metadata')" :aria-label="$i18n.get('label_displayed_metadata')"
class="button is-white"
slot="trigger"> slot="trigger">
<span>{{ $i18n.get('label_displayed_metadata') }}</span> <span>{{ $i18n.get('label_displayed_metadata') }}</span>
<span class="icon"> <span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
</span> </span>
</button> </button>
<div class="metadata-options-container"> <div class="metadata-options-container">
@ -251,30 +266,25 @@
<!-- Change OrderBy Select and Order Button--> <!-- Change OrderBy Select and Order Button-->
<div class="search-control-item"> <div class="search-control-item">
<b-field> <b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-dropdown <b-dropdown
:disabled="totalItems <= 0" :mobile-modal="true"
@input="onChangeOrderBy($event)"> @input="onChangeOrderBy($event)">
<button <button
:aria-label="$i18n.get('label_sorting')" :aria-label="$i18n.get('label_sorting')"
class="button is-white" class="button is-white"
slot="trigger"> slot="trigger">
<span>{{ $i18n.get('label_sorting') }}</span> <span>{{ orderByName }}</span>
<span class="icon"> <span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown "/>
</span> </span>
</button> </button>
<b-dropdown-item <b-dropdown-item
aria-controls="items-list-results" aria-controls="items-list-results"
role="button" role="button"
:class="{ 'is-active': metadatum != undefined && orderBy == metadatum.slug }" :class="{ 'is-active': (orderBy != 'meta_value' && orderBy != 'meta_value_num' && orderBy == metadatum.slug) || ((orderBy == 'meta_value' || orderBy == 'meta_value_num') && metaKey == metadatum.id) }"
v-for="metadatum of sortingMetadata" v-for="metadatum of sortingMetadata"
v-if=" v-if="metadatum != undefined"
totalItems > 0 &&
metadatum != undefined &&
metadatum.slug === 'creation_date' || (
metadatum.metadata_type_object &&
metadatum.metadata_type_object.related_mapped_prop == 'title'
)"
:value="metadatum" :value="metadatum"
:key="metadatum.slug"> :key="metadatum.slug">
{{ metadatum.name }} {{ metadatum.name }}
@ -327,6 +337,7 @@
v-if="isOnTheme" v-if="isOnTheme"
class="search-control-item"> class="search-control-item">
<b-field> <b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':&nbsp; ' }}</label>
<b-dropdown <b-dropdown
@change="onChangeViewMode($event)" @change="onChangeViewMode($event)"
:mobile-modal="true" :mobile-modal="true"
@ -334,15 +345,15 @@
:aria-label="$i18n.get('label_view_mode')"> :aria-label="$i18n.get('label_view_mode')">
<button <button
class="button is-white" class="button is-white"
:aria-label="$i18n.get('label_view_mode')" :aria-label="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
slot="trigger"> slot="trigger">
<span <span
class="gray-icon view-mode-icon" class="gray-icon view-mode-icon"
v-if="registeredViewModes[viewMode] != undefined" v-if="registeredViewModes[viewMode] != undefined"
v-html="registeredViewModes[viewMode].icon"/> v-html="registeredViewModes[viewMode].icon"/>
<span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}</span> <span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization') }}</span>
<span class="icon"> <span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span> </span>
</button> </button>
<b-dropdown-item <b-dropdown-item
@ -356,7 +367,7 @@
<span <span
class="gray-icon" class="gray-icon"
v-html="registeredViewModes[viewModeOption].icon"/> v-html="registeredViewModes[viewModeOption].icon"/>
{{ registeredViewModes[viewModeOption].label }} <span>{{ registeredViewModes[viewModeOption].label }}</span>
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
</b-field> </b-field>
@ -365,6 +376,7 @@
v-if="!isOnTheme" v-if="!isOnTheme"
class="search-control-item"> class="search-control-item">
<b-field> <b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':' }}</label>
<b-dropdown <b-dropdown
@change="onChangeAdminViewMode($event)" @change="onChangeAdminViewMode($event)"
:mobile-modal="true" :mobile-modal="true"
@ -375,7 +387,7 @@
:aria-label="$i18n.get('label_view_mode')" :aria-label="$i18n.get('label_view_mode')"
slot="trigger"> slot="trigger">
<span> <span>
<span class="icon is-small gray-icon"> <span class="view-mode-icon icon is-small gray-icon">
<i <i
:class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined), :class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined),
'tainacan-icon-viewcards' : adminViewMode == 'cards', 'tainacan-icon-viewcards' : adminViewMode == 'cards',
@ -385,9 +397,9 @@
class="tainacan-icon"/> class="tainacan-icon"/>
</span> </span>
</span> </span>
&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }} &nbsp;&nbsp;&nbsp;{{ adminViewMode != undefined ? $i18n.get('label_' + adminViewMode) : $i18n.get('label_table') }}
<span class="icon"> <span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
</span> </span>
</button> </button>
<b-dropdown-item <b-dropdown-item
@ -398,7 +410,7 @@
<span class="icon gray-icon"> <span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewtable"/> <i class="tainacan-icon tainacan-icon-viewtable"/>
</span> </span>
{{ $i18n.get('label_table') }} <span>{{ $i18n.get('label_table') }}</span>
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
aria-controls="items-list-results" aria-controls="items-list-results"
@ -408,7 +420,7 @@
<span class="icon gray-icon"> <span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewcards"/> <i class="tainacan-icon tainacan-icon-viewcards"/>
</span> </span>
{{ $i18n.get('label_cards') }} <span>{{ $i18n.get('label_cards') }}</span>
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
aria-controls="items-list-results" aria-controls="items-list-results"
@ -418,7 +430,7 @@
<span class="icon gray-icon"> <span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewminiature"/> <i class="tainacan-icon tainacan-icon-viewminiature"/>
</span> </span>
{{ $i18n.get('label_thumbnails') }} <span>{{ $i18n.get('label_thumbnails') }}</span>
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
aria-controls="items-list-results" aria-controls="items-list-results"
@ -428,7 +440,7 @@
<span class="icon gray-icon"> <span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewrecords"/> <i class="tainacan-icon tainacan-icon-viewrecords"/>
</span> </span>
{{ $i18n.get('label_records') }} <span>{{ $i18n.get('label_records') }}</span>
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
aria-controls="items-list-results" aria-controls="items-list-results"
@ -438,7 +450,7 @@
<span class="icon gray-icon"> <span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewmasonry"/> <i class="tainacan-icon tainacan-icon-viewmasonry"/>
</span> </span>
{{ $i18n.get('label_masonry') }} <span>{{ $i18n.get('label_masonry') }}</span>
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
</b-field> </b-field>
@ -544,7 +556,7 @@
<button <button
aria-controls="items-list-results" aria-controls="items-list-results"
@click="advancedSearchResults = !advancedSearchResults" @click="advancedSearchResults = !advancedSearchResults"
class="button is-small is-outlined">{{ $i18n.get('edit_search') }}</button> class="button is-outlined">{{ $i18n.get('edit_search') }}</button>
</p> </p>
<p <p
v-if="advancedSearchResults" v-if="advancedSearchResults"
@ -552,7 +564,7 @@
<button <button
aria-controls="items-list-results" aria-controls="items-list-results"
@click="isDoSearch = !isDoSearch" @click="isDoSearch = !isDoSearch"
class="button is-small is-secondary">{{ $i18n.get('search') }}</button> class="button is-success">{{ $i18n.get('search') }}</button>
</p> </p>
</div> </div>
</div> </div>
@ -592,7 +604,7 @@
<h3 <h3
id="items-list-landmark" id="items-list-landmark"
class="is-hidden"> class="sr-only">
{{ $i18n.get('label_items_list') }} {{ $i18n.get('label_items_list') }}
</h3> </h3>
@ -838,6 +850,26 @@
}, },
showLoading() { showLoading() {
return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata; return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata;
},
metaKey() {
return this.getMetaKey();
},
orderByName() {
if (this.getOrderByName() != null && this.getOrderByName() != undefined && this.getOrderByName() != '') {
return this.getOrderByName();
} else {
for (let metadatum of this.sortingMetadata) {
if (
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
)
return metadatum.name;
}
}
} }
}, },
components: { components: {
@ -882,10 +914,12 @@
'getSearchQuery', 'getSearchQuery',
'getStatus', 'getStatus',
'getOrderBy', 'getOrderBy',
'getOrderByName',
'getOrder', 'getOrder',
'getViewMode', 'getViewMode',
'getTotalItems', 'getTotalItems',
'getAdminViewMode' 'getAdminViewMode',
'getMetaKey'
]), ]),
onSwipeFiltersMenu($event) { onSwipeFiltersMenu($event) {
if (this.registeredViewModes[this.viewMode] == undefined || if (this.registeredViewModes[this.viewMode] == undefined ||
@ -965,6 +999,7 @@
// Updates searchControlHeight before in case we need to adjust filters position on mobile // Updates searchControlHeight before in case we need to adjust filters position on mobile
setTimeout(() => { setTimeout(() => {
if (this.$refs['search-control'] != undefined)
this.searchControlHeight = this.$refs['search-control'].clientHeight; this.searchControlHeight = this.$refs['search-control'].clientHeight;
}, 500); }, 500);
}, },
@ -988,12 +1023,11 @@
// Updates Search // Updates Search
this.$eventBusSearch.addFetchOnly( this.$eventBusSearch.addFetchOnly(
thumbnailMetadatum != undefined && thumbnailMetadatum.display ? 'thumbnail' : null +','+ ((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
creationDateMetadatum != undefined && creationDateMetadatum.display ? 'creation_date' : null +','+ ((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
authorNameMetadatum != undefined && authorNameMetadatum.display ? 'author_name': null +','+ ((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null) + ',' +
(this.isRepositoryLevel ? 'title' : null) +','+ (this.isRepositoryLevel ? 'title' : null) + ',' +
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null) (this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
, false, fetchOnlyMetadatumIds.toString());
// Closes dropdown // Closes dropdown
this.$refs.displayedMetadataDropdown.toggle(); this.$refs.displayedMetadataDropdown.toggle();
@ -1118,12 +1152,22 @@
multiple: metadatum.multiple, multiple: metadatum.multiple,
}); });
if (display) if (display) {
fetchOnlyMetadatumIds.push(metadatum.id); fetchOnlyMetadatumIds.push(metadatum.id);
} }
if (
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Core_Description' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Taxonomy' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Relationship'
) {
this.sortingMetadata.push(metadatum); this.sortingMetadata.push(metadatum);
} }
}
}
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true; let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
let authorNameMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[2] != null) : true; let authorNameMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[2] != null) : true;
@ -1186,7 +1230,7 @@
display: authorNameMetadatumDisplay display: authorNameMetadatumDisplay
}); });
} }
// Loads only basic attributes necessay to view modes that do not allow custom meta // Loads only basic attributes necessary to view modes that do not allow custom meta
} else { } else {
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, ''); this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
@ -1219,13 +1263,14 @@
this.isLoadingMetadata = false; this.isLoadingMetadata = false;
}); });
}, },
},
adjustSearchControlHeight: _.debounce( function() { adjustSearchControlHeight: _.debounce( function() {
this.$nextTick(() => { this.$nextTick(() => {
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight : 0; if (this.$refs['search-control'] != undefined)
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight + this.$refs['search-control'].offsetTop : 0;
this.isFiltersMenuCompressed = jQuery(window).width() <= 768; this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
}); });
}, 500) }, 500),
},
removeEventListeners() { removeEventListeners() {
// Component // Component
this.$off(); this.$off();
@ -1238,6 +1283,7 @@
this.$eventBusSearch.$off('hasFiltered'); this.$eventBusSearch.$off('hasFiltered');
this.$eventBusSearch.$off('advancedSearchResults'); this.$eventBusSearch.$off('advancedSearchResults');
this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters'); this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters');
}, },
created() { created() {
@ -1316,7 +1362,7 @@
} else { } else {
let prefsAdminViewMode = !this.isRepositoryLevel ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode'; let prefsAdminViewMode = !this.isRepositoryLevel ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode';
if (this.$userPrefs.get(prefsAdminViewMode) == undefined) if (this.$userPrefs.get(prefsAdminViewMode) == undefined)
this.$eventBusSearch.setInitialAdminViewMode('cards'); this.$eventBusSearch.setInitialAdminViewMode('table');
else { else {
let existingViewMode = this.$userPrefs.get(prefsAdminViewMode); let existingViewMode = this.$userPrefs.get(prefsAdminViewMode);
if (existingViewMode == 'cards' || if (existingViewMode == 'cards' ||
@ -1326,7 +1372,7 @@
existingViewMode == 'masonry') existingViewMode == 'masonry')
this.$eventBusSearch.setInitialAdminViewMode(this.$userPrefs.get(prefsAdminViewMode)); this.$eventBusSearch.setInitialAdminViewMode(this.$userPrefs.get(prefsAdminViewMode));
else else
this.$eventBusSearch.setInitialAdminViewMode('cards'); this.$eventBusSearch.setInitialAdminViewMode('table');
} }
} }
@ -1340,6 +1386,7 @@
// Cancels previous Request // Cancels previous Request
if (this.$eventBusSearch.searchCancel != undefined) if (this.$eventBusSearch.searchCancel != undefined)
this.$eventBusSearch.searchCancel.cancel('Item search Canceled.'); this.$eventBusSearch.searchCancel.cancel('Item search Canceled.');
} }
} }
</script> </script>
@ -1348,6 +1395,16 @@
@import '../../scss/_variables.scss'; @import '../../scss/_variables.scss';
@keyframes open-full-screen {
from {
opacity: 0;
transform: scale(0.6);
}
to {
opacity: 1;
transform: scale(1.0);
}
}
.is-fullscreen { .is-fullscreen {
position: absolute; position: absolute;
@ -1359,7 +1416,8 @@
height: 100vh; height: 100vh;
z-index: 999999999; z-index: 999999999;
background-color: black; background-color: black;
transition: all 0.3s ease; transition: background-color 0.3s ease, width 0.3s ease, height 0.3s ease;
animation: open-full-screen 0.4s ease;
} }
.collapse-all { .collapse-all {
@ -1374,9 +1432,9 @@
h1, h2 { h1, h2 {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
margin-bottom: 0;
color: $gray5; color: $gray5;
display: inline-block; display: inline-block;
margin-bottom: 0;
} }
.field.is-grouped { .field.is-grouped {
margin-left: auto; margin-left: auto;
@ -1400,9 +1458,9 @@
h1, h2 { h1, h2 {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
margin-bottom: 0;
color: $gray5; color: $gray5;
display: inline-block; display: inline-block;
margin-bottom: 0;
} }
.field.is-grouped { .field.is-grouped {
margin-left: auto; margin-left: auto;
@ -1569,6 +1627,14 @@
flex-basis: 100%; flex-basis: 100%;
} }
.label {
font-size: 0.875rem;
font-weight: normal;
margin-top: 3px;
margin-bottom: 2px;
cursor: default;
}
.button { .button {
display: flex; display: flex;
align-items: center; align-items: center;
@ -1582,7 +1648,6 @@
color: $gray4 !important; color: $gray4 !important;
padding-right: 10px; padding-right: 10px;
} }
.gray-icon .icon i::before, .gray-icon .icon i::before,
.gray-icon i::before { .gray-icon i::before {
font-size: 1.3125rem !important; font-size: 1.3125rem !important;
@ -1590,8 +1655,9 @@
} }
.view-mode-icon { .view-mode-icon {
margin-right: 4px !important; margin-right: 3px !important;
margin-top: 1px; margin-top: 1px;
margin-left: 6px !important;
} }
.dropdown-menu { .dropdown-menu {
@ -1601,7 +1667,7 @@
padding: 0; padding: 0;
.metadata-options-container { .metadata-options-container {
max-height: 240px; max-height: 288px;
overflow: auto; overflow: auto;
} }
.dropdown-item { .dropdown-item {
@ -1613,7 +1679,7 @@
.dropdown-item-apply { .dropdown-item-apply {
width: 100%; width: 100%;
border-top: 1px solid #efefef; border-top: 1px solid #efefef;
padding: 8px 12px 2px 12px; padding: 8px 12px;
text-align: right; text-align: right;
} }
.dropdown-item-apply .button { .dropdown-item-apply .button {

View File

@ -468,9 +468,11 @@
}); });
// Obtains collection name // Obtains collection name
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => { this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName; this.collectionName = collectionName;
}); });
}
// Get attachments // Get attachments
this.fetchAttachments(this.itemId); this.fetchAttachments(this.itemId);

View File

@ -21,9 +21,13 @@
padding: 0px; padding: 0px;
border-radius: 0px; border-radius: 0px;
min-width: 6rem; min-width: 6rem;
.dropdown-content { .dropdown-content {
padding: 6px 0px; padding: 0px;
border-radius: 0px !important; border-radius: 0px !important;
max-height: 240px;
overflow-y: auto;
.dropdown-item { .dropdown-item {
display: block; display: block;
text-decoration: none; text-decoration: none;
@ -67,6 +71,13 @@
} }
} }
// This dropdown has a particular way of dealing with scroll
.metadata-options-dropdown {
.dropdown-content {
max-height: unset !important;
}
}
.taginput-container { .taginput-container {
padding: 0px !important; padding: 0px !important;
background-color: white !important; background-color: white !important;

View File

@ -28,6 +28,9 @@
.is-has-text-secondary:focus { .is-has-text-secondary:focus {
color: $blue3 !important; color: $blue3 !important;
} }
a.button.is-secondary {
color: white !important;
}
.tainacan-page-title hr{ .tainacan-page-title hr{
background-color: $blue3 !important; background-color: $blue3 !important;
} }

View File

@ -115,7 +115,10 @@
this.isLoading = true; this.isLoading = true;
this.options = []; this.options = [];
let query_items = { 'current_query': this.query }; let query_items = {
'current_query': this.query,
'search': query
};
let endpoint = this.isRepositoryLevel ? '/facets/' + this.metadatum : '/collection/'+ this.collection +'/facets/' + this.metadatum; let endpoint = this.isRepositoryLevel ? '/facets/' + this.metadatum : '/collection/'+ this.collection +'/facets/' + this.metadatum;

View File

@ -10,13 +10,7 @@ class Oaipmh_Importer extends Importer {
'name' => 'Create Collections', 'name' => 'Create Collections',
'progress_label' => 'Create Collections', 'progress_label' => 'Create Collections',
'callback' => 'create_collections' 'callback' => 'create_collections'
],
[
'name' => 'Import Items',
'progress_label' => 'Import Items',
'callback' => 'process_collections'
] ]
]; ];
protected $tainacan_api_address, $wordpress_api_address, $actual_collection; protected $tainacan_api_address, $wordpress_api_address, $actual_collection;
@ -34,7 +28,6 @@ class Oaipmh_Importer extends Importer {
$this->remove_import_method('file'); $this->remove_import_method('file');
$this->add_import_method('url'); $this->add_import_method('url');
$this->tainacan_api_address = "/wp-json/tainacan/v1/oai";
} }
@ -43,7 +36,7 @@ class Oaipmh_Importer extends Importer {
* @return int * @return int
*/ */
public function process_item( $index, $collection_id ){ public function process_item( $index, $collection_id ){
return true;
} }
/** /**
@ -58,17 +51,19 @@ class Oaipmh_Importer extends Importer {
if( isset($collection_xml->ListSets) ){ if( isset($collection_xml->ListSets) ){
foreach ($collection_xml->ListSets->set as $set) { foreach ($collection_xml->ListSets->set as $set) {
$setSpec = $set->setSpec; $setSpec = (string) $set->setSpec;
$setName = $set->setName; $setName = (string) $set->setName;
$collection = $this->create_collection( $setSpec, $setName ); $collection = $this->create_collection( $setSpec, $setName );
$metadata_map = $this->create_collection_metadata($collection); $metadata_map = $this->create_collection_metadata($collection);
$total = intval($this->get_total_items_from_source($setSpec));
$this->add_log('total in collection: ' . $total);
$this->add_collection([ $this->add_collection([
'id' => $collection->get_id(), 'id' => $collection->get_id(),
'mapping' => $metadata_map, 'mapping' => $metadata_map,
'total_items' => intval($this->get_total_items_from_source($setSpec)), 'total_items' => $total,
'source_id' => $setSpec 'source_id' => $setSpec
]); ]);
} }
@ -87,6 +82,7 @@ class Oaipmh_Importer extends Importer {
$info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $setSpec); $info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $setSpec);
if( !isset($info['body']) ){ if( !isset($info['body']) ){
$this->add_log('ERROR');
$this->add_error_log('Error in fetch remote total items'); $this->add_error_log('Error in fetch remote total items');
$this->abort(); $this->abort();
return false; return false;
@ -96,22 +92,28 @@ class Oaipmh_Importer extends Importer {
$xml = new \SimpleXMLElement($info['body']); $xml = new \SimpleXMLElement($info['body']);
if( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){ if( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){
$this->add_log('NO resumptiontoken ');
$cont = 0; $cont = 0;
foreach ($xml->ListRecords->record as $record) $cont++; foreach ($xml->ListRecords->record as $record) $cont++;
return $cont; return $cont;
} elseif ( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){ } elseif ( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){
$resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes(); $resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes();
foreach ($resumptionToken_attributes as $tag => $attribute) { foreach ($resumptionToken_attributes as $tag => $attribute) {
$this->add_log('resumptiontoken: ' . (string) $tag . ' ' . (string) $attribute );
if ($tag == 'completeListSize') { if ($tag == 'completeListSize') {
return (string) $attribute; return (string) $attribute;
} }
} }
} }
} catch (Exception $e) { } catch (Exception $e) {
$this->add_log('ERROR');
return 0; return 0;
} }
$this->add_log('SKIP');
return 0; return 0;
} }
@ -150,7 +152,7 @@ class Oaipmh_Importer extends Importer {
* @throws \ErrorException * @throws \ErrorException
*/ */
protected function create_collection_metadata( $collection_object ){ protected function create_collection_metadata( $collection_object ){
$Tainacan_Mappers = \Tainacan\Repositories\Mappers::get_instance(); $Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance();
$mapper_obj = $Tainacan_Mappers->check_class_name('dublin-core', true, $Tainacan_Mappers::MAPPER_CLASS_PREFIX); $mapper_obj = $Tainacan_Mappers->check_class_name('dublin-core', true, $Tainacan_Mappers::MAPPER_CLASS_PREFIX);
$mapper = new $mapper_obj; $mapper = new $mapper_obj;
$array_metadata = []; $array_metadata = [];
@ -173,7 +175,8 @@ class Oaipmh_Importer extends Importer {
$_meta_mapping[$mapper->slug] = $slug; $_meta_mapping[$mapper->slug] = $slug;
$core_meta->set_exposer_mapping($_meta_mapping); $core_meta->set_exposer_mapping($_meta_mapping);
if ($core_meta->validate()) { if ($core_meta->validate()) {
$Tainacan_Metadata->insert($core_meta); $new_metadata = $Tainacan_Metadata->insert($core_meta);
$array_metadata[$new_metadata->get_id()] = $slug;
} }
} }
continue; continue;
@ -201,7 +204,7 @@ class Oaipmh_Importer extends Importer {
if($metadatum->validate()){ if($metadatum->validate()){
$new_metadata = $Tainacan_Metadata->insert($metadatum); $new_metadata = $Tainacan_Metadata->insert($metadatum);
$array_metadata[$new_metadata->get_id()] = $mapper_metadatum['label']; $array_metadata[$new_metadata->get_id()] = $slug;
} }
} }
} }

View File

@ -773,9 +773,6 @@ class Old_Tainacan extends Importer{
/*Properties of metadatum*/ /*Properties of metadatum*/
if(isset($meta->metadata)){ if(isset($meta->metadata)){
if($meta->metadata->required == 1){
$newMetadatum->set_required(true);
}
if(!empty($meta->metadata->default_value)){ if(!empty($meta->metadata->default_value)){
$newMetadatum->set_default_value($meta->metadata->default_value); $newMetadatum->set_default_value($meta->metadata->default_value);

View File

@ -108,7 +108,6 @@ export default {
this.$route.query.orderby = 'meta_value'; this.$route.query.orderby = 'meta_value';
this.$route.query.meta_key = orderBy.id; this.$route.query.meta_key = orderBy.id;
} }
this.$route.query.orderby = orderBy.slug;
} else { } else {
this.$route.query.orderby = 'date'; this.$route.query.orderby = 'date';

View File

@ -85,22 +85,32 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
// Primitive Types: string, date, item, term, compound, float // Primitive Types: string, date, item, term, compound, float
if (orderBy.slug == 'creation_date') { if (orderBy.slug == 'creation_date') {
commit('setPostQueryAttribute', { attr: 'orderby', value: 'date' } ); commit('setPostQueryAttribute', { attr: 'orderby', value: 'date' } );
commit('removePostQueryAttribute', 'meta_key');
commit('removePostQueryAttribute', 'meta_type');
} else if (orderBy.slug == 'author_name') { } else if (orderBy.slug == 'author_name') {
commit('setPostQueryAttribute', { attr: 'orderby', value: 'author_name' } ); commit('setPostQueryAttribute', { attr: 'orderby', value: 'author_name' } );
commit('removePostQueryAttribute', 'meta_key');
commit('removePostQueryAttribute', 'meta_type');
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') { } else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } ); commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } );
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('removePostQueryAttribute', 'meta_type');
} else if (orderBy.metadata_type_object.primitive_type == 'date') { } else if (orderBy.metadata_type_object.primitive_type == 'date') {
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'metatype', value: 'DATETIME' } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } ); commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'meta_type', value: 'DATETIME' } );
} else if (orderBy.metadata_type_object.core) { } else if (orderBy.metadata_type_object.core) {
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } ); commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
commit('removePostQueryAttribute', 'meta_key');
commit('removePostQueryAttribute', 'meta_type');
} else { } else {
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } ); commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('removePostQueryAttribute', 'meta_type');
} }
commit('setOrderByName', orderBy.name);
}; };
export const setOrder = ({ commit }, order ) => { export const setOrder = ({ commit }, order ) => {

View File

@ -64,6 +64,14 @@ export const getFetchOnly = state => {
return state.postquery.fetch_only; return state.postquery.fetch_only;
}; };
export const getOrderByName = state => {
return state.orderByName;
};
export const getMetaKey = state => {
return state.postquery.meta_key;
};
export const getFetchOnlyMeta = state => { export const getFetchOnlyMeta = state => {
return ( ! state.postquery.fetch_only_meta ) ? '' : state.postquery.fetch_only_meta; return ( ! state.postquery.fetch_only_meta ) ? '' : state.postquery.fetch_only_meta;
}; };

View File

@ -22,7 +22,8 @@ const state = {
totalItems: 0, totalItems: 0,
totalPages: 0, totalPages: 0,
itemsPerPage: 12, // Not the same as postquery.perpage as API may have limited it's value itemsPerPage: 12, // Not the same as postquery.perpage as API may have limited it's value
facets: {} facets: {},
orderByName: ''
}; };
export default { export default {

View File

@ -143,6 +143,10 @@ export const setAdminViewMode = ( state, adminViewMode ) => {
state.postquery.admin_view_mode = adminViewMode; state.postquery.admin_view_mode = adminViewMode;
}; };
export const setOrderByName = ( state, orderByName ) => {
state.orderByName = orderByName;
};
export const addFilterTag = ( state, filterTag ) => { export const addFilterTag = ( state, filterTag ) => {
state.filter_tags = ( ! state.filter_tags) ? [] : state.filter_tags; state.filter_tags = ( ! state.filter_tags) ? [] : state.filter_tags;