From 9ebbe3da56914c408327997cea4eb00db2f88e0c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 26 May 2016 21:38:43 -0400 Subject: Rename task controllers --- app/Controller/TaskImport.php | 75 --------- app/Controller/TaskImportController.php | 75 +++++++++ app/Controller/TaskInternalLink.php | 167 --------------------- app/Controller/TaskInternalLinkController.php | 167 +++++++++++++++++++++ app/Controller/TaskModificationController.php | 130 ++++++++++++++++ app/Controller/TaskPopover.php | 100 ------------ app/Controller/TaskPopoverController.php | 100 ++++++++++++ app/Controller/TaskRecurrence.php | 65 -------- app/Controller/TaskRecurrenceController.php | 65 ++++++++ app/Controller/TaskStatusController.php | 62 ++++++++ app/Controller/Taskmodification.php | 130 ---------------- app/Controller/Taskstatus.php | 62 -------- app/ServiceProvider/AuthenticationProvider.php | 12 +- app/ServiceProvider/RouteProvider.php | 2 +- app/Template/board/task_avatar.php | 4 +- app/Template/board/task_footer.php | 2 +- app/Template/board/task_private.php | 4 +- app/Template/listing/show.php | 2 +- app/Template/project/sidebar.php | 4 +- app/Template/task/details.php | 2 +- app/Template/task/dropdown.php | 18 +-- app/Template/task/layout.php | 6 +- app/Template/task/show.php | 2 +- app/Template/task/sidebar.php | 14 +- app/Template/task_import/step1.php | 4 +- app/Template/task_internal_link/create.php | 4 +- app/Template/task_internal_link/edit.php | 4 +- app/Template/task_internal_link/remove.php | 4 +- app/Template/task_internal_link/table.php | 4 +- .../task_modification/edit_description.php | 2 +- app/Template/task_modification/edit_task.php | 3 +- app/Template/task_popover/change_assignee.php | 2 +- app/Template/task_popover/change_category.php | 2 +- app/Template/task_recurrence/edit.php | 4 +- app/Template/task_status/close.php | 4 +- app/Template/task_status/open.php | 4 +- 36 files changed, 655 insertions(+), 656 deletions(-) delete mode 100644 app/Controller/TaskImport.php create mode 100644 app/Controller/TaskImportController.php delete mode 100644 app/Controller/TaskInternalLink.php create mode 100644 app/Controller/TaskInternalLinkController.php create mode 100644 app/Controller/TaskModificationController.php delete mode 100644 app/Controller/TaskPopover.php create mode 100644 app/Controller/TaskPopoverController.php delete mode 100644 app/Controller/TaskRecurrence.php create mode 100644 app/Controller/TaskRecurrenceController.php create mode 100644 app/Controller/TaskStatusController.php delete mode 100644 app/Controller/Taskmodification.php delete mode 100644 app/Controller/Taskstatus.php (limited to 'app') diff --git a/app/Controller/TaskImport.php b/app/Controller/TaskImport.php deleted file mode 100644 index 5e37fb2f..00000000 --- a/app/Controller/TaskImport.php +++ /dev/null @@ -1,75 +0,0 @@ -getProject(); - - $this->response->html($this->helper->layout->project('task_import/step1', array( - 'project' => $project, - 'values' => $values, - 'errors' => $errors, - 'max_size' => ini_get('upload_max_filesize'), - 'delimiters' => Csv::getDelimiters(), - 'enclosures' => Csv::getEnclosures(), - 'title' => t('Import tasks from CSV file'), - ))); - } - - /** - * Process CSV file - * - */ - public function step2() - { - $project = $this->getProject(); - $values = $this->request->getValues(); - $filename = $this->request->getFilePath('file'); - - if (! file_exists($filename)) { - $this->step1($values, array('file' => array(t('Unable to read your file')))); - } - - $this->taskImport->projectId = $project['id']; - - $csv = new Csv($values['delimiter'], $values['enclosure']); - $csv->setColumnMapping($this->taskImport->getColumnMapping()); - $csv->read($filename, array($this->taskImport, 'import')); - - if ($this->taskImport->counter > 0) { - $this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter)); - } else { - $this->flash->failure(t('Nothing have been imported!')); - } - - $this->response->redirect($this->helper->url->to('taskImport', 'step1', array('project_id' => $project['id']))); - } - - /** - * Generate template - * - */ - public function template() - { - $this->response->withFileDownload('tasks.csv'); - $this->response->csv(array($this->taskImport->getColumnMapping())); - } -} diff --git a/app/Controller/TaskImportController.php b/app/Controller/TaskImportController.php new file mode 100644 index 00000000..a4c39f84 --- /dev/null +++ b/app/Controller/TaskImportController.php @@ -0,0 +1,75 @@ +getProject(); + + $this->response->html($this->helper->layout->project('task_import/step1', array( + 'project' => $project, + 'values' => $values, + 'errors' => $errors, + 'max_size' => ini_get('upload_max_filesize'), + 'delimiters' => Csv::getDelimiters(), + 'enclosures' => Csv::getEnclosures(), + 'title' => t('Import tasks from CSV file'), + ))); + } + + /** + * Process CSV file + * + */ + public function step2() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + $filename = $this->request->getFilePath('file'); + + if (! file_exists($filename)) { + $this->step1($values, array('file' => array(t('Unable to read your file')))); + } + + $this->taskImport->projectId = $project['id']; + + $csv = new Csv($values['delimiter'], $values['enclosure']); + $csv->setColumnMapping($this->taskImport->getColumnMapping()); + $csv->read($filename, array($this->taskImport, 'import')); + + if ($this->taskImport->counter > 0) { + $this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter)); + } else { + $this->flash->failure(t('Nothing have been imported!')); + } + + $this->response->redirect($this->helper->url->to('TaskImportController', 'step1', array('project_id' => $project['id']))); + } + + /** + * Generate template + * + */ + public function template() + { + $this->response->withFileDownload('tasks.csv'); + $this->response->csv(array($this->taskImport->getColumnMapping())); + } +} diff --git a/app/Controller/TaskInternalLink.php b/app/Controller/TaskInternalLink.php deleted file mode 100644 index 6ff20252..00000000 --- a/app/Controller/TaskInternalLink.php +++ /dev/null @@ -1,167 +0,0 @@ -taskLink->getById($this->request->getIntegerParam('link_id')); - - if (empty($link)) { - throw new PageNotFoundException(); - } - - return $link; - } - - /** - * Creation form - * - * @access public - * @param array $values - * @param array $errors - * @throws PageNotFoundException - * @throws \Kanboard\Core\Controller\AccessForbiddenException - */ - public function create(array $values = array(), array $errors = array()) - { - $task = $this->getTask(); - - $this->response->html($this->template->render('task_internal_link/create', array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'labels' => $this->link->getList(0, false), - ))); - } - - /** - * Validation and creation - * - * @access public - */ - public function save() - { - $task = $this->getTask(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskLinkValidator->validateCreation($values); - - if ($valid) { - if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { - $this->flash->success(t('Link added successfully.')); - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); - } - - $errors = array('title' => array(t('The exact same link already exists'))); - $this->flash->failure(t('Unable to create your link.')); - } - - return $this->create($values, $errors); - } - - /** - * Edit form - * - * @access public - * @param array $values - * @param array $errors - * @throws PageNotFoundException - * @throws \Kanboard\Core\Controller\AccessForbiddenException - */ - public function edit(array $values = array(), array $errors = array()) - { - $task = $this->getTask(); - $task_link = $this->getTaskLink(); - - if (empty($values)) { - $opposite_task = $this->taskFinder->getById($task_link['opposite_task_id']); - $values = $task_link; - $values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title']; - } - - $this->response->html($this->template->render('task_internal_link/edit', array( - 'values' => $values, - 'errors' => $errors, - 'task_link' => $task_link, - 'task' => $task, - 'labels' => $this->link->getList(0, false) - ))); - } - - /** - * Validation and update - * - * @access public - */ - public function update() - { - $task = $this->getTask(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskLinkValidator->validateModification($values); - - if ($valid) { - if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { - $this->flash->success(t('Link updated successfully.')); - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); - } - - $this->flash->failure(t('Unable to update your link.')); - } - - return $this->edit($values, $errors); - } - - /** - * Confirmation dialog before removing a link - * - * @access public - */ - public function confirm() - { - $task = $this->getTask(); - $link = $this->getTaskLink(); - - $this->response->html($this->template->render('task_internal_link/remove', array( - 'link' => $link, - 'task' => $task, - ))); - } - - /** - * Remove a link - * - * @access public - */ - public function remove() - { - $this->checkCSRFParam(); - $task = $this->getTask(); - - if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) { - $this->flash->success(t('Link removed successfully.')); - } else { - $this->flash->failure(t('Unable to remove this link.')); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); - } -} diff --git a/app/Controller/TaskInternalLinkController.php b/app/Controller/TaskInternalLinkController.php new file mode 100644 index 00000000..f97426c6 --- /dev/null +++ b/app/Controller/TaskInternalLinkController.php @@ -0,0 +1,167 @@ +taskLink->getById($this->request->getIntegerParam('link_id')); + + if (empty($link)) { + throw new PageNotFoundException(); + } + + return $link; + } + + /** + * Creation form + * + * @access public + * @param array $values + * @param array $errors + * @throws PageNotFoundException + * @throws \Kanboard\Core\Controller\AccessForbiddenException + */ + public function create(array $values = array(), array $errors = array()) + { + $task = $this->getTask(); + + $this->response->html($this->template->render('task_internal_link/create', array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'labels' => $this->link->getList(0, false), + ))); + } + + /** + * Validation and creation + * + * @access public + */ + public function save() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskLinkValidator->validateCreation($values); + + if ($valid) { + if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + $this->flash->success(t('Link added successfully.')); + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + } + + $errors = array('title' => array(t('The exact same link already exists'))); + $this->flash->failure(t('Unable to create your link.')); + } + + return $this->create($values, $errors); + } + + /** + * Edit form + * + * @access public + * @param array $values + * @param array $errors + * @throws PageNotFoundException + * @throws \Kanboard\Core\Controller\AccessForbiddenException + */ + public function edit(array $values = array(), array $errors = array()) + { + $task = $this->getTask(); + $task_link = $this->getTaskLink(); + + if (empty($values)) { + $opposite_task = $this->taskFinder->getById($task_link['opposite_task_id']); + $values = $task_link; + $values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title']; + } + + $this->response->html($this->template->render('task_internal_link/edit', array( + 'values' => $values, + 'errors' => $errors, + 'task_link' => $task_link, + 'task' => $task, + 'labels' => $this->link->getList(0, false) + ))); + } + + /** + * Validation and update + * + * @access public + */ + public function update() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskLinkValidator->validateModification($values); + + if ($valid) { + if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + $this->flash->success(t('Link updated successfully.')); + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); + } + + $this->flash->failure(t('Unable to update your link.')); + } + + return $this->edit($values, $errors); + } + + /** + * Confirmation dialog before removing a link + * + * @access public + */ + public function confirm() + { + $task = $this->getTask(); + $link = $this->getTaskLink(); + + $this->response->html($this->template->render('task_internal_link/remove', array( + 'link' => $link, + 'task' => $task, + ))); + } + + /** + * Remove a link + * + * @access public + */ + public function remove() + { + $this->checkCSRFParam(); + $task = $this->getTask(); + + if ($this->taskLink->remove($this->request->getIntegerParam('link_id'))) { + $this->flash->success(t('Link removed successfully.')); + } else { + $this->flash->failure(t('Unable to remove this link.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + } +} diff --git a/app/Controller/TaskModificationController.php b/app/Controller/TaskModificationController.php new file mode 100644 index 00000000..47c07511 --- /dev/null +++ b/app/Controller/TaskModificationController.php @@ -0,0 +1,130 @@ +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']))); + } + + /** + * Edit description form + * + * @access public + * @param array $values + * @param array $errors + * @throws \Kanboard\Core\Controller\AccessForbiddenException + * @throws \Kanboard\Core\Controller\PageNotFoundException + */ + public function description(array $values = array(), array $errors = array()) + { + $task = $this->getTask(); + + if (empty($values)) { + $values = array('id' => $task['id'], 'description' => $task['description']); + } + + $this->response->html($this->template->render('task_modification/edit_description', array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + ))); + } + + /** + * Update description + * + * @access public + */ + public function updateDescription() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values); + + if ($valid) { + if ($this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $this->flash->failure(t('Unable to update your task.')); + } + + return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + } + + return $this->description($values, $errors); + } + + /** + * Display a form to edit a task + * + * @access public + * @param array $values + * @param array $errors + * @throws \Kanboard\Core\Controller\AccessForbiddenException + * @throws \Kanboard\Core\Controller\PageNotFoundException + */ + public function edit(array $values = array(), array $errors = array()) + { + $task = $this->getTask(); + $project = $this->project->getById($task['project_id']); + + if (empty($values)) { + $values = $task; + $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); + $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); + } + + $values = $this->dateParser->format($values, array('date_due'), $this->config->get('application_date_format', DateParser::DATE_FORMAT)); + $values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); + + $this->response->html($this->template->render('task_modification/edit_task', array( + 'project' => $project, + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), + 'colors_list' => $this->color->getList(), + 'categories_list' => $this->category->getList($task['project_id']), + ))); + } + + /** + * 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 && $this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + } else { + $this->flash->failure(t('Unable to update your task.')); + $this->edit($values, $errors); + } + } +} diff --git a/app/Controller/TaskPopover.php b/app/Controller/TaskPopover.php deleted file mode 100644 index 0e47cffe..00000000 --- a/app/Controller/TaskPopover.php +++ /dev/null @@ -1,100 +0,0 @@ -getTask(); - $project = $this->project->getById($task['project_id']); - - $this->response->html($this->template->render('task_popover/change_assignee', array( - 'values' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), - 'project' => $project, - ))); - } - - /** - * Validate an assignee modification - * - * @access public - */ - public function updateAssignee() - { - $values = $this->request->getValues(); - - list($valid,) = $this->taskValidator->validateAssigneeModification($values); - - if ($valid && $this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $this->flash->failure(t('Unable to update your task.')); - } - - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); - } - - /** - * Change a task category directly from the board - * - * @access public - */ - public function changeCategory() - { - $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); - - $this->response->html($this->template->render('task_popover/change_category', array( - 'values' => $task, - 'categories_list' => $this->category->getList($project['id']), - 'project' => $project, - ))); - } - - /** - * Validate a category modification - * - * @access public - */ - public function updateCategory() - { - $values = $this->request->getValues(); - - list($valid,) = $this->taskValidator->validateCategoryModification($values); - - if ($valid && $this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $this->flash->failure(t('Unable to update your task.')); - } - - $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); - } - - /** - * Screenshot popover - * - * @access public - */ - public function screenshot() - { - $task = $this->getTask(); - - $this->response->html($this->template->render('task_file/screenshot', array( - 'task' => $task, - ))); - } -} diff --git a/app/Controller/TaskPopoverController.php b/app/Controller/TaskPopoverController.php new file mode 100644 index 00000000..9bac2206 --- /dev/null +++ b/app/Controller/TaskPopoverController.php @@ -0,0 +1,100 @@ +getTask(); + $project = $this->project->getById($task['project_id']); + + $this->response->html($this->template->render('task_popover/change_assignee', array( + 'values' => $task, + 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), + 'project' => $project, + ))); + } + + /** + * Validate an assignee modification + * + * @access public + */ + public function updateAssignee() + { + $values = $this->request->getValues(); + + list($valid,) = $this->taskValidator->validateAssigneeModification($values); + + if ($valid && $this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $this->flash->failure(t('Unable to update your task.')); + } + + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); + } + + /** + * Change a task category directly from the board + * + * @access public + */ + public function changeCategory() + { + $task = $this->getTask(); + $project = $this->project->getById($task['project_id']); + + $this->response->html($this->template->render('task_popover/change_category', array( + 'values' => $task, + 'categories_list' => $this->category->getList($project['id']), + 'project' => $project, + ))); + } + + /** + * Validate a category modification + * + * @access public + */ + public function updateCategory() + { + $values = $this->request->getValues(); + + list($valid,) = $this->taskValidator->validateCategoryModification($values); + + if ($valid && $this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $this->flash->failure(t('Unable to update your task.')); + } + + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $values['project_id'])), true); + } + + /** + * Screenshot popover + * + * @access public + */ + public function screenshot() + { + $task = $this->getTask(); + + $this->response->html($this->template->render('task_file/screenshot', array( + 'task' => $task, + ))); + } +} diff --git a/app/Controller/TaskRecurrence.php b/app/Controller/TaskRecurrence.php deleted file mode 100644 index 72dce3a5..00000000 --- a/app/Controller/TaskRecurrence.php +++ /dev/null @@ -1,65 +0,0 @@ -getTask(); - - if (empty($values)) { - $values = $task; - } - - $this->response->html($this->template->render('task_recurrence/edit', 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(), - ))); - } - - /** - * Update recurrence form - * - * @access public - */ - public function update() - { - $task = $this->getTask(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); - - if ($valid) { - if ($this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $this->flash->failure(t('Unable to update your task.')); - } - - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); - } - - return $this->edit($values, $errors); - } -} diff --git a/app/Controller/TaskRecurrenceController.php b/app/Controller/TaskRecurrenceController.php new file mode 100644 index 00000000..1acf4038 --- /dev/null +++ b/app/Controller/TaskRecurrenceController.php @@ -0,0 +1,65 @@ +getTask(); + + if (empty($values)) { + $values = $task; + } + + $this->response->html($this->template->render('task_recurrence/edit', 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(), + ))); + } + + /** + * Update recurrence form + * + * @access public + */ + public function update() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); + + if ($valid) { + if ($this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $this->flash->failure(t('Unable to update your task.')); + } + + return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + } + + return $this->edit($values, $errors); + } +} diff --git a/app/Controller/TaskStatusController.php b/app/Controller/TaskStatusController.php new file mode 100644 index 00000000..fca168ec --- /dev/null +++ b/app/Controller/TaskStatusController.php @@ -0,0 +1,62 @@ +changeStatus('close', 'task_status/close', t('Task closed successfully.'), t('Unable to close this task.')); + } + + /** + * Open a task + * + * @access public + */ + public function open() + { + $this->changeStatus('open', 'task_status/open', t('Task opened successfully.'), t('Unable to open this task.')); + } + + /** + * Common method to change status + * + * @access private + * @param string $method + * @param string $template + * @param string $success_message + * @param string $failure_message + */ + private function changeStatus($method, $template, $success_message, $failure_message) + { + $task = $this->getTask(); + + if ($this->request->getStringParam('confirmation') === 'yes') { + $this->checkCSRFParam(); + + if ($this->taskStatus->$method($task['id'])) { + $this->flash->success($success_message); + } else { + $this->flash->failure($failure_message); + } + + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + } + + return $this->response->html($this->template->render($template, array( + 'task' => $task, + ))); + } +} diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php deleted file mode 100644 index e8eafe20..00000000 --- a/app/Controller/Taskmodification.php +++ /dev/null @@ -1,130 +0,0 @@ -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']))); - } - - /** - * Edit description form - * - * @access public - * @param array $values - * @param array $errors - * @throws \Kanboard\Core\Controller\AccessForbiddenException - * @throws \Kanboard\Core\Controller\PageNotFoundException - */ - public function description(array $values = array(), array $errors = array()) - { - $task = $this->getTask(); - - if (empty($values)) { - $values = array('id' => $task['id'], 'description' => $task['description']); - } - - $this->response->html($this->template->render('task_modification/edit_description', array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - ))); - } - - /** - * Update description - * - * @access public - */ - public function updateDescription() - { - $task = $this->getTask(); - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateDescriptionCreation($values); - - if ($valid) { - if ($this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $this->flash->failure(t('Unable to update your task.')); - } - - return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); - } - - return $this->description($values, $errors); - } - - /** - * Display a form to edit a task - * - * @access public - * @param array $values - * @param array $errors - * @throws \Kanboard\Core\Controller\AccessForbiddenException - * @throws \Kanboard\Core\Controller\PageNotFoundException - */ - public function edit(array $values = array(), array $errors = array()) - { - $task = $this->getTask(); - $project = $this->project->getById($task['project_id']); - - if (empty($values)) { - $values = $task; - $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); - $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); - } - - $values = $this->dateParser->format($values, array('date_due'), $this->config->get('application_date_format', DateParser::DATE_FORMAT)); - $values = $this->dateParser->format($values, array('date_started'), $this->config->get('application_datetime_format', DateParser::DATE_TIME_FORMAT)); - - $this->response->html($this->template->render('task_modification/edit_task', array( - 'project' => $project, - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']), - 'colors_list' => $this->color->getList(), - 'categories_list' => $this->category->getList($task['project_id']), - ))); - } - - /** - * 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 && $this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); - } else { - $this->flash->failure(t('Unable to update your task.')); - $this->edit($values, $errors); - } - } -} diff --git a/app/Controller/Taskstatus.php b/app/Controller/Taskstatus.php deleted file mode 100644 index eeaf8513..00000000 --- a/app/Controller/Taskstatus.php +++ /dev/null @@ -1,62 +0,0 @@ -changeStatus('close', 'task_status/close', t('Task closed successfully.'), t('Unable to close this task.')); - } - - /** - * Open a task - * - * @access public - */ - public function open() - { - $this->changeStatus('open', 'task_status/open', t('Task opened successfully.'), t('Unable to open this task.')); - } - - /** - * Common method to change status - * - * @access private - * @param string $method - * @param string $template - * @param string $success_message - * @param string $failure_message - */ - private function changeStatus($method, $template, $success_message, $failure_message) - { - $task = $this->getTask(); - - if ($this->request->getStringParam('confirmation') === 'yes') { - $this->checkCSRFParam(); - - if ($this->taskStatus->$method($task['id'])) { - $this->flash->success($success_message); - } else { - $this->flash->failure($failure_message); - } - - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); - } - - return $this->response->html($this->template->render($template, array( - 'task' => $task, - ))); - } -} diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index 3b5a9bab..ce0c6f27 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -72,7 +72,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('Analytic', '*', Role::PROJECT_MANAGER); $acl->add('Board', 'save', Role::PROJECT_MEMBER); $acl->add('BoardPopover', '*', Role::PROJECT_MEMBER); - $acl->add('TaskPopover', '*', Role::PROJECT_MEMBER); + $acl->add('TaskPopoverController', '*', Role::PROJECT_MEMBER); $acl->add('Calendar', 'save', Role::PROJECT_MEMBER); $acl->add('Category', '*', Role::PROJECT_MANAGER); $acl->add('Column', '*', Role::PROJECT_MANAGER); @@ -95,12 +95,12 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('TaskCreationController', '*', Role::PROJECT_MEMBER); $acl->add('TaskBulkController', '*', Role::PROJECT_MEMBER); $acl->add('Taskduplication', '*', Role::PROJECT_MEMBER); - $acl->add('TaskRecurrence', '*', Role::PROJECT_MEMBER); - $acl->add('TaskImport', '*', Role::PROJECT_MANAGER); - $acl->add('TaskInternalLink', '*', Role::PROJECT_MEMBER); + $acl->add('TaskRecurrenceController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskImportController', '*', Role::PROJECT_MANAGER); + $acl->add('TaskInternalLinkController', '*', Role::PROJECT_MEMBER); $acl->add('TaskExternalLink', '*', Role::PROJECT_MEMBER); - $acl->add('Taskmodification', '*', Role::PROJECT_MEMBER); - $acl->add('Taskstatus', '*', Role::PROJECT_MEMBER); + $acl->add('TaskModificationController', '*', Role::PROJECT_MEMBER); + $acl->add('TaskStatusController', '*', Role::PROJECT_MEMBER); $acl->add('UserAjaxController', array('mention'), Role::PROJECT_MEMBER); return $acl; diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php index f44820d9..d8c9fd45 100644 --- a/app/ServiceProvider/RouteProvider.php +++ b/app/ServiceProvider/RouteProvider.php @@ -58,7 +58,7 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('project/:project_id/integrations', 'ProjectViewController', 'integrations'); $container['route']->addRoute('project/:project_id/duplicate', 'ProjectViewController', 'duplicate'); $container['route']->addRoute('project/:project_id/permissions', 'ProjectPermissionController', 'index'); - $container['route']->addRoute('project/:project_id/import', 'taskImport', 'step1'); + $container['route']->addRoute('project/:project_id/import', 'TaskImportController', 'step1'); $container['route']->addRoute('project/:project_id/activity', 'activity', 'project'); // Project Overview diff --git a/app/Template/board/task_avatar.php b/app/Template/board/task_avatar.php index 53739b19..14b55476 100644 --- a/app/Template/board/task_avatar.php +++ b/app/Template/board/task_avatar.php @@ -1,9 +1,9 @@
user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> class="task-board-assignee task-board-change-assignee" - data-url="url->href('TaskPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> + data-url="url->href('TaskPopoverController', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> class="task-board-assignee"> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index dbfe65b0..67cae77a 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -6,7 +6,7 @@ url->link( $this->text->e($task['category_name']), - 'TaskPopover', + 'TaskPopoverController', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, diff --git a/app/Template/board/task_private.php b/app/Template/board/task_private.php index 57623042..03ed3950 100644 --- a/app/Template/board/task_private.php +++ b/app/Template/board/task_private.php @@ -16,7 +16,7 @@ board->isCollapsed($task['project_id'])): ?>
- user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> render('task/dropdown', array('task' => $task)) ?> @@ -32,7 +32,7 @@
- user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> render('task/dropdown', array('task' => $task)) ?> diff --git a/app/Template/listing/show.php b/app/Template/listing/show.php index a5cba1c4..1c92de4c 100644 --- a/app/Template/listing/show.php +++ b/app/Template/listing/show.php @@ -18,7 +18,7 @@ getCollection() as $task): ?> - user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?> + user->hasProjectAccess('TaskModificationController', 'edit', $task['project_id'])): ?> render('task/dropdown', array('task' => $task)) ?> # diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php index 1071e78b..0f58c112 100644 --- a/app/Template/project/sidebar.php +++ b/app/Template/project/sidebar.php @@ -51,8 +51,8 @@ url->link(t('Enable'), 'ProjectStatusController', 'confirmEnable', array('project_id' => $project['id']), false, 'popover') ?> -
  • app->checkMenuSelection('taskImport') ?>> - url->link(t('Import'), 'taskImport', 'step1', array('project_id' => $project['id'])) ?> +
  • app->checkMenuSelection('TaskImportController') ?>> + url->link(t('Import'), 'TaskImportController', 'step1', array('project_id' => $project['id'])) ?>
  • user->hasProjectAccess('ProjectStatusController', 'remove', $project['id'])): ?>
  • diff --git a/app/Template/task/details.php b/app/Template/task/details.php index 5b8b7c6d..6e72ca3c 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -148,7 +148,7 @@
    - url->button('fa-play', t('Set start date'), 'taskmodification', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->button('fa-play', t('Set start date'), 'TaskModificationController', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
    diff --git a/app/Template/task/dropdown.php b/app/Template/task/dropdown.php index 887e1828..2c3c38c6 100644 --- a/app/Template/task/dropdown.php +++ b/app/Template/task/dropdown.php @@ -4,24 +4,24 @@
  • - url->link(t('Set automatically the start date'), 'taskmodification', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('Set automatically the start date'), 'TaskModificationController', 'start', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
  • - url->link(t('Change assignee'), 'TaskPopover', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Change assignee'), 'TaskPopoverController', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • - url->link(t('Change category'), 'TaskPopover', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Change category'), 'TaskPopoverController', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • - url->link(t('Edit the task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Edit the task'), 'TaskModificationController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • - url->link(t('Edit the description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Edit the description'), 'TaskModificationController', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • @@ -29,7 +29,7 @@
  • - url->link(t('Add internal link'), 'TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Add internal link'), 'TaskInternalLinkController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • @@ -41,7 +41,7 @@
  • - url->link(t('Add a screenshot'), 'TaskPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Add a screenshot'), 'TaskPopoverController', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • @@ -65,10 +65,10 @@
  • - url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Close this task'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> - url->link(t('Open this task'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> + url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
  • diff --git a/app/Template/task/layout.php b/app/Template/task/layout.php index 4bc67406..0a755617 100644 --- a/app/Template/task/layout.php +++ b/app/Template/task/layout.php @@ -3,10 +3,10 @@ hook->render('template:task:layout:top', array('task' => $task)) ?>
    -

    url->link(t('Download CSV template'), 'taskImport', 'template', array('project_id' => $project['id'])) ?>

    \ No newline at end of file +

    url->link(t('Download CSV template'), 'TaskImportController', 'template', array('project_id' => $project['id'])) ?>

    diff --git a/app/Template/task_internal_link/create.php b/app/Template/task_internal_link/create.php index 94dcdd66..87b3fd28 100644 --- a/app/Template/task_internal_link/create.php +++ b/app/Template/task_internal_link/create.php @@ -2,7 +2,7 @@

    - + form->csrf() ?> form->hidden('task_id', array('task_id' => $task['id'])) ?> @@ -30,4 +30,4 @@ url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    - \ No newline at end of file + diff --git a/app/Template/task_internal_link/edit.php b/app/Template/task_internal_link/edit.php index 03622df7..15066443 100644 --- a/app/Template/task_internal_link/edit.php +++ b/app/Template/task_internal_link/edit.php @@ -2,7 +2,7 @@

    -
    + form->csrf() ?> form->hidden('id', $values) ?> @@ -31,4 +31,4 @@ url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> -
    \ No newline at end of file + diff --git a/app/Template/task_internal_link/remove.php b/app/Template/task_internal_link/remove.php index 82156ece..4dea7c9d 100644 --- a/app/Template/task_internal_link/remove.php +++ b/app/Template/task_internal_link/remove.php @@ -8,8 +8,8 @@

    - url->link(t('Yes'), 'TaskInternalLink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> + url->link(t('Yes'), 'TaskInternalLinkController', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    - \ No newline at end of file + diff --git a/app/Template/task_internal_link/table.php b/app/Template/task_internal_link/table.php index 57a3536c..631796bf 100644 --- a/app/Template/task_internal_link/table.php +++ b/app/Template/task_internal_link/table.php @@ -72,8 +72,8 @@ diff --git a/app/Template/task_modification/edit_description.php b/app/Template/task_modification/edit_description.php index 801b4005..cddc0cf5 100644 --- a/app/Template/task_modification/edit_description.php +++ b/app/Template/task_modification/edit_description.php @@ -2,7 +2,7 @@

    -
    + form->csrf() ?> form->hidden('id', $values) ?> diff --git a/app/Template/task_modification/edit_task.php b/app/Template/task_modification/edit_task.php index 5ddec5ea..f7ecc9cb 100644 --- a/app/Template/task_modification/edit_task.php +++ b/app/Template/task_modification/edit_task.php @@ -1,8 +1,7 @@ - - + form->csrf() ?> form->hidden('id', $values) ?> form->hidden('project_id', $values) ?> diff --git a/app/Template/task_popover/change_assignee.php b/app/Template/task_popover/change_assignee.php index bf68c34d..1a424e1f 100644 --- a/app/Template/task_popover/change_assignee.php +++ b/app/Template/task_popover/change_assignee.php @@ -2,7 +2,7 @@ - + form->csrf() ?> diff --git a/app/Template/task_popover/change_category.php b/app/Template/task_popover/change_category.php index 0364e660..1755ac9b 100644 --- a/app/Template/task_popover/change_category.php +++ b/app/Template/task_popover/change_category.php @@ -2,7 +2,7 @@ - + form->csrf() ?> diff --git a/app/Template/task_recurrence/edit.php b/app/Template/task_recurrence/edit.php index 0f5d611a..e1f0feca 100644 --- a/app/Template/task_recurrence/edit.php +++ b/app/Template/task_recurrence/edit.php @@ -15,7 +15,7 @@ - + form->csrf() ?> @@ -44,4 +44,4 @@
    - \ No newline at end of file + diff --git a/app/Template/task_status/close.php b/app/Template/task_status/close.php index 7d200544..f78e051d 100644 --- a/app/Template/task_status/close.php +++ b/app/Template/task_status/close.php @@ -8,8 +8,8 @@

    - url->link(t('Yes'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> + url->link(t('Yes'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    - \ No newline at end of file + diff --git a/app/Template/task_status/open.php b/app/Template/task_status/open.php index 5d19bfbe..1bd89cf4 100644 --- a/app/Template/task_status/open.php +++ b/app/Template/task_status/open.php @@ -8,8 +8,8 @@

    - url->link(t('Yes'), 'taskstatus', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> + url->link(t('Yes'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red popover-link') ?> url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    - \ No newline at end of file + -- cgit v1.2.3