From 401b0bdfb10ebfe75c9a392de52d37cc3c22c062 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 19 Jul 2015 18:14:20 -0400 Subject: [PATCH] Split task controller into smaller classes --- app/Controller/Comment.php | 2 +- app/Controller/Task.php | 375 +----------------- app/Controller/Taskcreation.php | 86 ++++ app/Controller/Taskmodification.php | 212 ++++++++++ app/Controller/Taskstatus.php | 79 ++++ app/Model/Acl.php | 3 + app/Template/board/table_container.php | 2 +- app/Template/board/table_swimlane.php | 2 +- app/Template/board/task_menu.php | 6 +- .../{show_description.php => description.php} | 0 app/Template/task/public.php | 2 +- app/Template/task/show.php | 6 +- app/Template/task/sidebar.php | 12 +- ...tracking.php => time_tracking_details.php} | 2 +- ...imesheet.php => time_tracking_summary.php} | 0 .../{task/new.php => task_creation/form.php} | 2 +- .../edit_description.php | 2 +- .../edit_recurrence.php | 2 +- .../edit_task.php} | 4 +- .../edit_time.php} | 4 +- app/Template/{task => task_status}/close.php | 2 +- app/Template/{task => task_status}/open.php | 2 +- app/common.php | 21 +- 23 files changed, 441 insertions(+), 387 deletions(-) create mode 100644 app/Controller/Taskcreation.php create mode 100644 app/Controller/Taskmodification.php create mode 100644 app/Controller/Taskstatus.php rename app/Template/task/{show_description.php => description.php} (100%) rename app/Template/task/{time_tracking.php => time_tracking_details.php} (93%) rename app/Template/task/{timesheet.php => time_tracking_summary.php} (100%) rename app/Template/{task/new.php => task_creation/form.php} (96%) rename app/Template/{task => task_modification}/edit_description.php (88%) rename app/Template/{task => task_modification}/edit_recurrence.php (91%) rename app/Template/{task/edit.php => task_modification/edit_task.php} (89%) rename app/Template/{task/time.php => task_modification/edit_time.php} (68%) rename app/Template/{task => task_status}/close.php (68%) rename app/Template/{task => task_status}/open.php (69%) diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index ca701a881..7b9d4aeec 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -93,7 +93,7 @@ class Comment extends Base $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), 'comments'); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); } $this->create($values, $errors); diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 1b9f94171..0770fcd14 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -2,8 +2,6 @@ namespace Controller; -use Model\Project as ProjectModel; - /** * Task controller * @@ -107,231 +105,40 @@ class Task extends Base } /** - * Display a form to create a new task + * Display the time tracking details * * @access public */ - public function create(array $values = array(), array $errors = array()) + public function timetracking() { - $project = $this->getProject(); - $method = $this->request->isAjax() ? 'render' : 'layout'; - $swimlanes_list = $this->swimlane->getList($project['id'], false, true); + $task = $this->getTask(); - if (empty($values)) { + $subtask_paginator = $this->paginator + ->setUrl('task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'pagination' => 'subtasks')) + ->setMax(15) + ->setOrder('start') + ->setDirection('DESC') + ->setQuery($this->subtaskTimeTracking->getTaskQuery($task['id'])) + ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); - $values = array( - 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)), - 'column_id' => $this->request->getIntegerParam('column_id'), - 'color_id' => $this->request->getStringParam('color_id', $this->color->getDefaultColor()), - 'owner_id' => $this->request->getIntegerParam('owner_id'), - 'another_task' => $this->request->getIntegerParam('another_task'), - ); - } - - $this->response->html($this->template->$method('task/new', array( - 'ajax' => $this->request->isAjax(), - 'errors' => $errors, - 'values' => $values + array('project_id' => $project['id']), - 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), - 'columns_list' => $this->board->getColumnsList($project['id']), - 'users_list' => $this->projectPermission->getMemberList($project['id'], true, false, true), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($project['id']), - 'swimlanes_list' => $swimlanes_list, - 'date_format' => $this->config->get('application_date_format'), - 'date_formats' => $this->dateParser->getAvailableFormats(), - 'title' => $project['name'].' > '.t('New task') + $this->response->html($this->taskLayout('task/time_tracking_details', array( + 'task' => $task, + 'subtask_paginator' => $subtask_paginator, ))); } /** - * Validate and save a new task + * Display the task transitions * * @access public */ - public function save() - { - $project = $this->getProject(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateCreation($values); - - if ($valid) { - - if ($this->taskCreation->create($values)) { - $this->session->flash(t('Task created successfully.')); - - if (isset($values['another_task']) && $values['another_task'] == 1) { - unset($values['title']); - unset($values['description']); - $this->response->redirect($this->helper->url->to('task', 'create', $values)); - } - else { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id']))); - } - } - else { - $this->session->flashError(t('Unable to create your task.')); - } - } - - $this->create($values, $errors); - } - - /** - * Display a form to edit a task - * - * @access public - */ - public function edit(array $values = array(), array $errors = array()) + public function transitions() { $task = $this->getTask(); - $ajax = $this->request->isAjax(); - if (empty($values)) { - $values = $task; - } - - $this->dateParser->format($values, array('date_due')); - - $params = array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'users_list' => $this->projectPermission->getMemberList($task['project_id']), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($task['project_id']), - 'date_format' => $this->config->get('application_date_format'), - 'date_formats' => $this->dateParser->getAvailableFormats(), - 'ajax' => $ajax, - ); - - if ($ajax) { - $this->response->html($this->template->render('task/edit', $params)); - } - else { - $this->response->html($this->taskLayout('task/edit', $params)); - } - } - - /** - * Validate and update a task - * - * @access public - */ - public function update() - { - $task = $this->getTask(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateModification($values); - - if ($valid) { - - if ($this->taskModification->update($values)) { - $this->session->flash(t('Task updated successfully.')); - - if ($this->request->getIntegerParam('ajax')) { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); - } - else { - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - } - else { - $this->session->flashError(t('Unable to update your task.')); - } - } - - $this->edit($values, $errors); - } - - /** - * Update time tracking information - * - * @access public - */ - public function time() - { - $task = $this->getTask(); - $values = $this->request->getValues(); - - list($valid,) = $this->taskValidator->validateTimeModification($values); - - if ($valid && $this->taskModification->update($values)) { - $this->session->flash(t('Task updated successfully.')); - } - else { - $this->session->flashError(t('Unable to update your task.')); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - - /** - * Hide a task - * - * @access public - */ - public function close() - { - $task = $this->getTask(); - $redirect = $this->request->getStringParam('redirect'); - - if ($this->request->getStringParam('confirmation') === 'yes') { - - $this->checkCSRFParam(); - - if ($this->taskStatus->close($task['id'])) { - $this->session->flash(t('Task closed successfully.')); - } else { - $this->session->flashError(t('Unable to close this task.')); - } - - if ($redirect === 'board') { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); - } - - if ($this->request->isAjax()) { - $this->response->html($this->template->render('task/close', array( - 'task' => $task, - 'redirect' => $redirect, - ))); - } - - $this->response->html($this->taskLayout('task/close', array( - 'task' => $task, - 'redirect' => $redirect, - ))); - } - - /** - * Open a task - * - * @access public - */ - public function open() - { - $task = $this->getTask(); - - if ($this->request->getStringParam('confirmation') === 'yes') { - - $this->checkCSRFParam(); - - if ($this->taskStatus->open($task['id'])) { - $this->session->flash(t('Task opened successfully.')); - } else { - $this->session->flashError(t('Unable to open this task.')); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - - $this->response->html($this->taskLayout('task/open', array( + $this->response->html($this->taskLayout('task/transitions', array( 'task' => $task, + 'transitions' => $this->transition->getAllByTask($task['id']), ))); } @@ -365,152 +172,4 @@ class Task extends Base 'task' => $task, ))); } - - /** - * Edit description form - * - * @access public - */ - public function description() - { - $task = $this->getTask(); - $ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax'); - - if ($this->request->isPost()) { - - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values); - - if ($valid) { - - if ($this->taskModification->update($values)) { - $this->session->flash(t('Task updated successfully.')); - } - else { - $this->session->flashError(t('Unable to update your task.')); - } - - if ($ajax) { - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); - } - else { - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - } - } - else { - $values = $task; - $errors = array(); - } - - $params = array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'ajax' => $ajax, - ); - - if ($ajax) { - $this->response->html($this->template->render('task/edit_description', $params)); - } - else { - $this->response->html($this->taskLayout('task/edit_description', $params)); - } - } - - /** - * Edit recurrence form - * - * @access public - */ - public function recurrence() - { - $task = $this->getTask(); - - if ($this->request->isPost()) { - - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); - - if ($valid) { - - if ($this->taskModification->update($values)) { - $this->session->flash(t('Task updated successfully.')); - } - else { - $this->session->flashError(t('Unable to update your task.')); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - } - else { - $values = $task; - $errors = array(); - } - - $params = array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), - ); - - $this->response->html($this->taskLayout('task/edit_recurrence', $params)); - } - - /** - * Display the time tracking details - * - * @access public - */ - public function timesheet() - { - $task = $this->getTask(); - - $subtask_paginator = $this->paginator - ->setUrl('task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'pagination' => 'subtasks')) - ->setMax(15) - ->setOrder('start') - ->setDirection('DESC') - ->setQuery($this->subtaskTimeTracking->getTaskQuery($task['id'])) - ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); - - $this->response->html($this->taskLayout('task/time_tracking', array( - 'task' => $task, - 'subtask_paginator' => $subtask_paginator, - ))); - } - - /** - * Display the task transitions - * - * @access public - */ - public function transitions() - { - $task = $this->getTask(); - - $this->response->html($this->taskLayout('task/transitions', array( - 'task' => $task, - 'transitions' => $this->transition->getAllByTask($task['id']), - ))); - } - - /** - * Set automatically the start date - * - * @access public - */ - public function start() - { - $task = $this->getTask(); - $this->taskModification->update(array('id' => $task['id'], 'date_started' => time())); - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } } diff --git a/app/Controller/Taskcreation.php b/app/Controller/Taskcreation.php new file mode 100644 index 000000000..7c841e107 --- /dev/null +++ b/app/Controller/Taskcreation.php @@ -0,0 +1,86 @@ +getProject(); + $method = $this->request->isAjax() ? 'render' : 'layout'; + $swimlanes_list = $this->swimlane->getList($project['id'], false, true); + + if (empty($values)) { + + $values = array( + 'swimlane_id' => $this->request->getIntegerParam('swimlane_id', key($swimlanes_list)), + 'column_id' => $this->request->getIntegerParam('column_id'), + 'color_id' => $this->request->getStringParam('color_id', $this->color->getDefaultColor()), + 'owner_id' => $this->request->getIntegerParam('owner_id'), + 'another_task' => $this->request->getIntegerParam('another_task'), + ); + } + + $this->response->html($this->template->$method('task_creation/form', array( + 'ajax' => $this->request->isAjax(), + 'errors' => $errors, + 'values' => $values + array('project_id' => $project['id']), + 'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE), + 'columns_list' => $this->board->getColumnsList($project['id']), + 'users_list' => $this->projectPermission->getMemberList($project['id'], true, false, true), + 'colors_list' => $this->color->getList(), + 'categories_list' => $this->category->getList($project['id']), + 'swimlanes_list' => $swimlanes_list, + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), + 'title' => $project['name'].' > '.t('New task') + ))); + } + + /** + * Validate and save a new task + * + * @access public + */ + public function save() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateCreation($values); + + if ($valid) { + + if ($this->taskCreation->create($values)) { + $this->session->flash(t('Task created successfully.')); + + if (isset($values['another_task']) && $values['another_task'] == 1) { + unset($values['title']); + unset($values['description']); + $this->response->redirect($this->helper->url->to('taskcreation', 'create', $values)); + } + else { + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id']))); + } + } + else { + $this->session->flashError(t('Unable to create your task.')); + } + } + + $this->create($values, $errors); + } +} diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php new file mode 100644 index 000000000..56d2b9f99 --- /dev/null +++ b/app/Controller/Taskmodification.php @@ -0,0 +1,212 @@ +getTask(); + $this->taskModification->update(array('id' => $task['id'], 'date_started' => time())); + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + } + + /** + * Update time tracking information + * + * @access public + */ + public function time() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid,) = $this->taskValidator->validateTimeModification($values); + + if ($valid && $this->taskModification->update($values)) { + $this->session->flash(t('Task updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your task.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + } + + /** + * Edit description form + * + * @access public + */ + public function description() + { + $task = $this->getTask(); + $ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax'); + + if ($this->request->isPost()) { + + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values); + + if ($valid) { + + if ($this->taskModification->update($values)) { + $this->session->flash(t('Task updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your task.')); + } + + if ($ajax) { + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); + } + else { + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + } + } + } + else { + $values = $task; + $errors = array(); + } + + $params = array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'ajax' => $ajax, + ); + + if ($ajax) { + $this->response->html($this->template->render('task_modification/edit_description', $params)); + } + else { + $this->response->html($this->taskLayout('task_modification/edit_description', $params)); + } + } + + /** + * Display a form to edit a task + * + * @access public + */ + public function edit(array $values = array(), array $errors = array()) + { + $task = $this->getTask(); + $ajax = $this->request->isAjax(); + + if (empty($values)) { + $values = $task; + } + + $this->dateParser->format($values, array('date_due')); + + $params = array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'users_list' => $this->projectPermission->getMemberList($task['project_id']), + 'colors_list' => $this->color->getList(), + 'categories_list' => $this->category->getList($task['project_id']), + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), + 'ajax' => $ajax, + ); + + if ($ajax) { + $this->response->html($this->template->render('task_modification/edit_task', $params)); + } + else { + $this->response->html($this->taskLayout('task_modification/edit_task', $params)); + } + } + + /** + * Validate and update a task + * + * @access public + */ + public function update() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateModification($values); + + if ($valid) { + + if ($this->taskModification->update($values)) { + $this->session->flash(t('Task updated successfully.')); + + if ($this->request->getIntegerParam('ajax')) { + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); + } + else { + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + } + } + else { + $this->session->flashError(t('Unable to update your task.')); + } + } + + $this->edit($values, $errors); + } + + /** + * Edit recurrence form + * + * @access public + */ + public function recurrence() + { + $task = $this->getTask(); + + if ($this->request->isPost()) { + + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); + + if ($valid) { + + if ($this->taskModification->update($values)) { + $this->session->flash(t('Task updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your task.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + } + } + else { + $values = $task; + $errors = array(); + } + + $params = array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), + 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + ); + + $this->response->html($this->taskLayout('task_modification/edit_recurrence', $params)); + } +} diff --git a/app/Controller/Taskstatus.php b/app/Controller/Taskstatus.php new file mode 100644 index 000000000..a47d9da34 --- /dev/null +++ b/app/Controller/Taskstatus.php @@ -0,0 +1,79 @@ +getTask(); + $redirect = $this->request->getStringParam('redirect'); + + if ($this->request->getStringParam('confirmation') === 'yes') { + + $this->checkCSRFParam(); + + if ($this->taskStatus->close($task['id'])) { + $this->session->flash(t('Task closed successfully.')); + } else { + $this->session->flashError(t('Unable to close this task.')); + } + + if ($redirect === 'board') { + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id']))); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + } + + if ($this->request->isAjax()) { + $this->response->html($this->template->render('task_status/close', array( + 'task' => $task, + 'redirect' => $redirect, + ))); + } + + $this->response->html($this->taskLayout('task_status/close', array( + 'task' => $task, + 'redirect' => $redirect, + ))); + } + + /** + * Open a task + * + * @access public + */ + public function open() + { + $task = $this->getTask(); + + if ($this->request->getStringParam('confirmation') === 'yes') { + + $this->checkCSRFParam(); + + if ($this->taskStatus->open($task['id'])) { + $this->session->flash(t('Task opened successfully.')); + } else { + $this->session->flashError(t('Unable to open this task.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + } + + $this->response->html($this->taskLayout('task_status/open', array( + 'task' => $task, + ))); + } +} diff --git a/app/Model/Acl.php b/app/Model/Acl.php index 6ee78faa7..95056de6c 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -42,6 +42,9 @@ class Acl extends Base 'subtask' => '*', 'task' => '*', 'taskduplication' => '*', + 'taskcreation' => '*', + 'taskmodification' => '*', + 'taskstatus' => '*', 'tasklink' => '*', 'timer' => '*', 'calendar' => array('show', 'project'), diff --git a/app/Template/board/table_container.php b/app/Template/board/table_container.php index 9d3a11344..65ccdc4fc 100644 --- a/app/Template/board/table_container.php +++ b/app/Template/board/table_container.php @@ -8,7 +8,7 @@ data-check-interval="" data-save-url="url->href('board', 'save', array('project_id' => $project['id'])) ?>" data-check-url="url->href('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>" - data-task-creation-url="url->href('task', 'create', array('project_id' => $project['id'])) ?>" + data-task-creation-url="url->href('taskcreation', 'create', array('project_id' => $project['id'])) ?>" > diff --git a/app/Template/board/table_swimlane.php b/app/Template/board/table_swimlane.php index 436c53b57..4cd137cb5 100644 --- a/app/Template/board/table_swimlane.php +++ b/app/Template/board/table_swimlane.php @@ -15,7 +15,7 @@
- url->link('+', 'task', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'task-board-popover', t('Add a new task')) ?> + url->link('+', 'taskcreation', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'task-board-popover', t('Add a new task')) ?>
diff --git a/app/Template/board/task_menu.php b/app/Template/board/task_menu.php index a84b972d7..71963b5eb 100644 --- a/app/Template/board/task_menu.php +++ b/app/Template/board/task_menu.php @@ -4,12 +4,12 @@ diff --git a/app/Template/task/show_description.php b/app/Template/task/description.php similarity index 100% rename from app/Template/task/show_description.php rename to app/Template/task/description.php diff --git a/app/Template/task/public.php b/app/Template/task/public.php index 73116de95..e31054884 100644 --- a/app/Template/task/public.php +++ b/app/Template/task/public.php @@ -4,7 +4,7 @@

url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?>

- render('task/show_description', array( + render('task/description', array( 'task' => $task, 'project' => $project, 'is_public' => true diff --git a/app/Template/task/show.php b/app/Template/task/show.php index a594d9064..68d63c582 100644 --- a/app/Template/task/show.php +++ b/app/Template/task/show.php @@ -6,10 +6,10 @@ 'recurrence_basedate_list' => $this->task->recurrenceBasedates(), )) ?> -render('task/time', array('task' => $task, 'values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?> -render('task/show_description', array('task' => $task)) ?> +render('task_modification/edit_time', array('task' => $task, 'values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?> +render('task/description', array('task' => $task)) ?> render('tasklink/show', array('task' => $task, 'links' => $links, 'link_label_list' => $link_label_list)) ?> render('subtask/show', array('task' => $task, 'subtasks' => $subtasks, 'project' => $project, 'users_list' => isset($users_list) ? $users_list : array())) ?> -render('task/timesheet', array('task' => $task)) ?> +render('task/time_tracking_summary', array('task' => $task)) ?> render('file/show', array('task' => $task, 'files' => $files, 'images' => $images)) ?> render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?> diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index 942e7d01c..1116040a9 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -15,20 +15,20 @@ 0 || $task['time_spent'] > 0): ?>
  • - url->link(t('Time tracking'), 'task', 'timesheet', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('Time tracking'), 'task', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
  • -
    -
    diff --git a/app/Template/task/time.php b/app/Template/task_modification/edit_time.php similarity index 68% rename from app/Template/task/time.php rename to app/Template/task_modification/edit_time.php index 90407d7a9..8e7f9b426 100644 --- a/app/Template/task/time.php +++ b/app/Template/task_modification/edit_time.php @@ -1,7 +1,7 @@ - + - url->link('', 'task', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-show-start-link', t('Set automatically the start date')) ?> + url->link('', 'taskmodification', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-show-start-link', t('Set automatically the start date')) ?> form->csrf() ?> diff --git a/app/Template/task/close.php b/app/Template/task_status/close.php similarity index 68% rename from app/Template/task/close.php rename to app/Template/task_status/close.php index 160d54008..4de3dcb20 100644 --- a/app/Template/task/close.php +++ b/app/Template/task_status/close.php @@ -8,7 +8,7 @@

    - url->link(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => $redirect), true, 'btn btn-red') ?> + url->link(t('Yes'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => $redirect), true, 'btn btn-red') ?> url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    diff --git a/app/Template/task/open.php b/app/Template/task_status/open.php similarity index 69% rename from app/Template/task/open.php rename to app/Template/task_status/open.php index fbcc11113..0043fdaea 100644 --- a/app/Template/task/open.php +++ b/app/Template/task_status/open.php @@ -8,7 +8,7 @@

    - url->link(t('Yes'), 'task', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> + url->link(t('Yes'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
    diff --git a/app/common.php b/app/common.php index 815d2643f..7f66c05e0 100644 --- a/app/common.php +++ b/app/common.php @@ -86,9 +86,24 @@ if (ENABLE_URL_REWRITE) { // Task routes $container['router']->addRoute('project/:project_id/task/:task_id', 'task', 'show', array('project_id', 'task_id')); $container['router']->addRoute('t/:task_id', 'task', 'show', array('task_id')); - $container['router']->addRoute('project/:project_id/swimlane/:swimlane_id/column/:column_id', 'task', 'create', array('project_id', 'swimlane_id', 'column_id')); $container['router']->addRoute('public/task/:task_id/:token', 'task', 'readonly', array('task_id', 'token')); + $container['router']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/screenshot', 'file', 'screenshot', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/upload', 'file', 'create', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/comment', 'comment', 'create', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/link', 'tasklink', 'create', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/remove', 'task', 'remove', array('project_id', 'task_id')); + + $container['router']->addRoute('project/:project_id/task/:task_id/edit', 'taskmodification', 'edit', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/description', 'taskmodification', 'description', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/recurrence', 'taskmodification', 'recurrence', array('project_id', 'task_id')); + + $container['router']->addRoute('project/:project_id/task/:task_id/close', 'taskstatus', 'close', array('task_id', 'project_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/open', 'taskstatus', 'open', array('task_id', 'project_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/duplicate', 'taskduplication', 'duplicate', array('task_id', 'project_id')); $container['router']->addRoute('project/:project_id/task/:task_id/copy', 'taskduplication', 'copy', array('task_id', 'project_id')); $container['router']->addRoute('project/:project_id/task/:task_id/copy/:dst_project_id', 'taskduplication', 'copy', array('task_id', 'project_id', 'dst_project_id')); @@ -112,7 +127,9 @@ if (ENABLE_URL_REWRITE) { $container['router']->addRoute('list/:project_id/:search', 'listing', 'show', array('project_id', 'search')); // Subtask routes - $container['router']->addRoute('project/:project_id/task/:task_id/subtask/:subtask_id', 'subtask', 'remove', array('project_id', 'task_id', 'subtask_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/subtask/create', 'subtask', 'create', array('project_id', 'task_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/subtask/:subtask_id/remove', 'subtask', 'confirm', array('project_id', 'task_id', 'subtask_id')); + $container['router']->addRoute('project/:project_id/task/:task_id/subtask/:subtask_id/edit', 'subtask', 'edit', array('project_id', 'task_id', 'subtask_id')); // Feed routes $container['router']->addRoute('feed/project/:token', 'feed', 'project', array('token'));