Merge branch 'develop' into feature/778
This commit is contained in:
commit
3ca1411a6a
|
@ -19,17 +19,10 @@ class REST_Exporters_Controller extends REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->rest_base = 'exporters';
|
$this->rest_base = 'exporters';
|
||||||
if (session_status() == PHP_SESSION_NONE) {
|
|
||||||
@session_start(); // @ avoids Warnings when running phpunit tests
|
|
||||||
}
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
add_action('init', array(&$this, 'init_objects'), 11);
|
add_action('init', array(&$this, 'init_objects'), 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
|
||||||
session_write_close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize objects after post_type register
|
* Initialize objects after post_type register
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,8 +11,6 @@ use Tainacan\Entities;
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
class REST_Importers_Controller extends REST_Controller {
|
class REST_Importers_Controller extends REST_Controller {
|
||||||
private $collections_repository;
|
|
||||||
private $collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST_Importers_Controller constructor.
|
* REST_Importers_Controller constructor.
|
||||||
|
@ -20,15 +18,9 @@ class REST_Importers_Controller extends REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->rest_base = 'importers';
|
$this->rest_base = 'importers';
|
||||||
if (session_status() == PHP_SESSION_NONE) {
|
|
||||||
@session_start(); // @ avoids Warnings when running phpunit tests
|
|
||||||
}
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
|
||||||
session_write_close();
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Register the collections route and their endpoints
|
* Register the collections route and their endpoints
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class ScriptTainacanOld {
|
|
||||||
|
|
||||||
var $step = 0;
|
|
||||||
var $url = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* start the execution
|
|
||||||
*/
|
|
||||||
function __construct($argv) {
|
|
||||||
|
|
||||||
$this->parse_args($argv);
|
|
||||||
$this->run();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parse args from and set the attributs
|
|
||||||
* 1 - Old Tainacan url (required)
|
|
||||||
*/
|
|
||||||
function parse_args($argv) {
|
|
||||||
|
|
||||||
if (!is_array($argv))
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($argv[1])) {
|
|
||||||
|
|
||||||
if (filter_var($argv[1], FILTER_VALIDATE_URL)) {
|
|
||||||
$this->url = $argv[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($argv[2])) {
|
|
||||||
|
|
||||||
if (is_numeric($argv[2])) {
|
|
||||||
$this->step = $argv[2];
|
|
||||||
} else {
|
|
||||||
$this->run = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* echo message in prompt line
|
|
||||||
*/
|
|
||||||
function log($msg) {
|
|
||||||
|
|
||||||
echo $msg . PHP_EOL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function run() {
|
|
||||||
|
|
||||||
$start = $partial = microtime(true);
|
|
||||||
|
|
||||||
// Avoid warnings
|
|
||||||
$_SERVER['SERVER_PROTOCOL'] = "HTTP/1.1";
|
|
||||||
$_SERVER['REQUEST_METHOD'] = "GET";
|
|
||||||
|
|
||||||
define( 'WP_USE_THEMES', false );
|
|
||||||
define( 'SHORTINIT', false );
|
|
||||||
// require( dirname(__FILE__) . '/../../../../wp-blog-header.php' );
|
|
||||||
|
|
||||||
$old_tainacan = new \Tainacan\Importer\Old_Tainacan();
|
|
||||||
$id = $old_tainacan->get_id();
|
|
||||||
|
|
||||||
$_SESSION['tainacan_importer'][$id]->set_url($this->url);
|
|
||||||
|
|
||||||
while (!$_SESSION['tainacan_importer'][$id]->is_finished()){
|
|
||||||
$_SESSION['tainacan_importer'][$id]->run();
|
|
||||||
}
|
|
||||||
|
|
||||||
$scripttime = microtime(true) - $start;
|
|
||||||
|
|
||||||
$this->log("==========================================================");
|
|
||||||
$this->log("==========================================================");
|
|
||||||
$this->log("=== Fim do script. Tempo de execução {$scripttime}s");
|
|
||||||
$this->log("==========================================================");
|
|
||||||
$this->log("==========================================================");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$x = new ScriptTainacanOld($argv);
|
|
|
@ -4,7 +4,7 @@ Tags: museums, libraries, archives, GLAM, collections, repository
|
||||||
Requires at least: 5.0
|
Requires at least: 5.0
|
||||||
Tested up to: 6.1
|
Tested up to: 6.1
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Stable tag: 0.20.1
|
Stable tag: 0.20.2
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Plugin Name: Tainacan
|
||||||
Plugin URI: https://tainacan.org/
|
Plugin URI: https://tainacan.org/
|
||||||
Description: Open source, 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.
|
Description: Open source, 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.
|
||||||
Author: Tainacan.org
|
Author: Tainacan.org
|
||||||
Version: 0.20.1
|
Version: 0.20.2
|
||||||
Requires at least: 5.0
|
Requires at least: 5.0
|
||||||
Tested up to: 6.1
|
Tested up to: 6.1
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
|
@ -14,7 +14,7 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TAINACAN_VERSION = '0.20.1';
|
const TAINACAN_VERSION = '0.20.2';
|
||||||
|
|
||||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
||||||
|
|
|
@ -86,8 +86,33 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import TainacanFilterNumeric from './numeric/Numeric.vue';
|
||||||
|
import TainacanFilterDate from './date/Date.vue';
|
||||||
|
import TainacanFilterSelectbox from './selectbox/Selectbox.vue';
|
||||||
|
import TainacanFilterAutocomplete from './autocomplete/Autocomplete.vue';
|
||||||
|
import TainacanFilterCheckbox from './checkbox/Checkbox.vue';
|
||||||
|
import TainacanFilterTaginput from './taginput/Taginput.vue';
|
||||||
|
import TainacanFilterTaxonomyCheckbox from './taxonomy/Checkbox.vue';
|
||||||
|
import TainacanFilterTaxonomyTaginput from './taxonomy/Taginput.vue';
|
||||||
|
import TainacanFilterDateInterval from './date-interval/DateInterval.vue';
|
||||||
|
import TainacanFilterNumericInterval from './numeric-interval/NumericInterval.vue';
|
||||||
|
import TainacanFilterNumericListInterval from './numeric-list-interval/NumericListInterval.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TainacanFilterItem',
|
name: 'TainacanFilterItem',
|
||||||
|
components: {
|
||||||
|
TainacanFilterNumeric,
|
||||||
|
TainacanFilterDate,
|
||||||
|
TainacanFilterSelectbox,
|
||||||
|
TainacanFilterAutocomplete,
|
||||||
|
TainacanFilterCheckbox,
|
||||||
|
TainacanFilterTaginput,
|
||||||
|
TainacanFilterTaxonomyCheckbox,
|
||||||
|
TainacanFilterTaxonomyTaginput,
|
||||||
|
TainacanFilterDateInterval,
|
||||||
|
TainacanFilterNumericInterval,
|
||||||
|
TainacanFilterNumericListInterval
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
filter: Object,
|
filter: Object,
|
||||||
query: Object,
|
query: Object,
|
||||||
|
|
|
@ -229,6 +229,35 @@ class Compound extends Metadata_Type {
|
||||||
return "<div class='tainacan-compound-group'> {$return} </div>";
|
return "<div class='tainacan-compound-group'> {$return} </div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Return the value of an Item_Metadata_Entity using a metadatum of this metadatum type as a string
|
||||||
|
// * @param Item_Metadata_Entity $item_metadata
|
||||||
|
// * @return string The String representation of the value, containing one or multiple items names, linked to the item page
|
||||||
|
// */
|
||||||
|
public function get_value_as_string(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||||
|
$value = $item_metadata->get_value();
|
||||||
|
$return = '';
|
||||||
|
|
||||||
|
if ( empty($value) )
|
||||||
|
return $return;
|
||||||
|
|
||||||
|
if ( $item_metadata->is_multiple() ) {
|
||||||
|
foreach ( $value as $compound_element ) {
|
||||||
|
if ( !empty($compound_element) ) {
|
||||||
|
foreach ( $compound_element as $meta_id => $meta ) {
|
||||||
|
$return .= $meta->get_value_as_string() . " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return .= "\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ( $value as $meta_id => $meta ) {
|
||||||
|
$return .= $meta->get_value_as_string() . " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
private function get_meta_html(Item_Metadata_Entity $meta) {
|
private function get_meta_html(Item_Metadata_Entity $meta) {
|
||||||
$html = '';
|
$html = '';
|
||||||
if ($meta instanceof Item_Metadata_Entity && !empty($meta->get_value_as_html())) {
|
if ($meta instanceof Item_Metadata_Entity && !empty($meta->get_value_as_html())) {
|
||||||
|
|
|
@ -292,10 +292,12 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters, mapActions } from 'vuex';
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
|
import TainacanFilterItem from '../filter-types/tainacan-filter-item.vue';
|
||||||
import FiltersTagsList from './filters-tags-list.vue';
|
import FiltersTagsList from './filters-tags-list.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
TainacanFilterItem,
|
||||||
FiltersTagsList
|
FiltersTagsList
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
|
@ -55,19 +55,6 @@ import FormNumeric from '../components/metadata-types/numeric/FormNumeric.vue';
|
||||||
import FormUser from '../components/metadata-types/user/FormUser.vue';
|
import FormUser from '../components/metadata-types/user/FormUser.vue';
|
||||||
import FormGeoCoordinate from '../components/metadata-types/geocoordinate/FormGeoCoordinate.vue';
|
import FormGeoCoordinate from '../components/metadata-types/geocoordinate/FormGeoCoordinate.vue';
|
||||||
|
|
||||||
|
|
||||||
import FilterNumeric from '../components/filter-types/numeric/Numeric.vue';
|
|
||||||
import FilterDate from '../components/filter-types/date/Date.vue';
|
|
||||||
import FilterSelectbox from '../components/filter-types/selectbox/Selectbox.vue';
|
|
||||||
import FilterAutocomplete from '../components/filter-types/autocomplete/Autocomplete.vue';
|
|
||||||
import FilterCheckbox from '../components/filter-types/checkbox/Checkbox.vue';
|
|
||||||
import FilterTaginput from '../components/filter-types/taginput/Taginput.vue';
|
|
||||||
import FilterNumericInterval from '../components/filter-types/numeric-interval/NumericInterval.vue';
|
|
||||||
import FilterDateInterval from '../components/filter-types/date-interval/DateInterval.vue';
|
|
||||||
import FilterNumericListInterval from '../components/filter-types/numeric-list-interval/NumericListInterval.vue';
|
|
||||||
import FilterTaxonomyCheckbox from '../components/filter-types/taxonomy/Checkbox.vue';
|
|
||||||
import FilterTaxonomyTaginput from '../components/filter-types/taxonomy/Taginput.vue';
|
|
||||||
|
|
||||||
// Term edition form must be imported here so that it is not necessary on item-submission bundle
|
// Term edition form must be imported here so that it is not necessary on item-submission bundle
|
||||||
import TermEditionForm from '../components/edition/term-edition-form.vue';
|
import TermEditionForm from '../components/edition/term-edition-form.vue';
|
||||||
|
|
||||||
|
@ -80,7 +67,6 @@ import FormFilterNumericListInterval from '../components/filter-types/numeric-li
|
||||||
// import FormDate from '../../../classes/filter-types/date/FormDate.vue';
|
// import FormDate from '../../../classes/filter-types/date/FormDate.vue';
|
||||||
|
|
||||||
import TainacanFormItem from '../components/metadata-types/tainacan-form-item.vue';
|
import TainacanFormItem from '../components/metadata-types/tainacan-form-item.vue';
|
||||||
import TainacanFiltersList from '../components/filter-types/tainacan-filter-item.vue';
|
|
||||||
|
|
||||||
// Remaining imports
|
// Remaining imports
|
||||||
import AdminPage from '../admin.vue'
|
import AdminPage from '../admin.vue'
|
||||||
|
@ -228,29 +214,14 @@ export default (element) => {
|
||||||
Vue.component('term-edition-form', TermEditionForm);
|
Vue.component('term-edition-form', TermEditionForm);
|
||||||
Vue.component('tainacan-form-geocoordinate', FormGeoCoordinate);
|
Vue.component('tainacan-form-geocoordinate', FormGeoCoordinate);
|
||||||
|
|
||||||
|
|
||||||
/* Filters */
|
|
||||||
Vue.component('tainacan-filter-numeric', FilterNumeric);
|
|
||||||
Vue.component('tainacan-filter-date', FilterDate);
|
|
||||||
Vue.component('tainacan-filter-selectbox', FilterSelectbox);
|
|
||||||
Vue.component('tainacan-filter-autocomplete', FilterAutocomplete);
|
|
||||||
Vue.component('tainacan-filter-checkbox', FilterCheckbox);
|
|
||||||
Vue.component('tainacan-filter-taginput', FilterTaginput);
|
|
||||||
Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
|
|
||||||
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
|
|
||||||
Vue.component('tainacan-filter-numeric-interval', FilterNumericInterval);
|
|
||||||
Vue.component('tainacan-filter-numeric-list-interval', FilterNumericListInterval);
|
|
||||||
Vue.component('tainacan-filter-date-interval', FilterDateInterval);
|
|
||||||
|
|
||||||
/* Filter Metadata Option forms */
|
/* Filter Metadata Option forms */
|
||||||
Vue.component('tainacan-filter-form-numeric', FormFilterNumeric);
|
Vue.component('tainacan-filter-form-numeric', FormFilterNumeric);
|
||||||
Vue.component('tainacan-filter-form-numeric-interval', FormFilterNumericInterval);
|
Vue.component('tainacan-filter-form-numeric-interval', FormFilterNumericInterval);
|
||||||
Vue.component('tainacan-filter-form-numeric-list-interval', FormFilterNumericListInterval);
|
Vue.component('tainacan-filter-form-numeric-list-interval', FormFilterNumericListInterval);
|
||||||
// Vue.component('tainacan-filter-form-date', FormDate);
|
// Vue.component('tainacan-filter-form-date', FormDate);
|
||||||
|
|
||||||
// Filter and Metadadum parent containers
|
// Metadadum parent containers
|
||||||
Vue.component('tainacan-form-item', TainacanFormItem);
|
Vue.component('tainacan-form-item', TainacanFormItem);
|
||||||
Vue.component('tainacan-filter-item', TainacanFiltersList);
|
|
||||||
|
|
||||||
/* Others */
|
/* Others */
|
||||||
Vue.component('recursive-term-item', RecursiveTermItem);
|
Vue.component('recursive-term-item', RecursiveTermItem);
|
||||||
|
|
|
@ -73,17 +73,30 @@
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-content {
|
.media-content {
|
||||||
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 80%;
|
|
||||||
|
|
||||||
.ellipsed-text {
|
.ellipsed-text {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
|
transition: white-space .3s ease, overflow .3s ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.media-left+.media-content {
|
||||||
|
width: calc(100% - 32px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.ellipsed-text {
|
||||||
|
overflow-x: visible !important;
|
||||||
|
white-space: normal !important;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@
|
||||||
placement: 'auto-start',
|
placement: 'auto-start',
|
||||||
popperClass: ['tainacan-tooltip', 'tooltip']
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
}"
|
}"
|
||||||
class="ellipsed-text">
|
class="ellipsed-name">
|
||||||
{{ metadatum.name }}
|
{{ metadatum.name }}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -126,11 +126,11 @@
|
||||||
|
|
||||||
color: var(--tainacan-white);
|
color: var(--tainacan-white);
|
||||||
|
|
||||||
span:not(.ellipsed-text) {
|
span:not(.ellipsed-name) {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
margin-left: -5px;
|
margin-left: -5px;
|
||||||
}
|
}
|
||||||
.ellipsed-text {
|
.ellipsed-name {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
|
@ -687,7 +687,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FiltersTagsList from '../../../../admin/components/search/filters-tags-list.vue';
|
import FiltersTagsList from '../../../../admin/components/search/filters-tags-list.vue';
|
||||||
import FiltersItemsList from '../../../../admin/components/search/filters-items-list.vue';
|
|
||||||
import Pagination from '../../../../admin/components/search/pagination.vue'
|
import Pagination from '../../../../admin/components/search/pagination.vue'
|
||||||
import AdvancedSearch from '../../../../admin/components/search/advanced-search.vue';
|
import AdvancedSearch from '../../../../admin/components/search/advanced-search.vue';
|
||||||
import ExposersModal from '../../../../admin/components/modals/exposers-modal.vue';
|
import ExposersModal from '../../../../admin/components/modals/exposers-modal.vue';
|
||||||
|
@ -698,7 +697,6 @@
|
||||||
name: 'ThemeItemsPage',
|
name: 'ThemeItemsPage',
|
||||||
components: {
|
components: {
|
||||||
FiltersTagsList,
|
FiltersTagsList,
|
||||||
FiltersItemsList,
|
|
||||||
Pagination,
|
Pagination,
|
||||||
AdvancedSearch,
|
AdvancedSearch,
|
||||||
ExposersModal
|
ExposersModal
|
||||||
|
|
|
@ -27,32 +27,9 @@ import cssVars from 'css-vars-ponyfill';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
import VueBlurHash from 'vue-blurhash';
|
import VueBlurHash from 'vue-blurhash';
|
||||||
|
|
||||||
// Filters
|
|
||||||
import FilterNumeric from '../../../admin/components/filter-types/numeric/Numeric.vue';
|
|
||||||
import FilterDate from '../../../admin/components/filter-types/date/Date.vue';
|
|
||||||
import FilterSelectbox from '../../../admin/components/filter-types/selectbox/Selectbox.vue';
|
|
||||||
import FilterAutocomplete from '../../../admin/components/filter-types/autocomplete/Autocomplete.vue';
|
|
||||||
import FilterCheckbox from '../../../admin/components/filter-types/checkbox/Checkbox.vue';
|
|
||||||
import FilterTaginput from '../../../admin/components/filter-types/taginput/Taginput.vue';
|
|
||||||
import FilterTaxonomyCheckbox from '../../../admin/components/filter-types/taxonomy/Checkbox.vue';
|
|
||||||
import FilterTaxonomyTaginput from '../../../admin/components/filter-types/taxonomy/Taginput.vue';
|
|
||||||
import FilterDateInterval from '../../../admin/components/filter-types/date-interval/DateInterval.vue';
|
|
||||||
import FilterNumericInterval from '../../../admin/components/filter-types/numeric-interval/NumericInterval.vue';
|
|
||||||
import FilterNumericListInterval from '../../../admin/components/filter-types/numeric-list-interval/NumericListInterval.vue';
|
|
||||||
|
|
||||||
import TaincanFiltersList from '../../../admin/components/filter-types/tainacan-filter-item.vue';
|
|
||||||
import ThemeItemsPage from './theme-search/theme-items-page.vue';
|
import ThemeItemsPage from './theme-search/theme-items-page.vue';
|
||||||
import ThemeSearch from './theme.vue';
|
import ThemeSearch from './theme.vue';
|
||||||
|
|
||||||
// View Modes
|
|
||||||
import ViewModeTable from './theme-search/components/view-mode-table.vue';
|
|
||||||
import ViewModeCards from './theme-search/components/view-mode-cards.vue';
|
|
||||||
import ViewModeRecords from './theme-search/components/view-mode-records.vue';
|
|
||||||
import ViewModeMasonry from './theme-search/components/view-mode-masonry.vue';
|
|
||||||
import ViewModeSlideshow from './theme-search/components/view-mode-slideshow.vue';
|
|
||||||
import ViewModeList from './theme-search/components/view-mode-list.vue';
|
|
||||||
import ViewModeMap from './theme-search/components/view-mode-map.vue';
|
|
||||||
|
|
||||||
// Remaining imports
|
// Remaining imports
|
||||||
import store from '../../../admin/js/store/store';
|
import store from '../../../admin/js/store/store';
|
||||||
import routerTheme from './theme-search/js/theme-router.js';
|
import routerTheme from './theme-search/js/theme-router.js';
|
||||||
|
@ -135,33 +112,49 @@ export default (element) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.component('tainacan-filter-item', TaincanFiltersList);
|
// Filters logic
|
||||||
|
let possibleHideFilters = false;
|
||||||
|
if ( blockElement.attributes['hide-filters'] != undefined ) {
|
||||||
|
const hideFiltersValue = blockElement.attributes['hide-filters'].value;
|
||||||
|
possibleHideFilters = ( hideFiltersValue == true || hideFiltersValue == 'true' || hideFiltersValue == '1' || hideFiltersValue == 1 ) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Filters */
|
if ( !possibleHideFilters ) {
|
||||||
Vue.component('tainacan-filter-numeric', FilterNumeric);
|
import('../../../admin/components/search/filters-items-list.vue')
|
||||||
Vue.component('tainacan-filter-date', FilterDate);
|
.then(importedModule => Vue.component('filters-items-list', importedModule.default))
|
||||||
Vue.component('tainacan-filter-selectbox', FilterSelectbox);
|
.catch(error => console.log(error));
|
||||||
Vue.component('tainacan-filter-autocomplete', FilterAutocomplete);
|
}
|
||||||
Vue.component('tainacan-filter-checkbox', FilterCheckbox);
|
|
||||||
Vue.component('tainacan-filter-taginput', FilterTaginput);
|
|
||||||
Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
|
|
||||||
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
|
|
||||||
Vue.component('tainacan-filter-date-interval', FilterDateInterval);
|
|
||||||
Vue.component('tainacan-filter-numeric-interval', FilterNumericInterval);
|
|
||||||
Vue.component('tainacan-filter-numeric-list-interval', FilterNumericListInterval);
|
|
||||||
|
|
||||||
/* Main page component */
|
/* Main page component */
|
||||||
Vue.component('theme-items-page', ThemeItemsPage);
|
Vue.component('theme-items-page', ThemeItemsPage);
|
||||||
Vue.component('theme-search', ThemeSearch);
|
Vue.component('theme-search', ThemeSearch);
|
||||||
|
|
||||||
// Oficial view modes
|
// View Modes Logic
|
||||||
Vue.component('view-mode-table', ViewModeTable);
|
const registeredViewModes =
|
||||||
Vue.component('view-mode-cards', ViewModeCards);
|
( tainacan_plugin && tainacan_plugin.registered_view_modes && tainacan_plugin.registered_view_modes.lenght ) ?
|
||||||
Vue.component('view-mode-records', ViewModeRecords);
|
tainacan_plugin.registered_view_modes :
|
||||||
Vue.component('view-mode-masonry', ViewModeMasonry);
|
[ 'table', 'cards', 'records', 'masonry', 'slideshow', 'list', 'map' ];
|
||||||
Vue.component('view-mode-slideshow', ViewModeSlideshow);
|
|
||||||
Vue.component('view-mode-list', ViewModeList);
|
// At first, we consider that all registered view modes are included.
|
||||||
Vue.component('view-mode-map', ViewModeMap);
|
let possibleViewModes = registeredViewModes;
|
||||||
|
if ( blockElement.attributes['enabled-view-modes'] != undefined )
|
||||||
|
possibleViewModes = blockElement.attributes['enabled-view-modes'].value.split(',');
|
||||||
|
|
||||||
|
// View Mode settings
|
||||||
|
let possibleDefaultViewMode = 'masonry';
|
||||||
|
if ( blockElement.attributes['default-view-mode'] != undefined)
|
||||||
|
possibleDefaultViewMode = blockElement.attributes['default-view-mode'].value;
|
||||||
|
|
||||||
|
if ( possibleViewModes.indexOf(possibleDefaultViewMode) < 0 )
|
||||||
|
possibleViewModes.push(possibleDefaultViewMode);
|
||||||
|
|
||||||
|
// Logic for dynamic importing Tainacan oficial view modes only if they are necessary
|
||||||
|
possibleViewModes.forEach(viewModeSlug => {
|
||||||
|
if ( registeredViewModes.indexOf(viewModeSlug) >= 0 )
|
||||||
|
import('./theme-search/components/view-mode-' + viewModeSlug + '.vue')
|
||||||
|
.then(importedModule => Vue.component('view-mode-' + viewModeSlug, importedModule.default) )
|
||||||
|
.catch(error => console.log(error));
|
||||||
|
});
|
||||||
|
|
||||||
Vue.use(eventBusSearch, { store: store, router: routerTheme});
|
Vue.use(eventBusSearch, { store: store, router: routerTheme});
|
||||||
|
|
||||||
|
@ -215,18 +208,6 @@ export default (element) => {
|
||||||
if (this.$el.attributes['taxonomy'] != undefined)
|
if (this.$el.attributes['taxonomy'] != undefined)
|
||||||
this.taxonomy = this.$el.attributes['taxonomy'].value;
|
this.taxonomy = this.$el.attributes['taxonomy'].value;
|
||||||
|
|
||||||
// View Mode settings
|
|
||||||
if (this.$el.attributes['default-view-mode'] != undefined)
|
|
||||||
this.defaultViewMode = this.$el.attributes['default-view-mode'].value;
|
|
||||||
else
|
|
||||||
this.defaultViewMode = 'cards';
|
|
||||||
|
|
||||||
if (this.$el.attributes['is-forced-view-mode'] != undefined)
|
|
||||||
this.isForcedViewMode = new Boolean(this.$el.attributes['is-forced-view-mode'].value);
|
|
||||||
|
|
||||||
if (this.$el.attributes['enabled-view-modes'] != undefined)
|
|
||||||
this.enabledViewModes = this.$el.attributes['enabled-view-modes'].value.split(',');
|
|
||||||
|
|
||||||
// Sorting options
|
// Sorting options
|
||||||
if (this.$el.attributes['default-order'] != undefined)
|
if (this.$el.attributes['default-order'] != undefined)
|
||||||
this.defaultOrder = this.$el.attributes['default-order'].value;
|
this.defaultOrder = this.$el.attributes['default-order'].value;
|
||||||
|
@ -239,9 +220,15 @@ export default (element) => {
|
||||||
if (this.$el.attributes['default-orderby-type'] != undefined)
|
if (this.$el.attributes['default-orderby-type'] != undefined)
|
||||||
this.defaultOrderByType = this.maybeConvertFromJSON(this.$el.attributes['default-orderby-type'].value);
|
this.defaultOrderByType = this.maybeConvertFromJSON(this.$el.attributes['default-orderby-type'].value);
|
||||||
|
|
||||||
|
// View modes settings
|
||||||
|
if (this.$el.attributes['is-forced-view-mode'] != undefined)
|
||||||
|
this.isForcedViewMode = new Boolean(this.$el.attributes['is-forced-view-mode'].value);
|
||||||
|
|
||||||
|
this.defaultViewMode = possibleDefaultViewMode;
|
||||||
|
this.enabledViewModes = possibleViewModes;
|
||||||
|
|
||||||
// Options related to hidding elements
|
// Options related to hidding elements
|
||||||
if (this.$el.attributes['hide-filters'] != undefined)
|
this.hideFilters = possibleHideFilters;
|
||||||
this.hideFilters = this.isParameterTrue('hide-filters');
|
|
||||||
if (this.$el.attributes['hide-hide-filters-button'] != undefined)
|
if (this.$el.attributes['hide-hide-filters-button'] != undefined)
|
||||||
this.hideHideFiltersButton = this.isParameterTrue('hide-hide-filters-button');
|
this.hideHideFiltersButton = this.isParameterTrue('hide-hide-filters-button');
|
||||||
if (this.$el.attributes['hide-search'] != undefined)
|
if (this.$el.attributes['hide-search'] != undefined)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<li
|
<li
|
||||||
class="facet-list-item"
|
class="facet-list-item"
|
||||||
:class="(!showImage ? 'facet-without-image' : '') + (nameInsideImage ? ' facet-with-name-inside-image' : '') + ((appendChildTerms && facet.total_children > 0) ? ' facet-term-with-children': '')">
|
:class="(!showImage ? 'facet-without-image' : '') + (nameInsideImage ? ' facet-with-name-inside-image' : '') + (isCollapseInsteadOfLink(facet) ? ' facet-term-with-children': '')">
|
||||||
<a
|
<a
|
||||||
:id="isNaN(facetId) ? facetId : 'facet-id-' + facetId"
|
:id="isNaN(facetId) ? facetId : 'facet-id-' + facetId"
|
||||||
:href="(appendChildTerms && facet.total_children > 0) ? null : ((linkTermFacetsToTermPage && isMetadatumTypeTaxonomy) ? facet.term_url : facet.url)"
|
:href="isCollapseInsteadOfLink(facet) ? null : ((linkTermFacetsToTermPage && isMetadatumTypeTaxonomy) ? facet.term_url : facet.url)"
|
||||||
@click="() => { (appendChildTerms && facet.total_children > 0) ? displayChildTerms(facetId) : null }"
|
@click="() => { isCollapseInsteadOfLink(facet) ? displayChildTerms(facetId) : null }"
|
||||||
:style="{ fontSize: layout == 'cloud' && facet.total_items ? + (1 + (cloudRate/4) * Math.log(facet.total_items)) + 'em' : ''}">
|
:style="{ fontSize: layout == 'cloud' && facet.total_items ? + (1 + (cloudRate/4) * Math.log(facet.total_items)) + 'em' : ''}">
|
||||||
<img
|
<img
|
||||||
v-if="isMetadatumTypeTaxonomy"
|
v-if="isMetadatumTypeTaxonomy"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="appendChildTerms && facet.total_children > 0">
|
<template v-if="appendChildTerms && facet.total_children > 0 && (!childFacetsObject[facet.id != undefined ? facet.id : facet.value] || childFacetsObject[facet.id != undefined ? facet.id : facet.value].facets.length)">
|
||||||
<svg
|
<svg
|
||||||
v-if="childFacetsObject[facetId] && childFacetsObject[facetId].visible"
|
v-if="childFacetsObject[facetId] && childFacetsObject[facetId].visible"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
@ -154,6 +154,9 @@ export default {
|
||||||
displayChildTerms(facetId) {
|
displayChildTerms(facetId) {
|
||||||
this.$emit('on-display-child-terms', facetId)
|
this.$emit('on-display-child-terms', facetId)
|
||||||
},
|
},
|
||||||
|
isCollapseInsteadOfLink(facet) {
|
||||||
|
return (this.appendChildTerms && facet.total_children > 0 && (!this.childFacetsObject[facet.id != undefined ? facet.id : facet.value] || this.childFacetsObject[facet.id != undefined ? facet.id : facet.value].facets.length) );
|
||||||
|
},
|
||||||
getSkeletonHeight() {
|
getSkeletonHeight() {
|
||||||
switch(this.layout) {
|
switch(this.layout) {
|
||||||
case 'grid':
|
case 'grid':
|
||||||
|
|
|
@ -30,6 +30,15 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
this->assertEquals( $collection->get_id(), $_SESSION['tainacan_importer'][$id]->collection->get_id() );
|
this->assertEquals( $collection->get_id(), $_SESSION['tainacan_importer'][$id]->collection->get_id() );
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
@session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __destruct() {
|
||||||
|
session_write_close();
|
||||||
|
}
|
||||||
|
|
||||||
public function test_automapping_old_tainacan()
|
public function test_automapping_old_tainacan()
|
||||||
{
|
{
|
||||||
//$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
//$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||||
|
|
Loading…
Reference in New Issue