diff --git a/app/Controller/TaskReorderController.php b/app/Controller/TaskReorderController.php new file mode 100644 index 000000000..32bdfc521 --- /dev/null +++ b/app/Controller/TaskReorderController.php @@ -0,0 +1,36 @@ +getProject(); + + if (! $this->helper->user->hasProjectAccess('TaskModificationController', 'update', $project['id'])) { + throw new AccessForbiddenException(); + } + + $swimlaneID = $this->request->getIntegerParam('swimlane_id'); + $columnID = $this->request->getIntegerParam('column_id'); + $direction = $this->request->getStringParam('direction'); + $sort = $this->request->getStringParam('sort'); + + switch ($sort) { + case 'priority': + $this->taskReorderModel->reorderByPriority($project['id'], $swimlaneID, $columnID, $direction); + break; + case 'assignee-priority': + $this->taskReorderModel->reorderByAssigneeAndPriority($project['id'], $swimlaneID, $columnID, $direction); + break; + case 'assignee': + $this->taskReorderModel->reorderByAssignee($project['id'], $swimlaneID, $columnID, $direction); + break; + } + + $this->response->redirect($this->helper->url->to('BoardViewController', 'show', ['project_id' => $project['id']])); + } +} diff --git a/app/Core/Base.php b/app/Core/Base.php index 709327a7e..3535a339d 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -142,6 +142,7 @@ use Pimple\Container; * @property \Kanboard\Model\TaskLinkModel $taskLinkModel * @property \Kanboard\Model\TaskModificationModel $taskModificationModel * @property \Kanboard\Model\TaskPositionModel $taskPositionModel + * @property \Kanboard\Model\TaskReorderModel $taskReorderModel * @property \Kanboard\Model\TaskStatusModel $taskStatusModel * @property \Kanboard\Model\TaskTagModel $taskTagModel * @property \Kanboard\Model\TaskMetadataModel $taskMetadataModel diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index daf9d9e60..f226d027c 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index 58efe43b5..60a9278de 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index c885ebefa..a7fa4082a 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 2add59dae..e404ed774 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1392,4 +1392,10 @@ return array( 'Destination swimlane' => 'Mål spor', 'Assign a category when the task is moved to a specific swimlane' => 'Tildele kategori når opgave flyttes til anført spor', 'Move the task to another swimlane when the category is changed' => 'Flytte opgave til andet spor når kategori ændres', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 9805019d1..d716cfc97 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 12cb44b3c..73d0a74e4 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 56317bc4d..275960ec0 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 02e58f06e..aa675269a 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 73db83641..1df707c89 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1392,4 +1392,10 @@ return array( 'Destination swimlane' => 'Swimlane de destination', 'Assign a category when the task is moved to a specific swimlane' => 'Assigner une catégorie lorsque la tâche est déplaçée dans une swimlane spécifique', 'Move the task to another swimlane when the category is changed' => 'Déplaçer la tâche dans une autre swimlane lorsque la catégorie est modifiée', + 'Reorder this column by priority (ASC)' => 'Réorganiser cette colonne par priorité (ASC)', + 'Reorder this column by priority (DESC)' => 'Réorganiser cette colonne par priorité (DESC)', + 'Reorder this column by assignee and priority (ASC)' => 'Réorganiser cette colonne par assigné et par priorité (ASC)', + 'Reorder this column by assignee and priority (DESC)' => 'Réorganiser cette colonne par assigné et par priorité (DESC)', + 'Reorder this column by assignee (A-Z)' => 'Réorganiser cette colonne par assigné (A-Z)', + 'Reorder this column by assignee (Z-A)' => 'Réorganiser cette colonne par assigné (Z-A)', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index 72739963a..f6cf08c46 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 5b689f9f1..550c50f5a 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 07937a75b..fd1ce47a9 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 32c547bde..b6d723f00 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 5add24763..9cd3495db 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index fc1725139..a57f6c2ff 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 68eb82e0f..2b6b56692 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index e063b9936..9bda0ae1b 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index c6802decf..d32e6d907 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 58a1de82a..4b5581fa2 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index b41e0c649..0d0b3b83d 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1392,4 +1392,10 @@ return array( 'Destination swimlane' => 'Raia de destino', 'Assign a category when the task is moved to a specific swimlane' => 'Atribuir uma categoria quando a tarefa for movida para uma raia específica', 'Move the task to another swimlane when the category is changed' => 'Mover a tarefa para outra raia quando a categoria é alterada', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index ada3c81ce..edbfec697 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php index 3f0f6f4fe..e3d39a777 100644 --- a/app/Locale/ro_RO/translations.php +++ b/app/Locale/ro_RO/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 82135dc7b..4dfc401ed 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 4e501cf91..9dba713f0 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index be88f1b19..ccd72005c 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 3d4c27db2..3ee974939 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 3c3b1cd20..ad79c8aab 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/uk_UA/translations.php b/app/Locale/uk_UA/translations.php index dd0491543..e56dc6592 100644 --- a/app/Locale/uk_UA/translations.php +++ b/app/Locale/uk_UA/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index 31e5d540a..fa22254de 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index bcea8ae34..feb7495c2 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1392,4 +1392,10 @@ return array( 'Destination swimlane' => '目标泳道', 'Assign a category when the task is moved to a specific swimlane' => '将移动到指定泳道的任务设定分类', 'Move the task to another swimlane when the category is changed' => '当分类改变时将任务移动到另一个泳道', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Locale/zh_TW/translations.php b/app/Locale/zh_TW/translations.php index 5e6571963..631aa0263 100644 --- a/app/Locale/zh_TW/translations.php +++ b/app/Locale/zh_TW/translations.php @@ -1392,4 +1392,10 @@ return array( // 'Destination swimlane' => '', // 'Assign a category when the task is moved to a specific swimlane' => '', // 'Move the task to another swimlane when the category is changed' => '', + // 'Reorder this column by priority (ASC)' => '', + // 'Reorder this column by priority (DESC)' => '', + // 'Reorder this column by assignee and priority (ASC)' => '', + // 'Reorder this column by assignee and priority (DESC)' => '', + // 'Reorder this column by assignee (A-Z)' => '', + // 'Reorder this column by assignee (Z-A)' => '', ); diff --git a/app/Model/TaskReorderModel.php b/app/Model/TaskReorderModel.php new file mode 100644 index 000000000..db72274cf --- /dev/null +++ b/app/Model/TaskReorderModel.php @@ -0,0 +1,74 @@ +db->startTransaction(); + + $taskIDs = $this->db->table(TaskModel::TABLE) + ->eq('project_id', $projectID) + ->eq('swimlane_id', $swimlaneID) + ->eq('column_id', $columnID) + ->orderBy('priority', $direction) + ->asc('id') + ->findAllByColumn('id'); + + $this->reorderTasks($taskIDs); + + $this->db->closeTransaction(); + } + + public function reorderByAssigneeAndPriority($projectID, $swimlaneID, $columnID, $direction) + { + $this->db->startTransaction(); + + $taskIDs = $this->db->table(TaskModel::TABLE) + ->eq('tasks.project_id', $projectID) + ->eq('tasks.swimlane_id', $swimlaneID) + ->eq('tasks.column_id', $columnID) + ->asc('u.name') + ->asc('u.username') + ->orderBy('tasks.priority', $direction) + ->left(UserModel::TABLE, 'u', 'id', TaskModel::TABLE, 'owner_id') + ->findAllByColumn('tasks.id'); + + $this->reorderTasks($taskIDs); + + $this->db->closeTransaction(); + } + + public function reorderByAssignee($projectID, $swimlaneID, $columnID, $direction) + { + $this->db->startTransaction(); + + $taskIDs = $this->db->table(TaskModel::TABLE) + ->eq('tasks.project_id', $projectID) + ->eq('tasks.swimlane_id', $swimlaneID) + ->eq('tasks.column_id', $columnID) + ->orderBy('u.name', $direction) + ->orderBy('u.username', $direction) + ->orderBy('u.id', $direction) + ->left(UserModel::TABLE, 'u', 'id', TaskModel::TABLE, 'owner_id') + ->findAllByColumn('tasks.id'); + + $this->reorderTasks($taskIDs); + + $this->db->closeTransaction(); + } + + protected function reorderTasks(array $taskIDs) + { + $i = 1; + foreach ($taskIDs as $taskID) { + $this->db->table(TaskModel::TABLE) + ->eq('id', $taskID) + ->update(['position' => $i]); + $i++; + } + } +} diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php index 7f05dfae4..b012d80b5 100644 --- a/app/ServiceProvider/ClassProvider.php +++ b/app/ServiceProvider/ClassProvider.php @@ -85,6 +85,7 @@ class ClassProvider implements ServiceProviderInterface 'TaskLinkModel', 'TaskModificationModel', 'TaskPositionModel', + 'TaskReorderModel', 'TaskStatusModel', 'TaskTagModel', 'TaskMetadataModel', diff --git a/app/Template/board/table_column.php b/app/Template/board/table_column.php index 765d05a95..5b81d709d 100644 --- a/app/Template/board/table_column.php +++ b/app/Template/board/table_column.php @@ -48,6 +48,27 @@ + 0 && $this->user->hasProjectAccess('TaskModificationController', 'update', $column['project_id'])): ?> +