Merge branch 'develop' of github.com:tainacan/tainacan into develop

This commit is contained in:
Mateus Machado Luna 2019-04-02 18:08:06 -03:00
commit 01c76e5c0c
60 changed files with 10182 additions and 4188 deletions

View File

@ -10,6 +10,9 @@ Assuming:
* $BUILD_PATH is where the plugin is condigured to buid
* $SVN_PATH is where the WordPress.org SVN repo is
## Pre-release
Before we publish a new version, we always release one or more Release Candidates so the community have time to test and make sure the new version of Tainacan is clean and ready to reach the world.
### Start in the git repository
@ -19,10 +22,22 @@ git checkout develop
git pull
```
### Create a new Release branch
Create a new `release/$NEW_VERSION` branch. If using git flow:
```
git flow release start $NEW_VERSION
```
### Edit version numbers
Edit `src/readme.txt` and `src/tainacan.php` and change the version numbers to `$NEW_VERSION`.
When releasing a RC version, append RC (number) to the version.
Also increase the `Tested Up` version, if applicable.
### Set build to production mode
Edit `webpack.config.js` to set production mode.
@ -34,6 +49,62 @@ Edit `webpack.config.js` to set production mode.
cd $BUILD_PATH
rm -r admin/scss/.sass-cache
```
### Set build to development mode
```
cd $GIT_PATH
git checkout webpack.config.js
```
### Publish the RC
Create a ZIP package with the built plugin and publish a blog post calling for tests.
Commit and push to Git!
### Test
Using the Test guide as a resource, test every feature of the plugin, including importers and exporters. With time, we can build more detailed test scripts and distribute tests among people in the community.
### Fix and publish new RC, or finish
If bugs are found, fix them and commit to the release branch. Publish a new RC, following the steps above, until we have a stable version we feel confident to release.
## Release
The plugin is ready to go. We have published one or more RCs and the community have tested it. Lets get it live to the world!
### Finish version number
Back to the git repository, make sure everything is up to date:
```
cd $GIT_PATH
git checkout release/$NEW_VERSION
git pull
```
Edit `src/readme.txt` and `src/tainacan.php` and change the version numbers to `$NEW_VERSION`.
Commit and push.
### Set build to production mode
Edit `webpack.config.js` to set production mode.
### Build and cleanup
```
./build.sh
cd $BUILD_PATH
rm -r admin/scss/.sass-cache
```
### Set build to development mode
```
cd $GIT_PATH
git checkout webpack.config.js
```
### Prepare SVN repo
@ -98,17 +169,14 @@ Check if everything is ok.
Once the release is tested and confirmed, commit and create the tag on git.
Don't forget to undo the changes to `webpack.config.js`, setting production mode to false again.
Merge the release branch into master and develop branches and create a tag.
Using git flow:
```
cd $GIT_PATH
git checkout webpack.config.js
git commit -am "Releasing verion $NEW_VERSION"
git tag $NEW_VERSION
git checkout master
git merge develop
git flow release finish $NEW_VERSION
git push --all
git push --tags
```

View File

@ -35,7 +35,6 @@
"babel-loader": "^8.0.4",
"cross-env": "^5.2.0",
"css-loader": "^1.0.0",
"element-theme-chalk": "^2.4.8",
"eslint": "^4.0.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-vue": "^4.7.1",

View File

