Fix redirects after deleting a comment

refs #8624
This commit is contained in:
Matthias Jentsch 2015-05-07 17:02:34 +02:00
parent 1fa550838d
commit c6c78989a5
2 changed files with 11 additions and 6 deletions

View File

@ -64,12 +64,15 @@ class Monitoring_CommentController extends Controller
*/ */
public function showAction() public function showAction()
{ {
$listCommentsLink = Url::fromPath('monitoring/list/comments')
->setQueryString('comment_type=(comment|ack)');
$this->view->comment = $this->comment; $this->view->comment = $this->comment;
if ($this->hasPermission('monitoring/command/comment/delete')) { if ($this->hasPermission('monitoring/command/comment/delete')) {
$this->view->delCommentForm = $this->createDelCommentForm(); $this->view->delCommentForm = $this->createDelCommentForm();
$this->view->delCommentForm->populate( $this->view->delCommentForm->populate(
array( array(
'redirect' => Url::fromPath('monitoring/list/comments'), 'redirect' => $listCommentsLink,
'comment_id' => $this->comment->id, 'comment_id' => $this->comment->id,
'comment_is_service' => isset($this->comment->service_description) 'comment_is_service' => isset($this->comment->service_description)
) )

View File

@ -81,9 +81,8 @@ class Monitoring_CommentsController extends Controller
{ {
$this->assertPermission('monitoring/command/comment/delete'); $this->assertPermission('monitoring/command/comment/delete');
$this->view->comments = $this->comments; $listCommentsLink = Url::fromPath('monitoring/list/comments')
$this->view->listAllLink = Url::fromPath('monitoring/list/comments') ->setQueryString('comment_type=(comment|ack)');
->setQueryString($this->filter->toQueryString());
$delCommentForm = new DeleteCommentsCommandForm(); $delCommentForm = new DeleteCommentsCommandForm();
$delCommentForm->setTitle($this->view->translate('Remove all Comments')); $delCommentForm->setTitle($this->view->translate('Remove all Comments'));
$delCommentForm->addDescription(sprintf( $delCommentForm->addDescription(sprintf(
@ -91,8 +90,11 @@ class Monitoring_CommentsController extends Controller
count($this->comments) count($this->comments)
)); ));
$delCommentForm->setComments($this->comments) $delCommentForm->setComments($this->comments)
->setRedirectUrl(Url::fromPath('monitoring/list/comments')) ->setRedirectUrl($listCommentsLink)
->handleRequest(); ->handleRequest();
$this->view->delCommentForm = $delCommentForm; $this->view->delCommentForm = $delCommentForm;
$this->view->comments = $this->comments;
$this->view->listAllLink = Url::fromPath('monitoring/list/comments')
->setQueryString($this->filter->toQueryString());
} }
} }