[icinga-checkins] icinga.org: icingaweb2/master: LoggingConfigForm: only display the Syslog facility option if logging to Syslog

git at icinga.org git at icinga.org
Fri Nov 4 17:21:05 CET 2016


Module: icingaweb2
Branch: master
Commit: 1045d9138925d5428c2c2ca833bf53fb6f018410
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=1045d9138925d5428c2c2ca833bf53fb6f018410

Author: Alexander A. Klimov <alexander.klimov at icinga.com>
Date:   Fri Nov  4 17:19:35 2016 +0100

LoggingConfigForm: only display the Syslog facility option if logging to Syslog

---

 .../forms/Config/General/LoggingConfigForm.php     |   48 ++++++++++----------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/application/forms/Config/General/LoggingConfigForm.php b/application/forms/Config/General/LoggingConfigForm.php
index 4658877..e1b0e13 100644
--- a/application/forms/Config/General/LoggingConfigForm.php
+++ b/application/forms/Config/General/LoggingConfigForm.php
@@ -94,29 +94,31 @@ class LoggingConfigForm extends Form
                 )
             );
 
-            if (Platform::isWindows()) {
-                /* @see https://secure.php.net/manual/en/function.openlog.php */
-                $this->addElement(
-                    'hidden',
-                    'logging_facility',
-                    array(
-                        'value'     => 'user',
-                        'disabled'  => true
-                    )
-                );
-            } else {
-                $facilities = array_keys(SyslogWriter::$facilities);
-                $this->addElement(
-                    'select',
-                    'logging_facility',
-                    array(
-                        'required'      => true,
-                        'label'         => $this->translate('Facility'),
-                        'description'   => $this->translate('The syslog facility to utilize.'),
-                        'value'         => 'user',
-                        'multiOptions'  => array_combine($facilities, $facilities)
-                    )
-                );
+            if (! isset($formData['logging_log']) || $formData['logging_log'] === 'syslog') {
+                if (Platform::isWindows()) {
+                    /* @see https://secure.php.net/manual/en/function.openlog.php */
+                    $this->addElement(
+                        'hidden',
+                        'logging_facility',
+                        array(
+                            'value' => 'user',
+                            'disabled' => true
+                        )
+                    );
+                } else {
+                    $facilities = array_keys(SyslogWriter::$facilities);
+                    $this->addElement(
+                        'select',
+                        'logging_facility',
+                        array(
+                            'required' => true,
+                            'label' => $this->translate('Facility'),
+                            'description' => $this->translate('The syslog facility to utilize.'),
+                            'value' => 'user',
+                            'multiOptions' => array_combine($facilities, $facilities)
+                        )
+                    );
+                }
             }
         } elseif (isset($formData['logging_log']) && $formData['logging_log'] === 'file') {
             $this->addElement(



More information about the icinga-checkins mailing list