parent
d18d05ccee
commit
47405127d0
|
@ -43,6 +43,20 @@ class ApplicationConfigForm extends Form
|
|||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
'global_show_application_state_messages',
|
||||
array(
|
||||
'required' => true,
|
||||
'value' => true,
|
||||
'label' => $this->translate('Show Application State Messages'),
|
||||
'description' => $this->translate(
|
||||
"Set whether to show application state messages."
|
||||
. " This can also be set in a user's preferences."
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'text',
|
||||
'global_module_path',
|
||||
|
|
|
@ -233,6 +233,23 @@ class PreferenceForm extends Form
|
|||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'select',
|
||||
'show_application_state_messages',
|
||||
array(
|
||||
'required' => true,
|
||||
'label' => $this->translate('Show application state messages'),
|
||||
'description' => $this->translate('Whether to show application state messages.'),
|
||||
'multiOptions' => [
|
||||
'system' => (bool) Config::app()->get('global', 'show_application_state_messages', true)
|
||||
? $this->translate('System (Yes)')
|
||||
: $this->translate('System (No)'),
|
||||
1 => $this->translate('Yes'),
|
||||
0 => $this->translate('No')],
|
||||
'value' => 'system'
|
||||
)
|
||||
);
|
||||
|
||||
if (Auth::getInstance()->hasPermission('application/stacktraces')) {
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
namespace Icinga\Web\Widget;
|
||||
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Application\Hook\ApplicationStateHook;
|
||||
use Icinga\Authentication\Auth;
|
||||
use Icinga\Forms\AcknowledgeApplicationStateMessageForm;
|
||||
use Icinga\Web\ApplicationStateCookie;
|
||||
use Icinga\Web\Helper\HtmlPurifier;
|
||||
|
@ -33,6 +35,19 @@ class ApplicationStateMessages extends AbstractWidget
|
|||
|
||||
public function render()
|
||||
{
|
||||
$enabled = Auth::getInstance()
|
||||
->getUser()
|
||||
->getPreferences()
|
||||
->getValue('icingaweb', 'show_application_state_messages', 'system');
|
||||
|
||||
if ($enabled === 'system') {
|
||||
$enabled = Config::app()->get('global', 'show_application_state_messages', true);
|
||||
}
|
||||
|
||||
if (! (bool) $enabled) {
|
||||
return '<div style="display: none;"></div>';
|
||||
}
|
||||
|
||||
$active = $this->getMessages();
|
||||
|
||||
if (empty($active)) {
|
||||
|
|
Loading…
Reference in New Issue