From ff36103f8efbcae6bfa72487ef44d9baa694c367 Mon Sep 17 00:00:00 2001 From: Leon Ossowski Date: Mon, 3 Nov 2025 11:16:34 +0100 Subject: [PATCH 1/3] only show unarchived tasks and add filter --- messages/de/base.php | 1 + models/forms/TaskFilter.php | 20 +++++++++--- models/lists/TaskList.php | 16 +++++---- models/lists/UnsortedTaskList.php | 2 +- module.json | 43 +++++++++++-------------- views/list/index.php | 23 ++++++------- widgets/lists/TaskListWidget.php | 2 -- widgets/search/TaskFilterNavigation.php | 34 +++++++++++++------ 8 files changed, 82 insertions(+), 59 deletions(-) diff --git a/messages/de/base.php b/messages/de/base.php index 8541238e..2b162c47 100644 --- a/messages/de/base.php +++ b/messages/de/base.php @@ -178,4 +178,5 @@ '{userName} started working on Task {task} in space {spaceName}.' => '{userName} hat begonnen, an der Aufgabe {task} im Space {spaceName} zu arbeiten.', '{userName} works on task {task}.' => '{userName} arbeitet an der Aufgabe {task}.', 'Task content ID' => '', + "Archived" => "Archiviert" ]; diff --git a/models/forms/TaskFilter.php b/models/forms/TaskFilter.php index b27f9e90..d24effa7 100644 --- a/models/forms/TaskFilter.php +++ b/models/forms/TaskFilter.php @@ -35,6 +35,7 @@ class TaskFilter extends Model public const FILTER_SPACE = 'spaces'; public const FILTER_DATE_START = 'date_start'; public const FILTER_DATE_END = 'date_end'; + public const FILTER_ARCHIVED = "archived"; public $filters = []; @@ -88,13 +89,19 @@ public function query() { $this->validate(); - $query = Task::find()->readable()->andWhere('content.archived = 0'); + $query = Task::find()->readable(); + + if ($this->isFilterActive(static::FILTER_ARCHIVED)) { + $query->andWhere("content.archived = 1"); + } else { + $query->andWhere("content.archived = 0"); + } if ($this->contentContainer) { $query->contentContainer($this->contentContainer); } elseif (!empty($this->spaces)) { - $query->joinWith(['content', 'content.contentContainer', 'content.createdBy']); + $query->joinWith(['content.contentContainer', 'content.createdBy']); $query->andWhere(['IN', 'contentcontainer.guid', $this->spaces]); } else { // exclude archived content from global view @@ -134,12 +141,15 @@ public function query() if (! empty($this->date_start) && ! empty($this->date_end)) { $query->andWhere( - ['or', - ['and', + [ + 'or', + [ + 'and', CalendarUtils::getStartCriteria($this->date_start, 'start_datetime', '>='), CalendarUtils::getStartCriteria($this->date_end, 'start_datetime', '<='), ], - ['and', + [ + 'and', CalendarUtils::getEndCriteria($this->date_start, 'end_datetime', '>='), CalendarUtils::getEndCriteria($this->date_end, 'end_datetime', '<='), ], diff --git a/models/lists/TaskList.php b/models/lists/TaskList.php index ad441e68..0993ba6a 100644 --- a/models/lists/TaskList.php +++ b/models/lists/TaskList.php @@ -11,7 +11,6 @@ use humhub\modules\content\components\ActiveQueryContent; use humhub\modules\content\components\ContentContainerActiveRecord; -use humhub\modules\content\models\ContentContainer; use humhub\modules\content\models\ContentTag; use humhub\modules\tasks\models\Sortable; use humhub\modules\tasks\models\Task; @@ -50,7 +49,7 @@ public function afterSave($insert, $changedAttributes) */ public function getTasks() { - return Task::find()->andWhere(['task_list_id' => $this->id])->readable(); + return Task::find()->where(['task_list_id' => $this->id])->andWhere(["content.archived" => 0])->readable(); } public function load($data, $formName = null) @@ -65,7 +64,7 @@ public function load($data, $formName = null) */ public function getNonCompletedTasks() { - return $this->getTasks()->where(['!=', 'task.status', Task::STATUS_COMPLETED])->orderBy(['sort_order' => SORT_ASC, 'updated_at' => SORT_DESC]); + return $this->getTasks()->andWhere(['!=', 'task.status', Task::STATUS_COMPLETED])->orderBy(['sort_order' => SORT_ASC, 'updated_at' => SORT_DESC]); } /** @@ -92,7 +91,7 @@ public function getCompletedTasks() */ public function getTasksByStatus($status) { - return $this->getTasks()->where(['task.status' => $status]); + return $this->getTasks()->andWhere(['task.status' => $status]); } /** @@ -129,7 +128,8 @@ public static function findByFilter($container, $filters = []) $includes = is_array($filters[static::FILTER_STATUS_INCLUDE]) ? $filters[static::FILTER_STATUS_INCLUDE] : [$filters[static::FILTER_STATUS_INCLUDE]]; $query->andWhere( - ['OR', + [ + 'OR', ['IS', 'task.id', new Expression("NULL")], ['IN', 'task.status', $includes], ], @@ -152,7 +152,8 @@ public static function findOverviewLists(ContentContainerActiveRecord $container $includes = [Task::STATUS_IN_PROGRESS, Task::STATUS_PENDING_REVIEW, Task::STATUS_PENDING]; $query->andWhere( - ['OR', + [ + 'OR', ['IN', 'task.status', $includes], ['IS', 'task.id', new Expression("NULL")], ['task_list_setting.hide_if_completed' => '0'], @@ -176,7 +177,8 @@ public static function findHiddenLists(ContentContainerActiveRecord $container) $subQuery = Task::find()->where('task.task_list_id = content_tag.id')->andWhere(['IN', 'task.status', $includes]); $query->andWhere( - ['AND', + [ + 'AND', ['NOT EXISTS', $subQuery], ['IS NOT', 't.id', new Expression("NULL")], ['task_list_setting.hide_if_completed' => '1'], diff --git a/models/lists/UnsortedTaskList.php b/models/lists/UnsortedTaskList.php index 1242e20c..027d9f7f 100644 --- a/models/lists/UnsortedTaskList.php +++ b/models/lists/UnsortedTaskList.php @@ -25,7 +25,7 @@ public function getTasks() */ public function getNonCompletedTasks() { - return $this->getTasks()->where(['!=', 'task.status', Task::STATUS_COMPLETED])->orderBy(['sort_order' => SORT_ASC, 'task.updated_at' => SORT_DESC]); + return $this->getTasks()->where(['!=', 'task.status', Task::STATUS_COMPLETED])->andWhere(["content.archived" => 0])->orderBy(['sort_order' => SORT_ASC, 'task.updated_at' => SORT_DESC]); } /** diff --git a/module.json b/module.json index 34ae1dce..155fc027 100644 --- a/module.json +++ b/module.json @@ -1,26 +1,21 @@ { - "id": "tasks", - "name": "Tasks", - "description": "Create tasks, assign users, set deadlines, and organize projects to keep your team on track.", - "keywords": [ - "task", - "todo", - "project", - "management" - ], - "version": "1.8.8", - "homepage": "https://github.com/humhub/tasks", - "humhub": { - "minVersion": "1.14" - }, - "screenshots": [ - "resources/screenshot1.png", - "resources/screenshot2.png", - "resources/screenshot3.png", - "resources/screenshot4.png", - "resources/screenshot5.png", - "resources/screenshot6.png", - "resources/screenshot7.png", - "resources/screenshot8.png" - ] + "id": "tasks", + "name": "Tasks", + "description": "Create tasks, assign users, set deadlines, and organize projects to keep your team on track.", + "keywords": ["task", "todo", "project", "management"], + "version": "1.8.9", + "homepage": "https://github.com/humhub/tasks", + "humhub": { + "minVersion": "1.14" + }, + "screenshots": [ + "resources/screenshot1.png", + "resources/screenshot2.png", + "resources/screenshot3.png", + "resources/screenshot4.png", + "resources/screenshot5.png", + "resources/screenshot6.png", + "resources/screenshot7.png", + "resources/screenshot8.png" + ] } diff --git a/views/list/index.php b/views/list/index.php index ba1e0c75..391bbb5b 100644 --- a/views/list/index.php +++ b/views/list/index.php @@ -1,4 +1,5 @@ -
-
-
-
-
- +
+
+
+
+
+ +
+
+
+ $contentContainer]) ?>
-
-
- $contentContainer]) ?>
-
\ No newline at end of file diff --git a/widgets/lists/TaskListWidget.php b/widgets/lists/TaskListWidget.php index cd271386..86c7c7f2 100644 --- a/widgets/lists/TaskListWidget.php +++ b/widgets/lists/TaskListWidget.php @@ -9,12 +9,10 @@ namespace humhub\modules\tasks\widgets\lists; -use humhub\modules\content\components\ContentContainerActiveRecord; use humhub\modules\tasks\helpers\TaskListUrl; use humhub\modules\tasks\models\Task; use humhub\modules\tasks\models\lists\TaskListInterface; use humhub\widgets\JsWidget; -use Yii; class TaskListWidget extends JsWidget { diff --git a/widgets/search/TaskFilterNavigation.php b/widgets/search/TaskFilterNavigation.php index 41a2266b..f4052574 100644 --- a/widgets/search/TaskFilterNavigation.php +++ b/widgets/search/TaskFilterNavigation.php @@ -104,33 +104,38 @@ protected function initFilters() 'data-action-keypress' => null, 'placeholder' => Yii::t('TasksModule.base', 'Filter by title'), ], - 'sortOrder' => 100], static::FILTER_BLOCK_TITLE); + 'sortOrder' => 100 + ], static::FILTER_BLOCK_TITLE); $this->addFilter([ 'id' => TaskFilter::FILTER_OVERDUE, 'checked' => $this->filter->isFilterActive(TaskFilter::FILTER_OVERDUE), 'title' => Yii::t('TasksModule.base', 'Overdue'), 'options' => ['label' => Yii::t('TasksModule.base', 'Filter')], - 'sortOrder' => 100], static::FILTER_BLOCK_CHECKBOX); + 'sortOrder' => 100 + ], static::FILTER_BLOCK_CHECKBOX); if (!Yii::$app->user->isGuest && (!$this->filter->contentContainer || $this->filter->contentContainer instanceof Space)) { $this->addFilter([ 'id' => TaskFilter::FILTER_ASSIGNED, 'checked' => $this->filter->isFilterActive(TaskFilter::FILTER_ASSIGNED), 'title' => Yii::t('TasksModule.base', 'I\'m assigned'), - 'sortOrder' => 200], static::FILTER_BLOCK_CHECKBOX); + 'sortOrder' => 200 + ], static::FILTER_BLOCK_CHECKBOX); $this->addFilter([ 'id' => TaskFilter::FILTER_RESPONSIBLE, 'checked' => $this->filter->isFilterActive(TaskFilter::FILTER_RESPONSIBLE), 'title' => Yii::t('TasksModule.base', 'I\'m responsible'), - 'sortOrder' => 300], static::FILTER_BLOCK_CHECKBOX); + 'sortOrder' => 300 + ], static::FILTER_BLOCK_CHECKBOX); $this->addFilter([ 'id' => TaskFilter::FILTER_MINE, 'checked' => $this->filter->isFilterActive(TaskFilter::FILTER_MINE), 'title' => Yii::t('TasksModule.base', 'Created by me'), - 'sortOrder' => 400], static::FILTER_BLOCK_CHECKBOX); + 'sortOrder' => 400 + ], static::FILTER_BLOCK_CHECKBOX); } $this->addFilter([ @@ -146,8 +151,16 @@ protected function initFilters() 'items' => TaskState::getStatusItems(), 'placeholderMore' => Yii::t('TasksModule.base', 'Filter by status'), 'name' => 'task-filter-state', - ]], static::FILTER_BLOCK_PICKER); + ] + ], static::FILTER_BLOCK_PICKER); + $this->addFilter([ + "id" => TaskFilter::FILTER_ARCHIVED, + "title" => Yii::t("TasksModule.base", "Archived"), + "options" => [ + "label" => Yii::t("TasksModule.base", "Show archived?") + ] + ], static::FILTER_BLOCK_CHECKBOX); if (!$this->filter->contentContainer) { $memberships = MembershipSearch::findByUser(Yii::$app->user->identity)->all(); @@ -170,7 +183,8 @@ protected function initFilters() 'pickerOptions' => [ 'name' => 'task-filter-spaces', 'defaultResults' => $spaces, - ]], static::FILTER_BLOCK_PICKER); + ] + ], static::FILTER_BLOCK_PICKER); } $this->addFilter([ @@ -180,7 +194,8 @@ protected function initFilters() 'filterOptions' => [ 'label' => Yii::t('TasksModule.base', 'Date'), 'placeholder' => Yii::t('TasksModule.base', 'Start date'), - ]], static::FILTER_BLOCK_DATEPICKER); + ] + ], static::FILTER_BLOCK_DATEPICKER); $this->addFilter([ 'id' => TaskFilter::FILTER_DATE_END, @@ -188,7 +203,8 @@ protected function initFilters() 'class' => DateFilter::class, 'filterOptions' => [ 'placeholder' => Yii::t('TasksModule.base', 'End date'), - ]], static::FILTER_BLOCK_DATEPICKER); + ] + ], static::FILTER_BLOCK_DATEPICKER); } public function getData() From d84900f35d790b52ff5a6803be004b643487fbeb Mon Sep 17 00:00:00 2001 From: Leon Ossowski Date: Mon, 3 Nov 2025 11:40:17 +0100 Subject: [PATCH 2/3] Show list name in global task list --- messages/de/base.php | 3 ++- views/global/index.php | 4 +--- widgets/search/views/taskSearchListEntry.php | 18 ++++++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/messages/de/base.php b/messages/de/base.php index 2b162c47..eae36e3d 100644 --- a/messages/de/base.php +++ b/messages/de/base.php @@ -178,5 +178,6 @@ '{userName} started working on Task {task} in space {spaceName}.' => '{userName} hat begonnen, an der Aufgabe {task} im Space {spaceName} zu arbeiten.', '{userName} works on task {task}.' => '{userName} arbeitet an der Aufgabe {task}.', 'Task content ID' => '', - "Archived" => "Archiviert" + "Archived" => "Archiviert", + "List: {name}" => "Liste: {name}" ]; diff --git a/views/global/index.php b/views/global/index.php index 63cfd75e..b87000da 100644 --- a/views/global/index.php +++ b/views/global/index.php @@ -3,7 +3,6 @@ use humhub\modules\tasks\assets\Assets; use humhub\modules\tasks\widgets\search\TaskSearchList; use humhub\modules\tasks\widgets\search\TaskFilterNavigation; -use humhub\modules\tasks\models\forms\TaskFilter; /* @var $this \humhub\modules\ui\view\components\View */ /* @var $filter TaskFilter */ @@ -24,5 +23,4 @@ $filter]) ?>
-
- + \ No newline at end of file diff --git a/widgets/search/views/taskSearchListEntry.php b/widgets/search/views/taskSearchListEntry.php index 193bb737..c1e04990 100644 --- a/widgets/search/views/taskSearchListEntry.php +++ b/widgets/search/views/taskSearchListEntry.php @@ -1,4 +1,5 @@ $task->content->container, 'width' => '24', 'showTooltip' => true, - 'link' => true]) + 'link' => true + ]) : UserImage::widget([ 'user' => $task->content->container, 'width' => '24', 'showTooltip' => true, - 'link' => true]); + 'link' => true + ]); ?> @@ -40,7 +43,7 @@
- +
@@ -52,19 +55,22 @@

