Merge branch 'develop' into feature/modal-checkbox-item-edit-page
18
package.json
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
"buefy": "^0.6.6",
|
"buefy": "^0.6.7",
|
||||||
"bulma": "^0.7.1",
|
"bulma": "^0.7.1",
|
||||||
"mdi": "^2.2.43",
|
"mdi": "^2.2.43",
|
||||||
"moment": "^2.22.2",
|
"moment": "^2.22.2",
|
||||||
|
@ -25,26 +25,26 @@
|
||||||
"vuex": "^3.0.1"
|
"vuex": "^3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.1.0",
|
||||||
"@babel/preset-env": "^7.0.0",
|
"@babel/preset-env": "^7.1.0",
|
||||||
"autoprefixer": "^9.1.5",
|
"autoprefixer": "^9.1.5",
|
||||||
"babel-loader": "^8.0.2",
|
"babel-loader": "^8.0.2",
|
||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
"css-loader": "^1.0.0",
|
"css-loader": "^1.0.0",
|
||||||
"element-theme-chalk": "^2.4.6",
|
"element-theme-chalk": "^2.4.7",
|
||||||
"eslint": "^5.5.0",
|
"eslint": "^5.6.0",
|
||||||
"eslint-loader": "^2.1.0",
|
"eslint-loader": "^2.1.0",
|
||||||
"eslint-plugin-vue": "^4.7.1",
|
"eslint-plugin-vue": "^4.7.1",
|
||||||
"file-loader": "^2.0.0",
|
"file-loader": "^2.0.0",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^7.1.0",
|
||||||
"style-loader": "^0.23.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-custom-element": "^3.2.5",
|
||||||
"vue-loader": "^15.4.1",
|
"vue-loader": "^15.4.2",
|
||||||
"vue-template-compiler": "^2.5.17",
|
"vue-template-compiler": "^2.5.17",
|
||||||
"webpack": "^4.17.2",
|
"webpack": "^4.19.1",
|
||||||
"webpack-cli": "^3.1.0",
|
"webpack-cli": "^3.1.0",
|
||||||
"webpack-dev-server": "^3.1.7"
|
"webpack-dev-server": "^3.1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,16 @@
|
||||||
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
||||||
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
|
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
|
||||||
</button>
|
</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
|
<form
|
||||||
v-if="!isLoading"
|
v-if="!isLoading"
|
||||||
class="tainacan-form"
|
class="tainacan-form"
|
||||||
|
@ -489,8 +498,9 @@ export default {
|
||||||
return {
|
return {
|
||||||
pageTitle: '',
|
pageTitle: '',
|
||||||
itemId: Number,
|
itemId: Number,
|
||||||
item: null,
|
item: {},
|
||||||
collectionId: Number,
|
collectionId: Number,
|
||||||
|
isCreatingNewItem: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isMetadataColumnCompressed: false,
|
isMetadataColumnCompressed: false,
|
||||||
metadatumCollapses: [],
|
metadatumCollapses: [],
|
||||||
|
@ -837,6 +847,7 @@ export default {
|
||||||
this.form.collectionId = this.collectionId;
|
this.form.collectionId = this.collectionId;
|
||||||
|
|
||||||
if (this.$route.fullPath.split("/").pop() == "new") {
|
if (this.$route.fullPath.split("/").pop() == "new") {
|
||||||
|
this.isCreatingNewItem = true;
|
||||||
this.createNewItem();
|
this.createNewItem();
|
||||||
} else if (this.$route.fullPath.split("/").pop() == "edit") {
|
} else if (this.$route.fullPath.split("/").pop() == "edit") {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
@ -962,8 +973,33 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tainacan-page-title {
|
.tainacan-page-title {
|
||||||
padding-left: $page-side-padding;
|
padding: 0 $page-side-padding;
|
||||||
padding-right: $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 {
|
.column.is-5-5 {
|
||||||
|
|
|
@ -162,18 +162,17 @@
|
||||||
class="icon has-text-success loading-icon">
|
class="icon has-text-success loading-icon">
|
||||||
<div class="control has-icons-right is-loading is-clearfix" />
|
<div class="control has-icons-right is-loading is-clearfix" />
|
||||||
</span>
|
</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
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('label_stop_process'),
|
||||||
|
autoHide: false,
|
||||||
|
placement: 'auto-start'
|
||||||
|
}"
|
||||||
v-if="bgProcess.done <= 0"
|
v-if="bgProcess.done <= 0"
|
||||||
class="icon has-text-gray action-icon"
|
class="icon has-text-gray action-icon"
|
||||||
@click="pauseProcess(index)">
|
@click="pauseProcess(index)">
|
||||||
<i class="mdi mdi-18px mdi-close-circle-outline"/>
|
<i class="mdi mdi-18px mdi-stop-circle"/>
|
||||||
</span> -->
|
</span>
|
||||||
<span
|
<span
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
content: $i18n.get('label_process_completed'),
|
content: $i18n.get('label_process_completed'),
|
||||||
|
@ -248,7 +247,8 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('bgprocess', [
|
...mapActions('bgprocess', [
|
||||||
'deleteProcess'
|
'deleteProcess',
|
||||||
|
'updateProcess'
|
||||||
]),
|
]),
|
||||||
selectAllOnPage() {
|
selectAllOnPage() {
|
||||||
for (let i = 0; i < this.selected.length; i++)
|
for (let i = 0; i < this.selected.length; i++)
|
||||||
|
@ -337,7 +337,8 @@
|
||||||
return this.$i18n.get('info_unknown_date');
|
return this.$i18n.get('info_unknown_date');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pauseProcess() {
|
pauseProcess(index) {
|
||||||
|
this.updateProcess({ id: this.processes[index].ID, status: 'closed' });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -52,17 +52,17 @@
|
||||||
<p>{{ bgProcess.name ? bgProcess.name : $i18n.get('label_unamed_process') }}</p>
|
<p>{{ bgProcess.name ? bgProcess.name : $i18n.get('label_unamed_process') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- <span
|
<!-- <span
|
||||||
v-if="bgProcess.done <= 0"
|
v-if="bgProcess.done <= 0 && bgProcess.status == 'closed'"
|
||||||
class="icon has-text-gray action-icon"
|
class="icon has-text-gray action-icon"
|
||||||
@click="pauseProcess(index)">
|
@click="resumeProcess(index)">
|
||||||
<i class="mdi mdi-18px mdi-pause-circle"/>
|
<i class="mdi mdi-18px mdi-play-circle"/>
|
||||||
</span>
|
</span> -->
|
||||||
<span
|
<span
|
||||||
v-if="bgProcess.done <= 0"
|
v-if="bgProcess.done <= 0"
|
||||||
class="icon has-text-gray action-icon"
|
class="icon has-text-gray action-icon"
|
||||||
@click="pauseProcess(index)">
|
@click="pauseProcess(index)">
|
||||||
<i class="mdi mdi-18px mdi-close-circle-outline"/>
|
<i class="mdi mdi-18px mdi-stop-circle"/>
|
||||||
</span> -->
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="bgProcess.done > 0 && !bgProcess.error_log"
|
v-if="bgProcess.done > 0 && !bgProcess.error_log"
|
||||||
class="icon has-text-success">
|
class="icon has-text-success">
|
||||||
|
@ -152,7 +152,8 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('bgprocess', [
|
...mapActions('bgprocess', [
|
||||||
'fetchProcesses'
|
'fetchProcesses',
|
||||||
|
'updateProcess'
|
||||||
]),
|
]),
|
||||||
...mapGetters('bgprocess', [
|
...mapGetters('bgprocess', [
|
||||||
'getProcesses',
|
'getProcesses',
|
||||||
|
@ -180,7 +181,8 @@ export default {
|
||||||
return this.$i18n.get('info_unknown_date');
|
return this.$i18n.get('info_unknown_date');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pauseProcess() {
|
pauseProcess(index) {
|
||||||
|
this.updateProcess({ id: this.bgProcesses[index].ID, status: 'closed' });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
|
@ -68,8 +68,8 @@ export default {
|
||||||
id: null
|
id: null
|
||||||
}
|
}
|
||||||
|
|
||||||
this.params.flex_width = 0;
|
this.params.flex_width = 1;
|
||||||
this.params.flex_height = 0;
|
this.params.flex_height = 1;
|
||||||
this.params.width = 220;
|
this.params.width = 220;
|
||||||
this.params.height = 220;
|
this.params.height = 220;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,15 @@
|
||||||
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
||||||
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
|
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
|
||||||
</button>
|
</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="tainacan-form">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-5-5">
|
<div class="column is-5-5">
|
||||||
|
@ -436,7 +444,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 70px;
|
top: 148px;
|
||||||
max-width: 36px;
|
max-width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
width: 36px;
|
width: 36px;
|
||||||
|
@ -462,8 +470,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.tainacan-page-title {
|
.tainacan-page-title {
|
||||||
padding-left: $page-side-padding;
|
padding: 0 $page-side-padding;
|
||||||
padding-right: $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 {
|
.tainacan-form>.columns {
|
||||||
|
|
|
@ -288,6 +288,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
||||||
'label_last_processed_on' => __( 'Last processed on:', 'tainacan' ),
|
'label_last_processed_on' => __( 'Last processed on:', 'tainacan' ),
|
||||||
'label_progress' => __( 'Progress', 'tainacan' ),
|
'label_progress' => __( 'Progress', 'tainacan' ),
|
||||||
'label_process_completed' => __( 'Process completed', 'tainacan' ),
|
'label_process_completed' => __( 'Process completed', 'tainacan' ),
|
||||||
|
'label_stop_process' => __( 'Stop process', 'tainacan' ),
|
||||||
'label_process_failed' => __( 'Process failed', 'tainacan' ),
|
'label_process_failed' => __( 'Process failed', 'tainacan' ),
|
||||||
'label_max_options_to_show' => __( 'Max options to show', 'tainacan' ),
|
'label_max_options_to_show' => __( 'Max options to show', 'tainacan' ),
|
||||||
'label_unamed_process' => __( 'Unamed process', '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_show_filters' => __( 'Show filters menu', 'tainacan' ),
|
||||||
'label_select_all_items' => __( 'Select all items', 'tainacan' ),
|
'label_select_all_items' => __( 'Select all items', 'tainacan' ),
|
||||||
'label_select_all' => __( 'Select all', '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_value_not_informed' => __( 'Value not informed.', 'tainacan' ),
|
||||||
'label_description_not_informed' => __( 'Description 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' ),
|
'instruction_type_existing_term' => __( 'Type to add an existing term...', 'tainacan' ),
|
||||||
|
|
||||||
// Info. Other feedback to user.
|
// Info. Other feedback to user.
|
||||||
|
'info_error_invalid_date' => __( 'Invalid date', 'tainacan' ),
|
||||||
'info_search_results' => __( 'Search Results', 'tainacan' ),
|
'info_search_results' => __( 'Search Results', 'tainacan' ),
|
||||||
'info_search_criteria' => __( 'Search Criteria', 'tainacan' ),
|
'info_search_criteria' => __( 'Search Criteria', 'tainacan' ),
|
||||||
'info_name_is_required' => __( 'Name is required.', '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_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_collection' => __( 'Import from external sources.', 'tainacan' ),
|
||||||
'info_import_items' => __( 'Import items 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_by_inner' => __( 'by', 'tainacan' ),
|
||||||
'info_items_selected' => __( 'items selected', 'tainacan' ),
|
'info_items_selected' => __( 'items selected', 'tainacan' ),
|
||||||
'info_items_affected' => __( 'items affected', '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 ) {
|
foreach ( $request_meta_query as $index1 => $a ) {
|
||||||
|
|
||||||
// handle core metadatum
|
// 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']);
|
$metadatum = new \Tainacan\Entities\Metadatum($a['key']);
|
||||||
if( strpos( $metadatum->get_metadata_type(), 'Core_Title') !== false ){
|
if( strpos( $metadatum->get_metadata_type(), 'Core_Title') !== false ){
|
||||||
$args[ 'post_title_in' ] = [
|
$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);
|
$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 );
|
return new \WP_REST_Response( $result, 200 );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete_item( $request ) {
|
public function delete_item( $request ) {
|
||||||
|
|
|
@ -183,12 +183,12 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
$args['items_ids'] = $body['items_ids'];
|
$args['items_ids'] = $body['items_ids'];
|
||||||
} elseif ( isset($body['use_query']) && $body['use_query'] ) {
|
} elseif ( isset($body['use_query']) && $body['use_query'] ) {
|
||||||
|
|
||||||
unset($request['paged']);
|
unset($body['use_query']['paged']);
|
||||||
unset($request['offset']);
|
unset($body['use_query']['offset']);
|
||||||
unset($request['perpage']);
|
unset($body['use_query']['perpage']);
|
||||||
$request['nopaging'] = 1;
|
$body['use_query']['nopaging'] = 1;
|
||||||
|
|
||||||
$query_args = $this->prepare_filters($request);
|
$query_args = $this->prepare_filters($body['use_query']);
|
||||||
|
|
||||||
$collection_id = $request['collection_id'];
|
$collection_id = $request['collection_id'];
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,9 @@ class Bulk_Edit {
|
||||||
|
|
||||||
$select_q = $this->_build_select( 'post_id' );
|
$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);
|
return $wpdb->query($query_delete);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="block">
|
<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
|
<div
|
||||||
v-for="(option, index) in options.slice(0, filter.max_options)"
|
v-for="(option, index) in options.slice(0, filter.max_options)"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -115,6 +121,8 @@
|
||||||
promise = this.getValuesRelationship( collectionTarget, null, [], 0, this.filter.max_options, false, '1');
|
promise = this.getValuesRelationship( collectionTarget, null, [], 0, this.filter.max_options, false, '1');
|
||||||
promise
|
promise
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
||||||
|
this.isLoading = false;
|
||||||
if(this.options.length > this.filter.max_options){
|
if(this.options.length > this.filter.max_options){
|
||||||
this.options.splice(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 = this.getValuesPlainText( this.metadatum, null, this.isRepositoryLevel, [], 0, this.filter.max_options, false, '1' );
|
||||||
promise
|
promise
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
||||||
|
this.isLoading = false;
|
||||||
if(this.options.length > this.filter.max_options){
|
if(this.options.length > this.filter.max_options){
|
||||||
this.options.splice(this.filter.max_options);
|
this.options.splice(this.filter.max_options);
|
||||||
}
|
}
|
||||||
|
@ -213,4 +223,10 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.is-loading:after {
|
||||||
|
border: 2px solid white !important;
|
||||||
|
border-top-color: #dbdbdb !important;
|
||||||
|
border-right-color: #dbdbdb !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,5 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="block">
|
<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
|
<div
|
||||||
v-for="(option, index) in options.slice(0, filter.max_options)"
|
v-for="(option, index) in options.slice(0, filter.max_options)"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -241,4 +247,10 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.is-loading:after {
|
||||||
|
border: 2px solid white !important;
|
||||||
|
border-top-color: #dbdbdb !important;
|
||||||
|
border-right-color: #dbdbdb !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -6,12 +6,16 @@
|
||||||
<input
|
<input
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
class="input"
|
class="input"
|
||||||
|
:class="{'is-danger': isInvalidDate && dateValue}"
|
||||||
type="text"
|
type="text"
|
||||||
v-mask="dateMask"
|
v-mask="dateMask"
|
||||||
:value="dateValue"
|
v-model="dateValue"
|
||||||
@blur="onBlur"
|
@blur="onBlur"
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
:placeholder="dateFormat.toLowerCase()">
|
: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-->
|
<!--<b-collapse-->
|
||||||
<!--position="is-bottom-right">-->
|
<!--position="is-bottom-right">-->
|
||||||
<!--<b-icon-->
|
<!--<b-icon-->
|
||||||
|
@ -57,7 +61,8 @@
|
||||||
return {
|
return {
|
||||||
dateValue: '',
|
dateValue: '',
|
||||||
dateMask: this.getDateLocaleMask(),
|
dateMask: this.getDateLocaleMask(),
|
||||||
dateFormat: ''
|
dateFormat: '',
|
||||||
|
isInvalidDate: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -72,18 +77,25 @@
|
||||||
onBlur() {
|
onBlur() {
|
||||||
this.$emit('blur');
|
this.$emit('blur');
|
||||||
},
|
},
|
||||||
onInput($event) {
|
onInput: _.debounce(function ($event) {
|
||||||
let dateISO = '';
|
let dateISO = '';
|
||||||
|
|
||||||
if($event && $event instanceof Date) {
|
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) {
|
} 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('input', dateISO);
|
||||||
this.$emit('blur');
|
this.$emit('blur');
|
||||||
},
|
}, 300),
|
||||||
parseDateToNavigatorLanguage(date){
|
parseDateToNavigatorLanguage(date){
|
||||||
date = new Date(date.replace(/-/g, '/'));
|
date = new Date(date.replace(/-/g, '/'));
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Tainacan\Metadata_Types;
|
namespace Tainacan\Metadata_Types;
|
||||||
|
|
||||||
|
use Tainacan\Entities\Item_Metadata_Entity;
|
||||||
|
|
||||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
|
|
||||||
use Tainacan\Helpers;
|
use Tainacan\Helpers;
|
||||||
|
@ -28,4 +30,19 @@ class Date extends Metadata_Type {
|
||||||
value=\''.json_encode( $itemMetadata->get_value() ).'\'
|
value=\''.json_encode( $itemMetadata->get_value() ).'\'
|
||||||
name="'.$itemMetadata->get_metadatum()->get_name().'"></tainacan-date>';
|
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-select-to-create="allowSelectToCreate"
|
||||||
:allow-new="allowNew"
|
:allow-new="allowNew"
|
||||||
:terms="terms"
|
:terms="terms"
|
||||||
:taxonomy-id="taxonomy"
|
:taxonomy-id="taxonomy_id"
|
||||||
:options="getOptions(0)"/>
|
:options="getOptions(0)"/>
|
||||||
<!--<a -->
|
<!--<a -->
|
||||||
<!--class="add-new-term"-->
|
<!--class="add-new-term"-->
|
||||||
|
@ -203,7 +203,7 @@
|
||||||
this.$emit('blur');
|
this.$emit('blur');
|
||||||
},
|
},
|
||||||
reload( $event ) {
|
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.valueComponent = $event.values;
|
||||||
this.terms = [];
|
this.terms = [];
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Terms extends Repository {
|
||||||
'description' => __( 'The term creator', 'tainacan' ),
|
'description' => __( 'The term creator', 'tainacan' ),
|
||||||
'on_error' => __( 'The user is empty or invalid', 'tainacan' ),
|
'on_error' => __( 'The user is empty or invalid', 'tainacan' ),
|
||||||
'default' => get_current_user_id(),
|
'default' => get_current_user_id(),
|
||||||
'validation' => v::numeric(),
|
//'validation' => v::numeric(),
|
||||||
],
|
],
|
||||||
'header_image_id' => [
|
'header_image_id' => [
|
||||||
'map' => 'termmeta',
|
'map' => 'termmeta',
|
||||||
|
@ -222,7 +222,6 @@ class Terms extends Repository {
|
||||||
|
|
||||||
foreach ( $terms as $term ) {
|
foreach ( $terms as $term ) {
|
||||||
$tainacan_term = new Entities\Term( $term );
|
$tainacan_term = new Entities\Term( $term );
|
||||||
$tainacan_term->set_user( get_term_meta( $tainacan_term->get_id(), 'user', true ) );
|
|
||||||
$return[] = $tainacan_term;
|
$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
|
} 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 );
|
$wp_term = get_term_by( 'id', $args, $cpt );
|
||||||
$tainacan_term = new Entities\Term( $wp_term );
|
$tainacan_term = new Entities\Term( $wp_term );
|
||||||
$tainacan_term->set_user( get_term_meta( $tainacan_term->get_id(), 'user', true ) );
|
|
||||||
|
|
||||||
return $tainacan_term;
|
return $tainacan_term;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -643,6 +643,11 @@ class Old_Tainacan extends Importer{
|
||||||
if($term_father){
|
if($term_father){
|
||||||
$new_term->set_parent($term_father->get_id());
|
$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);
|
$inserted_term = $this->term_repo->insert($new_term);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Test_Importer extends Importer {
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $date_values = [
|
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 = [
|
protected $numeric_values = [
|
||||||
|
@ -231,7 +231,7 @@ class Test_Importer extends Importer {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<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">
|
<span class="help-wrapper">
|
||||||
<a class="help-button has-text-secondary">
|
<a class="help-button has-text-secondary">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
|
@ -243,7 +243,7 @@ class Test_Importer extends Importer {
|
||||||
<h5><?php _e('Horizontal image size', 'tainacan'); ?></h5>
|
<h5><?php _e('Horizontal image size', 'tainacan'); ?></h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="help-tooltip-body">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@ -253,7 +253,7 @@ class Test_Importer extends Importer {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<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">
|
<span class="help-wrapper">
|
||||||
<a class="help-button has-text-secondary">
|
<a class="help-button has-text-secondary">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
|
@ -265,7 +265,7 @@ class Test_Importer extends Importer {
|
||||||
<h5><?php _e('Vertical image size', 'tainacan'); ?></h5>
|
<h5><?php _e('Vertical image size', 'tainacan'); ?></h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="help-tooltip-body">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -312,12 +312,10 @@ export default {
|
||||||
'taxonomy': this.taxonomy
|
'taxonomy': this.taxonomy
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
this.$emit( 'isLoadingItems', false);
|
this.$emit( 'isLoadingItems', false);
|
||||||
this.$emit( 'hasFiltered', res.hasFiltered);
|
this.$emit( 'hasFiltered', res.hasFiltered);
|
||||||
|
|
||||||
if(res.advancedSearchResults){
|
if(res.advancedSearchResults){
|
||||||
this.$router.replace({query: this.$store.getters['search/getPostQuery'],});
|
|
||||||
this.$emit('advancedSearchResults', res.advancedSearchResults);
|
this.$emit('advancedSearchResults', res.advancedSearchResults);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,7 +6,7 @@ export const fetchProcesses = ({ commit }, {page, processesPerPage}) => {
|
||||||
let endpoint = '/bg-processes?all_users=1';
|
let endpoint = '/bg-processes?all_users=1';
|
||||||
|
|
||||||
if (page != undefined)
|
if (page != undefined)
|
||||||
endpoint += 'paged=' + page;
|
endpoint += '&paged=' + page;
|
||||||
if (processesPerPage != undefined)
|
if (processesPerPage != undefined)
|
||||||
endpoint += '&perpage=' + processesPerPage;
|
endpoint += '&perpage=' + processesPerPage;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
=== Tainacan ===
|
=== Tainacan ===
|
||||||
Contributors: fabianobn, jacsonp, leogermani, weryques, wetah
|
Contributors: andrebenedito, fabianobn, jacsonp, leogermani, weryques, wetah
|
||||||
Tags: museums, libraries, archives, GLAM, collections, repository
|
Tags: museums, libraries, archives, GLAM, collections, repository
|
||||||
Requires at least: 4.8
|
Requires at least: 4.8
|
||||||
Tested up to: 4.9.7
|
Tested up to: 4.9.8
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Stable tag: 0.3
|
Stable tag: 0.4
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
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.
|
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 =
|
= 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
|
7. Navigate through rich filtering interface
|
||||||
8. Explore more with Advanced Search
|
8. Explore more with Advanced Search
|
||||||
9. Set up Taxonomies to be used across your repository
|
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
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: Tainacan
|
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.
|
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
|
Author: Media Lab / UFG
|
||||||
Version: 0.3
|
Version: 0.4
|
||||||
Text Domain: tainacan
|
Text Domain: tainacan
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
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
|
* @return bool True if item has document, false if it does not
|
||||||
*/
|
*/
|
||||||
function tainacan_has_document() {
|
function tainacan_has_document() {
|
||||||
$item = tainacan_get_item();
|
|
||||||
|
|
||||||
if (!$item)
|
$document = tainacan_get_the_document();
|
||||||
return;
|
|
||||||
|
|
||||||
$document = $item->get_document();
|
|
||||||
|
|
||||||
return ! empty($document);
|
return ! empty($document);
|
||||||
|
|
||||||
|
|
|
@ -948,9 +948,9 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
||||||
'POST', $this->api_baseroute
|
'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);
|
$response = $this->server->dispatch($request);
|
||||||
|
|
||||||
|
@ -1128,6 +1128,10 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
||||||
'items_ids' => $ids,
|
'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() );
|
$this->assertEquals( 17, $bulk->delete_items() );
|
||||||
|
|
||||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
$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 |