From 4f659dbd6e2e7ec897cdbd5b492a79b3a77a43cf Mon Sep 17 00:00:00 2001 From: RohithMacharla11 <2203a52157@sru.edu.in> Date: Thu, 28 Aug 2025 20:13:06 +0530 Subject: [PATCH] Fix: show archived toggle not updating and persisting after refresh --- src/tasks.php | 21 +++++++-------------- src/templates/tasks/index.template.html | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/tasks.php b/src/tasks.php index e1a6ae273..26eaf939d 100755 --- a/src/tasks.php +++ b/src/tasks.php @@ -414,21 +414,14 @@ UI::add('binaries', Factory::getCrackerBinaryTypeFactory()->filter([])); $versions = Factory::getCrackerBinaryFactory()->filter([Factory::ORDER => $oF]); usort($versions, ["Util", "versionComparisonBinary"]); - UI::add('versions', $versions); - UI::add('pageTitle', "Create Task"); -} -else { - AccessControl::getInstance()->checkPermission(DViewControl::TASKS_VIEW_PERM); - UI::add('showArchived', false); - UI::add('pageTitle', "Tasks"); - if (isset($_GET['archived']) && $_GET['archived'] == 'true') { - Util::loadTasks(true); - UI::add('showArchived', true); - UI::add('pageTitle', "Archived Tasks"); - } - else { - Util::loadTasks(false); + } else { + setcookie('showArchived', '0', time() - 3600, "/"); // Remove cookie } + + // Load tasks and set UI state + Util::loadTasks($showArchived); + UI::add('showArchived', $showArchived); + UI::add('pageTitle', $showArchived ? "Archived Tasks" : "Tasks"); } echo Template::getInstance()->render(UI::getObjects()); diff --git a/src/templates/tasks/index.template.html b/src/templates/tasks/index.template.html index 660979aa2..f58772386 100755 --- a/src/templates/tasks/index.template.html +++ b/src/templates/tasks/index.template.html @@ -17,11 +17,19 @@

{{IF [[showArchived]]}}Archived {{ENDIF}}Tasks ([[sizeof([[taskList]])]]) {{ENDIF}} - {{IF [[showArchived]]}} - Show current - {{ELSE}} - Show archived - {{ENDIF}} + {{IF [[showArchived]]}}Show current{{ELSE}}Show archived{{ENDIF}} + {%TEMPLATE->tasks/autorefresh%}