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');
|
$this->render('resource/remove');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect target only for error-states
|
* Redirect target only for error-states
|
||||||
*
|
*
|
||||||
|
@ -526,7 +525,7 @@ class ConfigController extends BaseConfigController
|
||||||
public function configurationerrorAction()
|
public function configurationerrorAction()
|
||||||
{
|
{
|
||||||
$this->view->messageBox = new AlertMessageBox(true);
|
$this->view->messageBox = new AlertMessageBox(true);
|
||||||
$this->render('error/error');
|
$this->render('error/error', null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
<?php if ($this->message): ?>
|
||||||
<p><strong><?= $this->escape($message) ?></strong></p>
|
<p><strong><?= $this->escape($message) ?></strong></p>
|
||||||
|
<?php endif ?>
|
||||||
<?php if (isset($stackTrace)) : ?>
|
<?php if (isset($stackTrace)) : ?>
|
||||||
<hr />
|
<hr />
|
||||||
<pre><?= $this->escape($stackTrace) ?></pre>
|
<pre><?= $this->escape($stackTrace) ?></pre>
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Zend_Log;
|
use Zend_Log;
|
||||||
use Zend_Form;
|
use Zend_Form;
|
||||||
use Zend_View_Abstract;
|
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
use Icinga\User\Message;
|
use Icinga\User\Message;
|
||||||
use Icinga\Web\Session;
|
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
|
* but this is done lazily when render() is called, to ensure that messages will
|
||||||
* always be displayed before they are cleared.
|
* 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
|
* 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(
|
private $states = array(
|
||||||
Zend_Log::INFO => array(
|
Zend_Log::INFO => array(
|
||||||
'state' => 'alert-success',
|
'state' => 'alert-success',
|
||||||
'icon' => 'icinga-icon-success'
|
'icon' => 'success.png'
|
||||||
),
|
),
|
||||||
Zend_Log::NOTICE => array(
|
Zend_Log::NOTICE => array(
|
||||||
'state' => 'alert-info',
|
'state' => 'alert-info',
|
||||||
'icon' => 'icinga-icon-info'
|
'icon' => 'info.png'
|
||||||
),
|
),
|
||||||
Zend_Log::WARN => array(
|
Zend_Log::WARN => array(
|
||||||
'state' => 'alert-warning',
|
'state' => 'alert-warning',
|
||||||
'icon' => 'icinga-icon-warning'
|
'icon' => 'warning.png'
|
||||||
),
|
),
|
||||||
Zend_Log::ERR => array(
|
Zend_Log::ERR => array(
|
||||||
'state' => 'alert-danger',
|
'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];
|
$alert = $this->states[$level];
|
||||||
$html .= '<div class="alert ' . $alert['state']. '">' .
|
$html .= '<div class="alert ' . $alert['state']. '">' .
|
||||||
'<i class="' . $alert['icon'] . '"></i>' .
|
$this->view()->icon($alert['icon']) .
|
||||||
'<strong>' . htmlspecialchars($message->getMessage()) . '</strong>' .
|
'<strong>' . htmlspecialchars($message->getMessage()) . '</strong>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue