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 @@

-
+ @@ -30,7 +30,7 @@ - + $task['id'])) ?>
diff --git a/app/Template/comment_edit.php b/app/Template/comment/edit.php similarity index 82% rename from app/Template/comment_edit.php rename to app/Template/comment/edit.php index 96b7a8729..386dd9b13 100644 --- a/app/Template/comment_edit.php +++ b/app/Template/comment/edit.php @@ -2,7 +2,7 @@

-
+ @@ -30,6 +30,6 @@
- + $task['id'])) ?>
diff --git a/app/Template/comment/forbidden.php b/app/Template/comment/forbidden.php new file mode 100644 index 000000000..1e306d452 --- /dev/null +++ b/app/Template/comment/forbidden.php @@ -0,0 +1,7 @@ + + +

+ +

\ 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 @@ + + +
+

+ +

+ + $comment, 'task' => $task, 'preview' => true)) ?> + +
+ $task['id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> + + $task['id'])) ?> +
+
\ No newline at end of file diff --git a/app/Template/comment_show.php b/app/Template/comment/show.php similarity index 81% rename from app/Template/comment_show.php rename to app/Template/comment/show.php index b2ccc25a8..5e1e93374 100644 --- a/app/Template/comment_show.php +++ b/app/Template/comment/show.php @@ -11,10 +11,10 @@
  • - + $task['id'], 'comment_id' => $comment['id'])) ?>
  • - + $task['id'], 'comment_id' => $comment['id'])) ?>
  • diff --git a/app/Template/comment_forbidden.php b/app/Template/comment_forbidden.php deleted file mode 100644 index eeea8404b..000000000 --- a/app/Template/comment_forbidden.php +++ /dev/null @@ -1,9 +0,0 @@ -
    - - -

    - -

    -
    \ No newline at end of file diff --git a/app/Template/comment_remove.php b/app/Template/comment_remove.php deleted file mode 100644 index 7b1177817..000000000 --- a/app/Template/comment_remove.php +++ /dev/null @@ -1,16 +0,0 @@ - - -
    -

    - -

    - - $comment, 'task' => $task, 'preview' => true)) ?> - -
    - - -
    -
    \ No newline at end of file diff --git a/app/Template/task_comments.php b/app/Template/task_comments.php index 5cfa99ce1..343e66c5d 100644 --- a/app/Template/task_comments.php +++ b/app/Template/task_comments.php @@ -5,7 +5,7 @@ - $comment, 'task' => $task, 'project' => $project, @@ -15,7 +15,7 @@ - true, 'values' => array( 'user_id' => Helper\get_user_id(),