summaryrefslogtreecommitdiff
path: root/app/Controller/Board.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-12-26 17:43:13 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-12-26 17:43:13 -0500
commitcf821e117ce8b937cff7f386a107aaa81ba6bf9b (patch)
tree6075f4d1c5192f45e8b13479bc67f973b046fdf2 /app/Controller/Board.php
parent2b27d986b374923a266c132ac0a67fb515d30d1c (diff)
Add swimlanes
Diffstat (limited to 'app/Controller/Board.php')
-rw-r--r--app/Controller/Board.php100
1 files changed, 51 insertions, 49 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 7d498f81..c5823328 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -130,12 +130,14 @@ class Board extends Base
// Display the board with a specific layout
$this->response->html($this->template->layout('board/public', array(
'project' => $project,
- 'columns' => $this->board->get($project['id']),
+ 'swimlanes' => $this->board->getBoard($project['id']),
'categories' => $this->category->getList($project['id'], false),
'title' => $project['name'],
'no_layout' => true,
'not_editable' => true,
'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'),
+ 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
+ 'board_highlight_period' => $this->config->get('board_highlight_period'),
)));
}
@@ -188,7 +190,7 @@ class Board extends Base
'users' => $this->projectPermission->getMemberList($project['id'], true, true),
'projects' => $projects,
'project' => $project,
- 'board' => $this->board->get($project['id']),
+ 'swimlanes' => $this->board->getBoard($project['id']),
'categories' => $this->category->getList($project['id'], true, true),
'title' => $project['name'],
'board_selector' => $board_selector,
@@ -339,35 +341,38 @@ class Board extends Base
{
$project_id = $this->request->getIntegerParam('project_id');
- if ($project_id > 0 && $this->request->isAjax()) {
+ if (! $project_id || ! $this->request->isAjax()) {
+ return $this->response->status(403);
+ }
- if (! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
- $this->response->text('Forbidden', 403);
- }
+ if (! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
+ $this->response->text('Forbidden', 403);
+ }
- $values = $this->request->getJson();
+ $values = $this->request->getJson();
- if ($this->taskPosition->movePosition($project_id, $values['task_id'], $values['column_id'], $values['position'])) {
+ $result =$this->taskPosition->movePosition(
+ $project_id,
+ $values['task_id'],
+ $values['column_id'],
+ $values['position'],
+ $values['swimlane_id']
+ );
- $this->response->html(
- $this->template->load('board/show', array(
- 'project' => $this->project->getById($project_id),
- 'board' => $this->board->get($project_id),
- 'categories' => $this->category->getList($project_id, false),
- 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
- 'board_highlight_period' => $this->config->get('board_highlight_period'),
- )),
- 201
- );
- }
- else {
-
- $this->response->status(400);
- }
- }
- else {
- $this->response->status(403);
+ if (! $result) {
+ return $this->response->status(400);
}
+
+ $this->response->html(
+ $this->template->load('board/show', array(
+ 'project' => $this->project->getById($project_id),
+ 'swimlanes' => $this->board->getBoard($project_id),
+ 'categories' => $this->category->getList($project_id, false),
+ 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
+ 'board_highlight_period' => $this->config->get('board_highlight_period'),
+ )),
+ 201
+ );
}
/**
@@ -377,33 +382,30 @@ class Board extends Base
*/
public function check()
{
- if ($this->request->isAjax()) {
-
- $project_id = $this->request->getIntegerParam('project_id');
- $timestamp = $this->request->getIntegerParam('timestamp');
+ if (! $this->request->isAjax()) {
+ return $this->response->status(403);
+ }
- if ($project_id > 0 && ! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
- $this->response->text('Forbidden', 403);
- }
+ $project_id = $this->request->getIntegerParam('project_id');
+ $timestamp = $this->request->getIntegerParam('timestamp');
- if ($this->project->isModifiedSince($project_id, $timestamp)) {
- $this->response->html(
- $this->template->load('board/show', array(
- 'project' => $this->project->getById($project_id),
- 'board' => $this->board->get($project_id),
- 'categories' => $this->category->getList($project_id, false),
- 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
- 'board_highlight_period' => $this->config->get('board_highlight_period'),
- ))
- );
- }
- else {
- $this->response->status(304);
- }
+ if (! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
+ $this->response->text('Forbidden', 403);
}
- else {
- $this->response->status(403);
+
+ if (! $this->project->isModifiedSince($project_id, $timestamp)) {
+ return $this->response->status(304);
}
+
+ $this->response->html(
+ $this->template->load('board/show', array(
+ 'project' => $this->project->getById($project_id),
+ 'swimlanes' => $this->board->getBoard($project_id),
+ 'categories' => $this->category->getList($project_id, false),
+ 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
+ 'board_highlight_period' => $this->config->get('board_highlight_period'),
+ ))
+ );
}
/**