@ -296,7 +296,18 @@ export default {
this.$router.go(-2);
},
checkIfMetadatumIsAvailable(metadatumId) {
return this.mappedCollection['mapping'][metadatumId] != undefined;
if ( this.mappedCollection['mapping'][metadatumId] != undefined &&
this.importerSourceInfo != undefined &&
this.importerSourceInfo != null){
let val = this.mappedCollection['mapping'][metadatumId];
const { source_metadata } = this.importerSourceInfo;
if(source_metadata && source_metadata.indexOf(val) >= 0) {
return true;
}
}
return false;
},
checkCurrentSelectedCollectionMetadatum(sourceMetadatum) {
for (let key in this.mappedCollection['mapping']) {

View File

@ -198,6 +198,7 @@
<div class="control">
<button
id="button-submit-text-content-writing"
type="submit"
@click.prevent="confirmTextWriting()"
class="button is-success">
{{ $i18n.get('save') }}</button>

View File

@ -135,7 +135,7 @@
<!-- <span class="menu-text">{{ $i18n.get('items') }}</span> -->
</router-link>
</li>
<li>
<li v-if="collection.current_user_can_edit">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionEditPath(collection.id) }"

View File

@ -245,13 +245,14 @@
v-html="getTotalItems(collection.total_items)" />
</td>
<!-- Actions -->
<td
<td
@click="onClickCollection($event, collection.id, index)"
class="actions-cell column-default-width"
:label="$i18n.get('label_actions')">
<div class="actions-container">
<a
id="button-edit"
v-if="collection.current_user_can_edit"
:aria-label="$i18n.getFrom('collections','edit_item')"
@click.prevent.stop="goToCollectionEditPage(collection.id)">
<span class="icon">
@ -259,7 +260,8 @@
</span>
</a>
<a
id="button-delete"
id="button-delete"
v-if="collection.current_user_can_delete"
:aria-label="$i18n.get('label_button_delete')"
@click.prevent.stop="deleteOneCollection(collection.id)">
<span class="icon">
@ -292,7 +294,7 @@ export default {
cursorPosX: -1,
cursorPosY: -1,
contextMenuIndex: null,
contextMenuCollection: null,
contextMenuCollection: null
}
},
props: {

View File

@ -70,6 +70,7 @@
</b-tooltip>
</li>
<li
v-if="currentUserCanEdit"
:class="activeRoute == 'CollectionEditionForm' ? 'is-active':''"
class="level-item">
<b-tooltip
@ -88,6 +89,7 @@
</b-tooltip>
</li>
<li
v-if="currentUserCanEdit"
:class="activeRoute == 'MetadataList' ? 'is-active':''"
class="level-item">
<b-tooltip
@ -105,6 +107,7 @@
</b-tooltip>
</li>
<li
v-if="currentUserCanEdit"
:class="activeRoute == 'FiltersList' ? 'is-active':''"
class="level-item">
<b-tooltip
@ -163,6 +166,7 @@ export default {
},
props: {
id: Number,
currentUserCanEdit: Boolean
},
watch: {
'$route' (to, from) {

View File

@ -105,6 +105,14 @@ export default {
return this.getCollectionURL();
}
},
watch: {
'$route' (to, from) {
if (!this.isRepositoryLevel && from.path != undefined && to.path != from.path) {
this.collectionId = this.$route.params.collectionId;
this.fetchCollectionNameAndURL(this.collectionId);
}
}
},
methods: {
...mapActions('collection', [
'fetchCollectionNameAndURL'
@ -114,6 +122,7 @@ export default {
'getCollectionURL'
]),
openAvailableExportersModal(){
this.$modal.open({
parent: this,
component: AvailableExportersModal,
@ -124,12 +133,6 @@ export default {
}
});
}
},
mounted() {
if (!this.isRepositoryLevel) {
this.collectionId = this.$route.params.collectionId;
this.fetchCollectionNameAndURL(this.collectionId);
}
}
}
</script>
@ -180,7 +183,7 @@ export default {
h1 {
font-size: 1.125rem;
color: white;
line-height: 1.125rem;
line-height: 1.4rem;
max-width: 100%;
text-overflow: ellipsis;
white-space: nowrap;

View File

@ -7,6 +7,7 @@
<h2>{{ this.$i18n.get('exporters') }}</h2>
<hr>
</header>
<section class="tainacan-form">
<p>{{ $i18n.get('instruction_select_an_exporter_type') }}</p>
<div

View File

@ -299,14 +299,17 @@ export default {
availableExposers() {
let exposers = this.getAvailableExposers();
exposers.unshift({
accept_no_mapper: true,
class_name: 'API',
mappers: [],
name: this.$i18n.get('label_tainacan_api'),
description: this.$i18n.get('info_tainacan_api'),
slug: 'tainacan-api'
});
let tainacanApiExposerIndex = exposers.findIndex((aExposer) => aExposer.slug == 'tainacan-api');
if (tainacanApiExposerIndex < 0) {
exposers.unshift({
accept_no_mapper: true,
class_name: 'API',
mappers: [],
name: this.$i18n.get('label_tainacan_api'),
description: this.$i18n.get('info_tainacan_api'),
slug: 'tainacan-api'
});
}
return exposers;
}
},
@ -416,7 +419,7 @@ export default {
this.isLoading = false;
});
if (!this.collectionId != undefined) {
if (this.collectionId != undefined) {
this.fetchCollectionNameAndURL(this.collectionId);
}
}

View File

@ -75,6 +75,10 @@
font-size: 0.75rem;
margin-bottom: -0.375rem;
@media only screen and (max-width: 768px) {
padding-top: 1rem;
}
&.is-inline-flex {
flex-wrap: wrap;
justify-content: flex-start;

View File

@ -6,7 +6,6 @@
import Vue from 'vue';
import Buefy from 'buefy';
import VTooltip from 'v-tooltip';
// import { VueHammer } from 'vue2-hammer';
import VueMasonry from 'vue-masonry-css';
import draggable from 'vuedraggable';
import VueTheMask from 'vue-the-mask';
@ -49,7 +48,6 @@ import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCap
// Configure and Register Plugins
Vue.use(Buefy);
Vue.use(VTooltip);
// Vue.use(VueHammer);
Vue.use(VueMasonry);
Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin);

View File

@ -2,7 +2,6 @@
import Vue from 'vue';
import Buefy from 'buefy';
import VTooltip from 'v-tooltip';
// import { VueHammer } from 'vue2-hammer';
import VueMasonry from 'vue-masonry-css';
// Custom elements
@ -48,7 +47,6 @@ import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin } from '
// Configure and Register Plugins
Vue.use(Buefy);
Vue.use(VTooltip);
// Vue.use(VueHammer);
Vue.use(VueMasonry);
Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin);

View File

@ -168,7 +168,7 @@ export default {
loadCollections() {
this.cleanCollections();
this.isLoadingCollections = true;
this.fetchCollections({ 'page': 1, 'collectionsPerPage': 5 })
this.fetchCollections({ page: 1, collectionsPerPage: 5, status: undefined, contextEdit: true })
.then(() => {
this.isLoadingCollections = false;
})

View File

@ -1,10 +1,4 @@
<template>
<!-- <div <IF WE USE HAMMERJS>
v-hammer:swipe="onSwipeFiltersMenu"
:class="{
'repository-level-page': isRepositoryLevel,
'is-fullscreen': registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen
}"> -->
<div
:class="{
'repository-level-page': isRepositoryLevel,
@ -512,7 +506,7 @@
<button
class="button is-white"
:aria-label="$i18n.get('label_urls')"
:disabled="this.totalItems == undefined || this.totalItems <= 0"
:disabled="totalItems == undefined || totalItems <= 0"
@click="openExposersModal()">
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
@ -706,7 +700,7 @@
<!-- Empty Placeholder (only used in Admin) -->
<section
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
v-if="!isOnTheme && !isLoadingItems && totalItems == 0"
class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -1228,7 +1222,6 @@
}
}
}
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
@ -1293,20 +1286,32 @@
display: authorNameMetadatumDisplay
});
}
// Loads only basic attributes necessary to view modes that do not allow custom meta
} else {
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
metadata_type_object: {core: true, related_mapped_prop: 'title'},
metadata_type: undefined,
slug: 'title',
id: undefined,
display: true
});
if (this.isRepositoryLevel) {
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
metadata_type_object: {core: true, related_mapped_prop: 'title'},
metadata_type: undefined,
slug: 'title',
id: undefined,
display: true
});
}
for (let metadatum of this.metadata) {
if (metadatum.display !== 'never' &&
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({
name: this.$i18n.get('label_creation_date'),
@ -1352,7 +1357,7 @@
this.hasAnOpenModal = false;
},
hideCancel: true,
showNeverShowAgainOption: true,
showNeverShowAgainOption: tainacan_plugin.user_caps != undefined && tainacan_plugin.user_caps.length != undefined && tainacan_plugin.user_caps.length > 0,
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
}
});
@ -1402,7 +1407,7 @@
});
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
/* This condition is to prevent a incorrect fetch by filter or metadata when we coming from items
/* This condition is to prevent an incorrect fetch by filter or metadata when we coming from items
* at collection level to items page at repository level
*/
@ -1422,7 +1427,7 @@
},
mounted() {
this.prepareFilters();
this.prepareMetadata();
this.localDisplayedMetadata = JSON.parse(JSON.stringify(this.displayedMetadata));

View File

@ -1,10 +1,5 @@
<template>
<!-- <div <IF WE USE HAMMER JS>
v-hammer:swipe="onSwipeFiltersMenu"
:class="{
'repository-level-page': isRepositoryLevel,
'is-fullscreen': registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen
}"> -->
<div
:class="{
'repository-level-page': isRepositoryLevel,
@ -497,7 +492,7 @@
<button
class="button is-white"
:aria-label="$i18n.get('label_urls')"
:disabled="this.totalItems == undefined || this.totalItems <= 0"
:disabled="totalItems == undefined || totalItems <= 0"
@click="openExposersModal()">
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
@ -684,7 +679,7 @@
<!-- Empty Placeholder (only used in Admin) -->
<section
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
v-if="!isOnTheme && !isLoadingItems && totalItems == 0"
class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -1258,16 +1253,27 @@
} else {
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
metadata_type_object: {core: true, related_mapped_prop: 'title'},
metadata_type: undefined,
slug: 'title',
id: undefined,
display: true
});
if (this.isRepositoryLevel) {
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
metadata_type_object: {core: true, related_mapped_prop: 'title'},
metadata_type: undefined,
slug: 'title',
id: undefined,
display: true
});
}
for (let metadatum of this.metadata) {
if (metadatum.display !== 'never' &&
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({
name: this.$i18n.get('label_creation_date'),
@ -1305,7 +1311,7 @@
this.hasAnOpenModal = false;
},
hideCancel: true,
showNeverShowAgainOption: true,
showNeverShowAgainOption: tainacan_plugin.user_caps != undefined && tainacan_plugin.user_caps.length != undefined && tainacan_plugin.user_caps.length > 0,
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
}
});
@ -1361,7 +1367,7 @@
});
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
/* This condition is to prevent a incorrect fetch by filter or metadata when we come from items
/* This condition is to prevent an incorrect fetch by filter or metadata when we come from items
* at collection level to items page at repository level
*/

