From b669d3e879206b2accff340ae3de274f5a2ed200 Mon Sep 17 00:00:00 2001 From: Adrian Date: Wed, 10 Nov 2021 23:53:21 +0200 Subject: [PATCH] Modified several files for spelling and grammar mistakes --- .../class-tainacan-rest-items-controller.php | 10 +- .../class-tainacan-bulk-edit-process.php | 16 +-- .../class-tainacan-importer-handler.php | 62 ++++----- src/readme.txt | 76 +++++------ .../components/edition/term-edition-form.vue | 2 +- .../metadata-types/taxonomy/Taxonomy.vue | 20 +-- .../components/modals/bulk-edition-modal.vue | 6 +- src/views/admin/js/router.js | 18 +-- .../js/store/modules/taxonomy/actions.js | 32 ++--- .../components/term-creation-panel.vue | 2 +- .../item-submission/item-submission-form.vue | 120 +++++++++--------- src/views/tainacan-i18n.php | 24 ++-- tests/test-compound-metadatum-types.php | 66 +++++----- 13 files changed, 227 insertions(+), 227 deletions(-) diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php index be2cb4e40..1fb8abe6a 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php @@ -885,7 +885,7 @@ class REST_Items_Controller extends REST_Controller { } - private function submission_item_metadada ( \Tainacan\Entities\Item_Metadata_Entity &$item_metadata, $request) { + private function submission_item_metadata ( \Tainacan\Entities\Item_Metadata_Entity &$item_metadata, $request) { $collection_id = $item_metadata->get_item()->get_collection_id(); $item = $item_metadata->get_item(); $collection = $this->collections_repository->fetch($collection_id); @@ -1002,7 +1002,7 @@ class REST_Items_Controller extends REST_Controller { $metadatum_child = $this->metadatum_repository->fetch( $child['metadatum_id'] ); $item_metadata_child = new Entities\Item_Metadata_Entity($item, $metadatum_child, null, $parent_meta_id); $item_metadata_child->set_value($child_value); - $item_metadata_child = $this->submission_item_metadada($item_metadata_child, $request); + $item_metadata_child = $this->submission_item_metadata($item_metadata_child, $request); if ($item_metadata_child instanceof \WP_REST_Response) { return $item_metadata_child; } @@ -1024,7 +1024,7 @@ class REST_Items_Controller extends REST_Controller { $metadatum_child = $this->metadatum_repository->fetch( $child['metadatum_id'] ); $item_metadata_child = new Entities\Item_Metadata_Entity($item, $metadatum_child, null, $parent_meta_id); $item_metadata_child->set_value($child_value); - $item_metadata_child = $this->submission_item_metadada($item_metadata_child, $request); + $item_metadata_child = $this->submission_item_metadata($item_metadata_child, $request); if ($item_metadata_child instanceof \WP_REST_Response) { return $item_metadata_child; } @@ -1046,7 +1046,7 @@ class REST_Items_Controller extends REST_Controller { } else { $item_metadata->set_value( is_array($value) ? implode(' ', $value) : $value); } - $item_metadata = $this->submission_item_metadada($item_metadata, $request); + $item_metadata = $this->submission_item_metadata($item_metadata, $request); if ($item_metadata instanceof \WP_REST_Response) { return $item_metadata; } @@ -1061,7 +1061,7 @@ class REST_Items_Controller extends REST_Controller { } else { $item_metadata->set_value( is_array($value) ? implode(' ', $value) : $value); } - $item_metadata = $this->submission_item_metadada($item_metadata, $request); + $item_metadata = $this->submission_item_metadata($item_metadata, $request); if ($item_metadata instanceof \WP_REST_Response) { return $item_metadata; } diff --git a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php index 5c8221ec0..a6bbcba2a 100644 --- a/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php +++ b/src/classes/generic-background-process/class-tainacan-bulk-edit-process.php @@ -23,8 +23,8 @@ class Bulk_Edit_Process extends Generic_Process { $this->item_metadata_repository = \Tainacan\Repositories\Item_Metadata::get_instance(); $this->steps = [ [ - 'name' => __('Bulk edit control metadada', 'tainacan'), - 'progress_label' => __('Creating bulk edit control metadada', 'tainacan'), + 'name' => __('Bulk edit control metadata', 'tainacan'), + 'progress_label' => __('Creating bulk edit control metadata', 'tainacan'), 'callback' => 'add_control_metadata' ],[ 'name' => __('Bulk edit', 'tainacan'), @@ -310,7 +310,7 @@ class Bulk_Edit_Process extends Generic_Process { $unique = !$compoundItem->is_multiple(); $compoundValue = $compoundItem->get_value(); if ( $unique && !empty($compoundValue) ) { - $key = array_keys($compoundValue)[0]; // get the first metadata ID, if the argument metadata does not exist + $key = array_keys($compoundValue)[0]; // get the first metadata ID, if the argument metadata does not exist $parent_meta_id = $compoundValue[$key]->get_parent_meta_id(); return $parent_meta_id; } // elseif ((is_array($compoundValue) && sizeof($compoundValue) > 0)) @@ -359,10 +359,10 @@ class Bulk_Edit_Process extends Generic_Process { return $this->save_item_metadata($item_metadata, $item); } else { $metadatum_from = $this->metadatum_repository->fetch($metadatum_id_from); - if ( $metadatum_from->get_metadata_type() == $metadatum->get_metadata_type() && + if ( $metadatum_from->get_metadata_type() == $metadatum->get_metadata_type() && ( $metadatum_from->is_multiple() == false || $metadatum_from->is_multiple() == $metadatum->is_multiple() ) ) { $item_metadata_from = new Entities\Item_Metadata_Entity( $item, $metadatum_from ); - + $value = $item_metadata_from->get_value(); if ( $metadatum->get_metadata_type_object()->get_primitive_type() == 'term' ) { if ( $metadatum_from->is_multiple() ) { @@ -379,7 +379,7 @@ class Bulk_Edit_Process extends Generic_Process { return $this->save_item_metadata($item_metadata, $item); } } - + $this->add_error_log( __('Not possible to copy metadata values of different types', 'tainacan') ); return false; } @@ -445,7 +445,7 @@ class Bulk_Edit_Process extends Generic_Process { $metadatum = $item_metadata->get_metadatum(); if($metadatum->get_id() == $metadatum_id) { $values = is_array($item_metadata->get_value()) ? $item_metadata->get_value() : [$item_metadata->get_value()]; - + if ( $metadatum->get_metadata_type_object()->get_primitive_type() == 'term' ) { $new_term = is_string($new_value) ? $new_value : \Tainacan\Repositories\Terms::get_instance()->fetch($new_value, $metadatum->get_metadata_type_object()->get_taxonomy()); $values = array_map( function ($term) use ($old_value, $new_term) { @@ -453,7 +453,7 @@ class Bulk_Edit_Process extends Generic_Process { ($term == $old_value ? $new_term : $term) : ($term->get_id() == $old_value ? $new_term : $term); }, $values ); - + $item_metadata->set_value( $metadatum->is_multiple() ? $values : $new_term ); return $this->save_item_metadata($item_metadata, $item); } else { diff --git a/src/classes/importer/class-tainacan-importer-handler.php b/src/classes/importer/class-tainacan-importer-handler.php index 33767e069..555918c84 100644 --- a/src/classes/importer/class-tainacan-importer-handler.php +++ b/src/classes/importer/class-tainacan-importer-handler.php @@ -1,13 +1,13 @@ -bg_importer = new Background_Importer(); add_action('init', array(&$this, 'init')); @@ -23,7 +23,7 @@ class Importer_Handler { 'manual_collection' => true, 'manual_mapping' => true, ]); - + $this->register_importer([ 'name' => 'Test', 'description' => __('Create 2 test colletions with random items', 'tainacan'), @@ -61,8 +61,8 @@ class Importer_Handler { ]); $this->register_importer([ - 'name' => 'Youtube (Experimental)', - 'description' => __('Import items from an Youtube URL', 'tainacan'), + 'name' => 'YouTube (Experimental)', + 'description' => __('Import items from an YouTube URL', 'tainacan'), 'slug' => 'youtube_importer', 'class_name' => '\Tainacan\Importer\Youtube_Importer', 'manual_collection' => true, @@ -71,7 +71,7 @@ class Importer_Handler { $this->register_importer([ 'name' => 'Flickr (Experimental)', - 'description' => __('Import items from an Flickr URL', 'tainacan'), + 'description' => __('Import items from a Flickr URL', 'tainacan'), 'slug' => 'flickr_importer', 'class_name' => '\Tainacan\Importer\Flickr_Importer', 'manual_collection' => true, @@ -87,53 +87,53 @@ class Importer_Handler { global $TAINACAN_BASE_URL; wp_enqueue_script('import_term_csv_script', $TAINACAN_BASE_URL . '/classes/importer/term-importer/js/term.js', false, TAINACAN_VERSION, true); } - + function add_to_queue(\Tainacan\Importer\Importer $importer_object) { $data = $importer_object->_to_Array(true); $importer = $this->get_importer_by_object($importer_object); - + // Translators: The name of the importer process. E.g. CSV Importer, Legacy Tainacan Importer $importer_name = sprintf( __('%s Importer', 'tainacan'), $importer['name'] ); - + $bg_process = $this->bg_importer->data($data)->set_name($importer_name)->save(); if ( is_wp_error($bg_process->dispatch()) ) { return false; } return $bg_process; - + } /** * Register Importer - * - * - * + * + * + * * @param array $importer { * Required. Array or string of arguments describing the importer - * + * * @type string $name The name of the importer. e.g. 'Example Importer' * @type string $slug A unique slug for the importer. e.g. 'This is an example importer description' * @type string $description The importer description. e.g. 'example-importer' * @type string $class_name The Importer Class. e.g. '\Tainacan\Importer\Test_Importer' - * @type bool $manual_mapping Wether Tainacan must present the user with an interface to manually map + * @type bool $manual_mapping Wether Tainacan must present the user with an interface to manually map * the metadata from the source to the target collection. * - * If set to true, Importer Class must implement the method + * If set to true, Importer Class must implement the method * get_source_metadata() to return the metadatum found in the source. - * + * * Note that this will only work when importing items to one single collection. - * + * * @type bool $manual_collection Wether Tainacan will let the user choose a destination collection. * - * If set to true, the API endpoints will handle Collection creation and will assign it to + * If set to true, the API endpoints will handle Collection creation and will assign it to * the importer object using add_collection() method. - * - * Otherwise, the child importer class must create the collections and add them to the collections property also + * + * Otherwise, the child importer class must create the collections and add them to the collections property also * using add_collection() - * + * */ public function register_importer(array $importer) { - + $defaults = [ 'manual_mapping' => false, 'manual_collection' => true @@ -144,7 +144,7 @@ class Importer_Handler { if (!isset($attrs['slug']) || !isset($attrs['class_name']) || !isset($attrs['name'])) { return false; } - + $this->registered_importers[$importer['slug']] = $attrs; return true; @@ -185,7 +185,7 @@ class Importer_Handler { } return false; } - + /** * Save importer instance to the database * @param Tainacan\Importer\Importer $importer The Importer object @@ -194,7 +194,7 @@ class Importer_Handler { public function save_importer_instance(\Tainacan\Importer\Importer $importer) { update_option('tnc_transient_' . $importer->get_id(), $importer, false); } - + /** * Retrieves an Importer instance from the database based on its session_id * @param string $session_id The Importer ID @@ -204,7 +204,7 @@ class Importer_Handler { $importer = get_option('tnc_transient_' . $session_id); return $importer; } - + /** * Deletes this importer instance from the database * @param Tainacan\Importer\Importer $importer The Importer object @@ -213,8 +213,8 @@ class Importer_Handler { public function delete_importer_instance(\Tainacan\Importer\Importer $importer) { return delete_option('tnc_transient_' . $importer->get_id()); } - - + + } global $Tainacan_Importer_Handler; diff --git a/src/readme.txt b/src/readme.txt index 5089245ea..c4c3be2e9 100644 --- a/src/readme.txt +++ b/src/readme.txt @@ -10,81 +10,81 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.html Tainacan is an open-source, powerful and flexible digital repository platform for WordPress. With all the tools of a professional repository platform, you can manage and publish your digital collections as easily as posting to your blog. It is versatile and can be used to create a digital collection, a digital library or a digital repository for your institutional or personal collection. - + == Description == - -[Tainacan](https://tainacan.org/) is an [open-source](https://github.com/tainacan/tainacan), powerful and flexible digital repository platform for WordPress. Manage and publish your digital collections just as easily as you post to your blog, having all the tools of a professional repository platform. It can be used for the creation of a digital collection, a digital library or a digital repository for your institutional or personal collection. + +[Tainacan](https://tainacan.org/) is an [open-source](https://github.com/tainacan/tainacan), powerful and flexible digital repository platform for WordPress. Manage and publish your digital collections just as easily as you post to your blog, having all the tools of a professional repository platform. It can be used for the creation of a digital collection, a digital library or a digital repository for your institutional or personal collection. Tainacan aims to facilitate the activities of organizing, documenting, disseminating and displaying digital objects based on simple and accessible principles of digital curation. The plugin integrates with the Wordpress block engine, making it easy to reuse objects for different and varied uses. - + = Features = - + * "Metadata and Filters": Use a metadata standard or choose whatever set of metadata you want to describe the items in your collections. Also, choose which metadata will be used as a filter when browsing collections. - + * "Faceted Search". Browse your collection (and let the public browse it) using a faceted search interface with the filters you have chosen. - + * "Manage Taxonomies": Manage vocabularies that can be used across all your collections. - + * "Themes": The Tainacan plugin has its own default theme, which helps you to showcase your collections in a beautiful and effective manner. But it can also work with any WordPress theme, so interface developers can easily add Tainacan specific features to an existing theme. - + * "API and Interoperability": Tainacan implements a RESTful API (read and write) to allow other applications to interact with your repository. That way, you can expose your collection in different formats, such as JSON, JsonLD, OAI-PMH and others. If your collection has a specific set of metadata, you can map this metadata to match the patterns you want to use. - + * "Gutenberg blocks": Tell stories with your collections. Tainacan offers you several Gutenberg blocks so you can present your collections to the public in many different ways! - + == Getting Started == - + After installation, you will see a new menu item in your admin panel called "Tainacan". Click on it to open the Tainacan admin interface. - + To get an overview of the main concepts of Tainacan, please visit [this page](https://tainacan.github.io/tainacan-wiki/#/general-concepts). - + = Create a collection = - + Click "New Collection" to create a new collection, use a mapping standard or import it using one of our importers. - + = Configure your collection = - + Navigate to the top menu to set your collection up. Create the metadata that items in this collection will have, and choose, from these metadata, which ones are going to be used as a filter. - + = Add items = - + Back to the "Items" screen, click "Add new" to create a new item. - + = Manage and browse your collection = - + Through this admin interface you can manage your collection and browse its item using the faceted search interface or advanced search interface. - + If you want to visit your collections in the public side of your site, using your current theme, visit http://your-site/collections and you will get the list of your collections. - + = Set up Taxonomies = - + You can also have metadata as taxonomies, which you can configure with a set of hierarchical terms of your own vocabulary. - + = Add links to your menu = - -Edit your menu and links directly to your collections. Click "Screen options" at the top of the Menu edition page and enable "Collections". - + +Edit your menu and links directly to your collections. Click "Screen options" at the top of the Edit Menu page and enable "Collections". + If you want to add a link to the list of collections, click "View all" tab on the Collections box on the left, and then add the first item named "Collections" to the menu. - + = Faceted search in your theme = - -To have a fully-featured faceted search in your theme, you can either make it compatible with a few templates or use our Faceted Search Block. - + +To have a fully-featured faceted search in your theme, you can either make it compatible with a few templates or use our Faceted Search Block. + == Installation == - + Upload the files to the plugins directory and activate it. You can also install and activate directly from the admin panel. - + If you have Imagick installed in your server, Tainacan will be able to automatically generate a thumbnail from your PDF files. This is desired but not required. - + == Find out more == - + * Visit our official website: [https://tainacan.org/](https://tainacan.org/) * Contribute to the source code: [https://github.com/tainacan/tainacan](https://github.com/tainacan/tainacan) * Check our documentation Wiki: [https://wiki.tainacan.org/](https://wiki.tainacan.org/) - + == Screenshots == - + 1. Manage your repository 2. Set up your collection 3. Choose the metadata and filters for your collection diff --git a/src/views/admin/components/edition/term-edition-form.vue b/src/views/admin/components/edition/term-edition-form.vue index e9dcbe655..67764ab6b 100644 --- a/src/views/admin/components/edition/term-edition-form.vue +++ b/src/views/admin/components/edition/term-edition-form.vue @@ -12,7 +12,7 @@ :is="isModal ? 'header' : 'div'" class="tainacan-page-title" :class="{ 'tainacan-modal-title': isModal }"> -

{{ editForm & editForm.id && editForm.id != 'new' ? $i18n.get("title_term_edition") : $i18n.get("title_term_creation") }}

+

{{ editForm & editForm.id && editForm.id != 'new' ? $i18n.get("title_term_edit") : $i18n.get("title_term_creation") }}

-
- - 1 @@ -146,9 +146,9 @@ this.taxonomyId = metadata_type_options.taxonomy_id; this.taxonomy = metadata_type_options.taxonomy; - + this.allowNewFromOptions = this.allowNew === false ? false : metadata_type_options.allow_new_terms == 'yes'; - + this.getTermsId(); }, methods: { @@ -196,11 +196,11 @@ if (this.itemMetadatum.metadatum.multiple === 'no') this.valueComponent = term.parent ? (term.parent + '>>' + term.name) : term.name; else - this.valueComponent.push(term.parent ? (term.parent + '>>' + term.name) : term.name); + this.valueComponent.push(term.parent ? (term.parent + '>>' + term.name) : term.name); }, openTermCreationModal(newTerm) { this.newTermName = newTerm.name; - + if (this.isOnItemSubmissionForm) this.isTermCreationPanelOpen = true; else diff --git a/src/views/admin/components/modals/bulk-edition-modal.vue b/src/views/admin/components/modals/bulk-edition-modal.vue index 22d7f9d58..1bfc95b20 100644 --- a/src/views/admin/components/modals/bulk-edition-modal.vue +++ b/src/views/admin/components/modals/bulk-edition-modal.vue @@ -219,7 +219,7 @@ class="button is-white is-pulled-right"> + :label="$i18n.get('info_bulk_edit_process_added')"> @@ -279,7 +279,7 @@ -  {{ $i18n.get('new_bulk_edition_criterion') }} +  {{ $i18n.get('new_bulk_edit_criterion') }}
diff --git a/src/views/admin/js/router.js b/src/views/admin/js/router.js index 98d79b643..1665de306 100644 --- a/src/views/admin/js/router.js +++ b/src/views/admin/js/router.js @@ -16,7 +16,7 @@ import AvailableExportersPage from '../pages/lists/available-exporters-page.vue' import AvailableImportersPage from '../pages/lists/available-importers-page.vue' import CapabilitiesPage from '../pages/lists/capabilities-page.vue' -// Edition Form Components +// Edit Form Components import CollectionEditionForm from '../components/edition/collection-edition-form.vue' import ImporterEditionForm from '../components/edition/importer-edition-form.vue' import ImporterMappingForm from '../components/edition/importer-mapping-form.vue' @@ -32,25 +32,25 @@ const i18nGet = function (key) { return (string !== undefined && string !== null && string !== '' ) ? string : "ERROR: Invalid i18n key!"; }; -const routes = [ +const routes = [ { path: '/', redirect:'/home' }, { path: '/home', name: 'HomePage', component: HomePage, meta: {title: 'Tainacan'} }, { path: '/collections', name: 'CollectionsPage', component: CollectionsPage, meta: { title: i18nGet('title_repository_collections_page') } }, { path: '/collections/new', name: 'CollectionCreationForm', component: CollectionEditionForm, meta: {title: i18nGet('title_create_collection') } }, { path: '/collections/new/:mapper', name: 'MappedCollectionCreationForm', component: CollectionEditionForm, meta: {title: i18nGet('title_create_collection') } }, - - { path: '/collections/:collectionId', component: CollectionPage, meta: {title: i18nGet('title_collection_page') }, + + { path: '/collections/:collectionId', component: CollectionPage, meta: {title: i18nGet('title_collection_page') }, children: [ { path: '', redirect: 'items'}, - { path: 'items', component: ItemsPage, name: 'CollectionItemsPage', meta: {title: i18nGet('title_collection_page') }, props: { isOnTheme: false } }, + { path: 'items', component: ItemsPage, name: 'CollectionItemsPage', meta: {title: i18nGet('title_collection_page') }, props: { isOnTheme: false } }, { path: 'items/:itemId/edit', name: 'ItemEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item') } }, { path: 'items/new', name: 'CollectionItemCreatePage', component: ItemEditionForm, meta: {title: i18nGet('title_create_item_collection') } }, - { path: 'items/:itemId', name: 'ItemPage', component: ItemPage, meta: {title: i18nGet('title_item_page') } }, + { path: 'items/:itemId', name: 'ItemPage', component: ItemPage, meta: {title: i18nGet('title_item_page') } }, { path: 'bulk-add', name: 'CollectionItemBulkAddPage', component: ItemBulkEditionForm, meta: {title: i18nGet('title_item_bulk_add') } }, { path: 'settings', component: CollectionEditionForm, name: 'CollectionEditionForm', meta: {title: i18nGet('title_collection_settings') } }, - { path: 'metadata', component: MetadataPage, name: 'CollectionMetadataPage', meta: {title: i18nGet('title_collection_metadata_edition') } }, - { path: 'filters', component: FiltersPage, name: 'CollectionFiltersPage', meta: {title: i18nGet('title_collection_filters_edition') } }, + { path: 'metadata', component: MetadataPage, name: 'CollectionMetadataPage', meta: {title: i18nGet('title_collection_metadata_edit') } }, + { path: 'filters', component: FiltersPage, name: 'CollectionFiltersPage', meta: {title: i18nGet('title_collection_filters_edit') } }, { path: 'activities', component: ActivitiesPage, name: 'CollectionActivitiesPage', meta: {title: i18nGet('title_collection_activities') } }, { path: 'capabilities', component: CapabilitiesPage, name: 'CollectionCapabilitiesPage', meta: {title: i18nGet('title_collection_capabilities') } }, { path: 'sequence/:sequenceId', name: 'SavedSequenceEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item') } }, @@ -67,7 +67,7 @@ const routes = [ { path: '/taxonomies', name: 'TaxonomyPage', component: TaxonomyPage, meta: {title: i18nGet('title_taxonomies_page') } }, { path: '/taxonomies/new', name: 'TaxonomyCreationForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_create_taxonomy_page') } }, - { path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edition_page') } }, + { path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edit_page') } }, { path: '/taxonomies/:taxonomyId', redirect: '/taxonomies/:taxonomyId/edit' }, { path: '/activities', name: 'ActivitiesPage', component: ActivitiesPage, meta: {title: i18nGet('title_repository_activities_page') } }, diff --git a/src/views/admin/js/store/modules/taxonomy/actions.js b/src/views/admin/js/store/modules/taxonomy/actions.js index 41ce73031..92c9f670e 100644 --- a/src/views/admin/js/store/modules/taxonomy/actions.js +++ b/src/views/admin/js/store/modules/taxonomy/actions.js @@ -53,10 +53,10 @@ export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orde endpoint = endpoint + '&status=' + status; else endpoint += '&status=publish,private,draft'; - + if (order != undefined && order != '' && orderby != undefined && orderby != '') endpoint = endpoint + '&order=' + order + '&orderby=' + orderby; - + if (search != undefined && search != '') endpoint = endpoint + '&search=' + search; @@ -179,17 +179,17 @@ export const updateTerm = ({ commit }, { taxonomyId, id, name, description, pare }; export const fetchTerms = ({ commit }, {taxonomyId, fetchOnly, search, all, order, offset, number, exclude }) => { - + let query = ''; - + if (order == undefined) order = 'asc'; if(fetchOnly && search && !all ){ query = `?order=${order}&${qs.stringify(fetchOnly)}&${qs.stringify(search)}`; - } else if(fetchOnly && search && all ){ + } else if(fetchOnly && search && all ){ query = `?hideempty=0&order=${order}&${qs.stringify(fetchOnly)}&${qs.stringify(search)}`; - } else if(search && !all && !fetchOnly){ + } else if(search && !all && !fetchOnly){ query = `?hideempty=0&order=${order}&${qs.stringify(search)}`; } else { query =`?hideempty=0&order=${order}`; @@ -197,7 +197,7 @@ export const fetchTerms = ({ commit }, {taxonomyId, fetchOnly, search, all, orde if (number != undefined) query += '&number=' + number; - + if (offset != undefined) query += '&offset=' + offset; @@ -227,9 +227,9 @@ export const fetchChildTerms = ({ commit }, { parentId, taxonomyId, fetchOnly, s if(fetchOnly && search && !all ){ query = `?order=${order}&${qs.stringify(fetchOnly)}&${qs.stringify(search)}`; - } else if(fetchOnly && search && all ){ + } else if(fetchOnly && search && all ){ query = `?hideempty=0&order=${order}&${qs.stringify(fetchOnly)}&${qs.stringify(search)}`; - } else if(search && !all && !fetchOnly){ + } else if(search && !all && !fetchOnly){ query = `?hideempty=0&order=${order}&${qs.stringify(search)}`; } else { query =`?hideempty=0&order=${order}`; @@ -282,7 +282,7 @@ export const updateChildTerm = ({ commit }, { taxonomyId, term }) => { }; // Used to update parent changes after deletion only locally -export const updateChildTermLocal = ({ commit }, { term, parent, oldParent }) => { +export const updateChildTermLocal = ({ commit }, { term, parent, oldParent }) => { commit('updateChildTerm', { term: term, parent: parent, oldParent: oldParent }); }; @@ -305,11 +305,11 @@ export const clearTerms = ({ commit }) => { commit('clearTerms'); }; -// Used only on Term Edition form, for autocomplete search for parents +// Used only on Term Edit form, for autocomplete search for parents export const fetchPossibleParentTerms = ({ commit }, { taxonomyId, termId, search, offset } ) => { - + let endpoint = '/taxonomy/' + taxonomyId + '/terms?searchterm=' + search + '&hierarchical=1&exclude_tree=' + termId + "&hideempty=0&offset=0&number=20&order=asc"; - + if (offset) endpoint += '&offset=' + offset; @@ -317,13 +317,13 @@ export const fetchPossibleParentTerms = ({ commit }, { taxonomyId, termId, searc axios.tainacan.get(endpoint) .then(res => { let parentTerms = res.data; - + const theParentIndex = parentTerms.findIndex((term) => term.id == termId); if (theParentIndex >= 0) parentTerms.splice(theParentIndex, 1); - + const totalTerms = res.headers['x-wp-total']; - + resolve( { parentTerms, totalTerms } ); }) .catch(error => { diff --git a/src/views/gutenberg-blocks/blocks/item-submission-form/item-submission/components/term-creation-panel.vue b/src/views/gutenberg-blocks/blocks/item-submission-form/item-submission/components/term-creation-panel.vue index 86df2affb..eef8840fb 100644 --- a/src/views/gutenberg-blocks/blocks/item-submission-form/item-submission/components/term-creation-panel.vue +++ b/src/views/gutenberg-blocks/blocks/item-submission-form/item-submission/components/term-creation-panel.vue @@ -8,7 +8,7 @@ class="tainacan-form term-creation-panel" @submit.prevent="saveEdition(editForm)"> -

{{ editForm & editForm.id && editForm.id != 'new' ? $i18n.get("title_term_edition") : $i18n.get("title_term_creation") }}

+

{{ editForm & editForm.id && editForm.id != 'new' ? $i18n.get("title_term_edit") : $i18n.get("title_term_creation") }}

- + -
@@ -632,7 +632,7 @@ export default { // Initialize clear data from store this.clearItemSubmission(); - + eventBusItemMetadata.clearAllErrors(); this.formErrorMessage = ''; this.form.collection_id = this.collectionId; @@ -688,7 +688,7 @@ export default { ]), onSubmit() { - // Puts loading on Item edition + // Puts loading on Item edit this.isSubmitting = true; let data = this.form; @@ -699,10 +699,10 @@ export default { // Clear errors so we don't have them duplicated from api eventBusItemMetadata.errors = []; - this.submitItemSubmission({ + this.submitItemSubmission({ itemSubmission: this.itemSubmission, itemSubmissionMetadata: this.itemSubmissionMetadata, - captchaResponse: (this.useCaptcha == 'yes' && grecaptcha) ? grecaptcha.getResponse() : null + captchaResponse: (this.useCaptcha == 'yes' && grecaptcha) ? grecaptcha.getResponse() : null }) .then((fakeItemId) => { @@ -717,34 +717,34 @@ export default { this.linkToCreatedItem = item.url; }) - .catch((errors) => { + .catch((errors) => { if (errors.errors) { for (let error of errors.errors) { for (let metadatum of Object.keys(error)) { - eventBusItemMetadata.errors.push({ + eventBusItemMetadata.errors.push({ metadatum_id: metadatum, errors: error[metadatum] }); - } + } } } this.formErrorMessage = errors.error_message; - + this.isSubmitting = false; this.hasSentForm = false; this.isUploading = false; }); } }) - .catch((errors) => { + .catch((errors) => { if (errors.errors) { for (let error of errors.errors) { for (let metadatum of Object.keys(error)) { - eventBusItemMetadata.errors.push({ + eventBusItemMetadata.errors.push({ metadatum_id: metadatum, errors: error[metadatum] }); - } + } } } this.formErrorMessage = errors.error_message; @@ -757,7 +757,7 @@ export default { onDiscard() { // Initialize clear data from store this.clearItemSubmission(); - + eventBusItemMetadata.clearAllErrors(); this.formErrorMessage = ''; this.form.collection_id = this.collectionId; @@ -787,7 +787,7 @@ export default { for (let i = 0; i < metadata.length; i++) { this.metadataCollapses.push(false); this.metadataCollapses[i] = true; - } + } this.setItemSubmissionMetadata( metadata.map((metadatum) => { return { metadatum_id: metadatum.id, value: null } }) ); this.couldLoadCollection = true; this.isLoading = false; @@ -887,7 +887,7 @@ export default { padding: 0; display: flex; flex-wrap: wrap; - + li { margin-left: 0.25em; margin-right: 1.5em; @@ -906,8 +906,8 @@ export default { cursor: pointer; } } - p { - color: var(--tainacan-secondary); + p { + color: var(--tainacan-secondary); font-size: 0.8125em; } } diff --git a/src/views/tainacan-i18n.php b/src/views/tainacan-i18n.php index f29bd8ff2..a32a7a913 100644 --- a/src/views/tainacan-i18n.php +++ b/src/views/tainacan-i18n.php @@ -80,15 +80,15 @@ return apply_filters( 'tainacan-i18n', [ 'run' => __( 'Run', 'tainacan' ), 'edit_search' => __( 'Edit search', 'tainacan' ), 'apply' => __( 'Apply', 'tainacan' ), - 'add_another_bulk_edition' => __( 'Add another bulk edition criterion', 'tainacan' ), - 'add_one_bulk_edition' => __( 'Add one bulk edition criterion', 'tainacan' ), - 'remove_bulk_edition' => __( 'Remove bulk edition criterion', 'tainacan' ), + 'add_another_bulk_edit' => __( 'Add another bulk edit criterion', 'tainacan' ), + 'add_one_bulk_edit' => __( 'Add one bulk edit criterion', 'tainacan' ), + 'remove_bulk_edit' => __( 'Remove bulk edit criterion', 'tainacan' ), 'set_new_value' => __( 'Set new value', 'tainacan' ), 'replace_value' => __( 'Replace value', 'tainacan' ), 'copy_value' => __( 'Copy value from', 'tainacan' ), 'finish' => __( 'Finish', 'tainacan' ), 'select_to_create' => __( 'select to create', 'tainacan' ), - 'new_bulk_edition_criterion' => __( 'New bulk edition criterion', 'tainacan' ), + 'new_bulk_edit_criterion' => __( 'New bulk edit criterion', 'tainacan' ), 'undo' => __( 'Undo', 'tainacan' ), 'delete' => __( 'Delete', 'tainacan' ), 'skip' => __( 'Skip', 'tainacan' ), @@ -126,7 +126,7 @@ return apply_filters( 'tainacan-i18n', [ 'title_collection_activities' => __( 'Collection Activities', 'tainacan' ), 'title_filter_page' => __( 'Filter', 'tainacan' ), 'title_taxonomy_page' => __( 'Taxonomy', 'tainacan' ), - 'title_term_edition' => __( 'Term edition', 'tainacan' ), + 'title_term_edit' => __( 'Term edit', 'tainacan' ), 'title_term_creation' => __( 'Create a new term', 'tainacan' ), 'title_activity_page' => __( 'Activity', 'tainacan' ), 'title_create_collection' => __( 'Collection Creation', 'tainacan' ), @@ -135,11 +135,11 @@ return apply_filters( 'tainacan-i18n', [ 'title_create_filter' => __( 'Filter Creation', 'tainacan' ), 'title_collection_settings' => __( 'Settings of Collection', 'tainacan' ), 'title_edit_item' => __( 'Edit Item', 'tainacan' ), - 'title_taxonomy_edition_page' => __( 'Taxonomy Edition', 'tainacan' ), - 'title_filter_edition' => __( 'Filter Edition', 'tainacan' ), - 'title_metadatum_edition' => __( 'Metadata Edition', 'tainacan' ), - 'title_collection_metadata_edition' => __( 'Edit Metadata of', 'tainacan' ), - 'title_collection_filters_edition' => __( 'Edit Filters of', 'tainacan' ), + 'title_taxonomy_edit_page' => __( 'Edit Taxonomy', 'tainacan' ), + 'title_filter_edit' => __( 'Edit Filter', 'tainacan' ), + 'title_metadatum_edit' => __( 'Edit Metadata', 'tainacan' ), + 'title_collection_metadata_edit' => __( 'Edit Metadata of', 'tainacan' ), + 'title_collection_filters_edit' => __( 'Edit Filters of', 'tainacan' ), 'title_importer_page' => __( 'Importer', 'tainacan' ), 'title_importer_mapping_page' => __( "Metadata Mapping", 'tainacan' ), 'title_importers_page' => __( 'Importers', 'tainacan' ), @@ -824,7 +824,7 @@ return apply_filters( 'tainacan-i18n', [ 'info_bulk_add_items' => __( 'Bulk add documents from your computer as items.', 'tainacan' ), 'info_editing_items_in_bulk' => __( 'Bulk edit items', 'tainacan' ), 'info_by_inner' => __( 'by', 'tainacan' ), - 'info_bulk_edition_process_added' => __( 'Bulk edition added to process queue.', 'tainacan' ), + 'info_bulk_edit_process_added' => __( 'Bulk edit added to process queue.', 'tainacan' ), 'info_no_parent_term_found' => __( 'No valid parent term was found with this name.', 'tainacan' ), 'info_warning_changing_parent_term' => __( 'Warning! Changing parent term will reload the terms list, thus unchecking any selection.', 'tainacan' ), 'info_warning_selected_items_remove_from_trash' => __( 'Do you really want to remove from trash the selected items?', 'tainacan' ), @@ -834,7 +834,7 @@ return apply_filters( 'tainacan-i18n', [ 'info_there_are_%s_items_being_edited' => __( 'There are %s items being edited;', 'tainacan' ), 'info_there_is_one_item_being_edited' => __( 'There is one item being edited.', 'tainacan' ), 'info_no_preview_found' => __( 'No preview was found.', 'tainacan' ), - 'info_leaving_bulk_edition' => __( 'You are leaving the bulk edition now.', 'tainacan' ), + 'info_leaving_bulk_edit' => __( 'You are leaving the bulk edit now.', 'tainacan' ), 'info_current_view_mode_metadata_not_allowed' => __( 'Current view mode does not allow displayed metadata selection.', 'tainacan' ), 'info_cant_select_metadata_without_items' => __( 'Can not select displayed metadata without items on list.', 'tainacan' ), 'info_process_status_finished' => __( 'Finished', 'tainacan'), diff --git a/tests/test-compound-metadatum-types.php b/tests/test-compound-metadatum-types.php index 4cd03302f..57e281c59 100644 --- a/tests/test-compound-metadatum-types.php +++ b/tests/test-compound-metadatum-types.php @@ -26,7 +26,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $metadatum = $this->tainacan_entity_factory->create_entity( 'metadatum', array( @@ -82,24 +82,24 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $item_metadata1->validate(); $item_metadata1 = $Tainacan_Item_Metadata->insert($item_metadata1); - + $item_metadata = new Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata1->get_parent_meta_id()); $item_metadata->set_value('Blue'); - + $item_metadata->validate(); $item_metadata = $Tainacan_Item_Metadata->insert($item_metadata); - + $compoundItem = new Item_Metadata_Entity($i, $metadatum); - + $compoundValue = $compoundItem->get_value(); - + $this->assertTrue( is_array($compoundValue), 'value of a compound should return array' ); $this->assertEquals( 2, sizeof($compoundValue), 'value should have 2 item metadata' ); - + $this->assertTrue( isset($compoundValue[$metadatum_child1->get_id()]), 'First element of value must be set' ); $this->assertTrue( isset($compoundValue[$metadatum_child2->get_id()]), 'Second element of value must be set' ); - + $this->assertTrue( $compoundValue[$metadatum_child1->get_id()] instanceof Item_Metadata_Entity , 'First element of value should be an item metadata entity' ); $this->assertTrue( $compoundValue[$metadatum_child2->get_id()] instanceof Item_Metadata_Entity , 'Second element of value should be an item metadata entity' ); @@ -117,7 +117,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $metadatum = $this->tainacan_entity_factory->create_entity( 'metadatum', array( @@ -143,7 +143,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $metadatum_child2 = $this->tainacan_entity_factory->create_entity( 'metadatum', array( @@ -184,13 +184,13 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $item_metadata3->set_value('Green'); $item_metadata3->validate(); $item_metadata3 = $Tainacan_Item_Metadata->insert($item_metadata3); - - + + $item_metadata = new Item_Metadata_Entity($i, $metadatum_child2, null, $item_metadata3->get_parent_meta_id()); $item_metadata->set_value('Yellow'); $item_metadata->validate(); $item_metadata = $Tainacan_Item_Metadata->insert($item_metadata); - + $compoundItem = new Item_Metadata_Entity($i, $metadatum); $compoundValue = $compoundItem->get_value(); @@ -199,10 +199,10 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $this->assertTrue( is_array($compoundValue[0]), 'value of a compound should return array' ); $this->assertTrue( is_array($compoundValue[1]), 'value of a compound should return array' ); - + $this->assertTrue( isset($compoundValue[0][$metadatum_child1->get_id()]), 'First element of value must be set' ); $this->assertTrue( isset($compoundValue[1][$metadatum_child2->get_id()]), 'Second element of value must be set' ); - + $this->assertTrue( $compoundValue[0][$metadatum_child1->get_id()] instanceof Item_Metadata_Entity , 'First element of value should be an item metadata entity' ); $this->assertTrue( $compoundValue[1][$metadatum_child2->get_id()] instanceof Item_Metadata_Entity , 'Second element of value should be an item metadata entity' ); @@ -215,7 +215,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $item_metadata_removed = $Tainacan_Item_Metadata->remove_compound_value($i, $metadatum, $item_metadata3->get_parent_meta_id()); $compoundItem = new Item_Metadata_Entity($i, $metadatum); $compoundValue = $compoundItem->get_value(); - + $this->assertTrue( is_array($compoundValue), 'value of a compound should return array' ); $this->assertEquals( 1, sizeof($compoundValue), 'value should have 1 values' ); @@ -231,7 +231,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $metadatum = $this->tainacan_entity_factory->create_entity( 'metadatum', array( @@ -244,7 +244,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $newMetadatum = new \Tainacan\Entities\Metadatum(); $newMetadatum->set_name('test_multiple'); $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Taxonomy'); @@ -265,7 +265,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $metadatum = $this->tainacan_entity_factory->create_entity( 'metadatum', array( @@ -278,17 +278,17 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $newMetadatum = new \Tainacan\Entities\Metadatum(); $newMetadatum->set_name('test_multiple'); $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Taxonomy'); $newMetadatum->set_parent($metadatum->get_id()); - + $this->assertTrue($newMetadatum->validate(), 'You can add a taxonomy metadatum inside a not multiple compound metadatum'); $newMetadatum = $Tainacan_Metadata->insert($newMetadatum); - + $metadatum->set_multiple('yes'); - + $this->assertFalse($metadatum->validate(), 'You cant turn a compound metadatum into multiple when there is a taxonomy metadatum inside it'); } @@ -300,7 +300,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $metadatum = $this->tainacan_entity_factory->create_entity( 'metadatum', array( @@ -313,21 +313,21 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { ), true ); - + $newMetadatum = new \Tainacan\Entities\Metadatum(); $newMetadatum->set_name('test_multiple'); $newMetadatum->set_multiple('yes'); $newMetadatum->set_metadata_type('Tainacan\Metadata_Types\Text'); $newMetadatum->set_parent($metadatum->get_id()); - + $this->assertFalse($newMetadatum->validate(), 'You cant add a multiple metadatum inside a compound metadatum'); - + $newMetadatum->set_multiple('no'); - + $this->assertTrue($newMetadatum->validate()); } - function test_validations_metadada_order() { + function test_validations_metadata_order() { $Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance(); $collection = $this->tainacan_entity_factory->create_entity( @@ -412,14 +412,14 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $collection->set_metadata_order($order); $collection->validate(); \tainacan_collections()->insert($collection); - + $metadata_order = $Tainacan_Collections->fetch( $collection->get_id(), 'OBJECT' )->get_metadata_order(); $this->assertEquals($metadata_order[0]['id'], $order[0]['id']); //$this->assertEquals($metadata_order[1]['id'], $order[1]['id']); //$this->assertEquals($metadata_order[2]['id'], $order[2]['id']); $this->assertEquals($metadata_order[1]['id'], $order[1]['id']); $this->assertEquals($metadata_order[2]['id'], $order[2]['id']); - + $order = [ ['id' => $metadatum1->get_id(), 'enabled' => true], ['id' => $metadatum2->get_id(), 'enabled' => true], @@ -431,7 +431,7 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { $collection->set_metadata_order($order); $collection->validate(); \tainacan_collections()->insert($collection); - + $metadata_order = $Tainacan_Collections->fetch( $collection->get_id(), 'OBJECT' )->get_metadata_order(); $this->assertEquals($metadata_order[0]['id'], $order[0]['id']); $this->assertEquals($metadata_order[1]['id'], $order[1]['id']); @@ -450,4 +450,4 @@ class CompoundMetadatumTypes extends TAINACAN_UnitTestCase { // $collection->set_metadata_order($order); // $this->assertFalse($collection->validate()); } -} \ No newline at end of file +}