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(
|
$this->addElement(
|
||||||
'text',
|
'text',
|
||||||
'global_module_path',
|
'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')) {
|
if (Auth::getInstance()->hasPermission('application/stacktraces')) {
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'checkbox',
|
'checkbox',
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
|
use Icinga\Application\Config;
|
||||||
use Icinga\Application\Hook\ApplicationStateHook;
|
use Icinga\Application\Hook\ApplicationStateHook;
|
||||||
|
use Icinga\Authentication\Auth;
|
||||||
use Icinga\Forms\AcknowledgeApplicationStateMessageForm;
|
use Icinga\Forms\AcknowledgeApplicationStateMessageForm;
|
||||||
use Icinga\Web\ApplicationStateCookie;
|
use Icinga\Web\ApplicationStateCookie;
|
||||||
use Icinga\Web\Helper\HtmlPurifier;
|
use Icinga\Web\Helper\HtmlPurifier;
|
||||||
|
@ -33,6 +35,19 @@ class ApplicationStateMessages extends AbstractWidget
|
||||||
|
|
||||||
public function render()
|
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();
|
$active = $this->getMessages();
|
||||||
|
|
||||||
if (empty($active)) {
|
if (empty($active)) {
|
||||||
|
|
Loading…
Reference in New Issue