From 00ffecddd315cf300432097c4879363e67f73fec Mon Sep 17 00:00:00 2001 From: Aleksandr Litvin Date: Tue, 4 Aug 2026 14:52:55 +0200 Subject: [PATCH 1/2] fix bug 21693 ILIAS changes the tab-context while removing calendar using drop down menu --- .../classes/class.ilCalendarCategoryGUI.php | 21 ++++++++++++++----- .../class.ilCalendarManageTableGUI.php | 6 ++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/components/ILIAS/Calendar/classes/class.ilCalendarCategoryGUI.php b/components/ILIAS/Calendar/classes/class.ilCalendarCategoryGUI.php index 915e231ede82..14a7c82df288 100755 --- a/components/ILIAS/Calendar/classes/class.ilCalendarCategoryGUI.php +++ b/components/ILIAS/Calendar/classes/class.ilCalendarCategoryGUI.php @@ -129,6 +129,17 @@ protected function initSelectedCategoryIdsFromPost(): array return []; } + protected function initSelectedCategoryIdFromGet(): int + { + if ($this->http->wrapper()->query()->has('selected_cat_id')) { + return $this->http->wrapper()->query()->retrieve( + 'selected_cat_id', + $this->refinery->kindlyTo()->int() + ); + } + return 0; + } + public function executeCommand(): void { $next_class = $this->ctrl->getNextClass($this); @@ -334,15 +345,15 @@ protected function update(): void protected function confirmDelete(): void { $cat_ids = $this->initSelectedCategoryIdsFromPost(); - if ( - !count($cat_ids) && - $this->initCategoryIdFromQuery() > 0 - ) { - $cat_ids = [$this->initCategoryIdFromQuery()]; + $selected_cat_id = $this->initSelectedCategoryIdFromGet(); + + if (!count($cat_ids) && $selected_cat_id > 0) { + $cat_ids = [$selected_cat_id]; } if (!count($cat_ids)) { $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true); $this->manage(); + return; } $confirmation_gui = new ilConfirmationGUI(); $confirmation_gui->setFormAction($this->ctrl->getFormAction($this)); diff --git a/components/ILIAS/Calendar/classes/class.ilCalendarManageTableGUI.php b/components/ILIAS/Calendar/classes/class.ilCalendarManageTableGUI.php index b196fea95d68..ab7747347658 100755 --- a/components/ILIAS/Calendar/classes/class.ilCalendarManageTableGUI.php +++ b/components/ILIAS/Calendar/classes/class.ilCalendarManageTableGUI.php @@ -128,10 +128,14 @@ protected function fillRow(array $a_set): void $url ); } + $this->ctrl->clearParameterByClass($this->getParentObject()::class, 'category_id'); // delete if ($this->actions->checkDeleteCal($a_set['id'])) { + $this->ctrl->setParameter($this->getParentObject(), 'selected_cat_id', $a_set['id']); $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDelete'); + $this->ctrl->clearParameterByClass($this->getParentObject()::class, 'selected_cat_id'); + $dropDownItems[] = $this->ui_factory->button()->shy( $this->lng->txt('delete'), $url @@ -142,8 +146,6 @@ protected function fillRow(array $a_set): void $this->tpl->parseCurrentBlock(); } - $this->ctrl->setParameter($this->getParentObject(), 'category_id', ''); - switch ($a_set['type']) { case ilCalendarCategory::TYPE_GLOBAL: $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('standard/icon_calg.svg')); From d4e78a11bbb56f72b54ec2439cd8caf472a28e85 Mon Sep 17 00:00:00 2001 From: Aleksandr Litvin Date: Tue, 11 Aug 2026 08:35:57 +0200 Subject: [PATCH 2/2] adjust the removal inside of calendar for the consistent tab-context --- .../ILIAS/Calendar/classes/class.ilCalendarPresentationGUI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ILIAS/Calendar/classes/class.ilCalendarPresentationGUI.php b/components/ILIAS/Calendar/classes/class.ilCalendarPresentationGUI.php index 964b0e9fbeab..d45ec5bc049c 100755 --- a/components/ILIAS/Calendar/classes/class.ilCalendarPresentationGUI.php +++ b/components/ILIAS/Calendar/classes/class.ilCalendarPresentationGUI.php @@ -730,7 +730,7 @@ protected function prepareOutput(): void // delete action if ($this->actions->checkDeleteCal($this->category_id)) { - $ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id); + $ctrl->setParameterByClass("ilcalendarcategorygui", "selected_cat_id", $this->category_id); $dropDownItems[] = $this->ui_factory->button()->shy( $this->lng->txt("cal_delete_cal"), $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete")