Merge branch 'develop' into feature/modal-checkbox-item-edit-page
18
package.json
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"buefy": "^0.6.6",
|
||||
"buefy": "^0.6.7",
|
||||
"bulma": "^0.7.1",
|
||||
"mdi": "^2.2.43",
|
||||
"moment": "^2.22.2",
|
||||
|
@ -25,26 +25,26 @@
|
|||
"vuex": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"autoprefixer": "^9.1.5",
|
||||
"babel-loader": "^8.0.2",
|
||||
"cross-env": "^5.2.0",
|
||||
"css-loader": "^1.0.0",
|
||||
"element-theme-chalk": "^2.4.6",
|
||||
"eslint": "^5.5.0",
|
||||
"element-theme-chalk": "^2.4.7",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-loader": "^2.1.0",
|
||||
"eslint-plugin-vue": "^4.7.1",
|
||||
"file-loader": "^2.0.0",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"sass-loader": "^7.1.0",
|
||||
"style-loader": "^0.23.0",
|
||||
"uglifyjs-webpack-plugin": "^1.3.0",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"vue-custom-element": "^3.2.5",
|
||||
"vue-loader": "^15.4.1",
|
||||
"vue-loader": "^15.4.2",
|
||||
"vue-template-compiler": "^2.5.17",
|
||||
"webpack": "^4.17.2",
|
||||
"webpack": "^4.19.1",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-dev-server": "^3.1.7"
|
||||
"webpack-dev-server": "^3.1.8"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,16 @@
|
|||
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
||||
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
|
||||
</button>
|
||||
<tainacan-title />
|
||||
<div class="tainacan-page-title">
|
||||
<h1 v-if="isCreatingNewItem">{{ $i18n.get('title_create_item_collection') + ' ' }}<span style="font-weight: 600;">{{ collectionName }}</span></h1>
|
||||
<h1 v-else>{{ $i18n.get('title_edit_item') + ' ' }}<span style="font-weight: 600;">{{ (item != null && item != undefined) ? item.title : '' }}</span></h1>
|
||||
<a
|
||||
@click="$router.go(-1)"
|
||||
class="back-link has-text-secondary">
|
||||
{{ $i18n.get('back') }}
|
||||
</a>
|
||||
<hr>
|
||||
</div>
|
||||
<form
|
||||
v-if="!isLoading"
|
||||
class="tainacan-form"
|
||||
|
@ -489,8 +498,9 @@ export default {
|
|||
return {
|
||||
pageTitle: '',
|
||||
itemId: Number,
|
||||
item: null,
|
||||
item: {},
|
||||
collectionId: Number,
|
||||
isCreatingNewItem: false,
|
||||
isLoading: false,
|
||||
isMetadataColumnCompressed: false,
|
||||
metadatumCollapses: [],
|
||||
|
@ -837,6 +847,7 @@ export default {
|
|||
this.form.collectionId = this.collectionId;
|
||||
|
||||
if (this.$route.fullPath.split("/").pop() == "new") {
|
||||
this.isCreatingNewItem = true;
|
||||
this.createNewItem();
|
||||
} else if (this.$route.fullPath.split("/").pop() == "edit") {
|
||||
this.isLoading = true;
|
||||
|
@ -962,8 +973,33 @@ export default {
|
|||
}
|
||||
|
||||
.tainacan-page-title {
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
padding: 0 $page-side-padding;
|
||||
margin-bottom: 40px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
|
||||
h1, h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
color: $gray5;
|
||||
display: inline-block;
|
||||
width: 80%;
|
||||
flex-shrink: 1;
|
||||
flex-grow: 1;
|
||||
}
|
||||
a.back-link{
|
||||
font-weight: 500;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
}
|
||||
hr{
|
||||
margin: 3px 0px 4px 0px;
|
||||
height: 1px;
|
||||
background-color: $secondary;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.column.is-5-5 {
|
||||
|
|
|
@ -162,18 +162,17 @@
|
|||
class="icon has-text-success loading-icon">
|
||||
<div class="control has-icons-right is-loading is-clearfix" />
|
||||
</span>
|
||||
<!-- <span
|
||||
v-if="bgProcess.done <= 0"
|
||||
class="icon has-text-gray action-icon"
|
||||
@click="pauseProcess(index)">
|
||||
<i class="mdi mdi-18px mdi-pause-circle"/>
|
||||
</span>
|
||||
<span
|
||||
v-tooltip="{
|
||||
content: $i18n.get('label_stop_process'),
|
||||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
}"
|
||||
v-if="bgProcess.done <= 0"
|
||||
class="icon has-text-gray action-icon"
|
||||
@click="pauseProcess(index)">
|
||||
<i class="mdi mdi-18px mdi-close-circle-outline"/>
|
||||
</span> -->
|
||||
<i class="mdi mdi-18px mdi-stop-circle"/>
|
||||
</span>
|
||||
<span
|
||||
v-tooltip="{
|
||||
content: $i18n.get('label_process_completed'),
|
||||
|
@ -248,7 +247,8 @@
|
|||
},
|
||||
methods: {
|
||||
...mapActions('bgprocess', [
|
||||
'deleteProcess'
|
||||
'deleteProcess',
|
||||
'updateProcess'
|
||||
]),
|
||||
selectAllOnPage() {
|
||||
for (let i = 0; i < this.selected.length; i++)
|
||||
|
@ -337,7 +337,8 @@
|
|||
return this.$i18n.get('info_unknown_date');
|
||||
}
|
||||
},
|
||||
pauseProcess() {
|
||||
pauseProcess(index) {
|
||||
this.updateProcess({ id: this.processes[index].ID, status: 'closed' });
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -52,17 +52,17 @@
|
|||
<p>{{ bgProcess.name ? bgProcess.name : $i18n.get('label_unamed_process') }}</p>
|
||||
</div>
|
||||
<!-- <span
|
||||
v-if="bgProcess.done <= 0"
|
||||
v-if="bgProcess.done <= 0 && bgProcess.status == 'closed'"
|
||||
class="icon has-text-gray action-icon"
|
||||
@click="pauseProcess(index)">
|
||||
<i class="mdi mdi-18px mdi-pause-circle"/>
|
||||
</span>
|
||||
@click="resumeProcess(index)">
|
||||
<i class="mdi mdi-18px mdi-play-circle"/>
|
||||
</span> -->
|
||||
<span
|
||||
v-if="bgProcess.done <= 0"
|
||||
class="icon has-text-gray action-icon"
|
||||
@click="pauseProcess(index)">
|
||||
<i class="mdi mdi-18px mdi-close-circle-outline"/>
|
||||
</span> -->
|
||||
<i class="mdi mdi-18px mdi-stop-circle"/>
|
||||
</span>
|
||||
<span
|
||||
v-if="bgProcess.done > 0 && !bgProcess.error_log"
|
||||
class="icon has-text-success">
|
||||
|
@ -152,7 +152,8 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions('bgprocess', [
|
||||
'fetchProcesses'
|
||||
'fetchProcesses',
|
||||
'updateProcess'
|
||||
]),
|
||||
...mapGetters('bgprocess', [
|
||||
'getProcesses',
|
||||
|
@ -180,7 +181,8 @@ export default {
|
|||
return this.$i18n.get('info_unknown_date');
|
||||
}
|
||||
},
|
||||
pauseProcess() {
|
||||
pauseProcess(index) {
|
||||
this.updateProcess({ id: this.bgProcesses[index].ID, status: 'closed' });
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
|
|
@ -68,8 +68,8 @@ export default {
|
|||
id: null
|
||||
}
|
||||
|
||||
this.params.flex_width = 0;
|
||||
this.params.flex_height = 0;
|
||||
this.params.flex_width = 1;
|
||||
this.params.flex_height = 1;
|
||||
this.params.width = 220;
|
||||
this.params.height = 220;
|
||||
|
||||
|
|
|
@ -8,7 +8,15 @@
|
|||
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
||||
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
|
||||
</button>
|
||||
<tainacan-title/>
|
||||
<div class="tainacan-page-title">
|
||||
<h1>{{ $i18n.get('title_item_page') + ' ' }}<span style="font-weight: 600;">{{ (item != null && item != undefined) ? item.title : '' }}</span></h1>
|
||||
<a
|
||||
@click="$router.go(-1)"
|
||||
class="back-link has-text-secondary">
|
||||
{{ $i18n.get('back') }}
|
||||
</a>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="tainacan-form">
|
||||
<div class="columns">
|
||||
<div class="column is-5-5">
|
||||
|
@ -436,7 +444,7 @@
|
|||
position: absolute;
|
||||
z-index: 99;
|
||||
right: 0;
|
||||
top: 70px;
|
||||
top: 148px;
|
||||
max-width: 36px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
|
@ -462,8 +470,33 @@
|
|||
}
|
||||
|
||||
.tainacan-page-title {
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
padding: 0 $page-side-padding;
|
||||
margin-bottom: 40px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
|
||||
h1, h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
color: $gray5;
|
||||
display: inline-block;
|
||||
width: 80%;
|
||||
flex-shrink: 1;
|
||||
flex-grow: 1;
|
||||
}
|
||||
a.back-link{
|
||||
font-weight: 500;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
}
|
||||
hr{
|
||||
margin: 3px 0px 4px 0px;
|
||||
height: 1px;
|
||||
background-color: $secondary;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.tainacan-form>.columns {
|
||||
|
|
|
@ -288,6 +288,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_last_processed_on' => __( 'Last processed on:', 'tainacan' ),
|
||||
'label_progress' => __( 'Progress', 'tainacan' ),
|
||||
'label_process_completed' => __( 'Process completed', 'tainacan' ),
|
||||
'label_stop_process' => __( 'Stop process', 'tainacan' ),
|
||||
'label_process_failed' => __( 'Process failed', 'tainacan' ),
|
||||
'label_max_options_to_show' => __( 'Max options to show', 'tainacan' ),
|
||||
'label_unamed_process' => __( 'Unamed process', 'tainacan' ),
|
||||
|
@ -301,7 +302,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_show_filters' => __( 'Show filters menu', 'tainacan' ),
|
||||
'label_select_all_items' => __( 'Select all items', 'tainacan' ),
|
||||
'label_select_all' => __( 'Select all', 'tainacan' ),
|
||||
'label_untrash_selected_items' => __( 'Remove from trash the selected items', 'tainacan' ),
|
||||
'label_untrash_selected_items' => __( 'Recover from trash', 'tainacan' ),
|
||||
'label_value_not_informed' => __( 'Value not informed.', 'tainacan' ),
|
||||
'label_description_not_informed' => __( 'Description not informed.', 'tainacan' ),
|
||||
|
||||
|
@ -342,6 +343,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'instruction_type_existing_term' => __( 'Type to add an existing term...', 'tainacan' ),
|
||||
|
||||
// Info. Other feedback to user.
|
||||
'info_error_invalid_date' => __( 'Invalid date', 'tainacan' ),
|
||||
'info_search_results' => __( 'Search Results', 'tainacan' ),
|
||||
'info_search_criteria' => __( 'Search Criteria', 'tainacan' ),
|
||||
'info_name_is_required' => __( 'Name is required.', 'tainacan' ),
|
||||
|
@ -441,7 +443,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_there_are_no_metadata_in_repository_level' => __( 'There are no metadata in repository level', 'tainacan' ),
|
||||
'info_import_collection' => __( 'Import from external sources.', 'tainacan' ),
|
||||
'info_import_items' => __( 'Import items from external sources.', 'tainacan' ),
|
||||
'info_editing_items_in_bulk' => __( 'Editing items in bulk', 'tainacan' ),
|
||||
'info_editing_items_in_bulk' => __( 'Bulk edit items', 'tainacan' ),
|
||||
'info_by_inner' => __( 'by', 'tainacan' ),
|
||||
'info_items_selected' => __( 'items selected', 'tainacan' ),
|
||||
'info_items_affected' => __( 'items affected', 'tainacan' ),
|
||||
|
|
|
@ -164,7 +164,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
foreach ( $request_meta_query as $index1 => $a ) {
|
||||
|
||||
// handle core metadatum
|
||||
if( is_array($a) && array_key_exists("key", $a) && !$request['advancedSearch'] ){
|
||||
if( is_array($a) && array_key_exists("key", $a) && ( !isset($request['advancedSearch']) || !$request['advancedSearch'] ) ){
|
||||
$metadatum = new \Tainacan\Entities\Metadatum($a['key']);
|
||||
if( strpos( $metadatum->get_metadata_type(), 'Core_Title') !== false ){
|
||||
$args[ 'post_title_in' ] = [
|
||||
|
|
|
@ -235,12 +235,19 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$query = "UPDATE $this->table $status_q WHERE 1=1 $id_q $user_q";
|
||||
$query = "UPDATE $this->table SET $status_q WHERE 1=1 $id_q $user_q";
|
||||
|
||||
$result = $wpdb->query($query);
|
||||
|
||||
$query = "SELECT * FROM $this->table WHERE 1=1 $id_q $user_q LIMIT 1";
|
||||
|
||||
$result = $wpdb->get_row($query);
|
||||
|
||||
$result = $this->prepare_item_for_response($result, $request);
|
||||
|
||||
return new \WP_REST_Response( $result, 200 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function delete_item( $request ) {
|
||||
|
|
|
@ -183,12 +183,12 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
|||
$args['items_ids'] = $body['items_ids'];
|
||||
} elseif ( isset($body['use_query']) && $body['use_query'] ) {
|
||||
|
||||
unset($request['paged']);
|
||||
unset($request['offset']);
|
||||
unset($request['perpage']);
|
||||
$request['nopaging'] = 1;
|
||||
unset($body['use_query']['paged']);
|
||||
unset($body['use_query']['offset']);
|
||||
unset($body['use_query']['perpage']);
|
||||
$body['use_query']['nopaging'] = 1;
|
||||
|
||||
$query_args = $this->prepare_filters($request);
|
||||
$query_args = $this->prepare_filters($body['use_query']);
|
||||
|
||||
$collection_id = $request['collection_id'];
|
||||
|
||||
|
|
|
@ -356,7 +356,9 @@ class Bulk_Edit {
|
|||
|
||||
$select_q = $this->_build_select( 'post_id' );
|
||||
|
||||
$query_delete = "DELETE FROM $wpdb->posts WHERE ID IN ($select_q)";
|
||||
$security = " AND post_status = 'trash'";
|
||||
|
||||
$query_delete = "DELETE FROM $wpdb->posts WHERE ID IN ($select_q) $security";
|
||||
|
||||
return $wpdb->query($query_delete);
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<template>
|
||||
<div class="block">
|
||||
<span
|
||||
v-if="isLoading"
|
||||
style="width: 100%"
|
||||
class="icon has-text-centered loading-icon">
|
||||
<div class="control has-icons-right is-loading is-clearfix" />
|
||||
</span>
|
||||
<div
|
||||
v-for="(option, index) in options.slice(0, filter.max_options)"
|
||||
:key="index"
|
||||
|
@ -115,6 +121,8 @@
|
|||
promise = this.getValuesRelationship( collectionTarget, null, [], 0, this.filter.max_options, false, '1');
|
||||
promise
|
||||
.then(() => {
|
||||
|
||||
this.isLoading = false;
|
||||
if(this.options.length > this.filter.max_options){
|
||||
this.options.splice(this.filter.max_options);
|
||||
}
|
||||
|
@ -125,6 +133,8 @@
|
|||
promise = this.getValuesPlainText( this.metadatum, null, this.isRepositoryLevel, [], 0, this.filter.max_options, false, '1' );
|
||||
promise
|
||||
.then(() => {
|
||||
|
||||
this.isLoading = false;
|
||||
if(this.options.length > this.filter.max_options){
|
||||
this.options.splice(this.filter.max_options);
|
||||
}
|
||||
|
@ -213,4 +223,10 @@
|
|||
display: flex;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
.is-loading:after {
|
||||
border: 2px solid white !important;
|
||||
border-top-color: #dbdbdb !important;
|
||||
border-right-color: #dbdbdb !important;
|
||||
}
|
||||
</style>
|
|
@ -1,5 +1,11 @@
|
|||
<template>
|
||||
<div class="block">
|
||||
<span
|
||||
v-if="isLoading"
|
||||
style="width: 100%"
|
||||
class="icon has-text-centered loading-icon">
|
||||
<div class="control has-icons-right is-loading is-clearfix" />
|
||||
</span>
|
||||
<div
|
||||
v-for="(option, index) in options.slice(0, filter.max_options)"
|
||||
:key="index"
|
||||
|
@ -241,4 +247,10 @@
|
|||
display: flex;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
.is-loading:after {
|
||||
border: 2px solid white !important;
|
||||
border-top-color: #dbdbdb !important;
|
||||
border-right-color: #dbdbdb !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
<input
|
||||
:disabled="disabled"
|
||||
class="input"
|
||||
:class="{'is-danger': isInvalidDate && dateValue}"
|
||||
type="text"
|
||||
v-mask="dateMask"
|
||||
:value="dateValue"
|
||||
v-model="dateValue"
|
||||
@blur="onBlur"
|
||||
@input="onInput"
|
||||
:placeholder="dateFormat.toLowerCase()">
|
||||
<p
|
||||
v-if="isInvalidDate && dateValue"
|
||||
class="has-text-danger is-italic is-size-7">{{ $i18n.get('info_error_invalid_date') }}</p>
|
||||
<!--<b-collapse-->
|
||||
<!--position="is-bottom-right">-->
|
||||
<!--<b-icon-->
|
||||
|
@ -57,7 +61,8 @@
|
|||
return {
|
||||
dateValue: '',
|
||||
dateMask: this.getDateLocaleMask(),
|
||||
dateFormat: ''
|
||||
dateFormat: '',
|
||||
isInvalidDate: false,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -72,18 +77,25 @@
|
|||
onBlur() {
|
||||
this.$emit('blur');
|
||||
},
|
||||
onInput($event) {
|
||||
onInput: _.debounce(function ($event) {
|
||||
let dateISO = '';
|
||||
|
||||
if($event && $event instanceof Date) {
|
||||
dateISO = moment(this.dateValue, this.dateFormat).toISOString().split('T')[0];
|
||||
dateISO = moment(this.dateValue, this.dateFormat).toISOString() ? moment(this.dateValue, this.dateFormat).toISOString().split('T')[0] : false;
|
||||
} else if($event.target.value && $event.target.value.length === this.dateMask.length) {
|
||||
dateISO = moment($event.target.value, this.dateFormat).toISOString().split('T')[0];
|
||||
dateISO = moment(this.dateValue, this.dateFormat).toISOString() ? moment($event.target.value, this.dateFormat).toISOString().split('T')[0] : false;
|
||||
}
|
||||
|
||||
if(!dateISO){
|
||||
this.isInvalidDate = true;
|
||||
return;
|
||||
} else {
|
||||
this.isInvalidDate = false;
|
||||
}
|
||||
|
||||
this.$emit('input', dateISO);
|
||||
this.$emit('blur');
|
||||
},
|
||||
}, 300),
|
||||
parseDateToNavigatorLanguage(date){
|
||||
date = new Date(date.replace(/-/g, '/'));
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Tainacan\Metadata_Types;
|
||||
|
||||
use Tainacan\Entities\Item_Metadata_Entity;
|
||||
|
||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||
|
||||
use Tainacan\Helpers;
|
||||
|
@ -28,4 +30,19 @@ class Date extends Metadata_Type {
|
|||
value=\''.json_encode( $itemMetadata->get_value() ).'\'
|
||||
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-date>';
|
||||
}
|
||||
|
||||
|
||||
public function validate( Item_Metadata_Entity $item_metadata) {
|
||||
|
||||
$value = $item_metadata->get_value();
|
||||
|
||||
$format = 'Y-m-d';
|
||||
|
||||
$d = \DateTime::createFromFormat($format, $value);
|
||||
|
||||
return $d && $d->format($format) === $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
:allow-select-to-create="allowSelectToCreate"
|
||||
:allow-new="allowNew"
|
||||
:terms="terms"
|
||||
:taxonomy-id="taxonomy"
|
||||
:taxonomy-id="taxonomy_id"
|
||||
:options="getOptions(0)"/>
|
||||
<!--<a -->
|
||||
<!--class="add-new-term"-->
|
||||
|
@ -203,7 +203,7 @@
|
|||
this.$emit('blur');
|
||||
},
|
||||
reload( $event ) {
|
||||
if ($event.taxonomyId == this.taxonomy && $event.metadatumId == this.metadatum.metadatum.id) {
|
||||
if ($event.taxonomyId == this.taxonomy_id && $event.metadatumId == this.metadatum.metadatum.id) {
|
||||
this.valueComponent = $event.values;
|
||||
this.terms = [];
|
||||
this.offset = 0;
|
||||
|
|
|
@ -77,7 +77,7 @@ class Terms extends Repository {
|
|||
'description' => __( 'The term creator', 'tainacan' ),
|
||||
'on_error' => __( 'The user is empty or invalid', 'tainacan' ),
|
||||
'default' => get_current_user_id(),
|
||||
'validation' => v::numeric(),
|
||||
//'validation' => v::numeric(),
|
||||
],
|
||||
'header_image_id' => [
|
||||
'map' => 'termmeta',
|
||||
|
@ -222,7 +222,6 @@ class Terms extends Repository {
|
|||
|
||||
foreach ( $terms as $term ) {
|
||||
$tainacan_term = new Entities\Term( $term );
|
||||
$tainacan_term->set_user( get_term_meta( $tainacan_term->get_id(), 'user', true ) );
|
||||
$return[] = $tainacan_term;
|
||||
}
|
||||
|
||||
|
@ -230,8 +229,6 @@ class Terms extends Repository {
|
|||
} elseif ( is_numeric( $args ) && ! empty( $cpt ) && ! is_array( $cpt ) ) { // if an id is passed taxonomy cannot be an array
|
||||
$wp_term = get_term_by( 'id', $args, $cpt );
|
||||
$tainacan_term = new Entities\Term( $wp_term );
|
||||
$tainacan_term->set_user( get_term_meta( $tainacan_term->get_id(), 'user', true ) );
|
||||
|
||||
return $tainacan_term;
|
||||
} else {
|
||||
return [];
|
||||
|
|
|
@ -643,6 +643,11 @@ class Old_Tainacan extends Importer{
|
|||
if($term_father){
|
||||
$new_term->set_parent($term_father->get_id());
|
||||
}
|
||||
|
||||
// block terms with same name and parent in taxonomy
|
||||
if( get_term_by( 'name', $term->name, $taxonomy_father->get_db_identifier()) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
$inserted_term = $this->term_repo->insert($new_term);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class Test_Importer extends Importer {
|
|||
];
|
||||
|
||||
protected $date_values = [
|
||||
'03/04/1993', '03/12/1998', '10/09/2001', '03/01/2018', '13/11/2016', '22/04/1993'
|
||||
'1993-12-03', '1998-04-03', '2001-09-10', '2018-01-03', '2016-11-13', '1993-04-22'
|
||||
];
|
||||
|
||||
protected $numeric_values = [
|
||||
|
@ -231,7 +231,7 @@ class Test_Importer extends Importer {
|
|||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label"><?php _e('Horizontal image size', 'tainacan'); ?></label>
|
||||
<label class="label"><?php _e('Horizontal image size (0 for random)', 'tainacan'); ?></label>
|
||||
<span class="help-wrapper">
|
||||
<a class="help-button has-text-secondary">
|
||||
<span class="icon is-small">
|
||||
|
@ -243,7 +243,7 @@ class Test_Importer extends Importer {
|
|||
<h5><?php _e('Horizontal image size', 'tainacan'); ?></h5>
|
||||
</div>
|
||||
<div class="help-tooltip-body">
|
||||
<p><?php _e('Horizontal image size ( 0 for random size )', 'tainacan'); ?></p>
|
||||
<p><?php _e('Horizontal image size in pixels ( 0 for random size )', 'tainacan'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
@ -253,7 +253,7 @@ class Test_Importer extends Importer {
|
|||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label"><?php _e('Vertical image size', 'tainacan'); ?></label>
|
||||
<label class="label"><?php _e('Vertical image size (0 for random)', 'tainacan'); ?></label>
|
||||
<span class="help-wrapper">
|
||||
<a class="help-button has-text-secondary">
|
||||
<span class="icon is-small">
|
||||
|
@ -265,7 +265,7 @@ class Test_Importer extends Importer {
|
|||
<h5><?php _e('Vertical image size', 'tainacan'); ?></h5>
|
||||
</div>
|
||||
<div class="help-tooltip-body">
|
||||
<p><?php _e('Vertical image size ( 0 for random size )', 'tainacan'); ?></p>
|
||||
<p><?php _e('Vertical image size in pixels ( 0 for random size )', 'tainacan'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
|
|
@ -312,12 +312,10 @@ export default {
|
|||
'taxonomy': this.taxonomy
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
this.$emit( 'isLoadingItems', false);
|
||||
this.$emit( 'hasFiltered', res.hasFiltered);
|
||||
|
||||
if(res.advancedSearchResults){
|
||||
this.$router.replace({query: this.$store.getters['search/getPostQuery'],});
|
||||
this.$emit('advancedSearchResults', res.advancedSearchResults);
|
||||
}
|
||||
})
|
||||
|
|
|
@ -6,7 +6,7 @@ export const fetchProcesses = ({ commit }, {page, processesPerPage}) => {
|
|||
let endpoint = '/bg-processes?all_users=1';
|
||||
|
||||
if (page != undefined)
|
||||
endpoint += 'paged=' + page;
|
||||
endpoint += '&paged=' + page;
|
||||
if (processesPerPage != undefined)
|
||||
endpoint += '&perpage=' + processesPerPage;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
=== Tainacan ===
|
||||
Contributors: fabianobn, jacsonp, leogermani, weryques, wetah
|
||||
Contributors: andrebenedito, fabianobn, jacsonp, leogermani, weryques, wetah
|
||||
Tags: museums, libraries, archives, GLAM, collections, repository
|
||||
Requires at least: 4.8
|
||||
Tested up to: 4.9.7
|
||||
Tested up to: 4.9.8
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 0.3
|
||||
Stable tag: 0.4
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
@ -14,7 +14,7 @@ Tainacan is a powerful and flexible repository platform for WordPress. Manage an
|
|||
|
||||
Tainacan is a powerful 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 repository platform.
|
||||
|
||||
Please note: This is an early release of this plugin, and we are working hard to release 1.0 soon, please refer to the [project's website](http://tainacan.org/new) for more information and road map.
|
||||
Please note: This is an early release of this plugin, and we are working hard to release 1.0 soon, please refer to the [project's website](http://tainacan.org/) for more information and road map.
|
||||
|
||||
= Features =
|
||||
|
||||
|
@ -86,4 +86,5 @@ If you have Imagick installed in your server, Tainacan will be able to automatic
|
|||
7. Navigate through rich filtering interface
|
||||
8. Explore more with Advanced Search
|
||||
9. Set up Taxonomies to be used across your repository
|
||||
10. Expose your collection using Tainacan default theme
|
||||
10. Bulk edit as many items as you need quickly
|
||||
11. Expose your collection using Tainacan default theme
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/*
|
||||
Plugin Name: Tainacan
|
||||
Plugin URI: https://tainacan.org/new
|
||||
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.3
|
||||
Version: 0.4
|
||||
Text Domain: tainacan
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
|
|
@ -86,12 +86,8 @@ function tainacan_the_document() {
|
|||
* @return bool True if item has document, false if it does not
|
||||
*/
|
||||
function tainacan_has_document() {
|
||||
$item = tainacan_get_item();
|
||||
|
||||
if (!$item)
|
||||
return;
|
||||
|
||||
$document = $item->get_document();
|
||||
$document = tainacan_get_the_document();
|
||||
|
||||
return ! empty($document);
|
||||
|
||||
|
|
|
@ -948,9 +948,9 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
|||
'POST', $this->api_baseroute
|
||||
);
|
||||
|
||||
$request->set_query_params($query);
|
||||
//$request->set_query_params($query);
|
||||
|
||||
$request->set_body( json_encode(['use_query' => 1]) );
|
||||
$request->set_body( json_encode(['use_query' => $query]) );
|
||||
|
||||
$response = $this->server->dispatch($request);
|
||||
|
||||
|
@ -1128,6 +1128,10 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
|||
'items_ids' => $ids,
|
||||
]);
|
||||
|
||||
$this->assertEquals( 0, $bulk->delete_items(), 'Items must be on trash to be deleted' );
|
||||
|
||||
$bulk->trash_items();
|
||||
|
||||
$this->assertEquals( 17, $bulk->delete_items() );
|
||||
|
||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||
|
@ -1272,5 +1276,32 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
|||
|
||||
}
|
||||
|
||||
function test_create_delete_group() {
|
||||
|
||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||
|
||||
$ids = array_slice($this->items_ids, 2, 7);
|
||||
|
||||
$bulk = new \Tainacan\Bulk_Edit([
|
||||
'items_ids' => $ids,
|
||||
]);
|
||||
|
||||
$bulk->trash_items();
|
||||
|
||||
$query = [
|
||||
'status' => 'trash',
|
||||
'posts_per_page' => -1
|
||||
];
|
||||
|
||||
$bulk = new \Tainacan\Bulk_Edit([
|
||||
'query' => $query,
|
||||
'collection_id' => $this->collection->get_id()
|
||||
]);
|
||||
|
||||
$this->assertEquals(7, $bulk->count_posts());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace Tainacan\Tests;
|
||||
|
||||
/**
|
||||
* Class TestCollections
|
||||
*
|
||||
* @package Test_Tainacan
|
||||
*/
|
||||
|
||||
use Tainacan\Entities;
|
||||
|
||||
/**
|
||||
* Sample test case.
|
||||
*/
|
||||
class DateMetadatumTypes extends TAINACAN_UnitTestCase {
|
||||
|
||||
|
||||
function test_date_metadata_types() {
|
||||
|
||||
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
|
||||
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
|
||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||
|
||||
$collection = $this->tainacan_entity_factory->create_entity(
|
||||
'collection',
|
||||
array(
|
||||
'name' => 'test',
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
$metadatum = $this->tainacan_entity_factory->create_entity(
|
||||
'metadatum',
|
||||
array(
|
||||
'name' => 'meta',
|
||||
'description' => 'description',
|
||||
'collection' => $collection,
|
||||
'metadata_type' => 'Tainacan\Metadata_Types\Date',
|
||||
'status' => 'publish',
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$i = $this->tainacan_entity_factory->create_entity(
|
||||
'item',
|
||||
array(
|
||||
'title' => 'item test',
|
||||
'description' => 'adasdasdsa',
|
||||
'collection' => $collection,
|
||||
'status' => 'publish',
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($i, $metadatum);
|
||||
|
||||
$item_metadata->set_value('2010-01-01');
|
||||
$this->assertTrue($item_metadata->validate());
|
||||
|
||||
$item_metadata->set_value('2010-12-01');
|
||||
$this->assertTrue($item_metadata->validate());
|
||||
|
||||
$item_metadata->set_value('2010-12-31');
|
||||
$this->assertTrue($item_metadata->validate());
|
||||
|
||||
$item_metadata->set_value('2010-22-01');
|
||||
$this->assertFalse($item_metadata->validate());
|
||||
|
||||
$item_metadata->set_value('3/3/1202');
|
||||
$this->assertFalse($item_metadata->validate());
|
||||
|
||||
$item_metadata->set_value('2010-02-30');
|
||||
$this->assertFalse($item_metadata->validate());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Before Width: | Height: | Size: 498 KiB After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 498 KiB |
Before Width: | Height: | Size: 321 KiB After Width: | Height: | Size: 410 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 65 KiB |