diff options
author | Frédéric Guillot <contact@fredericguillot.com> | 2014-02-22 16:30:03 -0500 |
---|---|---|
committer | Frédéric Guillot <contact@fredericguillot.com> | 2014-02-22 16:30:03 -0500 |
commit | 2f4651411b1827e1e5859ba6053052b508f455e0 (patch) | |
tree | ea07631e7a5e5850367f873c7a9c1a0e07e10638 /controllers | |
parent | a1923d3d7f9276e859d6fd6bee339f0ea00f6544 (diff) |
Add kiosk mode, public board access with read-only and auto-refresh
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/base.php | 1 | ||||
-rw-r--r-- | controllers/board.php | 28 |
2 files changed, 26 insertions, 3 deletions
diff --git a/controllers/base.php b/controllers/base.php index 5c48d927..c248ede1 100644 --- a/controllers/base.php +++ b/controllers/base.php @@ -45,6 +45,7 @@ abstract class Base $public = array( 'user' => array('login', 'check'), 'task' => array('add'), + 'board' => array('readonly'), ); if (isset($public[$controller])) { diff --git a/controllers/board.php b/controllers/board.php index ec32e8a0..e8b161e7 100644 --- a/controllers/board.php +++ b/controllers/board.php @@ -4,7 +4,29 @@ namespace Controller; class Board extends Base { - // Display current board + // Display the public version of a board + // Access checked by a simple token, no user login, read only, auto-refresh + public function readonly() + { + $token = $this->request->getStringParam('token'); + $project = $this->project->getByToken($token); + + // Token verification + if (! $project) { + $this->response->text('Not Authorized', 401); + } + + // Display the board with a specific layout + $this->response->html($this->template->layout('board_public', array( + 'project' => $project, + 'columns' => $this->board->get($project['id']), + 'title' => $project['name'], + 'no_layout' => true, + 'auto_refresh' => true, + ))); + } + + // Display the default user project or the first project public function index() { $projects = $this->project->getListByStatus(\Model\Project::ACTIVE); @@ -30,7 +52,7 @@ class Board extends Base ))); } - // Show a board + // Show a board for a given project public function show() { $projects = $this->project->getListByStatus(\Model\Project::ACTIVE); @@ -175,7 +197,7 @@ class Board extends Base $this->response->redirect('?controller=board&action=edit&project_id='.$column['project_id']); } - // Save the board (Ajax request made by drag and drop) + // Save the board (Ajax request made by the drag and drop) public function save() { $this->response->json(array( |