title); ?>

+ list): ?> + ( $task->list->name]) ?>) +
$task]) ?> review) : ?>
+ title="">
@@ -81,4 +87,4 @@
- + \ No newline at end of file From 90e9a849b5482c8f7fd855bc54a4eb2443b85152 Mon Sep 17 00:00:00 2001 From: Leon Ossowski Date: Mon, 3 Nov 2025 11:45:45 +0100 Subject: [PATCH 3/3] add due date to global task list --- messages/de/base.php | 3 ++- widgets/search/views/taskSearchListEntry.php | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/messages/de/base.php b/messages/de/base.php index eae36e3d..533797a1 100644 --- a/messages/de/base.php +++ b/messages/de/base.php @@ -179,5 +179,6 @@ '{userName} works on task {task}.' => '{userName} arbeitet an der Aufgabe {task}.', 'Task content ID' => '', "Archived" => "Archiviert", - "List: {name}" => "Liste: {name}" + "List: {name}" => "Liste: {name}", + "Due Date" => "Fälligkeitsdatum" ]; diff --git a/widgets/search/views/taskSearchListEntry.php b/widgets/search/views/taskSearchListEntry.php index c1e04990..b179fbec 100644 --- a/widgets/search/views/taskSearchListEntry.php +++ b/widgets/search/views/taskSearchListEntry.php @@ -87,4 +87,12 @@ +
+ scheduling): ?> +
+ + schedule->getFormattedDateTime() ?> +
+ +
\ No newline at end of file