View File

@ -1,7 +1,9 @@
<template>
<div class="columns is-fullheight">
<section class="column is-secondary-content">
<tainacan-collection-subheader :id="collectionId"/>
<tainacan-collection-subheader
:current-user-can-edit="currentUserCanEdit"
:id="collectionId"/>
<router-view
id="collection-page-container"
@ -13,20 +15,32 @@
<script>
import TainacanCollectionSubheader from '../../components/navigation/tainacan-collection-subheader.vue';
import { mapActions } from 'vuex';
export default {
name: 'CollectionPage',
data(){
return {
collectionId: Number
collectionId: Number,
currentUserCanEdit: Boolean
}
},
components: {
TainacanCollectionSubheader
},
methods: {
...mapActions('collection', [
'fetchCollectionUserCanEdit'
])
},
created(){
this.collectionId = parseInt(this.$route.params.collectionId);
this.$eventBusSearch.setCollectionId(this.collectionId);
},
mounted() {
this.fetchCollectionUserCanEdit(this.collectionId).then((caps) => {
this.currentUserCanEdit = caps;
}).catch((error) => this.$console.error(error));
}
}
</script>

View File

@ -78,4 +78,5 @@ button.link-style:active {
.button:not(.is-small):not(.is-medium):not(.is-large) {
height: 1.875rem !important;
font-size: 0.875rem !important;
line-height: 1.5rem;
}

View File

@ -2,6 +2,12 @@
.modal .animation-content {
width: 100%;
}
.modal .modal-close {
z-index: 99999;
@media only screen and (max-width: 768px) {
&:before, &:after { background-color: #298596; }
}
}
.tainacan-modal-title {
display: flex;
@ -37,7 +43,8 @@
background-color: white;
padding: 40px 50px;
position: relative;
max-height: 100vh;
max-height: 86%;
max-height: 86vh;
overflow-y: auto;
overflow-x: hidden;
@ -52,6 +59,11 @@
.form-submit {
padding: 40px 0em 0.4em 0em !important;
}
@media only screen and (max-width: 768px) {
max-height: 100%;
max-height: 100vh;
}
}
// Bulma modals customized for Tainacan (custom-dialog.vue)
.dialog {

View File

@ -18,22 +18,29 @@
background-color: $blue5 !important;
color: white !important;
}
.has-text-primary, .has-text-primary:hover, .is-has-text-primary:focus {
color: $blue4 !important;
.dropdown .dropdown-menu .dropdown-content a.dropdown-item:hover {
color: black !important;
}
.has-text-primary,
.has-text-primary:hover,
.is-has-text-primary:focus,
a:not(.has-text-danger):not(.disabled),
a:hover:not(.has-text-danger):not(.disabled),
.has-text-secondary,
.has-text-secondary:hover,
.is-has-text-secondary:focus {
color: $blue3 !important;
color: $blue4 !important;
}
a.button.is-secondary {
a.button.is-secondary,
a.button.is-secondary:hover {
color: white !important;
}
.tainacan-page-title hr{
background-color: $blue3 !important;
}
button.link-style, button.link-style:focus button.link-style:active {
color: $blue4;
}
.button[disabled]:not(.is-white), .button:hover[disabled]:not(.is-white) {
border: none !important;
cursor: not-allowed !important;

View File

@ -83,6 +83,7 @@
// background-blend-mode
.skeleton {
background: #fff;
color: transparent !important;
}
}

View File

@ -19,7 +19,7 @@
<div class="wrap">
<h1><?php _e('Tainacan System Check', 'tainacan'); ?></h1>
<p><?php _e('This page checks your system against the Tainacan requirements. It helps you to find out wether your server is properly configured.', 'tainacan'); ?></p>
<p><?php _e('This page checks your system against the Tainacan requirements. It helps you to find out whether your server is properly configured.', 'tainacan'); ?></p>
<p><?php printf( __('If you want to have a more complete diagnosis of your current WordPress instance, we recommend you to install the %1$sHealth Check & Troubleshooting%2$s plugin.', 'tainacan'), '<a href="https://wordpress.org/plugins/health-check/" target="_blank">', '</a>' ); ?></p>

View File

@ -101,7 +101,7 @@ class System_Check {
if ( $time < $min ) {
$class = 'error';
$text = sprintf(
__('Your current configuratino is %ds. This is too little. Please increase it to at least 30s', 'tainacan'),
__('Your current configuration is %ds. This is too little. Please increase it to at least 30s', 'tainacan'),
$time
);
} elseif ( $time < $rec ) {
@ -113,7 +113,7 @@ class System_Check {
} else {
$class = 'good';
$text = sprintf(
__('Your current configuratino is %ds. This is excellent.', 'tainacan'),
__('Your current configuration is %ds. This is excellent.', 'tainacan'),
$time
);
}

View File

@ -6,7 +6,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'is_equal_to' => __( 'Equal', 'tainacan' ),
'is_not_equal_to' => __( 'Not equal', 'tainacan' ),
'contains' => __( 'Contains', 'tainacan' ),
'not_contains' => __( 'Not contains', 'tainacan' ),
'not_contains' => __( 'Do not contain', 'tainacan' ),
'greater_than' => __( 'Greater than', 'tainacan' ),
'less_than' => __( 'Less than', 'tainacan' ),
'greater_than_or_equal_to' => __( 'Greater than or equal to', 'tainacan' ),
@ -415,7 +415,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
'instruction_select_max_options_to_show' => __( 'Select max options to show', 'tainacan' ),
'instruction_select_collection_fetch_items' => __( 'Select a collection to fetch items', 'tainacan' ),
'instruction_select_a_action' => __( 'Select a action', 'tainacan' ),
'instruction_select_a_action' => __( 'Select an action', 'tainacan' ),
'instruction_parent_term' => __( 'Type to search a Parent Term to choose.', 'tainacan' ),
'instruction_type_existing_term' => __( 'Type to add an existing term...', 'tainacan' ),
'instruction_select_an_exporter_type' => __( 'Select an exporter from the options below:', 'tainacan'),

View File

@ -58,7 +58,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
],
'recent' => [
'type' => 'bool',
'description' => __( 'Return only processes created or updated recently', 'tainacan' ),
'description' => __( 'Returns only processes created or updated recently', 'tainacan' ),
],
],
),

View File

@ -181,6 +181,7 @@ class REST_Collections_Controller extends REST_Controller {
$item_arr['moderators'] = $moderators;
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
}
unset($item_arr['moderators_ids']);
@ -200,6 +201,7 @@ class REST_Collections_Controller extends REST_Controller {
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
}
$item_arr['url'] = get_permalink( $item_arr['id'] );

View File

@ -326,6 +326,7 @@ class REST_Filters_Controller extends REST_Controller {
if($request['context'] === 'edit'){
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
$item_arr['enabled'] = $item->get_enabled_for_collection();
}

View File

@ -100,6 +100,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
if($request['context'] === 'edit'){
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
}
return $item_arr;

View File

@ -161,6 +161,7 @@ class REST_Items_Controller extends REST_Controller {
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
}
$img_size = 'large';
@ -206,6 +207,7 @@ class REST_Items_Controller extends REST_Controller {
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
}
$item_arr['url'] = get_permalink( $item_arr['id'] );

View File

@ -295,6 +295,7 @@ class REST_Metadata_Controller extends REST_Controller {
if($request['context'] === 'edit'){
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
ob_start();
$item->get_metadata_type_object()->form();
$form = ob_get_clean();

View File

@ -100,6 +100,7 @@ class REST_Taxonomies_Controller extends REST_Controller {
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
$item_arr['collections'] = [];
if ( is_array($tax_collections = $item->get_collections()) ) {
foreach ($tax_collections as $tax_collection) {

View File

@ -261,6 +261,7 @@ class REST_Terms_Controller extends REST_Controller {
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
$item_arr['current_user_can_delete'] = $item->can_delete();
}
$children = get_terms([

View File

@ -55,13 +55,22 @@
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
right: -14px;
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button {
visibility: visible;
background-color: white !important;
opacity: 1;
right: 0px;
right: -8px;
top: -8px;
border: 1px solid #cbcbcb;
border-radius: 12px;
transition: opacity linear 0.15s, right linear 0.15s; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button:hover {
background-color: white !important;
border: 1px solid #cbcbcb !important; }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid {
@ -106,23 +115,6 @@
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item:hover a {
color: #454647;
text-decoration: none; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s; }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item {
@ -211,13 +203,22 @@
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
right: -14px;
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item:hover button {
visibility: visible;
background-color: white !important;
opacity: 1;
right: 0px;
right: -8px;
top: -8px;
border: 1px solid #cbcbcb;
border-radius: 12px;
transition: opacity linear 0.15s, right linear 0.15s; }
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item:hover button:hover {
background-color: white !important;
border: 1px solid #cbcbcb !important; }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-items-list ul.items-list.items-layout-grid,
.wp-block-tainacan-items-list ul.items-list-edit.items-layout-grid {
@ -262,38 +263,6 @@
.wp-block-tainacan-items-list ul.items-list-edit.items-layout-list li.item-list-item:hover a {
color: #454647;
text-decoration: none; }
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
.wp-block-tainacan-items-list ul.items-list-edit li.item-list-item:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s; }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: 30%;
width: 30%; } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: 45%;
width: 45%; } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-items-list ul.items-list.items-layout-list li.item-list-item,
.wp-block-tainacan-items-list ul.items-list-edit.items-layout-list li.item-list-item {
min-width: 100%;
width: 100%; } }
.wp-block-tainacan-collections-list {
margin: 2rem 0px; }
@ -367,13 +336,22 @@
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
right: -14px;
top: 0px;
justify-content: center;
z-index: 999; }
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item:hover button {
visibility: visible;
background-color: white !important;
opacity: 1;
right: 0px;
right: -8px;
top: -8px;
border: 1px solid #cbcbcb;
border-radius: 12px;
transition: opacity linear 0.15s, right linear 0.15s; }
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item:hover button:hover {
background-color: white !important;
border: 1px solid #cbcbcb !important; }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-collections-list ul.collections-list.collections-layout-grid,
.wp-block-tainacan-collections-list ul.collections-list-edit.collections-layout-grid {
@ -418,23 +396,6 @@
.wp-block-tainacan-collections-list ul.collections-list-edit.collections-layout-list li.collection-list-item:hover a {
color: #454647;
text-decoration: none; }
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
.wp-block-tainacan-collections-list ul.collections-list-edit li.collection-list-item:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s; }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-collections-list ul.collections-list.collections-layout-list li.collection-list-item,
.wp-block-tainacan-collections-list ul.collections-list-edit.collections-layout-list li.collection-list-item {

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@ class Core_Description extends Metadata_Type {
$this->set_related_mapped_prop('description');
$this->set_component('tainacan-textarea');
$this->set_name( __('Core Description', 'tainacan') );
$this->set_description( __('The fixed "Description" metadatum automatically created to all collection. This is the default description displayed in items lists and where basic search features will look', 'tainacan') );
$this->set_description( __('The "Core Description" is a compulsory metadata automatically created for all collections by default. This is the main description displayed in items lists and where the basic research tools will do their searches.', 'tainacan') );
}
/**

View File

@ -171,7 +171,7 @@
this.loadingMetadata = true;
this.hasMetadata = false;
axios.get('/collection/' + value + '/metadata/')
axios.get('/collection/' + value + '/metadata/?nopaging=1')
.then((res) => {
this.loadingMetadata = false;
let metadata = res.data;

View File

@ -55,8 +55,8 @@ class Relationship extends Metadata_Type {
'description' => __( 'Select the collection to fetch items', 'tainacan' ),
],
'search' => [
'title' => __( 'Metadata for search', 'tainacan' ),
'description' => __( 'Select the metadata to help the search', 'tainacan' ),
'title' => __( 'Metadata to search', 'tainacan' ),
'description' => __( 'Select the metadata to use as search criteria in the target collection', 'tainacan' ),
],
'repeated' => [
'title' =>__( 'Allow repeated items', 'tainacan' ),
@ -92,6 +92,13 @@ class Relationship extends Metadata_Type {
'collection_id' => __('The related collection is required','tainacan')
];
}
if ( !is_array($this->get_option('search')) ) {
return [
'search' => __('Search option must be an array','tainacan')
];
}
return true;
}

View File

@ -199,7 +199,7 @@ class Collections extends Repository {
'map' => 'comment_status',
'title' => __( 'Comment Status', 'tainacan' ),
'type' => 'string',
'description' => __( 'The status of collection comment, if is "open" the comments are allowed, or is "closed" for deny comments.', 'tainacan' ),
'description' => __( 'Collection comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
],
@ -207,7 +207,7 @@ class Collections extends Repository {
'map' => 'meta',
'title' => __( 'Allow Items Comments', 'tainacan' ),
'type' => 'string',
'description' => __( 'Collection items comment is allowed, if is "open" the comments are allowed for collection items, or is "closed" for deny comments to items.', 'tainacan' ),
'description' => __( 'Collection items comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
'default' => 'open',
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
]

View File

@ -111,7 +111,7 @@ class Items extends Repository {
'map' => 'comment_status',
'title' => __( 'Comment Status', 'tainacan' ),
'type' => 'string',
'description' => __( 'The status of item comment, if is "open" the comments are allowed to item, or is "closed" for deny comments to item.', 'tainacan' ),
'description' => __( 'Item comment status: "open" means comments are allowed, "closed" means comments are not allowed.', 'tainacan' ),
'default' => get_default_comment_status(Entities\Collection::get_post_type()),
'validation' => v::optional(v::stringType()->in( [ 'open', 'closed' ] )),
]

View File

@ -274,14 +274,14 @@ class Terms extends Repository {
/**
* Check if a term already exists
*
* @param string $term_name The term name
* @param string $searched_term The term name (string) or term_id (integer). If term id is passed, parent is not considered.
* @param mixed $taxonomy The taxonomy ID, slug or Entity.
* @param int $parent The ID of the parent term to look for children or null to look for terms in any hierarchical position. Default is null
* @param bool $return_term wether to return the term object if it exists. default is to false
*
* @return bool|WP_Term return boolean indicating if term exists. If $return_term is true and term exists, return WP_Term object
*/
public function term_exists($name, $taxonomy, $parent = null, $return_term = false) {
public function term_exists($searched_term, $taxonomy, $parent = null, $return_term = false) {
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
@ -293,36 +293,39 @@ class Terms extends Repository {
$taxonomy_slug = $taxonomy->get_db_identifier();
}
if(is_numeric($name)){
$args = [
'id' => (int) $name,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
if(is_int($searched_term)){
$term = get_term_by( 'id', $searched_term, $taxonomy_slug );
if ( ! $term ) {
return false;
}
} else {
$args = [
'name' => $name,
'name' => $searched_term,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
}
if (is_null($parent)) {
unset($args['parent']);
}
$terms = get_terms($args);
if (empty($terms)) {
return false;
if (is_null($parent)) {
unset($args['parent']);
}
$terms = get_terms($args);
if (empty($terms)) {
return false;
}
$term = $terms[0];
}
if ($return_term) {
return $terms[0];
return $term;
}
return true;

View File

@ -88,16 +88,26 @@
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
right: -14px;
top: 0px;
justify-content: center;
z-index: 999
}
&:hover button {
visibility: visible;
background-color: rgba(255, 255, 255, 1) !important;
opacity: 1;
right: 0px;
right: -8px;
top: -8px;
border: 1px solid #cbcbcb;
border-radius: 12px;
transition: opacity linear 0.15s, right linear 0.15s;
}
&:hover button:hover {
background-color: rgba(255, 255, 255, 1) !important;
border: 1px solid #cbcbcb !important;
}
}
@media only screen and (max-width: 498px) {
@ -156,30 +166,6 @@
}
}
}
ul.collections-list-edit li.collection-list-item {
button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center;
}
&:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s;
}
}
@media only screen and (max-width: 1600px) {
ul.collections-list.collections-layout-list li.collection-list-item,

View File

@ -172,7 +172,7 @@ registerBlockType('tainacan/items-list', {
html: false,
},
edit({ attributes, setAttributes, className, isSelected }){
let {
let {
selectedItemsObject,
selectedItemsHTML,
temporarySelectedItems,

View File

@ -88,16 +88,26 @@
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
right: -14px;
top: 0px;
justify-content: center;
z-index: 999;
}
&:hover button {
visibility: visible;
background-color: rgba(255, 255, 255, 1) !important;
opacity: 1;
right: 0px;
right: -8px;
top: -8px;
border: 1px solid #cbcbcb;
border-radius: 12px;
transition: opacity linear 0.15s, right linear 0.15s;
}
&:hover button:hover {
background-color: rgba(255, 255, 255, 1) !important;
border: 1px solid #cbcbcb !important;
}
}
@media only screen and (max-width: 498px) {
@ -156,53 +166,4 @@
}
}
}
ul.items-list-edit li.item-list-item {
button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center;
}
&:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s;
}
}
@media only screen and (max-width: 1600px) {
ul.items-list.items-layout-list li.item-list-item,
ul.items-list-edit.items-layout-list li.item-list-item {
min-width: 30%;
width: 30%;
}
}
@media only screen and (max-width: 1024px) {
ul.items-list.items-layout-list li.item-list-item,
ul.items-list-edit.items-layout-list li.item-list-item {
min-width: 45%;
width: 45%;
}
}
@media only screen and (max-width: 768px) {
ul.items-list.items-layout-list li.item-list-item,
ul.items-list-edit.items-layout-list li.item-list-item {
min-width: 100%;
width: 100%;
}
}
}

View File

@ -70,16 +70,26 @@
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
right: -14px;
top: 0px;
justify-content: center;
z-index: 999
}
&:hover button {
visibility: visible;
background-color: rgba(255, 255, 255, 1) !important;
opacity: 1;
right: 0px;
right: -8px;
top: -8px;
border: 1px solid #cbcbcb;
border-radius: 12px;
transition: opacity linear 0.15s, right linear 0.15s;
}
&:hover button:hover {
background-color: rgba(255, 255, 255, 1) !important;
border: 1px solid #cbcbcb !important;
}
}
@media only screen and (max-width: 498px) {
@ -138,31 +148,7 @@
}
}
}
ul.terms-list-edit li.term-list-item {
button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center;
}
&:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s;
}
}
@media only screen and (max-width: 1600px) {
ul.terms-list.terms-layout-list li.term-list-item,
ul.terms-list-edit.terms-layout-list li.term-list-item {

View File

@ -53,8 +53,8 @@ class Importer_Handler {
]);
$this->register_importer([
'name' => 'OAI PMH',
'description' => __('Import structure from a OAI PMH repository', 'tainacan'),
'name' => 'OAI-PMH (Experimental)',
'description' => __('Import items from an OAI-PMH data source', 'tainacan'),
'slug' => 'oaipmh_importer',
'class_name' => '\Tainacan\Importer\Oaipmh_Importer',
'manual_collection' => false,

View File

@ -96,8 +96,18 @@ class Oaipmh_Importer extends Importer {
while ( isset($xml->ListRecords->record[$j]) ) {
$record = $record = $xml->ListRecords->record[$j];
$dc = $record->metadata->children("http://www.openarchives.org/OAI/2.0/oai_dc/");
$header = $record->header;
// TODO: add sets if is necessary
$is_inserted = $this->get_transient($header->identifier);
if( $is_inserted ){
continue;
}
if( $this->get_option('using_set') == 'taxonomy' && ( isset($header) && isset($header->setSpec) ) ){
foreach ($header->setSpec as $item ) {
$record_processed['sets'][] = (string) $item;
}
}
if ($record->metadata->Count() > 0 ) {
$metadata = $dc->children('http://purl.org/dc/elements/1.1/');
@ -162,7 +172,7 @@ class Oaipmh_Importer extends Importer {
}
} else if( $this->get_option('using_set') == 'taxonomy') {
$collection = $this->create_collection( 'set', $this->NAME_FOR_SETS );
$collection = $this->create_collection( 'set', $this->getRepoName() );
$metadata_map = $this->create_collection_metadata($collection);
$total = intval( $this->get_total_items_from_source(false) );
$this->add_log('total in collection: ' . $total);
@ -174,11 +184,20 @@ class Oaipmh_Importer extends Importer {
$tax->set_status('publish');
if ($tax->validate()) {
$tax = $this->tax_repo->insert($tax);
$is_tax_created = $this->get_transient('set_taxonomy_id');
if( $is_tax_created ){
$tax = new Entities\Taxonomy( $is_tax_created );
} else {
$tax = $this->tax_repo->insert($tax);
$this->add_transient('set_taxonomy_id', $tax->get_id());
}
$metadatum_set_id = $this->create_set_metadata( $collection->get_id(), $tax->get_id() );
if( $metadatum_set_id ){
$this->add_transient('set_metadatum_id', $metadatum_set_id);
$this->add_collection([
'id' => $collection->get_id(),
'mapping' => $metadata_map,
@ -208,7 +227,14 @@ class Oaipmh_Importer extends Importer {
}
return false;
$resumptionToken = $this->get_transient('collection_resump');
if( $resumptionToken !== ''){
return 1;
} else {
return false;
}
}
/**
@ -238,10 +264,33 @@ class Oaipmh_Importer extends Importer {
if( $record && $item->validate() ){
$insertedItem = $this->items_repo->insert( $item );
if( isset($record['sets']) ){
$terms = [];
$metadatum_set_id = $this->get_transient('set_metadatum_id');
foreach ($record['sets'] as $set) {
$term_id = $this->get_transient($set);
if( $term_id ) $terms[] = $term_id;
}
if( $metadatum_set_id && $terms ){
$newMetadatum = new Entities\Metadatum($metadatum_set_id);
$item_metadata = new Entities\Item_Metadata_Entity( $insertedItem, $newMetadatum );
$item_metadata->set_value($terms);
if( $item_metadata->validate() ){
$this->item_metadata_repo->insert( $item_metadata );
}
}
unset($record['sets']);
}
foreach ( $record as $index => $value ){
$this->add_log( $index . ' ' . serialize($map) );
$this->add_log( $insertedItem->get_id() );
$this->add_log( 'inserting metadata ' . $index );
if( in_array( $index, $map ) && $insertedItem->get_id()){
$metadatum_id = array_search($index, $map );
$newMetadatum = new Entities\Metadatum($metadatum_id);
@ -340,6 +389,12 @@ class Oaipmh_Importer extends Importer {
* @return Entities\Collection
*/
protected function create_collection( $setSpec, $setName ){
$is_created = $this->get_transient('collection_' . $setSpec. '_name');
if( $is_created ){
$new_collection = new Entities\Collection( $is_created );
return $new_collection;
}
$new_collection = new Entities\Collection();
$new_collection->set_name($setName);
$new_collection->set_status('publish');
@ -420,8 +475,14 @@ class Oaipmh_Importer extends Importer {
if($metadatum->validate()){
$new_metadata = $Tainacan_Metadata->insert($metadatum);
$array_metadata[$new_metadata->get_id()] = $slug;
$metadatum_id_created = $this->get_transient('collection_' . $id . '_' . $slug );
if( $metadatum_id_created ){
$array_metadata[$metadatum_id_created] = $slug;
} else {
$new_metadata = $Tainacan_Metadata->insert($metadatum);
$array_metadata[$new_metadata->get_id()] = $slug;
}
}
}
}
@ -436,8 +497,14 @@ class Oaipmh_Importer extends Importer {
protected function fetch_collections(){
$collections_array = [];
// block terms with same set spec
$resumptionToken = $this->get_transient('collection_resump');
if( $resumptionToken ){
$collections_link = $this->get_url() . "?verb=ListSets&resumptionToken=" . $resumptionToken;
} else {
$collections_link = $this->get_url() . "?verb=ListSets";
}
$collections_link = $this->get_url() . "?verb=ListSets";
$collections = $this->requester($collections_link);
$xml = $this->decode_request($collections, $collections_link);
@ -448,19 +515,10 @@ class Oaipmh_Importer extends Importer {
}
}
while ( isset($xml->ListSets) && isset($xml->ListSets->resumptionToken) ){
$resumptionToken = (string) $xml->ListSets->resumptionToken;
$collections_link = $this->get_url() . "?verb=ListSets&resumptionToken=" . $resumptionToken;
$collections = $this->requester($collections_link);
$xml = $this->decode_request($collections, $collections_link);
if( isset($xml->ListSets->set) ) {
foreach ($xml->ListSets->set as $set) {
$collections_array[] = $set;
}
}
if( isset($xml->ListSets) && isset($xml->ListSets->resumptionToken) ){
$this->add_transient('collection_resump',(string) $xml->ListSets->resumptionToken);
} else {
$this->add_transient('collection_resump', (string) $xml->ListSets->resumptionToken);
}
return ($collections_array) ? $collections_array : [];
@ -606,11 +664,19 @@ class Oaipmh_Importer extends Importer {
$newMetadatum->set_collection_id( (isset($collection_id)) ? $collection_id : 'default');
$newMetadatum->set_status('publish');
$newMetadatum->set_metadata_type_options(['taxonomy_id' => $taxonomy_id ]);
$newMetadatum->set_multiple('yes');
if($newMetadatum->validate()){
$inserted_metadata = $this->metadata_repo->insert( $newMetadatum );
$is_meta_created = $this->get_transient('set_metadatum_id');
if( $is_meta_created ){
$inserted_metadata = new Entities\Metadatum($is_meta_created);
$this->add_log('Metadata created: ' . $inserted_metadata->get_name());
$this->add_log('Metadata get: ' . $inserted_metadata->get_name());
} else {
$inserted_metadata = $this->metadata_repo->insert( $newMetadatum );
$this->add_log('Metadata created: ' . $inserted_metadata->get_name());
}
return $inserted_metadata->get_id();
} else{
@ -618,6 +684,31 @@ class Oaipmh_Importer extends Importer {
}
}
public function getRepoName(){
$info = $this->requester( $this->get_url() . "?verb=Identify");
if( !isset($info['body']) ){
$this->add_log('ERROR on get repo name');
$this->add_error_log('Error in fetch remote total items');
$this->abort();
return __('Imported Repo');
} else {
try {
$xml = new \SimpleXMLElement($info['body']);
if( isset($xml->Identify) && isset($xml->Identify->repositoryName) ){
return (string) $xml->Identify->repositoryName;
}
} catch (Exception $e) {
return __('Imported Repo');
}
return __('Imported Repo');
}
}
public function options_form(){
ob_start();
?>
@ -640,7 +731,7 @@ class Oaipmh_Importer extends Importer {
</span>
<div class="control is-clearfix">
<div class="select">
<select disabled name="using_set">
<select name="using_set">
<option value="collection" <?php selected($this->get_option('using_set'), 'collection'); ?> ><?php _e('Collections', 'tainacan'); ?></option>
<option value="taxonomy" <?php selected($this->get_option('using_set'), 'taxonomy'); ?> ><?php _e('Taxonomies', 'tainacan'); ?></option>
</select>

View File

@ -272,6 +272,9 @@ export default {
this.$store.dispatch('search/setStatus', status);
this.updateURLQueries();
},
setTotalItems(totalItems) {
this.$store.dispatch('search/setTotalItems', totalItems);
},
setSearchQuery(searchQuery) {
this.$store.dispatch('search/setSearchQuery', searchQuery);
this.updateURLQueries();
@ -351,6 +354,7 @@ export default {
},
setCollectionId(collectionId) {
this.setTotalItems(null);
this.collectionId = collectionId;
},
setTerm(termId, taxonomy) {

View File

@ -92,8 +92,7 @@ export const cleanProcesses = ({ commit }) => {
export const deleteProcess = ({ commit }, id) => {
return new Promise((resolve, reject) => {
axios.tainacan.delete('/bg-process/' + id)
.then( res => {
axios.tainacan.delete('/bg-process/' + id).then( res => {
commit('deleteProcess', { id: id });
resolve( res );
}).catch((error) => {

View File

@ -204,6 +204,20 @@ export const fetchCollectionName = ({ commit }, id) => {
});
};
export const fetchCollectionUserCanEdit = ({ commit }, id) => {
return new Promise ((resolve, reject) => {
axios.tainacan.get('/collections/' + id + '?context=edit&fetch_only=current_user_can_edit')
.then(res => {
let caps = res.data.current_user_can_edit;
resolve( caps );
})
.catch(error => {
reject(error);
})
});
};
export const fetchCollectionTotalItems = ({ commit }, id) => {
return new Promise ((resolve, reject) => {

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,9 @@
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila
Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 4.8
Tested up to: 5.0.2
Tested up to: 5.1.1
Requires PHP: 5.6
Stable tag: 0.7
Stable tag: 0.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -4,7 +4,7 @@ Plugin Name: Tainacan
Plugin URI: https://tainacan.org/
Description: powerfull and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional respository platform.
Author: Media Lab / UFG
Version: 0.7
Version: 0.8
Text Domain: tainacan
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -378,6 +378,9 @@ function tainacan_get_initials($string, $one = false) {
if (empty($string)) {
return '';
}
$string = remove_accents($string);
if (strlen($string) == 1) {
return strtoupper($string);
}

View File

@ -141,9 +141,7 @@
</button>
<div
class="slide-main-content">
<!-- <div <IF WE USE HAMMER JS>
class="slide-main-content"
v-hammer:swipe.prevent="onSwipeFiltersMenu"> -->
<transition
mode="out-in"
:name="goingRight ? 'slide-right' : 'slide-left'" >

View File

@ -174,7 +174,7 @@ class Taxonomies extends TAINACAN_UnitTestCase {
// testing passing taxonomy object
$this->assertTrue( $Tainacan_Terms->term_exists('Rock', $taxonomy) );
// testing passing ID
// testing passing taxonomy ID
$this->assertTrue( $Tainacan_Terms->term_exists('Rock', $taxonomy->get_id()) );
// testing via Taxonomy object
@ -189,6 +189,20 @@ class Taxonomies extends TAINACAN_UnitTestCase {
$this->assertFalse( $Tainacan_Terms->term_exists('Child', $taxonomy->get_db_identifier(), 0) ); // parent 0
$this->assertTrue( $Tainacan_Terms->term_exists('Child', $taxonomy->get_db_identifier(), $parent->get_id()) ); // parent
// test with ID
$this->assertTrue( $Tainacan_Terms->term_exists($term->get_id(), $taxonomy->get_id()) );
// test get term
$test_term = $Tainacan_Terms->term_exists($term->get_id(), $taxonomy->get_id(), null, true);
$this->assertEquals($term->get_id(), $test_term->term_id);
$test_term = $Tainacan_Terms->term_exists('Rock', $taxonomy->get_id(), null, true);
$this->assertEquals($term->get_id(), $test_term->term_id);
$test_term = $Tainacan_Terms->term_exists('Parent', $taxonomy->get_id(), null, true);
$this->assertEquals($parent->get_id(), $test_term->term_id);
}
function test_term_validation() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 35 KiB