summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Board.php94
1 files changed, 68 insertions, 26 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index f43527ea..e2c10f58 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -51,39 +51,27 @@ class Board extends Base
*
* @access public
*/
- public function assign()
+ public function changeAssignee()
{
- $task = $this->task->getById($this->request->getIntegerParam('task_id'));
+ $task = $this->getTask();
$project = $this->project->getById($task['project_id']);
- $projects = $this->project->getListByStatus(ProjectModel::ACTIVE);
-
- if ($this->acl->isRegularUser()) {
- $projects = $this->project->filterListByAccess($projects, $this->acl->getUserId());
- }
-
- if (! $project) $this->notfound();
- $this->checkProjectPermissions($project['id']);
+ $projects = $this->project->getAvailableList($this->acl->getUserId());
+ $params = array(
+ 'errors' => array(),
+ 'values' => $task,
+ 'users_list' => $this->project->getUsersList($project['id']),
+ 'projects' => $projects,
+ 'current_project_id' => $project['id'],
+ 'current_project_name' => $project['name'],
+ );
if ($this->request->isAjax()) {
- $this->response->html($this->template->load('board_assign', array(
- 'errors' => array(),
- 'values' => $task,
- 'users_list' => $this->project->getUsersList($project['id']),
- 'projects' => $projects,
- 'current_project_id' => $project['id'],
- 'current_project_name' => $project['name'],
- )));
+ $this->response->html($this->template->load('board_assignee', $params));
}
else {
- $this->response->html($this->template->layout('board_assign', array(
- 'errors' => array(),
- 'values' => $task,
- 'users_list' => $this->project->getUsersList($project['id']),
- 'projects' => $projects,
- 'current_project_id' => $project['id'],
- 'current_project_name' => $project['name'],
+ $this->response->html($this->template->layout('board_assignee', $params + array(
'menu' => 'boards',
'title' => t('Change assignee').' - '.$task['title'],
)));
@@ -95,7 +83,7 @@ class Board extends Base
*
* @access public
*/
- public function assignTask()
+ public function updateAssignee()
{
$values = $this->request->getValues();
$this->checkProjectPermissions($values['project_id']);
@@ -113,6 +101,60 @@ class Board extends Base
}
/**
+ * Change a task category directly from the board
+ *
+ * @access public
+ */
+ public function changeCategory()
+ {
+ $task = $this->getTask();
+ $project = $this->project->getById($task['project_id']);
+ $projects = $this->project->getAvailableList($this->acl->getUserId());
+ $params = array(
+ 'errors' => array(),
+ 'values' => $task,
+ 'categories_list' => $this->category->getList($project['id']),
+ 'projects' => $projects,
+ 'current_project_id' => $project['id'],
+ 'current_project_name' => $project['name'],
+ );
+
+ if ($this->request->isAjax()) {
+
+ $this->response->html($this->template->load('board_category', $params));
+ }
+ else {
+
+ $this->response->html($this->template->layout('board_category', $params + array(
+ 'menu' => 'boards',
+ 'title' => t('Change category').' - '.$task['title'],
+ )));
+ }
+ }
+
+ /**
+ * Validate a category modification
+ *
+ * @access public
+ */
+ public function updateCategory()
+ {
+ $values = $this->request->getValues();
+ $this->checkProjectPermissions($values['project_id']);
+
+ list($valid,) = $this->task->validateCategoryModification($values);
+
+ if ($valid && $this->task->update($values)) {
+ $this->session->flash(t('Task updated successfully.'));
+ }
+ else {
+ $this->session->flashError(t('Unable to update your task.'));
+ }
+
+ $this->response->redirect('?controller=board&action=show&project_id='.$values['project_id']);
+ }
+
+ /**
* Display the public version of a board
* Access checked by a simple token, no user login, read only, auto-refresh
*