Skip to content

Commit

Permalink
Fix downtime and comment form redirects
Browse files Browse the repository at this point in the history
refs #8624
  • Loading branch information
majentsch committed May 7, 2015
1 parent 4463f16 commit b314c07
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
Expand Up @@ -123,9 +123,7 @@ public function removeAllAction()
$this->translate('Confirm removal of %d downtimes.'),
count($this->downtimes)
));
$delDowntimeForm->setDowntimes($this->downtimes)
->setRedirectUrl(Url::fromPath('monitoring/list/downtimes'))
->handleRequest();
$delDowntimeForm->setDowntimes($this->downtimes)->handleRequest();
$this->view->delDowntimeForm = $delDowntimeForm;
}
}
6 changes: 4 additions & 2 deletions modules/monitoring/application/controllers/ListController.php
Expand Up @@ -3,7 +3,7 @@

use Icinga\Module\Monitoring\Controller;
use Icinga\Module\Monitoring\Backend;
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentsCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm;
use Icinga\Web\Url;
use Icinga\Web\Widget\Tabextension\DashboardAction;
Expand Down Expand Up @@ -295,6 +295,7 @@ public function downtimesAction()

if ($this->Auth()->hasPermission('monitoring/command/downtime/delete')) {
$this->view->delDowntimeForm = new DeleteDowntimeCommandForm();
$this->view->delDowntimeForm->handleRequest();
}
}

Expand Down Expand Up @@ -501,7 +502,8 @@ public function commentsAction()
);

if ($this->Auth()->hasPermission('monitoring/command/comment/delete')) {
$this->view->delCommentForm = new DeleteCommentsCommandForm();
$this->view->delCommentForm = new DeleteCommentCommandForm();
$this->view->delCommentForm->handleRequest();
}
}

Expand Down
Expand Up @@ -86,11 +86,9 @@ if (count($comments) === 0) {
$delCommentForm->populate(
array(
'comment_id' => $comment->id,
'comment_is_service' => isset($comment->service_description),
'redirect' => $this->url
'comment_is_service' => isset($comment->service_description)
)
);
$delCommentForm->setAction($this->url('monitoring/comment/remove', array('comment_id' => $comment->id)));
echo $delCommentForm;
?>
</td>
Expand Down
Expand Up @@ -131,10 +131,9 @@ if (count($downtimes) === 0) {
$delDowntimeForm->populate(
array(
'downtime_id' => $downtime->id,
'redirect' => $this->url
'downtime_is_service' => isset($downtime->service_description)
)
);
$delDowntimeForm->setAction($this->url('monitoring/downtime/remove', array('downtime_id' => $downtime->id)));
echo $delDowntimeForm;
?>
</td>
Expand Down
Expand Up @@ -48,7 +48,12 @@ foreach ($object->comments as $comment) {
<td data-base-target="_self">
<?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
$delCommentForm = clone $delCommentForm;
$delCommentForm->populate(array('comment_id' => $comment->id));
$delCommentForm->populate(
array(
'comment_id' => $comment->id,
'comment_is_service' => isset($comment->service_description)
)
);
echo $delCommentForm;
} ?>
<span class="sr-only">(<?= $this->translate('Comment'); ?>): </span><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
Expand Down

0 comments on commit b314c07

Please sign in to comment.