diff --git a/Services/MetaData/ROADMAP.md b/Services/MetaData/ROADMAP.md
index 5baa73e102cc..404ae2617868 100644
--- a/Services/MetaData/ROADMAP.md
+++ b/Services/MetaData/ROADMAP.md
@@ -5,6 +5,11 @@
Reused constants should be collected into bespoke classes as
appropriate, instead of being scattered across the component.
+### Get URI from Data Factory
+
+Get URI from the data factory, instead of instantiating it
+directly.
+
### Clean up Remains of Migrations for Ilias 10
With ILIAS 10, the migrations `ilMDLOMConformanceMigration` and
diff --git a/Services/MetaData/classes/Settings/Vocabularies/DataRetrieval.php b/Services/MetaData/classes/Settings/Vocabularies/DataRetrieval.php
new file mode 100644
index 000000000000..6e2a1e520262
--- /dev/null
+++ b/Services/MetaData/classes/Settings/Vocabularies/DataRetrieval.php
@@ -0,0 +1,119 @@
+vocab_manager = $vocab_manager;
+ $this->presentation = $presentation;
+ }
+
+ public function getRows(
+ DataRowBuilder $row_builder,
+ array $visible_column_ids,
+ Range $range,
+ Order $order,
+ ?array $filter_data,
+ ?array $additional_parameters
+ ): \Generator {
+ $infos = $this->vocab_manager->infos();
+ foreach ($this->getVocabs($range) as $vocab) {
+ $record = [];
+
+ $record['element'] = $this->presentation->makeSlotPresentable($vocab->slot());
+ $record['type'] = $this->presentation->makeTypePresentable($vocab->type());
+ $record['source'] = $vocab->source();
+ $record['preview'] = implode(
+ ', ',
+ $this->presentation->makeValuesPresentable($vocab, self::MAX_PREVIEW_VALUES)
+ );
+ $record['active'] = $vocab->isActive();
+ if ($infos->isCustomInputApplicable($vocab)) {
+ $record['custom_input'] = $vocab->allowsCustomInputs();
+ }
+
+ yield $row_builder->buildDataRow(
+ $vocab->id(),
+ $record
+ )->withDisabledAction(
+ 'delete',
+ !$infos->canBeDeleted($vocab)
+ )->withDisabledAction(
+ 'activate',
+ $vocab->isActive()
+ )->withDisabledAction(
+ 'deactivate',
+ !$vocab->isActive() ||
+ !$infos->isDeactivatable($vocab)
+ )->withDisabledAction(
+ 'allow_custom_input',
+ !$infos->isCustomInputApplicable($vocab) ||
+ $vocab->allowsCustomInputs()
+ )->withDisabledAction(
+ 'disallow_custom_input',
+ !$infos->isCustomInputApplicable($vocab) ||
+ !$infos->canDisallowCustomInput($vocab) ||
+ !$vocab->allowsCustomInputs()
+ );
+ };
+ }
+
+ public function getTotalRowCount(?array $filter_data, ?array $additional_parameters): ?int
+ {
+ return count($this->getVocabs());
+ }
+
+ protected function getVocabs(Range $range = null): array
+ {
+ if (isset($this->vocabs)) {
+ $vocabs = $this->vocabs;
+ } else {
+ $vocabs = iterator_to_array($this->vocab_manager->getAllVocabularies(), false);
+ }
+
+ if ($range) {
+ $vocabs = array_slice($vocabs, $range->getStart(), $range->getLength());
+ }
+
+ return $this->vocabs = $vocabs;
+ }
+}
diff --git a/Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesDataRetrieval.php b/Services/MetaData/classes/Settings/Vocabularies/Presentation.php
similarity index 68%
rename from Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesDataRetrieval.php
rename to Services/MetaData/classes/Settings/Vocabularies/Presentation.php
index 6ef41a8d0d6f..af0047298fb6 100644
--- a/Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesDataRetrieval.php
+++ b/Services/MetaData/classes/Settings/Vocabularies/Presentation.php
@@ -18,11 +18,8 @@
declare(strict_types=1);
-use ILIAS\UI\Component\Table\DataRetrieval;
-use ILIAS\UI\Component\Table\DataRowBuilder;
-use ILIAS\Data\Range;
-use ILIAS\Data\Order;
-use ILIAS\MetaData\Vocabularies\Manager\Manager as VocabManager;
+namespace ILIAS\MetaData\Settings\Vocabularies;
+
use ILIAS\MetaData\Presentation\ElementsInterface as ElementsPresentation;
use ILIAS\MetaData\Presentation\UtilitiesInterface as PresentationUtilities;
use ILIAS\MetaData\Vocabularies\Dispatch\Presentation\PresentationInterface as VocabPresentation;
@@ -36,18 +33,19 @@
use ILIAS\MetaData\Elements\Structure\StructureElementInterface;
use ILIAS\MetaData\Elements\Data\Type as DataType;
use ILIAS\MetaData\Vocabularies\Slots\Conditions\ConditionInterface;
+use ILIAS\MetaData\Paths\FactoryInterface as PathFactory;
-class ilMDVocabulariesDataRetrieval implements DataRetrieval
+class Presentation
{
protected const MAX_PREVIEW_VALUES = 5;
- protected VocabManager $vocab_manager;
protected ElementsPresentation $elements_presentation;
protected PresentationUtilities $presentation_utils;
protected VocabPresentation $vocab_presentation;
protected SlotHandler $slot_handler;
protected Structure $structure;
protected NavigatorFactory $navigator_factory;
+ protected PathFactory $path_factory;
/**
* @var VocabularyInterface[]
@@ -55,66 +53,34 @@ class ilMDVocabulariesDataRetrieval implements DataRetrieval
protected array $vocabs;
public function __construct(
- VocabManager $vocab_manager,
ElementsPresentation $elements_presentation,
PresentationUtilities $presentation_utils,
VocabPresentation $vocab_presentation,
SlotHandler $slot_handler,
Structure $structure,
- NavigatorFactory $navigator_factory
+ NavigatorFactory $navigator_factory,
+ PathFactory $path_factory
) {
- $this->vocab_manager = $vocab_manager;
$this->elements_presentation = $elements_presentation;
$this->presentation_utils = $presentation_utils;
$this->vocab_presentation = $vocab_presentation;
$this->slot_handler = $slot_handler;
$this->structure = $structure;
$this->navigator_factory = $navigator_factory;
+ $this->path_factory = $path_factory;
}
- public function getRows(
- DataRowBuilder $row_builder,
- array $visible_column_ids,
- Range $range,
- Order $order,
- ?array $filter_data,
- ?array $additional_parameters
- ): Generator {
- $infos = $this->vocab_manager->infos();
- foreach ($this->getVocabs($range) as $vocab) {
- $record = [];
-
- $record['element'] = $this->translateSlot($vocab->slot());
- $record['type'] = $this->translateType($vocab->type());
- $record['source'] = $vocab->source();
- $record['preview'] = $this->buildValuesPreview($vocab);
- $record['active'] = $vocab->isActive();
- if ($infos->isCustomInputApplicable($vocab)) {
- $record['custom_input'] = $vocab->allowsCustomInputs();
- }
-
- yield $row_builder->buildDataRow(
- $vocab->id(),
- $record
- )->withDisabledAction(
- 'delete',
- !$infos->canBeDeleted($vocab)
- )->withDisabledAction(
- 'toggle_active',
- $vocab->isActive() && !$infos->isDeactivatable($vocab)
- )->withDisabledAction(
- 'toggle_custom_input',
- !$infos->canDisallowCustomInput($vocab)
- );
- };
+ public function txt(string $key): string
+ {
+ return $this->presentation_utils->txt($key);
}
- public function getTotalRowCount(?array $filter_data, ?array $additional_parameters): ?int
+ public function txtFill(string $key, string ...$values): string
{
- return count($this->getVocabs());
+ return $this->presentation_utils->txtFill($key, ...$values);
}
- protected function translateType(VocabType $type): string
+ public function makeTypePresentable(VocabType $type): string
{
return match ($type) {
VocabType::STANDARD => $this->presentation_utils->txt('md_vocab_type_standard'),
@@ -125,7 +91,7 @@ protected function translateType(VocabType $type): string
};
}
- protected function translateSlot(SlotIdentifier $slot): string
+ public function makeSlotPresentable(SlotIdentifier $slot): string
{
//skip the name of the element if it does not add any information
$skip_data = [DataType::VOCAB_VALUE, DataType::STRING];
@@ -162,44 +128,17 @@ protected function translateSlot(SlotIdentifier $slot): string
'md_vocab_element_with_condition',
$element_name,
$condition_element_name,
- $this->translateConditionValue($condition)
+ $this->translateConditionValue($condition, $element)
);
}
- protected function translateConditionValue(ConditionInterface $condition): string
- {
- $slot = $this->slot_handler->identiferFromPathAndCondition($condition->path(), null, null);
- return (string) $this->vocab_presentation->presentableLabels(
- $this->presentation_utils,
- $slot,
- false,
- $condition->value()
- )->current()?->label();
- }
-
- protected function findFirstCommonParent(
- StructureElementInterface $a,
- StructureElementInterface $b
- ): StructureElementInterface {
- while ($a !== $b) {
- $a = $a->getSuperElement();
- $b = $b->getSuperElement();
- }
- return $a;
- }
-
- protected function getStructureElementFromPath(
- PathInterface $path,
- StructureElementInterface $start
- ): StructureElementInterface {
- return $this->navigator_factory->structureNavigator(
- $path,
- $start
- )->elementAtFinalStep();
- }
-
- protected function buildValuesPreview(VocabularyInterface $vocabulary): string
- {
+ /**
+ * @return string[]
+ */
+ public function makeValuesPresentable(
+ VocabularyInterface $vocabulary,
+ int $limit = null
+ ): array {
$presentable_values = [];
$i = 0;
@@ -208,10 +147,11 @@ protected function buildValuesPreview(VocabularyInterface $vocabulary): string
$vocabulary
);
foreach ($labelled_values as $labelled_value) {
- if ($i >= self::MAX_PREVIEW_VALUES) {
+ if ($limit !== null && $i >= $limit) {
$presentable_values[] = '...';
break;
}
+ $i++;
if (
$vocabulary->type() === VocabType::STANDARD ||
@@ -228,20 +168,43 @@ protected function buildValuesPreview(VocabularyInterface $vocabulary): string
$presentable_values[] = $presentable_value;
}
- return implode(', ', $presentable_values);
+ return $presentable_values;
}
- protected function getVocabs(Range $range = null): array
- {
- if (isset($this->vocabs)) {
- return $this->vocabs;
- }
+ protected function translateConditionValue(
+ ConditionInterface $condition,
+ StructureElementInterface $element
+ ): string {
+ $path_from_root = $this->path_factory->toElement(
+ $this->getStructureElementFromPath($condition->path(), $element),
+ );
+ $slot = $this->slot_handler->identiferFromPathAndCondition($path_from_root, null, null);
+ return (string) $this->vocab_presentation->presentableLabels(
+ $this->presentation_utils,
+ $slot,
+ false,
+ $condition->value()
+ )->current()?->label();
+ }
- $vocabs = iterator_to_array($this->vocab_manager->getAllVocabularies(), false);
- if ($range) {
- $vocabs = array_slice($vocabs, $range->getStart(), $range->getLength());
+ protected function findFirstCommonParent(
+ StructureElementInterface $a,
+ StructureElementInterface $b
+ ): StructureElementInterface {
+ while ($a !== $b) {
+ $a = $a->getSuperElement();
+ $b = $b->getSuperElement();
}
+ return $a;
+ }
- return $this->vocabs = $vocabs;
+ protected function getStructureElementFromPath(
+ PathInterface $path,
+ StructureElementInterface $start
+ ): StructureElementInterface {
+ return $this->navigator_factory->structureNavigator(
+ $path,
+ $start
+ )->elementAtFinalStep();
}
}
diff --git a/Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php b/Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php
index f029218e505c..28845a19f904 100644
--- a/Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php
+++ b/Services/MetaData/classes/Settings/Vocabularies/class.ilMDVocabulariesGUI.php
@@ -30,32 +30,23 @@
use ILIAS\FileUpload\MimeType;
use ILIAS\Filesystem\Filesystem;
use ILIAS\MetaData\Vocabularies\Manager\ManagerInterface as VocabManager;
-use ILIAS\MetaData\Paths\FactoryInterface as PathFactory;
+use ILIAS\MetaData\Settings\Vocabularies\Presentation;
use ILIAS\MetaData\Settings\Vocabularies\Import\Importer;
-use ILIAS\MetaData\Vocabularies\Slots\HandlerInterface as SlotHandler;
-use ILIAS\MetaData\Presentation\ElementsInterface as ElementsPresentation;
-use ILIAS\MetaData\Presentation\UtilitiesInterface as PresentationUtilities;
-use ILIAS\MetaData\Vocabularies\Dispatch\Presentation\PresentationInterface as VocabPresentation;
-use ILIAS\MetaData\Elements\Structure\StructureSetInterface as Structure;
-use ILIAS\MetaData\Paths\Navigator\NavigatorFactoryInterface as NavigatorFactory;
use ILIAS\MetaData\Services\InternalServices;
+use ILIAS\Refinery\Factory as Refinery;
+use ILIAS\MetaData\Settings\Vocabularies\DataRetrieval;
+use JetBrains\PhpStorm\NoReturn;
/**
* @ilCtrl_Calls ilMDVocabulariesGUI: ilMDVocabularyUploadHandlerGUI
*/
class ilMDVocabulariesGUI
{
+ protected const MAX_CONFIRMATION_VALUES = 5;
+
protected ilCtrl $ctrl;
protected HTTP $http;
protected Filesystem $temp_files;
- protected VocabManager $vocab_manager;
- protected PathFactory $path_factory;
- protected NavigatorFactory $navigator_factory;
- protected Structure $structure;
- protected SlotHandler $slot_handler;
- protected ElementsPresentation $elements_presentation;
- protected PresentationUtilities $presentation_utils;
- protected VocabPresentation $vocab_presentation;
protected ilGlobalTemplateInterface $tpl;
protected ilLanguage $lng;
protected ilToolbarGUI $toolbar;
@@ -63,6 +54,11 @@ class ilMDVocabulariesGUI
protected UIRenderer $ui_renderer;
protected ilObjMDSettingsGUI $parent_obj_gui;
protected ilMDSettingsAccessService $access_service;
+ protected Refinery $refinery;
+
+ protected VocabManager $vocab_manager;
+ protected Presentation $presentation;
+ protected Importer $importer;
public function __construct(ilObjMDSettingsGUI $parent_obj_gui)
{
@@ -71,13 +67,20 @@ public function __construct(ilObjMDSettingsGUI $parent_obj_gui)
$services = new InternalServices($DIC);
$this->vocab_manager = $services->vocabularies()->manager();
- $this->elements_presentation = $services->presentation()->elements();
- $this->presentation_utils = $services->presentation()->utilities();
- $this->vocab_presentation = $services->vocabularies()->presentation();
- $this->slot_handler = $services->vocabularies()->slotHandler();
- $this->structure = $services->structure()->structure();
- $this->path_factory = $services->paths()->pathFactory();
- $this->navigator_factory = $services->paths()->navigatorFactory();
+ $this->presentation = new Presentation(
+ $services->presentation()->elements(),
+ $services->presentation()->utilities(),
+ $services->vocabularies()->presentation(),
+ $services->vocabularies()->slotHandler(),
+ $services->structure()->structure(),
+ $services->paths()->navigatorFactory(),
+ $services->paths()->pathFactory()
+ );
+ $this->importer = new Importer(
+ $services->paths()->pathFactory(),
+ $this->vocab_manager->controlledVocabularyCreator(),
+ $services->vocabularies()->slotHandler()
+ );
$this->ctrl = $DIC->ctrl();
$this->http = $DIC->http();
@@ -87,6 +90,7 @@ public function __construct(ilObjMDSettingsGUI $parent_obj_gui)
$this->toolbar = $DIC->toolbar();
$this->ui_factory = $DIC->ui()->factory();
$this->ui_renderer = $DIC->ui()->renderer();
+ $this->refinery = $DIC->refinery();
$this->parent_obj_gui = $parent_obj_gui;
$this->access_service = new ilMDSettingsAccessService(
@@ -142,9 +146,44 @@ public function showVocabularies(): void
public function tableAction(): void
{
- if (!$this->access_service->hasCurrentUserWriteAccess()) {
+ $action = $this->fetchTableAction();
+ $vocab_id = $this->fetchVocabID();
+
+ if (
+ $vocab_id === '' ||
+ ($action !== 'show_all' && !$this->access_service->hasCurrentUserWriteAccess())
+ ) {
$this->ctrl->redirect($this, 'showVocabularies');
}
+
+ switch ($action) {
+ case 'delete':
+ $this->confirmDeleteVocabulary($vocab_id);
+ return;
+
+ case 'activate':
+ $this->activateVocabulary($vocab_id);
+ return;
+
+ case 'deactivate':
+ $this->deactivateVocabulary($vocab_id);
+ return;
+
+ case 'allow_custom_input':
+ $this->allowCustomInputForVocabulary($vocab_id);
+ return;
+
+ case 'disallow_custom_input':
+ $this->disallowCustomInputForVocabulary($vocab_id);
+ return;
+
+ case 'show_all':
+ $this->showAllValuesModalForVocabulary($vocab_id);
+ return;
+
+ default:
+ $this->ctrl->redirect($this, 'showVocabularies');
+ }
}
public function importVocabulary(): void
@@ -176,21 +215,16 @@ public function importVocabulary(): void
}
if (!is_null($file_content)) {
- $importer = new Importer(
- $this->path_factory,
- $this->vocab_manager->controlledVocabularyCreator(),
- $this->slot_handler
- );
- $result = $importer->import($file_content);
+ $result = $this->importer->import($file_content);
if ($result->wasSuccessful()) {
$message_type = 'success';
$message_text = $this->lng->txt('md_vocab_import_successful');
} else {
$message_type = 'failure';
- printf(
- $message_text = $this->lng->txt('md_vocab_import_invalid'),
- implode("\n\r", $result->getErrors())
+ $message_text = sprintf(
+ $this->lng->txt('md_vocab_import_invalid'),
+ implode("
", $result->getErrors())
);
}
}
@@ -199,16 +233,124 @@ public function importVocabulary(): void
$this->ctrl->redirect($this, 'showVocabularies');
}
+ #[NoReturn] protected function confirmDeleteVocabulary(string $vocab_id): void
+ {
+ list($url_builder, $action_parameter_token, $vocabs_id_token) = $this->getTableURLBuilderAndParameters();
+ $key = $vocabs_id_token->getName();
+
+ $vocab = $this->vocab_manager->getVocabulary($vocab_id);
+ $value_items = [];
+ foreach ($this->presentation->makeValuesPresentable(
+ $vocab,
+ self::MAX_CONFIRMATION_VALUES
+ ) as $value) {
+ $value_items[] = $this->ui_factory->modal()->interruptiveItem()->standard(
+ '',
+ $value,
+ );
+ }
+
+ $this->ctrl->setParameter($this, $key, $vocab_id);
+ $link = $this->ctrl->getLinkTarget($this, 'deleteVocabulary');
+ $this->ctrl->clearParameters($this);
+
+ $modal = $this->ui_factory->modal()->interruptive(
+ $this->presentation->txt('md_vocab_delete_confirmation_title'),
+ $this->presentation->txtFill(
+ 'md_vocab_delete_confirmation_text',
+ $this->presentation->makeSlotPresentable($vocab->slot()),
+ $vocab->source()
+ ),
+ $link
+ )->withAffectedItems($value_items);
+ echo $this->ui_renderer->renderAsync($modal);
+ exit;
+ }
+
protected function deleteVocabulary(): void
{
+ $vocab_id = $this->fetchVocabID();
+ if ($vocab_id !== '') {
+ $this->vocab_manager->actions()->delete(
+ $this->vocab_manager->getVocabulary($vocab_id)
+ );
+ }
+ $this->tpl->setOnScreenMessage(
+ ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ $this->lng->txt('md_vocab_deletion_successful'),
+ true
+ );
+ $this->ctrl->redirect($this, 'showVocabularies');
+ }
+
+ protected function activateVocabulary(string $vocab_id): void
+ {
+ $this->vocab_manager->actions()->activate(
+ $this->vocab_manager->getVocabulary($vocab_id)
+ );
+ $this->tpl->setOnScreenMessage(
+ ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ $this->lng->txt('md_vocab_update_successful'),
+ true
+ );
+ $this->ctrl->redirect($this, 'showVocabularies');
+ }
+
+ protected function deactivateVocabulary(string $vocab_id): void
+ {
+ $this->vocab_manager->actions()->deactivate(
+ $this->vocab_manager->getVocabulary($vocab_id)
+ );
+ $this->tpl->setOnScreenMessage(
+ ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ $this->lng->txt('md_vocab_update_successful'),
+ true
+ );
+ $this->ctrl->redirect($this, 'showVocabularies');
+ }
+
+ protected function allowCustomInputForVocabulary(string $vocab_id): void
+ {
+ $this->vocab_manager->actions()->allowCustomInput(
+ $this->vocab_manager->getVocabulary($vocab_id)
+ );
+ $this->tpl->setOnScreenMessage(
+ ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ $this->lng->txt('md_vocab_update_successful'),
+ true
+ );
+ $this->ctrl->redirect($this, 'showVocabularies');
}
- protected function toggleActiveForVocabulary(): void
+ protected function disallowCustomInputForVocabulary(string $vocab_id): void
{
+ $this->vocab_manager->actions()->allowCustomInput(
+ $this->vocab_manager->getVocabulary($vocab_id)
+ );
+ $this->tpl->setOnScreenMessage(
+ ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS,
+ $this->lng->txt('md_vocab_update_successful'),
+ true
+ );
+ $this->ctrl->redirect($this, 'showVocabularies');
}
- protected function toggleCustomInputForVocabulary(): void
+ #[NoReturn] protected function showAllValuesModalForVocabulary(string $vocab_id): void
{
+ $vocab = $this->vocab_manager->getVocabulary($vocab_id);
+ $values = $this->ui_factory->listing()->unordered(
+ $this->presentation->makeValuesPresentable($vocab)
+ );
+ $modal = $this->ui_factory->modal()->roundtrip(
+ $this->presentation->txtFill(
+ 'md_vocab_all_values_title',
+ $this->presentation->makeSlotPresentable($vocab->slot()),
+ $vocab->source()
+ ),
+ [$values]
+ );
+ echo $this->ui_renderer->renderAsync($modal);
+ exit;
}
protected function getTable(): DataTable
@@ -231,15 +373,7 @@ protected function getTable(): DataTable
)->withIsSortable(false)
];
- $url_builder = new URLBuilder(new URI(
- rtrim(ILIAS_HTTP_PATH, '/') . $this->ctrl->getLinkTarget($this, 'tableAction')
- ));
- list($url_builder, $action_parameter_token, $row_id_token) =
- $url_builder->acquireParameters(
- ['metadata', 'vocab'],
- 'table_action',
- 'vocab_ids'
- );
+ list($url_builder, $action_parameter_token, $row_id_token) = $this->getTableURLBuilderAndParameters();
$actions_factory = $this->ui_factory->table()->action();
$actions = [
'delete' => $actions_factory->single(
@@ -247,14 +381,24 @@ protected function getTable(): DataTable
$url_builder->withParameter($action_parameter_token, 'delete'),
$row_id_token
)->withAsync(true),
- 'toggle_active' => $actions_factory->single(
- $this->lng->txt('md_vocab_toggle_active_action'),
- $url_builder->withParameter($action_parameter_token, 'toggle_active'),
+ 'activate' => $actions_factory->single(
+ $this->lng->txt('md_vocab_activate_action'),
+ $url_builder->withParameter($action_parameter_token, 'activate'),
$row_id_token
),
- 'toggle_custom_input' => $actions_factory->single(
- $this->lng->txt('md_vocab_toggle_custom_input_action'),
- $url_builder->withParameter($action_parameter_token, 'toggle_custom_input'),
+ 'deactivate' => $actions_factory->single(
+ $this->lng->txt('md_vocab_deactivate_action'),
+ $url_builder->withParameter($action_parameter_token, 'deactivate'),
+ $row_id_token
+ ),
+ 'allow_custom_input' => $actions_factory->single(
+ $this->lng->txt('md_vocab_allow_custom_input_action'),
+ $url_builder->withParameter($action_parameter_token, 'allow_custom_input'),
+ $row_id_token
+ ),
+ 'disallow_custom_input' => $actions_factory->single(
+ $this->lng->txt('md_vocab_disallow_custom_input_action'),
+ $url_builder->withParameter($action_parameter_token, 'disallow_custom_input'),
$row_id_token
),
'show_all' => $actions_factory->single(
@@ -267,14 +411,9 @@ protected function getTable(): DataTable
return $this->ui_factory->table()->data(
$this->lng->txt('md_vocab_table_title'),
$columns,
- new ilMDVocabulariesDataRetrieval(
+ new DataRetrieval(
$this->vocab_manager,
- $this->elements_presentation,
- $this->presentation_utils,
- $this->vocab_presentation,
- $this->slot_handler,
- $this->structure,
- $this->navigator_factory
+ $this->presentation
)
)->withActions($actions)->withRequest($this->http->request());
}
@@ -301,4 +440,42 @@ protected function getImportButton(Signal $signal): Button
$signal
);
}
+
+ protected function fetchTableAction(): string
+ {
+ list($url_builder, $action_parameter_token, $vocabs_id_token) = $this->getTableURLBuilderAndParameters();
+ $key = $action_parameter_token->getName();
+ if ($this->http->wrapper()->query()->has($key)) {
+ return $this->http->wrapper()->query()->retrieve(
+ $key,
+ $this->refinery->identity()
+ );
+ }
+ return '';
+ }
+
+ protected function fetchVocabID(): string
+ {
+ list($url_builder, $action_parameter_token, $vocabs_id_token) = $this->getTableURLBuilderAndParameters();
+ $key = $vocabs_id_token->getName();
+ if ($this->http->wrapper()->query()->has($key)) {
+ return $this->http->wrapper()->query()->retrieve(
+ $key,
+ $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
+ )[0] ?? '';
+ }
+ return '';
+ }
+
+ protected function getTableURLBuilderAndParameters(): array
+ {
+ $url_builder = new URLBuilder(new URI(
+ rtrim(ILIAS_HTTP_PATH, '/') . '/' . $this->ctrl->getLinkTarget($this, 'tableAction')
+ ));
+ return $url_builder->acquireParameters(
+ ['metadata', 'vocab'],
+ 'table_action',
+ 'ids'
+ );
+ }
}
diff --git a/Services/MetaData/classes/Vocabularies/Slots/Handler.php b/Services/MetaData/classes/Vocabularies/Slots/Handler.php
index 7b5ac5abb3d3..71fab7e79f12 100644
--- a/Services/MetaData/classes/Vocabularies/Slots/Handler.php
+++ b/Services/MetaData/classes/Vocabularies/Slots/Handler.php
@@ -128,7 +128,7 @@ public function identiferFromPathAndCondition(
$condition = $this->conditionForSlot($identifier);
if (
$condition?->value() !== $condition_value ||
- $condition?->path()?->toString() !== $path_to_element?->toString()
+ $condition?->path()?->toString() !== $path_to_condition?->toString()
) {
continue;
}
diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang
index 8c662fff4c26..1d6ab183b504 100644
--- a/lang/ilias_de.lang
+++ b/lang/ilias_de.lang
@@ -11808,6 +11808,9 @@ meta#:#md_delete_cp_sure#:#Möchten Sie wirklich die ausgewählten Vorgaben entf
meta#:#md_delimiter#:#Trennzeichen
meta#:#md_delimiter_info#:#Das Trennzeichen wird in der Schnellbearbeitung der Metadaten verwendet, um mehrere Angaben zu trennen. Standardzeichen ist ','.###Modified as part of gender mainstreaming activities for ILIAS 8
meta#:#md_fields#:#Felder
+meta#:#md_import_file_vocab#:#Importdatei
+meta#:#md_import_vocab#:#Import
+meta#:#md_import_vocab_modal#:#Aus Datei importieren
meta#:#md_months#:#Monate:
meta#:#md_oai_contact_mail#:#E-Mail-Kontaktadresse
meta#:#md_oai_identifier_prefix#:#OAI Präfix
@@ -11821,7 +11824,35 @@ meta#:#md_record_export_table#:#Exportdateien
meta#:#md_record_list_table#:#Benutzerdefinierte Metadatensätze
meta#:#md_separated_by#:#Getrennt mit %s
meta#:#md_time#:#Zeit:
+meta#:#md_unknown_vocabulary_flag#:#(unbekanntes Vokabular)
meta#:#md_used#:#Verwendung (Anzahl)
+meta#:#md_vocab_activate_action#:#Aktivieren
+meta#:#md_vocab_active_column#:#Aktiv
+meta#:#md_vocab_all_values_title#:#Begriffe für %s (%s)
+meta#:#md_vocab_allow_custom_input_action#:#Eigene Angaben erlauben
+meta#:#md_vocab_custom_input_column#:#Erlaubt eigene Angaben
+meta#:#md_vocab_deactivate_action#:#Deaktivieren
+meta#:#md_vocab_delete_action#:#Löschen
+meta#:#md_vocab_delete_confirmation_text#:#Sind Sie sicher, dass sie dass Vokabular %s (%s) mit den folgenden Begriffen löschen wollen?
+meta#:#md_vocab_delete_confirmation_title#:#Vokabular löschen
+meta#:#md_vocab_deletion_successful#:#Vokabular erfolgreich gelöscht.
+meta#:#md_vocab_disallow_custom_input_action#:#Keine eigenen Angaben erlauben
+meta#:#md_vocab_element_column#:#Element
+meta#:#md_vocab_element_with_condition#:#%s mit %s %s
+meta#:#md_vocab_import_invalid#:#Die Importdatei ist ungültig:
%s
+meta#:#md_vocab_import_successful#:#Vokabular erfolgreich imported.
+meta#:#md_vocab_import_upload_failed#:#Das Hochladen der Importdatei ist fehlgeschlagen.
+meta#:#md_vocab_preview_column#:#Begriffe (Vorschau)
+meta#:#md_vocab_show_all_action#:#Alle Begriffe anzeigen
+meta#:#md_vocab_source_column#:#Quelle
+meta#:#md_vocab_table_title#:#Vokabulare
+meta#:#md_vocab_type_column#:#Typ
+meta#:#md_vocab_type_controlled_string#:#Kontrollierter Text
+meta#:#md_vocab_type_controlled_vocab_value#:#Kontrollierte Auswahl
+meta#:#md_vocab_type_copyright#:#Copyright
+meta#:#md_vocab_type_standard#:#Standard
+meta#:#md_vocab_update_successful#:#Vokabular erfolgreich aktualisiert.
+meta#:#md_vocabularies_config#:#LOM Vokabulare
meta#:#meta_1#:#1
meta#:#meta_2#:#2
meta#:#meta_3#:#3
diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang
index df0c8d0262e3..59234d08fe18 100644
--- a/lang/ilias_en.lang
+++ b/lang/ilias_en.lang
@@ -11809,6 +11809,9 @@ meta#:#md_delete_cp_sure#:#Are you sure you want to delete the following entries
meta#:#md_delimiter#:#Delimiter
meta#:#md_delimiter_info#:#The delimiter is used in the quick editing screen to separate multiple keywords and/or authors. Default is ‘,’.
meta#:#md_fields#:#Fields
+meta#:#md_import_file_vocab#:#Import File
+meta#:#md_import_vocab#:#Import
+meta#:#md_import_vocab_modal#:#Import From File
meta#:#md_months#:#Months:
meta#:#md_oai_contact_mail#:#Contact E-Mail
meta#:#md_oai_identifier_prefix#:#OAI Prefix
@@ -11822,7 +11825,35 @@ meta#:#md_record_export_table#:#Export Files
meta#:#md_record_list_table#:#Custom Metadata Sets
meta#:#md_separated_by#:#Separated by %s
meta#:#md_time#:#Time:
+meta#:#md_unknown_vocabulary_flag#:#(unknown vocabulary)
meta#:#md_used#:#Current Number of Usages
+meta#:#md_vocab_activate_action#:#Activate
+meta#:#md_vocab_active_column#:#Active
+meta#:#md_vocab_all_values_title#:#Values for %s (%s)
+meta#:#md_vocab_allow_custom_input_action#:#Allow Custom Input
+meta#:#md_vocab_custom_input_column#:#Custom Input Allowed
+meta#:#md_vocab_deactivate_action#:#Deactivate
+meta#:#md_vocab_delete_action#:#Delete
+meta#:#md_vocab_delete_confirmation_text#:#Are you sure you want to delete the vocabulary for %s (%s) with the following values?
+meta#:#md_vocab_delete_confirmation_title#:#Delete Vocabulary
+meta#:#md_vocab_deletion_successful#:#Vocabulary successfully deleted.
+meta#:#md_vocab_disallow_custom_input_action#:#Disallow Custom Input
+meta#:#md_vocab_element_column#:#Element
+meta#:#md_vocab_element_with_condition#:#%s where %s is %s
+meta#:#md_vocab_import_invalid#:#The import file is invalid:
%s
+meta#:#md_vocab_import_successful#:#Vocabulary successfully imported.
+meta#:#md_vocab_import_upload_failed#:#Upload of the import file failed.
+meta#:#md_vocab_preview_column#:#Values (Preview)
+meta#:#md_vocab_show_all_action#:#Show All Values
+meta#:#md_vocab_source_column#:#Source
+meta#:#md_vocab_table_title#:#Vocabularies
+meta#:#md_vocab_type_column#:#Type
+meta#:#md_vocab_type_controlled_string#:#Controlled Text
+meta#:#md_vocab_type_controlled_vocab_value#:#Controlled Selection
+meta#:#md_vocab_type_copyright#:#Copyright
+meta#:#md_vocab_type_standard#:#Standard
+meta#:#md_vocab_update_successful#:#Vocabulary successfully updated.
+meta#:#md_vocabularies_config#:#LOM Vocabularies
meta#:#meta_1#:#1
meta#:#meta_2#:#2
meta#:#meta_3#:#3