diff --git a/app/Controller/Base.php b/app/Controller/Base.php index f9059d1e8..2d7b0c189 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -140,20 +140,28 @@ abstract class Base * Application not found page (404 error) * * @access public + * @param boolean $no_layout Display the layout or not */ - public function notfound() + public function notfound($no_layout = false) { - $this->response->html($this->template->layout('app_notfound', array('title' => t('Page not found')))); + $this->response->html($this->template->layout('app_notfound', array( + 'title' => t('Page not found'), + 'no_layout' => $no_layout, + ))); } /** * Application forbidden page * * @access public + * @param boolean $no_layout Display the layout or not */ - public function forbidden() + public function forbidden($no_layout = false) { - $this->response->html($this->template->layout('app_forbidden', array('title' => t('Access Forbidden')))); + $this->response->html($this->template->layout('app_forbidden', array( + 'title' => t('Access Forbidden'), + 'no_layout' => $no_layout, + ))); } /** diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 4724cae5d..71d94a293 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -167,7 +167,7 @@ class Board extends Base // Token verification if (! $project) { - $this->response->text('Not Authorized', 401); + $this->forbidden(true); } // Display the board with a specific layout diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index a0a11fc8b..a9032ed80 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -25,25 +25,15 @@ class Comment extends Base } if (! $this->acl->isAdminUser() && $comment['user_id'] != $this->acl->getUserId()) { - $this->forbidden(); + $this->response->html($this->template->layout('comment_forbidden', array( + 'menu' => 'tasks', + 'title' => t('Access Forbidden') + ))); } return $comment; } - /** - * Forbidden page for comments - * - * @access public - */ - public function forbidden() - { - $this->response->html($this->template->layout('comment_forbidden', array( - 'menu' => 'tasks', - 'title' => t('Access Forbidden') - ))); - } - /** * Add comment form * diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 7210be5f1..97751947d 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -46,6 +46,39 @@ class Task extends Base $this->response->text('FAILED'); } + /** + * Public access (display a task) + * + * @access public + */ + public function readonly() + { + $project = $this->project->getByToken($this->request->getStringParam('token')); + + // Token verification + if (! $project) { + $this->forbidden(true); + } + + $task = $this->task->getById($this->request->getIntegerParam('task_id'), true); + + if (! $task) { + $this->notfound(true); + } + + $this->response->html($this->template->layout('task_public', array( + 'project' => $project, + 'comments' => $this->comment->getAll($task['id']), + 'subtasks' => $this->subTask->getAll($task['id']), + 'task' => $task, + 'columns_list' => $this->board->getColumnsList($task['project_id']), + 'colors_list' => $this->task->getColors(), + 'title' => $task['title'], + 'no_layout' => true, + 'auto_refresh' => true, + ))); + } + /** * Show a task * @@ -56,6 +89,7 @@ class Task extends Base $task = $this->getTask(); $this->response->html($this->taskLayout('task_show', array( + 'project' => $this->project->getById($task['project_id']), 'files' => $this->file->getAll($task['id']), 'comments' => $this->comment->getAll($task['id']), 'subtasks' => $this->subTask->getAll($task['id']), diff --git a/app/Model/Acl.php b/app/Model/Acl.php index 21c763294..4f7d13571 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -18,7 +18,7 @@ class Acl extends Base */ private $public_actions = array( 'user' => array('login', 'check', 'google', 'github'), - 'task' => array('add'), + 'task' => array('add', 'readonly'), 'board' => array('readonly'), ); diff --git a/app/Templates/board_public.php b/app/Templates/board_public.php index f90dc01b5..85c90cfaa 100644 --- a/app/Templates/board_public.php +++ b/app/Templates/board_public.php @@ -21,7 +21,7 @@
= t('Sub-Tasks') ?>
+ += t('Sub-Tasks') ?>
+= t('Time tracking') ?>
++- = t('Estimate:') ?> = Helper\escape($total_estimated) ?> = t('hours') ?>
+ - = t('Spent:') ?> = Helper\escape($total_spent) ?> = t('hours') ?>
+ - = t('Remaining:') ?> = Helper\escape($total_remaining > 0 ? $total_remaining : 0) ?> = t('hours') ?>
+
+= t('Time tracking') ?>
--- = t('Estimate:') ?> = Helper\escape($total_estimated) ?> = t('hours') ?>
- - = t('Spent:') ?> = Helper\escape($total_spent) ?> = t('hours') ?>
- - = t('Remaining:') ?> = Helper\escape($total_remaining > 0 ? $total_remaining : 0) ?> = t('hours') ?>
-
-= t('Comments') ?>
+= Helper\escape($task['title']) ?>
+ + = Helper\escape($task['score']) ?> + ++-
+ = dt('Created on %B %e, %Y at %k:%M %p', $task['date_creation']) ?>
+
+
+ -
+ = dt('Last modified on %B %e, %Y at %k:%M %p', $task['date_modification']) ?>
+
+
+
+ -
+ = dt('Completed on %B %e, %Y at %k:%M %p', $task['date_completed']) ?>
+
+
+
+ -
+ = dt('Must be done before %B %e, %Y', $task['date_due']) ?>
+
+
+
+ -
+ = t('Created by %s', $task['creator_name'] ?: $task['creator_username']) ?>
+
+
+ -
+
+
+ = t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
+
+ = t('There is nobody assigned') ?>
+
+
+
+ -
+ = t('Column on the board:') ?>
+ = Helper\escape($task['column_title']) ?>
+ (= Helper\escape($task['project_name']) ?>)
+
+ - = t('Task position:').' '.Helper\escape($task['position']) ?>
+
+ -
+ = t('Category:') ?> = Helper\escape($task['category_name']) ?>
+
+
+ -
+
+ = t('Status is open') ?>
+
+ = t('Status is closed') ?>
+
+
+
+ -
+ = t('Public link') ?>
+
+
+
+= Helper\escape($task['title']) ?>
- - = Helper\escape($task['score']) ?> - ---
- = dt('Created on %B %e, %Y at %k:%M %p', $task['date_creation']) ?>
-
-
- -
- = dt('Last modified on %B %e, %Y at %k:%M %p', $task['date_modification']) ?>
-
-
-
- -
- = dt('Completed on %B %e, %Y at %k:%M %p', $task['date_completed']) ?>
-
-
-
- -
- = dt('Must be done before %B %e, %Y', $task['date_due']) ?>
-
-
-
- -
- = t('Created by %s', $task['creator_name'] ?: $task['creator_username']) ?>
-
-
- -
-
-
- = t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
-
- = t('There is nobody assigned') ?>
-
-
-
- -
- = t('Column on the board:') ?>
- = Helper\escape($task['column_title']) ?>
- (= Helper\escape($task['project_name']) ?>)
-
- - = t('Task position:').' '.Helper\escape($task['position']) ?>
-
- -
- = t('Category:') ?> = Helper\escape($task['category_name']) ?>
-
-
- -
-
- = t('Status is open') ?>
-
- = t('Status is closed') ?>
-
-
-
-= t('Description') ?>
-= t('Comments') ?>
-= t('Description') ?>
+