Widget\AlertMessageBox: fix broken widget
This widget is pretty useless as the error view script can to it's job. Interestingly nobody missed it, even the render() call was wrong. I guess we will remove this soon, but for now it's fixed. Looks ugly, but works.
This commit is contained in:
parent
219869607d
commit
b7b99cfd67
|
@ -516,7 +516,6 @@ class ConfigController extends BaseConfigController
|
|||
$this->render('resource/remove');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect target only for error-states
|
||||
*
|
||||
|
@ -526,7 +525,7 @@ class ConfigController extends BaseConfigController
|
|||
public function configurationerrorAction()
|
||||
{
|
||||
$this->view->messageBox = new AlertMessageBox(true);
|
||||
$this->render('error/error');
|
||||
$this->render('error/error', null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content">
|
||||
<?php if ($this->message): ?>
|
||||
<p><strong><?= $this->escape($message) ?></strong></p>
|
||||
<?php endif ?>
|
||||
<?php if (isset($stackTrace)) : ?>
|
||||
<hr />
|
||||
<pre><?= $this->escape($stackTrace) ?></pre>
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Icinga\Web\Widget;
|
|||
|
||||
use Zend_Log;
|
||||
use Zend_Form;
|
||||
use Zend_View_Abstract;
|
||||
use Icinga\User;
|
||||
use Icinga\User\Message;
|
||||
use Icinga\Web\Session;
|
||||
|
@ -18,7 +17,7 @@ use Icinga\Authentication\Manager as AuthenticationManager;
|
|||
* but this is done lazily when render() is called, to ensure that messages will
|
||||
* always be displayed before they are cleared.
|
||||
*/
|
||||
class AlertMessageBox implements \Icinga\Web\Widget\Widget
|
||||
class AlertMessageBox extends AbstractWidget
|
||||
{
|
||||
/**
|
||||
* Remove all messages from the current user, return them and commit
|
||||
|
@ -56,19 +55,19 @@ class AlertMessageBox implements \Icinga\Web\Widget\Widget
|
|||
private $states = array(
|
||||
Zend_Log::INFO => array(
|
||||
'state' => 'alert-success',
|
||||
'icon' => 'icinga-icon-success'
|
||||
'icon' => 'success.png'
|
||||
),
|
||||
Zend_Log::NOTICE => array(
|
||||
'state' => 'alert-info',
|
||||
'icon' => 'icinga-icon-info'
|
||||
'icon' => 'info.png'
|
||||
),
|
||||
Zend_Log::WARN => array(
|
||||
'state' => 'alert-warning',
|
||||
'icon' => 'icinga-icon-warning'
|
||||
'icon' => 'warning.png'
|
||||
),
|
||||
Zend_Log::ERR => array(
|
||||
'state' => 'alert-danger',
|
||||
'icon' => 'icinga-icon-danger'
|
||||
'icon' => 'error.png'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -123,7 +122,7 @@ class AlertMessageBox implements \Icinga\Web\Widget\Widget
|
|||
}
|
||||
$alert = $this->states[$level];
|
||||
$html .= '<div class="alert ' . $alert['state']. '">' .
|
||||
'<i class="' . $alert['icon'] . '"></i>' .
|
||||
$this->view()->icon($alert['icon']) .
|
||||
'<strong>' . htmlspecialchars($message->getMessage()) . '</strong>' .
|
||||
'</div>';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue