Skip to content

Commit 04ec4ea

Browse files
committed
Merge branch 'release_9' of https://github.com/ILIAS-eLearning/ILIAS into bugfix/item-column-spacing
2 parents fc1a0a0 + 514a820 commit 04ec4ea

56 files changed

Lines changed: 592 additions & 198 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Modules/Blog/Export/class.ilBlogImporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function finalProcessing(
7070

7171
$sty_map = $a_mapping->getMappingsOfEntity("Services/Style", "sty");
7272
foreach ($sty_map as $old_sty_id => $new_sty_id) {
73-
if (is_array(ilBlogDataSet::$style_map[$old_sty_id])) {
73+
if (is_array(ilBlogDataSet::$style_map[$old_sty_id] ?? false)) {
7474
foreach (ilBlogDataSet::$style_map[$old_sty_id] as $blog_id) {
7575
$this->content_style_domain
7676
->styleForObjId($blog_id)

Modules/Blog/PrintView/class.BlogPrintViewProviderGUI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getSelectionForm(): ?ilPropertyFormGUI
122122

123123
foreach ($postings as $p) {
124124
$nl->addListNode(
125-
$p["id"],
125+
(string) $p["id"],
126126
$p["title"],
127127
"0",
128128
false,

Modules/Chatroom/chat/package-lock.json

Lines changed: 31 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/Chatroom/chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "2.0.0",
55
"dependencies": {
66
"async": "^3.2",
7-
"express": "^4.21.2",
7+
"express": "^4.22.1",
88
"mysql": "^2.18.1",
99
"node-mysql": "^0.4.2",
1010
"node-schedule": "^2.1.0",

Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ protected function createSwitchers(): void
547547
$switcher->addTableSwitcherToToolbar(
548548
$tables,
549549
self::class,
550-
self::CMD_SHOW
550+
self::CMD_SHOW,
551+
$this->getTableId()
551552
);
552553

553554
$switcher->addViewSwitcherToToolbar(

Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldRepresentation.php

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ class ilDclReferenceFieldRepresentation extends ilDclBaseFieldRepresentation
2222
{
2323
public const REFERENCE_SEPARATOR = " -> ";
2424

25-
/**
26-
* @param ilPropertyFormGUI $form
27-
* @param int|null $record_id
28-
* @return ilSelectInputGUI|ilMultiSelectInputGUI
29-
*/
30-
public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilFormPropertyGUI
25+
public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilSelectInputGUI|ilMultiSelectInputGUI
3126
{
3227
if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_N_REFERENCE)) {
3328
$input = new ilMultiSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
@@ -39,11 +34,50 @@ public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null):
3934

4035
$this->setupInputField($input, $this->getField());
4136

42-
$options = [];
37+
$options = $this->getSortedRecords();
4338
if (!$this->getField()->getProperty(ilDclBaseFieldModel::PROP_N_REFERENCE)) {
44-
$options[''] = $this->lng->txt('dcl_please_select');
39+
$options = ['' => $this->lng->txt('dcl_please_select')] + $options;
40+
}
41+
42+
$input->setOptions($options);
43+
if ($input instanceof ilMultiSelectInputGUI) {
44+
$input->setHeight(32 * min(5, max(1, count($options))));
45+
}
46+
47+
$ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
48+
49+
$fieldref = (int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE);
50+
$reffield = ilDclCache::getFieldCache($fieldref);
51+
if (ilObjDataCollectionAccess::hasPermissionToAddRecord($ref_id, $reffield->getTableId())) {
52+
$input->addCustomAttribute('data-ref="1"');
53+
$input->addCustomAttribute('data-ref-table-id="' . $reffield->getTableId() . '"');
54+
$input->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
4555
}
4656

57+
return $input;
58+
}
59+
60+
public function addFilterInputFieldToTable(ilTable2GUI $table): array|string|null
61+
{
62+
$input = $table->addFilterItemByMetaType(
63+
"filter_" . $this->getField()->getId(),
64+
ilTable2GUI::FILTER_SELECT,
65+
false,
66+
$this->getField()->getId()
67+
);
68+
$options = ['' => $this->lng->txt('dcl_all_entries')]
69+
+ $this->getSortedRecords()
70+
+ ['none' => $this->lng->txt('dcl_no_entry')];
71+
$input->setOptions($options);
72+
73+
$this->setupFilterInputField($input);
74+
75+
return $this->getFilterInputFieldValue($input);
76+
}
77+
78+
protected function getSortedRecords(): array
79+
{
80+
$options = [];
4781
$fieldref = (int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE);
4882
$reffield = ilDclCache::getFieldCache($fieldref);
4983
$reftable = ilDclCache::getTableCache($reffield->getTableId());
@@ -85,63 +119,15 @@ public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null):
85119
}
86120
asort($options, SORT_NATURAL | SORT_FLAG_CASE);
87121

88-
// TT #0019091: restore the actual values after sorting with timestamp
89122
if ($reffield->getDatatypeId() === ilDclDatatype::INPUTFORMAT_DATE) {
90123
foreach ($options as $key => $opt) {
91124
if ($key != "" && isset($options2) && is_array($options2)) {
92125
$options[$key] = $options2[$key];
93126
}
94127
}
95-
// the option 'please select' messes with the order, therefore we reset it
96-
unset($options[""]);
97-
$options = ["" => $this->lng->txt('dcl_please_select')] + $options;
98-
}
99-
100-
$input->setOptions($options);
101-
if ($input instanceof ilMultiSelectInputGUI) {
102-
$input->setHeight(32 * min(5, max(1, count($options))));
103-
}
104-
105-
106-
$ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
107-
108-
if (ilObjDataCollectionAccess::hasPermissionToAddRecord($ref_id, $reftable->getId())) {
109-
$input->addCustomAttribute('data-ref="1"');
110-
$input->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
111-
$input->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
112128
}
113129

114-
return $input;
115-
}
116-
117-
/**
118-
* @return string|array|null
119-
*/
120-
public function addFilterInputFieldToTable(ilTable2GUI $table)
121-
{
122-
$input = $table->addFilterItemByMetaType(
123-
"filter_" . $this->getField()->getId(),
124-
ilTable2GUI::FILTER_SELECT,
125-
false,
126-
$this->getField()->getId()
127-
);
128-
$ref_field_id = (int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE);
129-
$ref_field = ilDclCache::getFieldCache($ref_field_id);
130-
$ref_table = ilDclCache::getTableCache($ref_field->getTableId());
131-
$options = [];
132-
foreach ($ref_table->getRecords() as $record) {
133-
$options[$record->getId()] = $record->getRecordField($ref_field_id)->getPlainText();
134-
}
135-
// Sort by values ASC
136-
asort($options);
137-
$options = ['' => $this->lng->txt('dcl_all_entries')]
138-
+ $options
139-
+ ['none' => $this->lng->txt('dcl_no_entry')];
140-
$input->setOptions($options);
141-
142-
$this->setupFilterInputField($input);
143-
144-
return $this->getFilterInputFieldValue($input);
130+
return $options;
145131
}
146132

147133
/**

Modules/DataCollection/classes/Fields/class.ilDclFieldListGUI.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ public function listFields(): void
190190
$switcher->addTableSwitcherToToolbar(
191191
$this->parent_obj->getDataCollectionObject()->getTables(),
192192
self::class,
193-
'listFields'
193+
'listFields',
194+
$this->getTableId()
194195
);
195196

196197
//table gui

Modules/DataCollection/classes/Helpers/class.ilDclSwitcher.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,46 @@ public function __construct(ilToolbarGUI $toolbar, \ILIAS\UI\Factory $ui_factory
3535

3636
/**
3737
* @param ilDclTable[] $tables
38-
* @param string $target_class
39-
* @param string $target_cmd
40-
* @return void
41-
* @throws ilCtrlException
4238
*/
43-
public function addTableSwitcherToToolbar(array $tables, string $target_class, string $target_cmd): void
39+
public function addTableSwitcherToToolbar(array $tables, string $target_class, string $target_cmd, int $table_id = 0): void
4440
{
41+
$this->ctrl->clearParameterByClass($target_class, 'tableview_id');
4542
$links = [];
46-
47-
$this->ctrl->clearParameterByClass(ilObjDataCollectionGUI::class, "tableview_id");
48-
$this->ctrl->clearParameterByClass($target_class, "tableview_id");
49-
43+
$current = '';
5044
foreach ($tables as $table) {
51-
$this->ctrl->setParameterByClass($target_class, "table_id", $table->getId());
52-
$links[] = $this->ui_factory->link()->standard($table->getTitle(), $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
45+
$title = $table->getTitle();
46+
if ($table->getId() == $table_id) {
47+
$current = $title;
48+
}
49+
$title = ($current === $title ? '' : '') . $title;
50+
$this->ctrl->setParameterByClass($target_class, 'table_id', $table->getId());
51+
$links[] = $this->ui_factory->link()->standard($title, $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
5352
}
54-
$this->ctrl->clearParameterByClass($target_class, "table_id");
53+
$this->ctrl->clearParameterByClass($target_class, 'table_id');
5554

56-
$this->addSwitcherToToolbar($links, $this->lng->txt('dcl_switch_table'));
55+
$this->addSwitcherToToolbar($links, $this->lng->txt('dcl_table') . ': ' . $current);
5756
}
5857

5958
/**
6059
* @param ilDclTableView[] $views
61-
* @param int $table_id
62-
* @param string $target_class
63-
* @param string $target_cmd
64-
* @return void
65-
* @throws ilCtrlException
6660
*/
6761
public function addViewSwitcherToToolbar(array $views, int $table_id, string $target_class, string $target_cmd, int $tableview_id = 0): void
6862
{
63+
$this->ctrl->setParameterByClass($target_class, 'table_id', $table_id);
6964
$links = [];
70-
$this->ctrl->setParameterByClass($target_class, "table_id", $table_id);
65+
$current = '';
7166
foreach ($views as $view) {
72-
$this->ctrl->setParameterByClass($target_class, "tableview_id", $view->getId());
7367
$title = $view->getTitle();
74-
if ($view->getId() === $tableview_id) {
75-
$title .= ' (' . $this->lng->txt('selected') . ')';
68+
if ($view->getId() == $tableview_id) {
69+
$current = $title;
7670
}
71+
$title = ($current === $title ? '✓⠀' : '⠀⠀') . $title;
72+
$this->ctrl->setParameterByClass($target_class, 'tableview_id', $view->getId());
7773
$links[] = $this->ui_factory->link()->standard($title, $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
7874
}
79-
$this->addSwitcherToToolbar($links, $this->lng->txt('dcl_switch_view'));
75+
$this->ctrl->clearParameterByClass($target_class, 'tableview_id');
76+
77+
$this->addSwitcherToToolbar($links, $this->lng->txt('dcl_tableview') . ': ' . $current);
8078
}
8179

8280
/**

Modules/DataCollection/classes/Table/class.ilDclTableEditGUI.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public function initForm(bool $create = true): void
181181
$switcher->addTableSwitcherToToolbar(
182182
$this->parent_object->getDataCollectionObject()->getTables(),
183183
self::class,
184-
'edit'
184+
'edit',
185+
$this->table_id
185186
);
186187

187188
$item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field'), 'default_sort_field');

Modules/DataCollection/classes/TableView/class.ilDclTableViewGUI.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public function show(): void
132132
$switcher->addTableSwitcherToToolbar(
133133
$this->parent_obj->getDataCollectionObject()->getTables(),
134134
self::class,
135-
'show'
135+
'show',
136+
$this->table->getId()
136137
);
137138

138139
$table_gui = new ilDclTableViewTableGUI($this, 'show', $this->table, $this->getParentObj()->getRefId());

0 commit comments

Comments
 (0)