diff --git a/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php b/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php index b754160e2d..51ac40ab51 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/FieldsController.php @@ -314,7 +314,8 @@ class FieldsController extends Controller ->set_readonly($data['readonly']) ->set_type($data['type']) ->set_tbranch($data['tbranch']) - ->set_publish_cterms($data['publish_cterms']) + ->set_generate_cterms($data['generate_cterms']) + ->set_gui_editable($data['gui_editable']) ->set_report($data['report']) ->setVocabularyControl(null) ->setVocabularyRestricted(false); @@ -350,7 +351,7 @@ class FieldsController extends Controller { return [ 'name', 'multi', 'thumbtitle', 'tag', 'business', 'indexable', 'aggregable', - 'required', 'separator', 'readonly', 'type', 'tbranch', 'publish_cterms', 'report', + 'required', 'separator', 'readonly', 'gui_editable', 'type', 'tbranch', 'generate_cterms', 'report', 'vocabulary-type', 'vocabulary-restricted', 'dces-element', 'labels' ]; } diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index f5963cca52..0c3bffb63e 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -594,7 +594,8 @@ class V1Controller extends Controller ], 'separator' => $databox_field->get_separator(), 'thesaurus_branch' => $databox_field->get_tbranch(), - 'publish_cterms' => $databox_field->get_publish_cterms(), + 'generate_cterms' => $databox_field->get_generate_cterms(), + 'gui_editable' => $databox_field->get_gui_editable(), 'type' => $databox_field->get_type(), 'indexable' => $databox_field->is_indexable(), 'multivalue' => $databox_field->is_multi(), diff --git a/lib/Alchemy/Phrasea/Controller/Prod/EditController.php b/lib/Alchemy/Phrasea/Controller/Prod/EditController.php index dfc2878bec..e164221a51 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/EditController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/EditController.php @@ -75,7 +75,8 @@ class EditController extends Controller 'format' => '', 'explain' => '', 'tbranch' => $meta->get_tbranch(), - 'publish_cterms' => $meta->get_publish_cterms(), + 'generate_cterms' => $meta->get_generate_cterms(), + 'gui_editable' => $meta->get_gui_editable(), 'maxLength' => $meta->get_tag() ->getMaxLength(), 'minLength' => $meta->get_tag() diff --git a/lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php b/lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php index fea21b3805..5f7e210a76 100644 --- a/lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php +++ b/lib/Alchemy/Phrasea/Databox/Field/DbalDataboxFieldRepository.php @@ -36,7 +36,8 @@ final class DbalDataboxFieldRepository implements DataboxFieldRepository 'label_fr', 'label_de', 'label_nl', - 'publish_cterms', + 'generate_cterms', + 'gui_editable', ]; /** @var DataboxFieldFactory */ diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php index 71ade45995..64fb4fedc0 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Indexer/Record/Hydrator/ThesaurusHydrator.php @@ -98,7 +98,7 @@ class ThesaurusHydrator implements HydratorInterface } } else { - if(($fields[$name])->get_publish_cterms()) { + if(($fields[$name])->get_generate_cterms()) { $this->candidate_terms->insert($field_names[$offset], $values[$offset]); } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php index 2307f7839a..f2dc5d0e7b 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/Structure/Field.php @@ -43,7 +43,7 @@ class Field implements Typed private $thesaurus_roots; - private $publish_cterms; + private $generate_cterms; private $used_by_collections; @@ -77,7 +77,7 @@ class Field implements Typed 'private' => $field->isBusiness(), 'facet' => $facet, 'thesaurus_roots' => $roots, - 'publish_cterms' => $field->get_publish_cterms(), + 'generate_cterms' => $field->get_generate_cterms(), 'used_by_collections' => $databox->get_collection_unique_ids() ]); } @@ -106,7 +106,7 @@ class Field implements Typed $this->is_private = \igorw\get_in($options, ['private'], false); $this->facet = \igorw\get_in($options, ['facet']); $this->thesaurus_roots = \igorw\get_in($options, ['thesaurus_roots'], null); - $this->publish_cterms = \igorw\get_in($options, ['publish_cterms'], false); + $this->generate_cterms = \igorw\get_in($options, ['generate_cterms'], false); $this->used_by_collections = \igorw\get_in($options, ['used_by_collections'], []); Assertion::boolean($this->is_searchable); @@ -130,7 +130,7 @@ class Field implements Typed 'private' => $this->is_private, 'facet' => $this->facet, 'thesaurus_roots' => $this->thesaurus_roots, - 'publish_cterms' => $this->publish_cterms, + 'generate_cterms' => $this->generate_cterms, 'used_by_collections' => $this->used_by_collections ]); } @@ -195,9 +195,9 @@ class Field implements Typed return $this->thesaurus_roots; } - public function get_publish_cterms() + public function get_generate_cterms() { - return $this->publish_cterms; + return $this->generate_cterms; } /** diff --git a/lib/classes/databox.php b/lib/classes/databox.php index 5d1ee0f7c9..01aa2eea31 100644 --- a/lib/classes/databox.php +++ b/lib/classes/databox.php @@ -462,7 +462,8 @@ class databox extends base implements ThumbnailedElement ->set_aggregable((isset($field['aggregable']) ? (string) $field['aggregable'] : 0)) ->set_type($type) ->set_tbranch(isset($field['tbranch']) ? (string) $field['tbranch'] : '') - ->set_publish_cterms((isset($field['publish_cterms']) && (string) $field['publish_cterms'] == 1)) + ->set_generate_cterms((isset($field['generate_cterms']) && (string) $field['generate_cterms'] == 1)) + ->set_gui_editable((isset($field['gui_editable']) && (string) $field['gui_editable'] == 1)) ->set_thumbtitle(isset($field['thumbtitle']) ? (string) $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0')) ->set_report(isset($field['report']) ? (string) $field['report'] : '1') ->save(); diff --git a/lib/classes/databox/field.php b/lib/classes/databox/field.php index 5d5c22a812..09dab67d46 100644 --- a/lib/classes/databox/field.php +++ b/lib/classes/databox/field.php @@ -43,7 +43,8 @@ class databox_field implements cache_cacheableInterface protected $report; protected $type; protected $tbranch; - protected $publish_cterms; + protected $generate_cterms; + protected $gui_editable; protected $separator; protected $thumbtitle; @@ -167,7 +168,8 @@ class databox_field implements cache_cacheableInterface $this->position = (int)$row['sorter']; $this->type = $row['type'] ?: self::TYPE_STRING; $this->tbranch = $row['tbranch']; - $this->publish_cterms = (bool)$row['publish_cterms']; + $this->generate_cterms = (bool)$row['generate_cterms']; + $this->gui_editable = (bool)$row['gui_editable']; $this->VocabularyType = $row['VocabularyControlType']; $this->VocabularyRestriction = (bool)$row['RestrictToVocabularyControl']; @@ -308,7 +310,8 @@ class databox_field implements cache_cacheableInterface `report` = :report, `type` = :type, `tbranch` = :tbranch, - `publish_cterms` = :publish_cterms, + `generate_cterms` = :generate_cterms, + `gui_editable` = :gui_editable, `sorter` = :position, `thumbtitle` = :thumbtitle, `VocabularyControlType` = :VocabularyControlType, @@ -332,7 +335,8 @@ class databox_field implements cache_cacheableInterface ':report' => $this->report ? '1' : '0', ':type' => $this->type, ':tbranch' => $this->tbranch, - ':publish_cterms' => $this->publish_cterms ? '1' : '0', + ':generate_cterms' => $this->generate_cterms ? '1' : '0', + ':gui_editable' => $this->gui_editable ? '1' : '0', ':position' => $this->position, ':thumbtitle' => $this->thumbtitle, ':VocabularyControlType' => $this->getVocabularyControl() ? $this->getVocabularyControl()->getType() : null, @@ -384,7 +388,8 @@ class databox_field implements cache_cacheableInterface $meta->setAttribute('aggregable', $this->aggregable); $meta->setAttribute('type', $this->type); $meta->setAttribute('tbranch', $this->tbranch); - $meta->setAttribute('publish_cterms', $this->publish_cterms ? '1' : '0'); + $meta->setAttribute('generate_cterms', $this->generate_cterms ? '1' : '0'); + $meta->setAttribute('gui_editable', $this->gui_editable ? '1' : '0'); if ($this->multi) { $meta->setAttribute('separator', $this->separator); } @@ -717,12 +722,23 @@ class databox_field implements cache_cacheableInterface } /** - * @param boolean $publish_cterms + * @param boolean $generate_cterms * @return databox_field */ - public function set_publish_cterms($publish_cterms) + public function set_generate_cterms($generate_cterms) { - $this->publish_cterms = $publish_cterms; + $this->generate_cterms = $generate_cterms; + + return $this; + } + + /** + * @param boolean $gui_editable + * @return databox_field + */ + public function set_gui_editable($gui_editable) + { + $this->gui_editable = $gui_editable; return $this; } @@ -815,9 +831,18 @@ class databox_field implements cache_cacheableInterface * * @return boolean */ - public function get_publish_cterms() + public function get_generate_cterms() { - return $this->publish_cterms; + return $this->generate_cterms; + } + + /** + * + * @return boolean + */ + public function get_gui_editable() + { + return $this->gui_editable; } /** @@ -930,7 +955,8 @@ class databox_field implements cache_cacheableInterface 'sorter' => $this->position, 'thumbtitle' => $this->thumbtitle, 'tbranch' => $this->tbranch, - 'publish_cterms' => $this->publish_cterms, + 'generate_cterms' => $this->generate_cterms, + 'gui_editable' => $this->gui_editable, 'separator' => $this->separator, 'required' => $this->required, 'report' => $this->report, @@ -969,10 +995,10 @@ class databox_field implements cache_cacheableInterface } $sql = "INSERT INTO metadatas_structure - (`id`, `name`, `src`, `readonly`, `required`, `indexable`, `type`, `tbranch`, `publish_cterms`, + (`id`, `name`, `src`, `readonly`, `gui_editable`, `required`, `indexable`, `type`, `tbranch`, `generate_cterms`, `thumbtitle`, `multi`, `business`, `aggregable`, `report`, `sorter`, `separator`) - VALUES (null, :name, '', 0, 0, 1, 'string', '', 1, + VALUES (null, :name, '', 0, 1, 0, 1, 'string', '', 1, null, 0, 0, 0, 1, :sorter, '')"; diff --git a/lib/classes/patch/410alpha17a.php b/lib/classes/patch/410alpha17a.php index 606810c5ac..ff682b1ef9 100644 --- a/lib/classes/patch/410alpha17a.php +++ b/lib/classes/patch/410alpha17a.php @@ -57,7 +57,9 @@ class patch_410alpha17a implements patchInterface public function apply(base $databox, Application $app) { // -- done by xml schema -- - // $sql = "ALTER TABLE `metadatas_structure` ADD `publish_cterms` INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `tbranch`"; + // $sql = "ALTER TABLE `metadatas_structure` ADD `generate_cterms` INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `tbranch`"; + // $databox->get_connection()->executeQuery($sql); + // $sql = "ALTER TABLE `metadatas_structure` ADD `gui_editable` INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `readonly`"; // $databox->get_connection()->executeQuery($sql); return true; diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index 6efb634354..b989e2f9d6 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -2034,11 +2034,19 @@ - publish_cterms + generate_cterms int(1) unsigned - + 1 + + + + gui_editable + int(1) unsigned + + + 1 diff --git a/templates/web/admin/fields/templates.html.twig b/templates/web/admin/fields/templates.html.twig index 8c26c77a8d..191f3f18b8 100644 --- a/templates/web/admin/fields/templates.html.twig +++ b/templates/web/admin/fields/templates.html.twig @@ -189,6 +189,14 @@ + + + + +