= t('Forbidden') ?>
-- = t('Only administrators or the creator of the comment can access to this page.') ?> -
-diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index efa7e066c..fb21353ec 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -25,7 +25,7 @@ class Comment extends Base } if (! $this->acl->isAdminUser() && $comment['user_id'] != $this->acl->getUserId()) { - $this->response->html($this->template->layout('comment_forbidden', array( + $this->response->html($this->template->layout('comment/forbidden', array( 'title' => t('Access Forbidden') ))); } @@ -38,16 +38,20 @@ class Comment extends Base * * @access public */ - public function create() + public function create(array $values = array(), array $errors = array()) { $task = $this->getTask(); - $this->response->html($this->taskLayout('comment_create', array( - 'values' => array( + if (empty($values)) { + $values = array( 'user_id' => $this->acl->getUserId(), 'task_id' => $task['id'], - ), - 'errors' => array(), + ); + } + + $this->response->html($this->taskLayout('comment/create', array( + 'values' => $values, + 'errors' => $errors, 'task' => $task, 'title' => t('Add a comment') ))); @@ -77,12 +81,7 @@ class Comment extends Base $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comments'); } - $this->response->html($this->taskLayout('comment_create', array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'title' => t('Add a comment') - ))); + $this->create($values, $errors); } /** @@ -90,14 +89,14 @@ class Comment extends Base * * @access public */ - public function edit() + public function edit(array $values = array(), array $errors = array()) { $task = $this->getTask(); $comment = $this->getComment(); - $this->response->html($this->taskLayout('comment_edit', array( - 'values' => $comment, - 'errors' => array(), + $this->response->html($this->taskLayout('comment/edit', array( + 'values' => empty($values) ? $comment : $values, + 'errors' => $errors, 'comment' => $comment, 'task' => $task, 'title' => t('Edit a comment') @@ -129,13 +128,7 @@ class Comment extends Base $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comment-'.$comment['id']); } - $this->response->html($this->taskLayout('comment_edit', array( - 'values' => $values, - 'errors' => $errors, - 'comment' => $comment, - 'task' => $task, - 'title' => t('Edit a comment') - ))); + $this->edit($values, $errors); } /** @@ -148,7 +141,7 @@ class Comment extends Base $task = $this->getTask(); $comment = $this->getComment(); - $this->response->html($this->taskLayout('comment_remove', array( + $this->response->html($this->taskLayout('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') diff --git a/app/Template/comment_create.php b/app/Template/comment/create.php similarity index 85% rename from app/Template/comment_create.php rename to app/Template/comment/create.php index 5590b77dc..d72fa6270 100644 --- a/app/Template/comment_create.php +++ b/app/Template/comment/create.php @@ -2,7 +2,7 @@
+ = t('Only administrators or the creator of the comment can access to this page.') ?> +
\ No newline at end of file diff --git a/app/Template/comment/remove.php b/app/Template/comment/remove.php new file mode 100644 index 000000000..503823694 --- /dev/null +++ b/app/Template/comment/remove.php @@ -0,0 +1,17 @@ ++ = t('Do you really want to remove this comment?') ?> +
+ + = Helper\template('comment/show', array('comment' => $comment, 'task' => $task, 'preview' => true)) ?> + +- = t('Only administrators or the creator of the comment can access to this page.') ?> -
-- = t('Do you really want to remove this comment?') ?> -
- - = Helper\template('comment_show', array('comment' => $comment, 'task' => $task, 'preview' => true)) ?> - -