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

This commit is contained in:
Leo Germani 2018-06-07 14:21:58 -03:00
commit b22dd954ca
16 changed files with 487 additions and 307 deletions

View File

@ -140,6 +140,7 @@
import { mapActions, mapGetters } from 'vuex';
import TermsList from '../lists/terms-list.vue'
import htmlToJSON from 'html-to-json';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'CategoryEditionForm',
@ -194,20 +195,20 @@
formNotSaved = true;
if (formNotSaved) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_category_not_saved'),
onConfirm: () => {
next();
},
icon: 'alert-circle',
hasIcon: true,
cancelText: this.$i18n.get('cancel'),
confirmText: this.$i18n.get('continue'),
type: 'is-success'
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_category_not_saved'),
onConfirm: () => {
next();
}
}
});
} else {
next()
next();
}
},
methods: {

View File

@ -336,6 +336,7 @@ import { mapActions, mapGetters } from 'vuex';
import { eventBus } from '../../../js/event-bus-web-components.js'
import wpMediaFrames from '../../js/wp-media-frames';
import FileItem from '../other/file-item.vue';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'ItemEditionForm',
@ -675,17 +676,17 @@ export default {
},
beforeRouteLeave ( to, from, next ) {
if (this.item.status == 'auto-draft') {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => {
next();
},
icon: 'alert-circle',
hasIcon: true,
cancelText: this.$i18n.get('cancel'),
confirmText: this.$i18n.get('continue'),
type: 'is-success'
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => {
next();
},
}
});
} else {
next()

View File

@ -132,7 +132,8 @@
</template>
<script>
import { mapActions } from 'vuex'
import { mapActions } from 'vuex';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'CategoriesList',
@ -179,73 +180,77 @@
this.selectedCategories.splice(i, 1, !this.allCategoriesOnPageSelected);
},
deleteOneCategory(categoryId) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_category_delete'),
onConfirm: () => {
this.deleteCategory(categoryId)
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_category_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: true
// });
for (let i = 0; i < this.selectedCategories.length; i++) {
if (this.selectedCategories[i].id === this.categoryId)
this.selectedCategories.splice(i, 1);
}
})
.catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_category'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: true
// });
});
},
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
});
},
deleteSelectedCategories() {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_selected_categories_delete'),
onConfirm: () => {
for (let i = 0; i < this.categories.length; i++) {
if (this.selectedCategories[i]) {
this.deleteCategory(this.categories[i].id)
.then(() => {
// this.loadCategories();
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_category_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: false
// })
}).catch(() => {
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_category_delete'),
onConfirm: () => {
this.deleteCategory(categoryId)
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_category_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: true
// });
for (let i = 0; i < this.selectedCategories.length; i++) {
if (this.selectedCategories[i].id === this.categoryId)
this.selectedCategories.splice(i, 1);
}
})
.catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_category'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: false
// queue: true
// });
});
}
}
this.allCategoriesOnPageSelected = false;
},
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}
});
},
deleteSelectedCategories() {
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_selected_categories_delete'),
onConfirm: () => {
for (let i = 0; i < this.categories.length; i++) {
if (this.selectedCategories[i]) {
this.deleteCategory(this.categories[i].id)
.then(() => {
// this.loadCategories();
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_category_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: false
// })
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_category'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: false
// });
});
}
}
this.allCategoriesOnPageSelected = false;
}
}
});
},
goToCategoryPage(categoryId) {

View File

@ -181,7 +181,8 @@
</template>
<script>
import { mapActions } from 'vuex'
import { mapActions } from 'vuex';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'CollectionsList',
@ -229,72 +230,77 @@ export default {
this.selectedCollections.splice(i, 1, !this.allCollectionsOnPageSelected);
},
deleteOneCollection(collectionId) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_collection_delete') : this.$i18n.get('info_warning_collection_trash'),
onConfirm: () => {
this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash })
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_collection_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: true
// });
for (let i = 0; i < this.selectedCollections.length; i++) {
if (this.selectedCollections[i].id == collectionId)
this.selectedCollections.splice(i, 1);
}
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_collection'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: true
// })
});
},
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_collection_delete') : this.$i18n.get('info_warning_collection_trash'),
onConfirm: () => {
this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash })
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_collection_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: true
// });
for (let i = 0; i < this.selectedCollections.length; i++) {
if (this.selectedCollections[i].id == collectionId)
this.selectedCollections.splice(i, 1);
}
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_collection'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: true
// })
});
}
}
});
},
deleteSelectedCollections() {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_collections_delete') : this.$i18n.get('info_warning_selected_collections_trash'),
onConfirm: () => {
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_collections_delete') : this.$i18n.get('info_warning_selected_collections_trash'),
onConfirm: () => {
for (let i = 0; i < this.collections.length; i++) {
if (this.selectedCollections[i]) {
this.deleteCollection({ collectionId: this.collections[i].id, isPermanently: this.isOnTrash })
.then(() => {
// this.loadCollections();
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_collection_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: false
// })
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_collection'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: false
// });
});
for (let i = 0; i < this.collections.length; i++) {
if (this.selectedCollections[i]) {
this.deleteCollection({ collectionId: this.collections[i].id, isPermanently: this.isOnTrash })
.then(() => {
// this.loadCollections();
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_collection_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: false
// })
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_collection'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: false
// });
});
}
}
}
this.allCollectionsOnPageSelected = false;
},
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
this.allCollectionsOnPageSelected = false;
},
}
});
},
goToCollectionPage(collectionId) {

View File

@ -149,6 +149,7 @@
import { mapActions, mapGetters } from 'vuex';
import GripIcon from '../other/grip-icon.vue';
import FieldEditionForm from './../edition/field-edition-form.vue';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'FieldsList',
@ -195,18 +196,18 @@ export default {
hasUnsavedForms = true;
}
if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_fields_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
icon: 'alert-circle',
hasIcon: true,
cancelText: this.$i18n.get('cancel'),
confirmText: this.$i18n.get('continue'),
type: 'is-success'
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_fields_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
}
});
} else {
next()

View File

@ -177,6 +177,7 @@
import { mapActions, mapGetters } from 'vuex';
import GripIcon from '../other/grip-icon.vue';
import FilterEditionForm from './../edition/filter-edition-form.vue';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'FiltersList',
@ -221,18 +222,18 @@ export default {
hasUnsavedForms = true;
}
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
icon: 'alert-circle',
hasIcon: true,
cancelText: this.$i18n.get('cancel'),
confirmText: this.$i18n.get('continue'),
type: 'is-success'
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
}
});
} else {
next()

View File

@ -315,6 +315,7 @@
<script>
import { mapActions } from 'vuex';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'ItemsList',
@ -362,77 +363,81 @@ export default {
this.selectedItems.splice(i, 1, !this.allItemsOnPageSelected);
},
deleteOneItem(itemId) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'),
onConfirm: () => {
this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash })
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_item_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: true
// });
for (let i = 0; i < this.selectedItems.length; i++) {
if (this.selectedItems[i].id == itemId)
this.selectedItems.splice(i, 1);
}
}).catch(() => {
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'),
onConfirm: () => {
this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash })
// .then(() => {
// // this.$toast.open({
// // duration: 3000,
// // message: this.$i18n.get('info_item_deleted'),
// // position: 'is-bottom',
// // type: 'is-secondary',
// // queue: true
// // });
// for (let i = 0; i < this.selectedItems.length; i++) {
// if (this.selectedItems[i].id == itemId)
// this.selectedItems.splice(i, 1);
// }
// }).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_item'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: true
// })
});
},
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
// // this.$toast.open({
// // duration: 3000,
// // message: this.$i18n.get('info_error_deleting_item'),
// // position: 'is-bottom',
// // type: 'is-danger',
// // queue: true
// // })
// });
}
}
});
},
deleteSelectedItems() {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'),
onConfirm: () => {
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'),
onConfirm: () => {
for (let i = 0; i < this.selectedItems.length; i++) {
if (this.selectedItems[i]) {
this.deleteItem({ itemId: this.items[i].id, isPermanently: this.isOnTrash })
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_item_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: false
// });
for (let i = 0; i < this.selectedItems.length; i++) {
if (this.selectedItems[i].id == this.itemId)
this.selectedItems.splice(i, 1);
}
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_item'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: false
// });
});
for (let i = 0; i < this.selectedItems.length; i++) {
if (this.selectedItems[i]) {
this.deleteItem({ itemId: this.items[i].id, isPermanently: this.isOnTrash })
.then(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_item_deleted'),
// position: 'is-bottom',
// type: 'is-secondary',
// queue: false
// });
for (let i = 0; i < this.selectedItems.length; i++) {
if (this.selectedItems[i].id == this.itemId)
this.selectedItems.splice(i, 1);
}
}).catch(() => {
// this.$toast.open({
// duration: 3000,
// message: this.$i18n.get('info_error_deleting_item'),
// position: 'is-bottom',
// type: 'is-danger',
// queue: false
// });
});
}
}
this.allItemsOnPageSelected = false;
}
this.allItemsOnPageSelected = false;
},
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}
});
},
goToItemPage(item) {

View File

@ -85,7 +85,8 @@
<script>
import { mapActions, mapGetters } from 'vuex';
import TermEditionForm from '../edition/term-edition-form.vue'
import TermEditionForm from '../edition/term-edition-form.vue';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'TermsList',
@ -212,16 +213,15 @@ export default {
// Checks if user is deleting a term with unsaved info.
if (term.id == 'new' || !term.saved || term.opened) {
this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_terms_not_saved'),
onCancel: () => { return },
onConfirm: () => { this.removeTerm(term); },
icon: 'alert-circle',
hasIcon: true,
cancelText: this.$i18n.get('cancel'),
confirmText: this.$i18n.get('continue'),
type: 'is-success'
this.$modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_terms_not_saved'),
onConfirm: () => { this.removeTerm(term); },
}
});
} else{
this.removeTerm(term);

View File

@ -0,0 +1,25 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width="6.44px"
height="32.202px"
viewBox="0 0 6.44 32.202"
enable-background="new 0 0 6.44 32.202"
xml:space="preserve">
<path
fill="#BB3636"
d="M0,25.761h6.44v6.44H0V25.761 M0,0h6.44v19.321H0V0"/>
</svg>
</template>
<script>
export default {
name: 'AlertIcon'
}
</script>

View File

@ -0,0 +1,25 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width="38.819px"
height="29.746px"
viewBox="0 0 38.819 29.746"
enable-background="new 0 0 38.819 29.746"
xml:space="preserve">
<path
fill="#259F87"
d="M38.819,3.128L12.2,29.746L0,17.546l3.128-3.128l9.073,9.05L35.691,0L38.819,3.128z"/>
</svg>
</template>
<script>
export default {
name: 'CheckIcon'
}
</script>

View File

@ -0,0 +1,57 @@
<template>
<div class="tainacan-form dialog">
<div
class="modal-card"
style="width: auto">
<div
v-if="icon != undefined && icon != ''"
class="modal-custom-icon">
<component :is="icon + '-icon'"/>
</div>
<section
class="modal-card-body">
<header
class="modal-card-head">
<h1 class="modal-card-title">{{ title }}</h1>
</header>
{{ message }}
</section>
<footer class="modal-card-foot form-submit">
<button
class="button is-outline"
type="button"
@click="$parent.close()">
{{ $i18n.get('cancel') }}
</button>
<button
class="button is-success"
@click="onConfirm(); $parent.close();">
{{ $i18n.get('continue') }}
</button>
</footer>
</div>
</div>
</template>
<script>
import AlertIcon from './alert-icon.vue';
import CheckIcon from './check-icon.vue';
import QuestionIcon from './question-icon.vue';
export default {
name: 'CustomDialog',
props: {
title: String,
message: String,
icon: String,
onConfirm: {
type: Function,
default: () => {}
}
},
components: {
AlertIcon,
CheckIcon,
QuestionIcon
}
}
</script>

View File

@ -0,0 +1,28 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width="19.749px"
height="33.073px"
viewBox="0 0 19.749 33.073"
enable-background="new 0 0 19.749 33.073"
xml:space="preserve">
<path
fill="#BB3636"
d="M6.615,28.112h4.961v4.961H6.615V28.112 M9.922,0c8.847,0.364,12.7,9.293,7.441,15.991
c-1.373,1.654-3.588,2.745-4.68,4.134c-1.108,1.373-1.108,3.026-1.108,4.68H6.615c0-2.762,0-5.093,1.108-6.747
c1.091-1.654,3.307-2.629,4.68-3.721c4.002-3.704,3.01-8.946-2.48-9.376c-2.74,0-4.961,2.221-4.961,4.961H0C0,4.442,4.442,0,9.922,0
z"/>
</svg>
</template>
<script>
export default {
name: 'QuestionIcon'
}
</script>

View File

@ -43,32 +43,42 @@
background-color: $modal-backgound-color;
color: $secondary;
border-radius: 10px;
flex-wrap: wrap;
flex-direction: row;
padding: 35px;
margin: 0 auto !important;
.modal-card-head, .modal-card-body, .modal-card-foot {
background-color: $modal-backgound-color;
color: $secondary;
border: none;
padding-bottom: 12px;
}
.modal-custom-icon {
background-color: white;
border-radius: 50px;
height: 80px;
width: 80px;
display: flex;
align-items: center;
justify-content: center;
}
.modal-card-head {
p { color: $secondary; }
h1 {
color: $secondary;
}
font-weight: normal;
padding: 30px 35px 0px 35px;
padding: 0;
margin-bottom: 12px;
}
.modal-card-body {
padding: 16px 35px;
i {
color: white !important;
&::before {
background-color: $danger;
border-radius: 55px;
display: initial;
}
}
padding: 0px 0px 0px 16px;
width: 50%;
}
.modal-card-foot {
justify-content: space-between;
padding: 0px 35px 30px 35px;
padding: 24px 0px 0px 0px;
width: 100%;
.button {
border-radius: 6px !important;

View File

@ -185,6 +185,10 @@
a {
margin: auto;
font-size: 18px !important;
.mdi-settings, .mdi-settings::before {
font-size: 23px;
}
}
}

View File

@ -8,8 +8,12 @@
namespace Tainacan\Importer;
class Old_Tainacan extends Importer
{
class Old_Tainacan extends Importer{
protected $manual_mapping = true;
protected $manual_collection = true;
public function __construct()
{
parent::__construct();
@ -26,39 +30,27 @@ class Old_Tainacan extends Importer
'socialdb_property_fixed_content',
'socialdb_property_fixed_thumbnail',
'socialdb_property_fixed_attachments'
],
$steps = [
//'Creating all categories' => 'create_categories',
//'Create empty collections' => 'create_collections',
//'Creating relationships metadata' => 'create_relationships_meta',
//'Create repository metadata' => 'treat_repo_meta',
//'Create collections metadata' => 'treat_collection_metas',
[
'name' => 'Create categories, collections and metadata',
'callback' => 'process_collections'
],
[
'name' => 'Import Items',
'callback' => 'process_collections'
],
[
'name' => 'Finishing',
'callback' => 'clear'
]
], $tainacan_api_address, $wordpress_api_address;
protected $steps = [
[
'name' => 'Creating all categories',
'callback' => 'create_categories'
],
[
'name' => 'Create empty collections' ,
'callback' => 'create_collections'
],
[
'name' => 'Creating relationships metadata' ,
'callback' => 'create_relationships_meta'
],
[
'name' => 'Create repository metadata' ,
'callback' => 'treat_repo_meta'
],
[
'name' => 'Create collections metadata' ,
'callback' => 'treat_collection_metas'
],
[
'name' => 'Create collections items' ,
'callback' => 'create_collection_items'
],
[
'name' => "Finishing" ,
'callback' => 'clear'
]
],
public function create_categories()
{
@ -673,12 +665,13 @@ class Old_Tainacan extends Importer
* get values for a single item
*
* @param $index
* @param $collection_id
* @return array with field_source's as the index and values for the
* item
*
* Ex: [ 'Field1' => 'value1', 'Field2' => [ 'value2','value3' ]
*/
public function process_item($index)
public function process_item( $index, $collection_id )
{
$processedItem = [];
$headers = $this->get_fields();
@ -779,6 +772,7 @@ class Old_Tainacan extends Importer
{
}
/**
* Method implemented by the child importer class to return the number of items to be imported
* @return int
@ -794,4 +788,19 @@ class Old_Tainacan extends Importer
return $this->total_items = $file_content->found_items;
}
/**
* Method implemented by the child importer class to return the number of items to be imported
* @return int
*/
public function get_progress_total_from_source(){
}
/**
* Method implemented by the child importer class to return the number of items to be imported
* @return int
*/
public function get_source_fields(){
}
}

View File

@ -28,7 +28,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
$id = $old_tainacan_importer->get_id();
$_SESSION['tainacan_importer'][$id]->set_collection( $collection );
this->assertEquals( $collection->get_id(), $_SESSION['tainacan_importer'][$id]->collection->get_id() );
}
}*/
public function test_automapping_old_tainacan()
{
@ -38,29 +38,31 @@ class ImporterTests extends TAINACAN_UnitTestCase {
$old_tainacan = new Importer\Old_Tainacan();
$id = $old_tainacan->get_id();
$_SESSION['tainacan_importer'][$id]->set_items_per_step(50);
//if(!copy('./tests/attachment/json_old_tainacan_base.txt', './tests/attachment/json_old_tainacan.txt'))
//{
//return false;
//}
//$_SESSION['tainacan_importer'][$id]->set_file( './tests/attachment/json_old_tainacan.txt' );
$url = 'http://localhost/wordpress_tainacan/';
$_SESSION['tainacan_importer'][$id]->set_url($url);
$_SESSION['tainacan_importer'][$id]->set_repository();
$url_repository = 'http://localhost/wordpress_tainacan/';
$url_repository = '';
if( $url_repository !== '' ){
$_SESSION['tainacan_importer'][$id]->set_url($url);
$_SESSION['tainacan_importer'][$id]->set_repository();
while (!$_SESSION['tainacan_importer'][$id]->is_finished())
{
$_SESSION['tainacan_importer'][$id]->run();
while (!$_SESSION['tainacan_importer'][$id]->is_finished())
{
$_SESSION['tainacan_importer'][$id]->run();
}
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$collections = $Tainacan_Collections->fetch([], 'OBJECT');
$this->assertEquals(3, $collections, 'total collection in this url does not match');
$this->assertTrue(true);
}
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$collections = $Tainacan_Collections->fetch([], 'OBJECT');
$this->assertEquals(3, $collections, 'total collection in this url does not match');
$this->assertTrue(true);
}*/
}
/*public function test_file_old_tainacan () {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();