From 2f4651411b1827e1e5859ba6053052b508f455e0 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 22 Feb 2014 16:30:03 -0500 Subject: Add kiosk mode, public board access with read-only and auto-refresh --- controllers/base.php | 1 + controllers/board.php | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'controllers') 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( -- cgit v1.2.3