Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions src/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
18 changes: 13 additions & 5 deletions src/templates/tasks/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ <h2>{{IF [[showArchived]]}}Archived {{ENDIF}}Tasks ([[sizeof([[taskList]])]])</h
<input type="submit" value="Delete archived" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}'>
</form>
{{ENDIF}}
{{IF [[showArchived]]}}
<a style="float: left; margin-right: 5px;" href="tasks.php" class="btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}">Show current</a>
{{ELSE}}
<a style="float: left; margin-right: 5px;" href="tasks.php?archived=true" class="btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}">Show archived</a>
{{ENDIF}}
<a id="toggleArchivedBtn" style="float: left; margin-right: 5px;" href="#" class="btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}">{{IF [[showArchived]]}}Show current{{ELSE}}Show archived{{ENDIF}}</a>
<script>
document.getElementById('toggleArchivedBtn').addEventListener('click', function(e) {
e.preventDefault();
const url = new URL(window.location.href);
if (url.searchParams.has('archived')) {
url.searchParams.delete('archived');
} else {
url.searchParams.set('archived', 'true');
}
window.location.href = url.toString();
});
</script>
{%TEMPLATE->tasks/autorefresh%}
<br>
</div>
Expand Down