From 051bf1c9dbb5733242c7657d6d507389206b33ee Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 24 Jan 2016 20:38:39 -0500 Subject: Add configurable task priority --- ChangeLog | 1 + app/Controller/ProjectEdit.php | 10 +++++++++ app/Controller/Taskcreation.php | 1 + app/Controller/Taskmodification.php | 2 ++ app/Helper/Task.php | 33 +++++++++++++++++++++++++++- app/Locale/bs_BA/translations.php | 9 ++++++++ app/Locale/cs_CZ/translations.php | 9 ++++++++ app/Locale/da_DK/translations.php | 9 ++++++++ app/Locale/de_DE/translations.php | 9 ++++++++ app/Locale/es_ES/translations.php | 9 ++++++++ app/Locale/fi_FI/translations.php | 9 ++++++++ app/Locale/fr_FR/translations.php | 9 ++++++++ app/Locale/hu_HU/translations.php | 9 ++++++++ app/Locale/id_ID/translations.php | 9 ++++++++ app/Locale/it_IT/translations.php | 9 ++++++++ app/Locale/ja_JP/translations.php | 9 ++++++++ app/Locale/my_MY/translations.php | 9 ++++++++ app/Locale/nb_NO/translations.php | 9 ++++++++ app/Locale/nl_NL/translations.php | 9 ++++++++ app/Locale/pl_PL/translations.php | 9 ++++++++ app/Locale/pt_BR/translations.php | 9 ++++++++ app/Locale/pt_PT/translations.php | 9 ++++++++ app/Locale/ru_RU/translations.php | 9 ++++++++ app/Locale/sr_Latn_RS/translations.php | 9 ++++++++ app/Locale/sv_SE/translations.php | 9 ++++++++ app/Locale/th_TH/translations.php | 9 ++++++++ app/Locale/tr_TR/translations.php | 9 ++++++++ app/Locale/zh_CN/translations.php | 9 ++++++++ app/Model/Project.php | 4 ++++ app/Model/TaskFinder.php | 2 ++ app/Model/TaskModification.php | 2 +- app/Schema/Mysql.php | 10 ++++++++- app/Schema/Postgres.php | 10 ++++++++- app/Schema/Sqlite.php | 10 ++++++++- app/ServiceProvider/RouteProvider.php | 1 + app/Template/board/task_footer.php | 2 ++ app/Template/board/task_private.php | 1 + app/Template/board/task_public.php | 1 + app/Template/project_edit/dates.php | 1 + app/Template/project_edit/description.php | 1 + app/Template/project_edit/general.php | 1 + app/Template/project_edit/task_priority.php | 29 ++++++++++++++++++++++++ app/Template/task/details.php | 3 +++ app/Template/task_creation/form.php | 20 +++++++++-------- app/Template/task_modification/edit_task.php | 12 +++++----- app/Validator/ProjectValidator.php | 3 +++ app/Validator/TaskValidator.php | 1 + tests/units/Helper/TaskHelperTest.php | 32 +++++++++++++++++++++++++++ tests/units/Model/ProjectTest.php | 20 +++++++++++++++++ 49 files changed, 401 insertions(+), 19 deletions(-) create mode 100644 app/Template/project_edit/task_priority.php create mode 100644 tests/units/Helper/TaskHelperTest.php diff --git a/ChangeLog b/ChangeLog index 6c46bb00..ec5f36b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ Version 1.0.25 (unreleased) New features: * Add project owner (Directly Responsible Individual) +* Add configurable task priority Version 1.0.24 -------------- diff --git a/app/Controller/ProjectEdit.php b/app/Controller/ProjectEdit.php index 3b0a3da3..0dfc7de3 100644 --- a/app/Controller/ProjectEdit.php +++ b/app/Controller/ProjectEdit.php @@ -40,6 +40,16 @@ class ProjectEdit extends Base $this->renderView('project_edit/description', $values, $errors); } + /** + * Change task priority + * + * @access public + */ + public function priority(array $values = array(), array $errors = array()) + { + $this->renderView('project_edit/task_priority', $values, $errors); + } + /** * Validate and update a project * diff --git a/app/Controller/Taskcreation.php b/app/Controller/Taskcreation.php index 4d74fac6..49ccea7f 100644 --- a/app/Controller/Taskcreation.php +++ b/app/Controller/Taskcreation.php @@ -32,6 +32,7 @@ class Taskcreation extends Base } $this->response->html($this->template->$method('task_creation/form', array( + 'project' => $project, 'ajax' => $this->request->isAjax(), 'errors' => $errors, 'values' => $values + array('project_id' => $project['id']), diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php index 81cf430f..2c97970b 100644 --- a/app/Controller/Taskmodification.php +++ b/app/Controller/Taskmodification.php @@ -98,6 +98,7 @@ class Taskmodification extends Base public function edit(array $values = array(), array $errors = array()) { $task = $this->getTask(); + $project = $this->project->getById($task['project_id']); $ajax = $this->request->isAjax(); if (empty($values)) { @@ -107,6 +108,7 @@ class Taskmodification extends Base $this->dateParser->format($values, array('date_due')); $params = array( + 'project' => $project, 'values' => $values, 'errors' => $errors, 'task' => $task, diff --git a/app/Helper/Task.php b/app/Helper/Task.php index 1405a167..500b8a89 100644 --- a/app/Helper/Task.php +++ b/app/Helper/Task.php @@ -2,13 +2,15 @@ namespace Kanboard\Helper; +use Kanboard\Core\Base; + /** * Task helpers * * @package helper * @author Frederic Guillot */ -class Task extends \Kanboard\Core\Base +class Task extends Base { public function getColors() { @@ -34,4 +36,33 @@ class Task extends \Kanboard\Core\Base { return $this->taskPermission->canRemoveTask($task); } + + public function selectPriority(array $project, array $values) + { + $html = ''; + + if ($project['priority_end'] > $project['priority_start']) { + $range = range($project['priority_start'], $project['priority_end']); + $options = array_combine($range, $range); + $values += array('priority' => $project['priority_default']); + + $html .= $this->helper->form->label(t('Priority'), 'priority'); + $html .= $this->helper->form->select('priority', $options, $values, array(), array('tabindex="7"')); + } + + return $html; + } + + public function formatPriority(array $project, array $task) + { + $html = ''; + + if ($project['priority_end'] > $project['priority_start']) { + $html .= ''; + $html .= $task['priority'] >= 0 ? 'P'.$task['priority'] : '-P'.abs($task['priority']); + $html .= ''; + } + + return $html; + } } diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index e1af1c08..90ab1296 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index b93b7c23..83d88f35 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 63850d70..7a82bc1e 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index ef056972..1158dd67 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 91709476..16c96ec5 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index c887e02d..cde825e2 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index f36ce104..32110e1c 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1112,4 +1112,13 @@ return array( 'Those dates are useful for the project Gantt chart.' => 'Ces dates sont utiles pour le diagramme de Gantt des projets.', 'Private projects do not have users and groups management.' => 'Les projets privés n\'ont pas de gestion d\'utilisateurs et de groupes.', 'There is no project member.' => 'Il y a aucun membre du projet.', + 'Priority' => 'Priorité', + 'Task priority' => 'Priorité des tâches', + 'General' => 'Général', + 'Dates' => 'Dates', + 'Default priority' => 'Priorité par défaut', + 'Lowest priority' => 'Priorité basse', + 'Highest priority' => 'Priorité haute', + 'If you put zero to the low and high priority, this feature will be disabled.' => 'Si vous mettez zéro pour la priorité basse et haute, cette fonctionnalité sera désactivée.', + 'Priority: %d' => 'Priorité : %d', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index e12a7aad..25d55bb2 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 49d61d58..e3316405 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 5e2c32a9..1e32213f 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index f1884b93..b9cde718 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index 65aaa4e3..43c288c7 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 520149d5..682f44a8 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 87f5323e..4f38f256 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 37dcfe3d..ee0ceb47 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 6e47c514..09e87048 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index f57657ee..19c2ebf7 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 02bf9934..d09258ed 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index c779cd6c..2b3553c2 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index ca412273..1c01e94d 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index b2b9a55b..e0de5844 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 17163f45..c4da560d 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index e4b732ef..e0b90b58 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1109,4 +1109,13 @@ return array( // 'Those dates are useful for the project Gantt chart.' => '', // 'Private projects do not have users and groups management.' => '', // 'There is no project member.' => '', + // 'Priority' => '', + // 'Task priority' => '', + // 'General' => '', + // 'Dates' => '', + // 'Default priority' => '', + // 'Lowest priority' => '', + // 'Highest priority' => '', + // 'If you put zero to the low and high priority, this feature will be disabled.' => '', + // 'Priority: %d' => '', ); diff --git a/app/Model/Project.php b/app/Model/Project.php index ba0716b0..d0a8bfc8 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -334,6 +334,8 @@ class Project extends Base $values['identifier'] = strtoupper($values['identifier']); } + $this->convertIntegerFields($values, array('priority_default', 'priority_start', 'priority_end')); + if (! $this->db->table(self::TABLE)->save($values)) { $this->db->cancelTransaction(); return false; @@ -400,6 +402,8 @@ class Project extends Base $values['identifier'] = strtoupper($values['identifier']); } + $this->convertIntegerFields($values, array('priority_default', 'priority_start', 'priority_end')); + return $this->exists($values['id']) && $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values); } diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php index 836fbe46..1c83136b 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinder.php @@ -113,6 +113,7 @@ class TaskFinder extends Base 'tasks.is_active', 'tasks.score', 'tasks.category_id', + 'tasks.priority', 'tasks.date_moved', 'tasks.recurrence_status', 'tasks.recurrence_trigger', @@ -308,6 +309,7 @@ class TaskFinder extends Base tasks.is_active, tasks.score, tasks.category_id, + tasks.priority, tasks.swimlane_id, tasks.date_moved, tasks.recurrence_status, diff --git a/app/Model/TaskModification.php b/app/Model/TaskModification.php index a0ad292c..eee7b2e0 100644 --- a/app/Model/TaskModification.php +++ b/app/Model/TaskModification.php @@ -88,7 +88,7 @@ class TaskModification extends Base $this->dateParser->convert($values, array('date_started'), true); $this->removeFields($values, array('another_task', 'id')); $this->resetFields($values, array('date_due', 'date_started', 'score', 'category_id', 'time_estimated', 'time_spent')); - $this->convertIntegerFields($values, array('is_active', 'recurrence_status', 'recurrence_trigger', 'recurrence_factor', 'recurrence_timeframe', 'recurrence_basedate')); + $this->convertIntegerFields($values, array('priority', 'is_active', 'recurrence_status', 'recurrence_trigger', 'recurrence_factor', 'recurrence_timeframe', 'recurrence_basedate')); $values['date_modification'] = time(); } diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index ad7f7be1..8f1db510 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,15 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 102; +const VERSION = 103; + +function version_103(PDO $pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_default INT DEFAULT 0"); + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_start INT DEFAULT 0"); + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_end INT DEFAULT 3"); + $pdo->exec("ALTER TABLE tasks ADD COLUMN priority INT DEFAULT 0"); +} function version_102(PDO $pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index d23a7723..a7bf8054 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,15 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 82; +const VERSION = 83; + +function version_83(PDO $pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_default INTEGER DEFAULT 0"); + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_start INTEGER DEFAULT 0"); + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_end INTEGER DEFAULT 3"); + $pdo->exec("ALTER TABLE tasks ADD COLUMN priority INTEGER DEFAULT 0"); +} function version_82(PDO $pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index daa70f54..08689749 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,15 @@ use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; use PDO; -const VERSION = 94; +const VERSION = 95; + +function version_95(PDO $pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_default INTEGER DEFAULT 0"); + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_start INTEGER DEFAULT 0"); + $pdo->exec("ALTER TABLE projects ADD COLUMN priority_end INTEGER DEFAULT 3"); + $pdo->exec("ALTER TABLE tasks ADD COLUMN priority INTEGER DEFAULT 0"); +} function version_94(PDO $pdo) { diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php index 5a5c8652..057a1b3c 100644 --- a/app/ServiceProvider/RouteProvider.php +++ b/app/ServiceProvider/RouteProvider.php @@ -64,6 +64,7 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('project/:project_id/edit', 'ProjectEdit', 'edit'); $container['route']->addRoute('project/:project_id/edit/dates', 'ProjectEdit', 'dates'); $container['route']->addRoute('project/:project_id/edit/description', 'ProjectEdit', 'description'); + $container['route']->addRoute('project/:project_id/edit/priority', 'ProjectEdit', 'priority'); // ProjectUser routes $container['route']->addRoute('projects/managers/:user_id', 'projectuser', 'managers'); diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index 4a16364c..26f3b1d4 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -69,4 +69,6 @@ + + task->formatPriority($project, $task) ?> diff --git a/app/Template/board/task_private.php b/app/Template/board/task_private.php index 8d76453c..4880af00 100644 --- a/app/Template/board/task_private.php +++ b/app/Template/board/task_private.php @@ -78,6 +78,7 @@ render('board/task_footer', array( 'task' => $task, 'not_editable' => $not_editable, + 'project' => $project, )) ?> diff --git a/app/Template/board/task_public.php b/app/Template/board/task_public.php index bacdcef4..d02722bb 100644 --- a/app/Template/board/task_public.php +++ b/app/Template/board/task_public.php @@ -25,5 +25,6 @@ render('board/task_footer', array( 'task' => $task, 'not_editable' => $not_editable, + 'project' => $project, )) ?> \ No newline at end of file diff --git a/app/Template/project_edit/dates.php b/app/Template/project_edit/dates.php index d3f4bad8..cb585c6a 100644 --- a/app/Template/project_edit/dates.php +++ b/app/Template/project_edit/dates.php @@ -4,6 +4,7 @@
  • url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?>
  • url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?>
  • url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?>
  • +
  • url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?>
  • diff --git a/app/Template/project_edit/description.php b/app/Template/project_edit/description.php index 3af484d5..dce8ab10 100644 --- a/app/Template/project_edit/description.php +++ b/app/Template/project_edit/description.php @@ -4,6 +4,7 @@
  • url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?>
  • url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?>
  • url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?>
  • +
  • url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?>
  • diff --git a/app/Template/project_edit/general.php b/app/Template/project_edit/general.php index 1da913da..5caefa2d 100644 --- a/app/Template/project_edit/general.php +++ b/app/Template/project_edit/general.php @@ -4,6 +4,7 @@
  • url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?>
  • url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?>
  • url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?>
  • +
  • url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?>
  • diff --git a/app/Template/project_edit/task_priority.php b/app/Template/project_edit/task_priority.php new file mode 100644 index 00000000..e54215b2 --- /dev/null +++ b/app/Template/project_edit/task_priority.php @@ -0,0 +1,29 @@ + + + form->csrf() ?> + form->hidden('id', $values) ?> + form->hidden('name', $values) ?> + + form->label(t('Default priority'), 'priority_default') ?> + form->number('priority_default', $values, $errors) ?> + + form->label(t('Lowest priority'), 'priority_start') ?> + form->number('priority_start', $values, $errors) ?> + + form->label(t('Highest priority'), 'priority_end') ?> + form->number('priority_end', $values, $errors) ?> + +
    + +
    +
    + +

    diff --git a/app/Template/task/details.php b/app/Template/task/details.php index 74799b15..d885ca9c 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -4,6 +4,9 @@ e($task['score']) ?>