From 3961a447693b8300e490042dc2abb020041735f7 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Mon, 12 Jan 2015 10:38:37 +0100 Subject: [PATCH 01/41] setup-welcome: fix cli doc * `createDirectory` does not exist, this should be `direcotory`. * For changing the group option `--group` must be used. * Default config directory is `/etc/icingaweb2` not `/etc/icingaweb`. Signed-off-by: Eric Lippmann --- .../setup/application/views/scripts/form/setup-welcome.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setup/application/views/scripts/form/setup-welcome.phtml b/modules/setup/application/views/scripts/form/setup-welcome.phtml index 9aad09dbc..8d3ba67c5 100644 --- a/modules/setup/application/views/scripts/form/setup-welcome.phtml +++ b/modules/setup/application/views/scripts/form/setup-welcome.phtml @@ -46,7 +46,7 @@ $cliPath = realpath(Icinga::app()->getApplicationDir() . '/../bin/icingacli'); ); ?>

- setup config createDirectory ; + setup config directory --group ; setup token create;

From e2667dfb63a40d360ebb1185a8aa7d2f97808f3b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 13 Jan 2015 13:08:09 +0100 Subject: [PATCH 02/41] doc: Use icingaweb2 as directory instead of icingaweb --- doc/installation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index 6eb6737ec..6928cb2e3 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -38,7 +38,7 @@ git clone git://git.icinga.org/icingaweb2.git Choose a target directory and move Icinga Web 2 there. ```` -mv icingaweb2 /usr/share/icingaweb +mv icingaweb2 /usr/share/icingaweb2 ```` **Step 3: Configuring the Web Server** @@ -48,13 +48,13 @@ Use `icingacli` to generate web server configuration for either Apache or nginx. *Apache* ```` -./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb/public +./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public ```` *nginx* ```` -./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb/public +./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public ```` **Step 4: Web Setup** From 4971037b379c173b4934d4531f1bdd70aac6358c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 14 Jan 2015 13:24:04 +0100 Subject: [PATCH 03/41] doc/installation: Add section Preparing Web Setup --- doc/installation.md | 58 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index 6928cb2e3..c4496cbf4 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -45,18 +45,66 @@ mv icingaweb2 /usr/share/icingaweb2 Use `icingacli` to generate web server configuration for either Apache or nginx. -*Apache* - +Apache: ```` ./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public ```` -*nginx* - +nginx: ```` ./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public ```` -**Step 4: Web Setup** +**Step 4: Preparing Web Setup** + +Because both web and CLI must have access to configuration and logs, permissions will be managed using a special +system group. The web server user and CLI user have to be added to this system group. + +Add the system group `icingaweb2` in the first place. + +Fedora, RHEL, CentOS, SLES and OpenSUSE: +```` +groupadd -r icingaweb2 +```` + +Debian and Ubuntu: +```` +addgroup --system icingaweb2 +```` + +Add your web server's user to the system group `icingaweb2`: + +Fedora, RHEL and CentOS: +```` +usermod -a -G icingaweb2 apache +```` + +SLES and OpenSUSE: +```` +usermod -G icingaweb2 wwwrun +```` + +Debian and Ubuntu: +```` +usermod -a -G icingaweb2 wwwrun +```` + +Use `icingacli` to create the configuration directory which defaults to **/etc/icingaweb2**: +```` +./bin/icingacli setup config directory +```` + +When using the web setup you are required to authenticate using a token. In order to generate a token use the +`icingacli`: +```` +./bin/icingacli setup token create +```` + +In case you do not remember the token you can show it using the `icingacli`: +```` +./bin/icingacli setup token show +```` + +**Step 5: Web Setup** Visit Icinga Web 2 in your browser and complete installation using the web setup. From b983f1901ba093ccd8433073db4a113e8e672651 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 14 Jan 2015 13:24:31 +0100 Subject: [PATCH 04/41] modules: Fix that the forms namespace is not registered when the module does not have any library file --- library/Icinga/Application/Modules/Module.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index 99722f2b6..96bbae7be 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -759,15 +759,15 @@ class Module protected function registerAutoloader() { $moduleName = ucfirst($this->getName()); + $moduleLibraryDir = $this->getLibDir(). '/'. $moduleName; - if (is_dir($this->getBaseDir()) && is_dir($this->getLibDir()) && is_dir($moduleLibraryDir)) { + if (is_dir($moduleLibraryDir)) { $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName, $moduleLibraryDir); - if (is_dir($this->getFormDir())) { - $this->app->getLoader()->registerNamespace( - 'Icinga\\Module\\' . $moduleName. '\\Forms', - $this->getFormDir() - ); - } + } + + $moduleFormDir = $this->getFormDir(); + if (is_dir($moduleFormDir)) { + $this->app->getLoader()->registerNamespace('Icinga\\Module\\' . $moduleName. '\\Forms', $moduleFormDir); } return $this; From b8288b28a7717e752250f29041521ddeb5ffa80c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 14 Jan 2015 14:14:44 +0100 Subject: [PATCH 05/41] doc/installation: Add PHP gettext and PHP OpenSSL support as requirement --- doc/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/installation.md b/doc/installation.md index c4496cbf4..def23ffaf 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -6,7 +6,7 @@ system and distribution you are running. But it is also possible to install Icin ## Installing Requirements * A web server, e.g. Apache or nginx -* PHP >= 5.3.0 +* PHP >= 5.3.0 w/ gettext and OpenSSL support * MySQL or PostgreSQL PHP libraries when using a database for authentication or storing user preferences into a database * LDAP PHP library when using Active Directory or LDAP for authentication * Icinga 1.x w/ Livestatus or IDO, Icinga 2 w/ Livestatus or IDO feature enabled From 37880c6c89dec056ae1d61377afb05c746a03d67 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 14 Jan 2015 14:15:24 +0100 Subject: [PATCH 06/41] rpm: Support SUSE packages resolves #6403 --- icingaweb2.spec | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/icingaweb2.spec b/icingaweb2.spec index b4d120923..b77f42d86 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -29,6 +29,20 @@ Packager: Icinga Team %endif %endif + +%if 0%{?suse_version} +%define wwwconfigdir %{_sysconfdir}/apache2/conf.d +%define wwwuser wwwrun +%define zend php5-ZendFramework +%if 0%{?suse_version} == 1110 +%define php php53 +Requires: apache2-mod_php53 +%else +%define php php5 +Requires: apache2-mod_php5 +%endif +%endif + Requires(pre): shadow-utils Requires: %{name}-common = %{version}-%{release} Requires: php-Icinga = %{version}-%{release} @@ -61,21 +75,23 @@ Common files for Icinga Web 2 and the Icinga CLI %package -n php-Icinga -Summary: Icinga Web 2 PHP library -Group: Development/Libraries -Requires: %{php} >= 5.3.0 +Summary: Icinga Web 2 PHP library +Group: Development/Libraries +Requires: %{php} >= 5.3.0 +%{?suse_version:Requires: %{php}-gettext %{php}-openssl} %description -n php-Icinga Icinga Web 2 PHP library %package -n icingacli -Summary: Icinga CLI -Group: Applications/System -Requires: %{name}-common = %{version}-%{release} -Requires: php-Icinga = %{version}-%{release} -Requires: %{php_cli} >= 5.3.0 -%{?rhel:Requires: bash-completion} +Summary: Icinga CLI +Group: Applications/System +Requires: %{name}-common = %{version}-%{release} +Requires: php-Icinga = %{version}-%{release} +%{?suse_version:Requires: %{php} >= 5.3.0} +%{?rhel:Requires: %{php_cli} >= 5.3.0} +%{?rhel:Requires: bash-completion} %description -n icingacli Icinga CLI @@ -168,7 +184,11 @@ cp -prv etc/schema %{buildroot}/%{_datadir}/doc/%{name} %pre getent group icingacmd >/dev/null || groupadd -r icingacmd +%if 0%{?suse_version} +usermod -G icingacmd,%{icingawebgroup} %{wwwuser} +%else usermod -a -G icingacmd,%{icingawebgroup} %{wwwuser} +%endif exit 0 %clean From 35e090c17eef7e2525c97e7061b207e063f16ff4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 13:12:10 +0100 Subject: [PATCH 07/41] monitoring: Support format query parameters for process/info --- .../monitoring/application/controllers/ProcessController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/controllers/ProcessController.php b/modules/monitoring/application/controllers/ProcessController.php index 62334d7e8..bb5a4e5c2 100644 --- a/modules/monitoring/application/controllers/ProcessController.php +++ b/modules/monitoring/application/controllers/ProcessController.php @@ -64,8 +64,9 @@ class Monitoring_ProcessController extends Controller 'process_performance_data' ) ) - ->getQuery() - ->fetchRow(); + ->getQuery(); + $this->handleFormatRequest($programStatus); + $programStatus = $programStatus->fetchRow(); if ($programStatus === false) { return $this->render('not-running', true, null); } From e93e8f633045d7fd0f844e797848d4d6fe32ca9e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 13:13:13 +0100 Subject: [PATCH 08/41] setup: Convert octal directory mode to decimal notation PHP's chmod sets wrong permissions when using 2770 as directory mode for example. fixes #8233 --- modules/setup/library/Setup/Utils/MakeDirStep.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/setup/library/Setup/Utils/MakeDirStep.php b/modules/setup/library/Setup/Utils/MakeDirStep.php index b758ccd79..27919820b 100644 --- a/modules/setup/library/Setup/Utils/MakeDirStep.php +++ b/modules/setup/library/Setup/Utils/MakeDirStep.php @@ -16,12 +16,12 @@ class MakeDirStep extends Step /** * @param array $paths - * @param int $dirmode + * @param int $dirmode Directory mode in octal notation */ public function __construct($paths, $dirmode) { $this->paths = $paths; - $this->dirmode = $dirmode; + $this->dirmode = octdec($dirmode); $this->errors = array(); } From a6861789bb668877fb4a1101ab3dcb97fe4a80bf Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:00:44 +0100 Subject: [PATCH 09/41] lib: Remove superfluous return false from IdoQuery --- .../monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index 4682487d2..0b505cd73 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -292,7 +292,6 @@ abstract class IdoQuery extends DbQuery $mapped = $this->getMappedField($field); if ($mapped === null) { return stripos($field, 'UNIX_TIMESTAMP') !== false; - return false; } return stripos($mapped, 'UNIX_TIMESTAMP') !== false; } From dae3ccd90cf040fc4add11b12e51049491affbce Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:02:35 +0100 Subject: [PATCH 10/41] monitoring: Take status_update_time into account when is_currently_running is 1 fixes #8210 --- .../Backend/Ido/Query/ProgramstatusQuery.php | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ProgramstatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ProgramstatusQuery.php index e6abd4f77..989c2b698 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ProgramstatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ProgramstatusQuery.php @@ -11,17 +11,27 @@ class ProgramstatusQuery extends IdoQuery { protected $columnMap = array( 'programstatus' => array( - 'id' => 'programstatus_id', - 'status_update_time' => 'UNIX_TIMESTAMP(status_update_time)', - 'program_start_time' => 'UNIX_TIMESTAMP(program_start_time)', - 'program_end_time' => 'UNIX_TIMESTAMP(program_end_time)', - 'is_currently_running' => 'is_currently_running', + 'id' => 'programstatus_id', + 'status_update_time' => 'UNIX_TIMESTAMP(programstatus.status_update_time)', + 'program_start_time' => 'UNIX_TIMESTAMP(programstatus.program_start_time)', + 'program_end_time' => 'UNIX_TIMESTAMP(programstatus.program_end_time)', + 'is_currently_running' => 'CASE WHEN (programstatus.is_currently_running = 0) + THEN + 0 + ELSE + CASE WHEN (UNIX_TIMESTAMP(programstatus.status_update_time) + 60 > UNIX_TIMESTAMP(NOW())) + THEN + 1 + ELSE + 0 + END + END', 'process_id' => 'process_id', 'daemon_mode' => 'daemon_mode', - 'last_command_check' => 'UNIX_TIMESTAMP(last_command_check)', - 'last_log_rotation' => 'UNIX_TIMESTAMP(last_log_rotation)', + 'last_command_check' => 'UNIX_TIMESTAMP(programstatus.last_command_check)', + 'last_log_rotation' => 'UNIX_TIMESTAMP(programstatus.last_log_rotation)', 'notifications_enabled' => 'notifications_enabled', - 'disable_notif_expire_time' => 'UNIX_TIMESTAMP(disable_notif_expire_time)', + 'disable_notif_expire_time' => 'UNIX_TIMESTAMP(programstatus.disable_notif_expire_time)', 'active_service_checks_enabled' => 'active_service_checks_enabled', 'passive_service_checks_enabled' => 'passive_service_checks_enabled', 'active_host_checks_enabled' => 'active_host_checks_enabled', From 09d5ec6b7a097fcc65a32e8c9272440c64b52882 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:05:50 +0100 Subject: [PATCH 11/41] postgres: Return 0 if a timestamp looks like the default timestamp The PostgreSQL IDO schema sets the default value for timestamps with time zone to the epoch time w/o giving the time zone +00. Thus default timestamps are always wrong when using a time zone other than 'UTC'. refs #7919 --- .../library/Monitoring/Backend/Ido/Query/IdoQuery.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index 0b505cd73..f2e5bd15f 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -323,6 +323,11 @@ abstract class IdoQuery extends DbQuery foreach ($columns as $key => & $value) { $value = preg_replace('/ COLLATE .+$/', '', $value); $value = preg_replace('/inet_aton\(([[:word:].]+)\)/i', '$1::inet - \'0.0.0.0\'', $value); + $value = preg_replace( + '/(UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\)))/i', + 'CASE WHEN ($1 = EXTRACT(TIMEZONE FROM NOW()) * -1) THEN 0 ELSE $1 END', + $value + ); } } } From bab92b1b16bfec9fd7bae6b3783b163cbf4196b4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:38:22 +0100 Subject: [PATCH 12/41] rpm: Use a macro for the docs directory refs #4075 --- icingaweb2.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/icingaweb2.spec b/icingaweb2.spec index b77f42d86..4fa670333 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -64,6 +64,7 @@ Icinga Web 2 %define logdir %{_localstatedir}/log/%{name} %define phpdir %{_datadir}/php %define icingawebgroup icingaweb2 +%define docsdir %{_datadir}/doc/%{name} %package common @@ -170,7 +171,7 @@ Icinga Web 2 vendor library Zend %install rm -rf %{buildroot} -mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir},%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{_datadir}/doc/%{name}} +mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir},%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{docsdir}} cp -prv application doc %{buildroot}/%{basedir} cp -pv etc/bash_completion.d/icingacli %{buildroot}/%{_sysconfdir}/bash_completion.d/icingacli cp -prv modules/{monitoring,setup} %{buildroot}/%{basedir}/modules @@ -180,7 +181,7 @@ cp -prv public/{css,img,js,error_norewrite.html} %{buildroot}/%{basedir}/public cp -pv packages/files/apache/icingaweb2.conf %{buildroot}/%{wwwconfigdir}/icingaweb2.conf cp -pv packages/files/bin/icingacli %{buildroot}/%{bindir} cp -pv packages/files/public/index.php %{buildroot}/%{basedir}/public -cp -prv etc/schema %{buildroot}/%{_datadir}/doc/%{name} +cp -prv etc/schema %{buildroot}/%{docsdir} %pre getent group icingacmd >/dev/null || groupadd -r icingacmd @@ -206,8 +207,8 @@ rm -rf %{buildroot} %{basedir}/public %{wwwconfigdir}/icingaweb2.conf %attr(2775,root,%{icingawebgroup}) %dir %{logdir} -%{_datadir}/doc/%{name} -%docdir %{_datadir}/doc/%{name} +%{docsdir} +%docdir %{docsdir} %pre common From 970006838cb2791091dfb2632b1c7eea9d4a243f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 19 Jan 2015 10:49:02 +0100 Subject: [PATCH 13/41] Replace t() and mt() with translate() in the monitoring module's forms refs #7551 --- .../DisableNotificationsExpireCommandForm.php | 11 ++-- .../ToggleInstanceFeaturesCommandForm.php | 28 +++++----- .../Object/AcknowledgeProblemCommandForm.php | 34 ++++++------ .../Command/Object/AddCommentCommandForm.php | 13 ++--- .../Command/Object/CheckNowCommandForm.php | 4 +- .../Object/DeleteCommentCommandForm.php | 4 +- .../Object/DeleteDowntimeCommandForm.php | 4 +- .../Object/ProcessCheckResultCommandForm.php | 30 +++++------ .../Object/ScheduleHostCheckCommandForm.php | 5 +- .../ScheduleHostDowntimeCommandForm.php | 16 +++--- .../ScheduleServiceCheckCommandForm.php | 17 +++--- .../ScheduleServiceDowntimeCommandForm.php | 34 ++++++------ .../ToggleObjectFeaturesCommandForm.php | 16 +++--- .../Config/Instance/LocalInstanceForm.php | 4 +- .../Config/Instance/RemoteInstanceForm.php | 16 +++--- .../RemoteInstanceKeyResourcePage.php | 54 +++++++++++++++++++ .../forms/Config/InstanceConfigForm.php | 34 ++++++------ .../forms/Config/SecurityConfigForm.php | 8 +-- .../application/forms/EventOverviewForm.php | 10 ++-- .../application/forms/Setup/BackendPage.php | 15 +++--- .../forms/Setup/IdoResourcePage.php | 11 ++-- .../application/forms/Setup/InstancePage.php | 5 +- .../forms/Setup/LivestatusResourcePage.php | 11 ++-- .../application/forms/Setup/SecurityPage.php | 5 +- .../application/forms/Setup/WelcomePage.php | 10 ++-- .../application/forms/StatehistoryForm.php | 42 +++++++-------- 26 files changed, 237 insertions(+), 204 deletions(-) create mode 100644 modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php diff --git a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php index 0e64a4b03..21d926b58 100644 --- a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php @@ -21,7 +21,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm */ public function init() { - $this->setSubmitLabel(mt('monitoring', 'Disable Notifications')); + $this->setSubmitLabel($this->translate('Disable Notifications')); } /** @@ -30,8 +30,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to disable host and service notifications for a specific time.' ); } @@ -49,8 +48,8 @@ class DisableNotificationsExpireCommandForm extends CommandForm 'expire_time', array( 'required' => true, - 'label' => mt('monitoring', 'Expire Time'), - 'description' => mt('monitoring', 'Set the expire time.'), + 'label' => $this->translate('Expire Time'), + 'description' => $this->translate('Set the expire time.'), 'value' => $expireTime ) ); @@ -67,7 +66,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm $disableNotifications ->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp()); $this->getTransport($this->request)->send($disableNotifications); - Notification::success(mt('monitoring', 'Disabling host and service notifications..')); + Notification::success($this->translate('Disabling host and service notifications..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php index 291619b2f..469c1b6eb 100644 --- a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php @@ -61,13 +61,13 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm if ((bool) $this->status->notifications_enabled) { $notificationDescription = sprintf( '%s', - mt('monitoring', 'Disable notifications for a specific time on a program-wide basis'), + $this->translate('Disable notifications for a specific time on a program-wide basis'), $this->getView()->href('monitoring/process/disable-notifications'), - mt('monitoring', 'Disable temporarily') + $this->translate('Disable temporarily') ); } elseif ($this->status->disable_notif_expire_time) { $notificationDescription = sprintf( - mt('monitoring', 'Notifications will be re-enabled in %s'), + $this->translate('Notifications will be re-enabled in %s'), $this->getView()->timeUntil($this->status->disable_notif_expire_time) ); } else { @@ -78,7 +78,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS, array( - 'label' => mt('monitoring', 'Active Host Checks Being Executed'), + 'label' => $this->translate('Active Host Checks Being Executed'), 'autosubmit' => true ) ), @@ -86,7 +86,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS, array( - 'label' => mt('monitoring', 'Active Service Checks Being Executed'), + 'label' => $this->translate('Active Service Checks Being Executed'), 'autosubmit' => true ) ), @@ -94,7 +94,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS, array( - 'label' => mt('monitoring', 'Event Handlers Enabled'), + 'label' => $this->translate('Event Handlers Enabled'), 'autosubmit' => true ) ), @@ -102,7 +102,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION, array( - 'label' => mt('monitoring', 'Flap Detection Enabled'), + 'label' => $this->translate('Flap Detection Enabled'), 'autosubmit' => true ) ), @@ -110,7 +110,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_NOTIFICATIONS, array( - 'label' => mt('monitoring', 'Notifications Enabled'), + 'label' => $this->translate('Notifications Enabled'), 'autosubmit' => true, 'description' => $notificationDescription, 'decorators' => array( @@ -129,7 +129,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING, array( - 'label' => mt('monitoring', 'Obsessing Over Hosts'), + 'label' => $this->translate('Obsessing Over Hosts'), 'autosubmit' => true ) ), @@ -137,7 +137,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING, array( - 'label' => mt('monitoring', 'Obsessing Over Services'), + 'label' => $this->translate('Obsessing Over Services'), 'autosubmit' => true ) ), @@ -145,7 +145,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS, array( - 'label' => mt('monitoring', 'Passive Host Checks Being Accepted'), + 'label' => $this->translate('Passive Host Checks Being Accepted'), 'autosubmit' => true ) ), @@ -153,7 +153,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS, array( - 'label' => mt('monitoring', 'Passive Service Checks Being Accepted'), + 'label' => $this->translate('Passive Service Checks Being Accepted'), 'autosubmit' => true ) ), @@ -161,7 +161,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA, array( - 'label' => mt('monitoring', 'Performance Data Being Processed'), + 'label' => $this->translate('Performance Data Being Processed'), 'autosubmit' => true ) ) @@ -198,7 +198,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm ->setEnabled($enabled); $this->getTransport($this->request)->send($toggleFeature); } - Notification::success(mt('monitoring', 'Toggling feature..')); + Notification::success($this->translate('Toggling feature..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php index 25ac76c25..df3731837 100644 --- a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php @@ -31,8 +31,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to acknowledge host or service problems. When a problem is acknowledged,' . ' future notifications about problems are temporarily disabled until the host or service' . ' recovers.' @@ -51,9 +50,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => mt('monitoring', 'Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Comment'), + 'description' => $this->translate( 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -64,9 +62,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'persistent', array( - 'label' => mt('monitoring', 'Persistent Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Persistent Comment'), + 'description' => $this->translate( 'If you would like the comment to remain even when the acknowledgement is removed, check this' . ' option.' ) @@ -76,8 +73,10 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'expire', array( - 'label' => mt('monitoring', 'Use Expire Time'), - 'description' => mt('monitoring', 'If the acknowledgement should expire, check this option.'), + 'label' => $this->translate('Use Expire Time'), + 'description' => $this->translate( + 'If the acknowledgement should expire, check this option.' + ), 'autosubmit' => true ) ) @@ -89,10 +88,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'dateTimePicker', 'expire_time', array( - 'label' => mt('monitoring', 'Expire Time'), + 'label' => $this->translate('Expire Time'), 'value' => $expireTime, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'Enter the expire date and time for this acknowledgement here. Icinga will delete the' . ' acknowledgement after this time expired.' ) @@ -114,10 +112,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'sticky', array( - 'label' => mt('monitoring', 'Sticky Acknowledgement'), + 'label' => $this->translate('Sticky Acknowledgement'), 'value' => true, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'If you want the acknowledgement to disable notifications until the host or service recovers,' . ' check this option.' ) @@ -127,10 +124,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'notify', array( - 'label' => mt('monitoring', 'Send Notification'), + 'label' => $this->translate('Send Notification'), 'value' => true, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,' . ' uncheck this option.' ) diff --git a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php index f5adf6c71..e7f7e91f9 100644 --- a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php @@ -29,8 +29,7 @@ class AddCommentCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to add host or service comments.' ); } @@ -47,9 +46,8 @@ class AddCommentCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => mt('monitoring', 'Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Comment'), + 'description' => $this->translate( 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -60,10 +58,9 @@ class AddCommentCommandForm extends ObjectsCommandForm 'checkbox', 'persistent', array( - 'label' => mt('monitoring', 'Persistent'), + 'label' => $this->translate('Persistent'), 'value' => true, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'If you uncheck this option, the comment will automatically be deleted the next time Icinga is' . ' restarted.' ) diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index 01006683f..1054aae05 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -35,8 +35,8 @@ class CheckNowCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'type' => 'submit', - 'value' => mt('monitoring', 'Check now'), - 'label' => ' ' . mt('monitoring', 'Check now'), + 'value' => $this->translate('Check now'), + 'label' => ' ' . $this->translate('Check now'), 'decorators' => array('ViewHelper'), 'escape' => false, 'class' => 'link-like' diff --git a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php index 3d85afcec..0f7858ad9 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php @@ -55,7 +55,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'label' => 'X', - 'title' => mt('monitoring', 'Delete comment'), + 'title' => $this->translate('Delete comment'), 'decorators' => array('ViewHelper') ) ); @@ -80,7 +80,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success(mt('monitoring', 'Deleting comment..')); + Notification::success($this->translate('Deleting comment..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php index 1c7095b82..43ca52b05 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php @@ -55,7 +55,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'label' => 'X', - 'title' => mt('monitoring', 'Delete downtime'), + 'title' => $this->translate('Delete downtime'), 'decorators' => array('ViewHelper') ) ); @@ -80,7 +80,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success(mt('monitoring', 'Deleting downtime..')); + Notification::success($this->translate('Deleting downtime..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php index 48ee00ab3..44e248956 100644 --- a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php @@ -29,8 +29,7 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to submit passive host or service check results.' ); } @@ -53,17 +52,17 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'status', array( 'required' => true, - 'label' => mt('monitoring', 'Status'), - 'description' => mt('monitoring', 'The state this check result should report'), + 'label' => $this->translate('Status'), + 'description' => $this->translate('The state this check result should report'), 'multiOptions' => $object->getType() === $object::TYPE_HOST ? array( - ProcessCheckResultCommand::HOST_UP => mt('monitoring', 'UP', 'icinga.state'), - ProcessCheckResultCommand::HOST_DOWN => mt('monitoring', 'DOWN', 'icinga.state'), - ProcessCheckResultCommand::HOST_UNREACHABLE => mt('monitoring', 'UNREACHABLE', 'icinga.state') + ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'), + ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state'), + ProcessCheckResultCommand::HOST_UNREACHABLE => $this->translate('UNREACHABLE', 'icinga.state') ) : array( - ProcessCheckResultCommand::SERVICE_OK => mt('monitoring', 'OK', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_WARNING => mt('monitoring', 'WARNING', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_CRITICAL => mt('monitoring', 'CRITICAL', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_UNKNOWN => mt('monitoring', 'UNKNOWN', 'icinga.state') + ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_UNKNOWN => $this->translate('UNKNOWN', 'icinga.state') ) ) ); @@ -72,8 +71,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'output', array( 'required' => true, - 'label' => mt('monitoring', 'Output'), - 'description' => mt('monitoring', 'The plugin output of this check result') + 'label' => $this->translate('Output'), + 'description' => $this->translate('The plugin output of this check result') ) ); $this->addElement( @@ -81,9 +80,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'perfdata', array( 'allowEmpty' => true, - 'label' => mt('monitoring', 'Performance Data'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Performance Data'), + 'description' => $this->translate( 'The performance data of this check result. Leave empty' . ' if this check result has no performance data' ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php index 82a9b2e52..949ec33e1 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php @@ -24,9 +24,8 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm 'checkbox', 'all_services', array( - 'label' => mt('monitoring', 'All Services'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('All Services'), + 'description' => $this->translate( 'Schedule check for all services on the hosts and the hosts themselves.' ) ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php index beb0793ef..f84069a9a 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php @@ -27,9 +27,8 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm 'checkbox', 'all_services', array( - 'label' => mt('monitoring', 'All Services'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('All Services'), + 'description' => $this->translate( 'Schedule downtime for all services on the hosts and the hosts themselves.' ) ) @@ -38,15 +37,14 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm 'select', 'child_hosts', array( - 'label' => mt('monitoring', 'Child Hosts'), + 'label' => $this->translate('Child Hosts'), 'required' => true, 'multiOptions' => array( - 0 => mt('monitoring', 'Do nothing with child hosts'), - 1 => mt('monitoring', 'Schedule triggered downtime for all child hosts'), - 2 => mt('monitoring', 'Schedule non-triggered downtime for all child hosts') + 0 => $this->translate('Do nothing with child hosts'), + 1 => $this->translate('Schedule triggered downtime for all child hosts'), + 2 => $this->translate('Schedule non-triggered downtime for all child hosts') ), - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'Define what should be done with the child hosts of the hosts.' ) ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php index 9e04a2254..b34472d49 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php @@ -32,8 +32,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to schedule the next check of hosts or services. Icinga will re-queue the' . ' hosts or services to be checked at the time you specify.' ); @@ -52,8 +51,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'note', 'command-info', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'This command is used to schedule the next check of hosts or services. Icinga will re-queue the' . ' hosts or services to be checked at the time you specify.' ) @@ -64,8 +62,10 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'check_time', array( 'required' => true, - 'label' => mt('monitoring', 'Check Time'), - 'description' => mt('monitoring', 'Set the date and time when the check should be scheduled.'), + 'label' => $this->translate('Check Time'), + 'description' => $this->translate( + 'Set the date and time when the check should be scheduled.' + ), 'value' => $checkTime ) ), @@ -73,9 +73,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'checkbox', 'force_check', array( - 'label' => mt('monitoring', 'Force Check'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Force Check'), + 'description' => $this->translate( 'If you select this option, Icinga will force a check regardless of both what time the' . ' scheduled check occurs and whether or not checks are enabled.' ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php index 9961d4b65..4f66898f6 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php @@ -42,8 +42,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to schedule host and service downtimes. During the specified downtime,' . ' Icinga will not send notifications out about the hosts and services. When the scheduled' . ' downtime expires, Icinga will send out notifications for the hosts and services as it' @@ -67,9 +66,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => mt('monitoring', 'Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Comment'), + 'description' => $this->translate( 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -81,8 +79,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'start', array( 'required' => true, - 'label' => mt('monitoring', 'Start Time'), - 'description' => mt('monitoring', 'Set the start date and time for the downtime.'), + 'label' => $this->translate('Start Time'), + 'description' => $this->translate('Set the start date and time for the downtime.'), 'value' => $start ) ), @@ -91,8 +89,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'end', array( 'required' => true, - 'label' => mt('monitoring', 'End Time'), - 'description' => mt('monitoring', 'Set the end date and time for the downtime.'), + 'label' => $this->translate('End Time'), + 'description' => $this->translate('Set the end date and time for the downtime.'), 'value' => $end ) ), @@ -102,17 +100,16 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm array( 'required' => true, 'autosubmit' => true, - 'label' => mt('monitoring', 'Type'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Type'), + 'description' => $this->translate( 'If you select the fixed option, the downtime will be in effect between the start and end' . ' times you specify whereas a flexible downtime starts when the host or service enters a' . ' problem state sometime between the start and end times you specified and lasts as long' . ' as the duration time you enter. The duration fields do not apply for fixed downtimes.' ), 'multiOptions' => array( - self::FIXED => mt('monitoring', 'Fixed'), - self::FLEXIBLE => mt('monitoring', 'Flexible') + self::FIXED => $this->translate('Fixed'), + self::FLEXIBLE => $this->translate('Flexible') ), 'validators' => array( array( @@ -141,7 +138,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'hours', array( 'required' => true, - 'label' => mt('monitoring', 'Hours'), + 'label' => $this->translate('Hours'), 'value' => 2, 'min' => -1 ) @@ -151,7 +148,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'minutes', array( 'required' => true, - 'label' => mt('monitoring', 'Minutes'), + 'label' => $this->translate('Minutes'), 'value' => 0, 'min' => -1 ) @@ -161,9 +158,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm array('hours', 'minutes'), 'duration', array( - 'legend' => mt('monitoring', 'Flexible Duration'), - 'description' => mt( - 'monitoring', + 'legend' => $this->translate('Flexible Duration'), + 'description' => $this->translate( 'Enter here the duration of the downtime. The downtime will be automatically deleted after this' . ' time expired.' ), diff --git a/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php index c33527895..bf0a1d8b1 100644 --- a/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php @@ -33,7 +33,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_ACTIVE_CHECKS, array( - 'label' => mt('monitoring', 'Active Checks'), + 'label' => $this->translate('Active Checks'), 'autosubmit' => true ) ), @@ -41,7 +41,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_PASSIVE_CHECKS, array( - 'label' => mt('monitoring', 'Passive Checks'), + 'label' => $this->translate('Passive Checks'), 'autosubmit' => true ) ), @@ -49,7 +49,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_OBSESSING, array( - 'label' => mt('monitoring', 'Obsessing'), + 'label' => $this->translate('Obsessing'), 'autosubmit' => true ) ), @@ -57,7 +57,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_NOTIFICATIONS, array( - 'label' => mt('monitoring', 'Notifications'), + 'label' => $this->translate('Notifications'), 'autosubmit' => true ) ), @@ -65,7 +65,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_EVENT_HANDLER, array( - 'label' => mt('monitoring', 'Event Handler'), + 'label' => $this->translate('Event Handler'), 'autosubmit' => true ) ), @@ -73,7 +73,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_FLAP_DETECTION, array( - 'label' => mt('monitoring', 'Flap Detection'), + 'label' => $this->translate('Flap Detection'), 'autosubmit' => true ) ) @@ -95,7 +95,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm $element = $this->getElement($feature); $element->setChecked($object->{$feature}); if ((bool) $object->{$feature . '_changed'} === true) { - $element->setDescription(mt('monitoring', 'changed')); + $element->setDescription($this->translate('changed')); } } return $this; @@ -120,7 +120,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm } } } - Notification::success(mt('monitoring', 'Toggling feature..')); + Notification::success($this->translate('Toggling feature..')); return true; } } diff --git a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php index daabe7e02..405bac144 100644 --- a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php @@ -28,9 +28,9 @@ class LocalInstanceForm extends Form 'path', array( 'required' => true, - 'label' => mt('monitoring', 'Command File'), + 'label' => $this->translate('Command File'), 'value' => '/var/run/icinga2/cmd/icinga2.cmd', - 'description' => mt('monitoring', 'Path to the local Icinga command file') + 'description' => $this->translate('Path to the local Icinga command file') ) ); return $this; diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index 7c55f655a..47b2a0316 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -29,8 +29,8 @@ class RemoteInstanceForm extends Form 'host', array( 'required' => true, - 'label' => mt('monitoring', 'Host'), - 'description' => mt('monitoring', + 'label' => $this->translate('Host'), + 'description' => $this->translate( 'Hostname or address of the remote Icinga instance' ) ) @@ -40,8 +40,8 @@ class RemoteInstanceForm extends Form 'port', array( 'required' => true, - 'label' => mt('monitoring', 'Port'), - 'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'), + 'label' => $this->translate('Port'), + 'description' => $this->translate('SSH port to connect to on the remote Icinga instance'), 'value' => 22 ) ), @@ -50,8 +50,8 @@ class RemoteInstanceForm extends Form 'user', array( 'required' => true, - 'label' => mt('monitoring', 'User'), - 'description' => mt('monitoring', + 'label' => $this->translate('User'), + 'description' => $this->translate( 'User to log in as on the remote Icinga instance. Please note that key-based SSH login must be' . ' possible for this user' ) @@ -62,9 +62,9 @@ class RemoteInstanceForm extends Form 'path', array( 'required' => true, - 'label' => mt('monitoring', 'Command File'), + 'label' => $this->translate('Command File'), 'value' => '/var/run/icinga2/cmd/icinga2.cmd', - 'description' => mt('monitoring', 'Path to the Icinga command file on the remote Icinga instance') + 'description' => $this->translate('Path to the Icinga command file on the remote Icinga instance') ) ) )); diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php new file mode 100644 index 000000000..454c67d47 --- /dev/null +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php @@ -0,0 +1,54 @@ +addElement( + 'button', + Wizard::BTN_NEXT, + array( + 'type' => 'submit', + 'value' => $pageName, + 'label' => $this->translate('Save Changes'), + 'decorators' => array('ViewHelper') + ) + ); + } + + public function addPreviousButton($pageName) + { + + } +} diff --git a/modules/monitoring/application/forms/Config/InstanceConfigForm.php b/modules/monitoring/application/forms/Config/InstanceConfigForm.php index b89e48c0a..5618f27ee 100644 --- a/modules/monitoring/application/forms/Config/InstanceConfigForm.php +++ b/modules/monitoring/application/forms/Config/InstanceConfigForm.php @@ -25,7 +25,7 @@ class InstanceConfigForm extends ConfigForm public function init() { $this->setName('form_config_monitoring_instance'); - $this->setSubmitLabel(mt('monitoring', 'Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -48,7 +48,7 @@ class InstanceConfigForm extends ConfigForm break; default: throw new InvalidArgumentException( - sprintf(mt('monitoring', 'Invalid instance type "%s" given'), $type) + sprintf($this->translate('Invalid instance type "%s" given'), $type) ); } return $form; @@ -69,10 +69,10 @@ class InstanceConfigForm extends ConfigForm { $name = isset($values['name']) ? $values['name'] : ''; if (! $name) { - throw new InvalidArgumentException(mt('monitoring', 'Instance name missing')); + throw new InvalidArgumentException($this->translate('Instance name missing')); } if ($this->config->hasSection($name)) { - throw new InvalidArgumentException(mt('monitoring', 'Instance already exists')); + throw new InvalidArgumentException($this->translate('Instance already exists')); } unset($values['name']); @@ -93,11 +93,11 @@ class InstanceConfigForm extends ConfigForm public function edit($name, array $values) { if (! $name) { - throw new InvalidArgumentException(mt('monitoring', 'Old instance name missing')); + throw new InvalidArgumentException($this->translate('Old instance name missing')); } elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) { - throw new InvalidArgumentException(mt('monitoring', 'New instance name missing')); + throw new InvalidArgumentException($this->translate('New instance name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided')); + throw new InvalidArgumentException($this->translate('Unknown instance name provided')); } unset($values['name']); @@ -117,9 +117,9 @@ class InstanceConfigForm extends ConfigForm public function remove($name) { if (! $name) { - throw new InvalidArgumentException(mt('monitoring', 'Instance name missing')); + throw new InvalidArgumentException($this->translate('Instance name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided')); + throw new InvalidArgumentException($this->translate('Unknown instance name provided')); } $instanceConfig = $this->config->getSection($name); @@ -136,10 +136,10 @@ class InstanceConfigForm extends ConfigForm $instanceName = $this->request->getQuery('instance'); if ($instanceName !== null) { if (! $instanceName) { - throw new ConfigurationError(mt('monitoring', 'Instance name missing')); + throw new ConfigurationError($this->translate('Instance name missing')); } if (! $this->config->hasSection($instanceName)) { - throw new ConfigurationError(mt('monitoring', 'Unknown instance name given')); + throw new ConfigurationError($this->translate('Unknown instance name given')); } $instanceConfig = $this->config->getSection($instanceName)->toArray(); @@ -158,10 +158,10 @@ class InstanceConfigForm extends ConfigForm try { if ($instanceName === null) { // create new instance $this->add($this->getValues()); - $message = mt('monitoring', 'Instance "%s" created successfully.'); + $message = $this->translate('Instance "%s" created successfully.'); } else { // edit existing instance $this->edit($instanceName, $this->getValues()); - $message = mt('monitoring', 'Instance "%s" edited successfully.'); + $message = $this->translate('Instance "%s" edited successfully.'); } } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); @@ -189,7 +189,7 @@ class InstanceConfigForm extends ConfigForm 'name', array( 'required' => true, - 'label' => mt('monitoring', 'Instance Name') + 'label' => $this->translate('Instance Name') ) ), array( @@ -198,10 +198,10 @@ class InstanceConfigForm extends ConfigForm array( 'required' => true, 'autosubmit' => true, - 'label' => mt('monitoring', 'Instance Type'), + 'label' => $this->translate('Instance Type'), 'multiOptions' => array( - LocalCommandFile::TRANSPORT => mt('monitoring', 'Local Command File'), - RemoteCommandFile::TRANSPORT => mt('monitoring', 'Remote Command File') + LocalCommandFile::TRANSPORT => $this->translate('Local Command File'), + RemoteCommandFile::TRANSPORT => $this->translate('Remote Command File') ), 'value' => $instanceType ) diff --git a/modules/monitoring/application/forms/Config/SecurityConfigForm.php b/modules/monitoring/application/forms/Config/SecurityConfigForm.php index 40c0b7b8c..b202f5938 100644 --- a/modules/monitoring/application/forms/Config/SecurityConfigForm.php +++ b/modules/monitoring/application/forms/Config/SecurityConfigForm.php @@ -18,7 +18,7 @@ class SecurityConfigForm extends ConfigForm public function init() { $this->setName('form_config_monitoring_security'); - $this->setSubmitLabel(mt('monitoring', 'Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -29,7 +29,7 @@ class SecurityConfigForm extends ConfigForm $this->config->setSection('security', $this->getValues()); if ($this->save()) { - Notification::success(mt('monitoring', 'New security configuration has successfully been stored')); + Notification::success($this->translate('New security configuration has successfully been stored')); } else { return false; } @@ -54,8 +54,8 @@ class SecurityConfigForm extends ConfigForm array( 'allowEmpty' => true, 'value' => '*pw*,*pass*,community', - 'label' => mt('monitoring', 'Protected Custom Variables'), - 'description' => mt('monitoring', + 'label' => $this->translate('Protected Custom Variables'), + 'description' => $this->translate( 'Comma separated case insensitive list of protected custom variables.' . ' Use * as a placeholder for zero or more wildcard characters.' . ' Existance of those custom variables will be shown, but their values will be masked.' diff --git a/modules/monitoring/application/forms/EventOverviewForm.php b/modules/monitoring/application/forms/EventOverviewForm.php index 25d268f76..dc697b940 100644 --- a/modules/monitoring/application/forms/EventOverviewForm.php +++ b/modules/monitoring/application/forms/EventOverviewForm.php @@ -44,7 +44,7 @@ class EventOverviewForm extends Form 'checkbox', 'statechange', array( - 'label' => t('State Changes'), + 'label' => $this->translate('State Changes'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->stateChangeFilter()->toQueryString()) === false ? 0 : 1 @@ -54,7 +54,7 @@ class EventOverviewForm extends Form 'checkbox', 'downtime', array( - 'label' => t('Downtimes'), + 'label' => $this->translate('Downtimes'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->downtimeFilter()->toQueryString()) === false ? 0 : 1 @@ -64,7 +64,7 @@ class EventOverviewForm extends Form 'checkbox', 'comment', array( - 'label' => t('Comments'), + 'label' => $this->translate('Comments'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->commentFilter()->toQueryString()) === false ? 0 : 1 @@ -74,7 +74,7 @@ class EventOverviewForm extends Form 'checkbox', 'notification', array( - 'label' => t('Notifications'), + 'label' => $this->translate('Notifications'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->notificationFilter()->toQueryString()) === false ? 0 : 1 @@ -84,7 +84,7 @@ class EventOverviewForm extends Form 'checkbox', 'flapping', array( - 'label' => t('Flapping'), + 'label' => $this->translate('Flapping'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->flappingFilter()->toQueryString()) === false ? 0 : 1 diff --git a/modules/monitoring/application/forms/Setup/BackendPage.php b/modules/monitoring/application/forms/Setup/BackendPage.php index 1f6ef6894..b5ab2ffd6 100644 --- a/modules/monitoring/application/forms/Setup/BackendPage.php +++ b/modules/monitoring/application/forms/Setup/BackendPage.php @@ -20,7 +20,7 @@ class BackendPage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'), + 'value' => $this->translate('Monitoring Backend', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,8 +31,7 @@ class BackendPage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please configure below how Icinga Web 2 should retrieve monitoring information.' ) ) @@ -44,8 +43,8 @@ class BackendPage extends Form array( 'required' => true, 'value' => 'icinga', - 'label' => mt('monitoring', 'Backend Name'), - 'description' => mt('monitoring', 'The identifier of this backend') + 'label' => $this->translate('Backend Name'), + 'description' => $this->translate('The identifier of this backend') ) ); @@ -60,8 +59,10 @@ class BackendPage extends Form 'type', array( 'required' => true, - 'label' => mt('monitoring', 'Backend Type'), - 'description' => mt('monitoring', 'The data source used for retrieving monitoring information'), + 'label' => $this->translate('Backend Type'), + 'description' => $this->translate( + 'The data source used for retrieving monitoring information' + ), 'multiOptions' => $resourceTypes ) ); diff --git a/modules/monitoring/application/forms/Setup/IdoResourcePage.php b/modules/monitoring/application/forms/Setup/IdoResourcePage.php index 189d65fea..c28b52e6b 100644 --- a/modules/monitoring/application/forms/Setup/IdoResourcePage.php +++ b/modules/monitoring/application/forms/Setup/IdoResourcePage.php @@ -28,7 +28,7 @@ class IdoResourcePage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'), + 'value' => $this->translate('Monitoring IDO Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -39,8 +39,7 @@ class IdoResourcePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please fill out the connection details below to access' . ' the IDO database of your monitoring environment.' ) @@ -91,8 +90,10 @@ class IdoResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => t('Skip Validation'), - 'description' => t('Check this to not to validate connectivity with the given database server') + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( + 'Check this to not to validate connectivity with the given database server' + ) ) ); } diff --git a/modules/monitoring/application/forms/Setup/InstancePage.php b/modules/monitoring/application/forms/Setup/InstancePage.php index dccfd1d91..8f151554d 100644 --- a/modules/monitoring/application/forms/Setup/InstancePage.php +++ b/modules/monitoring/application/forms/Setup/InstancePage.php @@ -20,7 +20,7 @@ class InstancePage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'), + 'value' => $this->translate('Monitoring Instance', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,8 +31,7 @@ class InstancePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please define the settings specific to your monitoring instance below.' ) ) diff --git a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php index 4faa17416..245d2abcc 100644 --- a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php +++ b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php @@ -28,7 +28,7 @@ class LivestatusResourcePage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'), + 'value' => $this->translate('Monitoring Livestatus Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -39,8 +39,7 @@ class LivestatusResourcePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please fill out the connection details below to access the Livestatus' . ' socket interface for your monitoring environment.' ) @@ -91,8 +90,10 @@ class LivestatusResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => t('Skip Validation'), - 'description' => t('Check this to not to validate connectivity with the given Livestatus socket') + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( + 'Check this to not to validate connectivity with the given Livestatus socket' + ) ) ); } diff --git a/modules/monitoring/application/forms/Setup/SecurityPage.php b/modules/monitoring/application/forms/Setup/SecurityPage.php index 0c7d3d1de..ba8083e50 100644 --- a/modules/monitoring/application/forms/Setup/SecurityPage.php +++ b/modules/monitoring/application/forms/Setup/SecurityPage.php @@ -20,7 +20,7 @@ class SecurityPage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'), + 'value' => $this->translate('Monitoring Security', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,8 +31,7 @@ class SecurityPage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'To protect your monitoring environment against prying eyes please fill out the settings below.' ) ) diff --git a/modules/monitoring/application/forms/Setup/WelcomePage.php b/modules/monitoring/application/forms/Setup/WelcomePage.php index d910e2e01..f79eb6c62 100644 --- a/modules/monitoring/application/forms/Setup/WelcomePage.php +++ b/modules/monitoring/application/forms/Setup/WelcomePage.php @@ -19,10 +19,7 @@ class WelcomePage extends Form 'note', 'welcome', array( - 'value' => mt( - 'monitoring', - 'Welcome to the configuration of the monitoring module for Icinga Web 2!' - ), + 'value' => $this->translate('Welcome to the configuration of the monitoring module for Icinga Web 2!'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -34,7 +31,7 @@ class WelcomePage extends Form 'note', 'core_hint', array( - 'value' => mt('monitoring', 'This is the core module for Icinga Web 2.') + 'value' => $this->translate('This is the core module for Icinga Web 2.') ) ); @@ -42,8 +39,7 @@ class WelcomePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'It offers various status and reporting views with powerful filter capabilities that allow' . ' you to keep track of the most important events in your monitoring environment.' ) diff --git a/modules/monitoring/application/forms/StatehistoryForm.php b/modules/monitoring/application/forms/StatehistoryForm.php index 9fa1bdc26..d859f5815 100644 --- a/modules/monitoring/application/forms/StatehistoryForm.php +++ b/modules/monitoring/application/forms/StatehistoryForm.php @@ -19,7 +19,7 @@ class StatehistoryForm extends Form public function init() { $this->setName('form_event_overview'); - $this->setSubmitLabel(mt('monitoring', 'Apply')); + $this->setSubmitLabel($this->translate('Apply')); } /** @@ -65,14 +65,14 @@ class StatehistoryForm extends Form 'select', 'from', array( - 'label' => mt('monitoring', 'From'), + 'label' => $this->translate('From'), 'value' => $this->getRequest()->getParam('from', strtotime('3 months ago')), 'multiOptions' => array( - strtotime('midnight 3 months ago') => mt('monitoring', '3 Months'), - strtotime('midnight 4 months ago') => mt('monitoring', '4 Months'), - strtotime('midnight 8 months ago') => mt('monitoring', '8 Months'), - strtotime('midnight 12 months ago') => mt('monitoring', '1 Year'), - strtotime('midnight 24 months ago') => mt('monitoring', '2 Years') + strtotime('midnight 3 months ago') => $this->translate('3 Months'), + strtotime('midnight 4 months ago') => $this->translate('4 Months'), + strtotime('midnight 8 months ago') => $this->translate('8 Months'), + strtotime('midnight 12 months ago') => $this->translate('1 Year'), + strtotime('midnight 24 months ago') => $this->translate('2 Years') ), 'class' => 'autosubmit' ) @@ -81,10 +81,10 @@ class StatehistoryForm extends Form 'select', 'to', array( - 'label' => mt('monitoring', 'To'), + 'label' => $this->translate('To'), 'value' => $this->getRequest()->getParam('to', time()), 'multiOptions' => array( - time() => mt('monitoring', 'Today') + time() => $this->translate('Today') ), 'class' => 'autosubmit' ) @@ -95,11 +95,11 @@ class StatehistoryForm extends Form 'select', 'objecttype', array( - 'label' => mt('monitoring', 'Object type'), + 'label' => $this->translate('Object type'), 'value' => $objectType, 'multiOptions' => array( - 'services' => mt('monitoring', 'Services'), - 'hosts' => mt('monitoring', 'Hosts') + 'services' => $this->translate('Services'), + 'hosts' => $this->translate('Hosts') ), 'class' => 'autosubmit' ) @@ -113,13 +113,13 @@ class StatehistoryForm extends Form 'select', 'state', array( - 'label' => mt('monitoring', 'State'), + 'label' => $this->translate('State'), 'value' => $serviceState, 'multiOptions' => array( - 'cnt_critical_hard' => mt('monitoring', 'Critical'), - 'cnt_warning_hard' => mt('monitoring', 'Warning'), - 'cnt_unknown_hard' => mt('monitoring', 'Unknown'), - 'cnt_ok' => mt('monitoring', 'Ok') + 'cnt_critical_hard' => $this->translate('Critical'), + 'cnt_warning_hard' => $this->translate('Warning'), + 'cnt_unknown_hard' => $this->translate('Unknown'), + 'cnt_ok' => $this->translate('Ok') ), 'class' => 'autosubmit' ) @@ -133,12 +133,12 @@ class StatehistoryForm extends Form 'select', 'state', array( - 'label' => mt('monitoring', 'State'), + 'label' => $this->translate('State'), 'value' => $hostState, 'multiOptions' => array( - 'cnt_up' => mt('monitoring', 'Up'), - 'cnt_down_hard' => mt('monitoring', 'Down'), - 'cnt_unreachable_hard' => mt('monitoring', 'Unreachable') + 'cnt_up' => $this->translate('Up'), + 'cnt_down_hard' => $this->translate('Down'), + 'cnt_unreachable_hard' => $this->translate('Unreachable') ), 'class' => 'autosubmit' ) From 8c87a9df13d1452bfc5906218d25bab1b7809435 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 19 Jan 2015 11:07:39 +0100 Subject: [PATCH 14/41] Replace t() and mt() with translate() in setup module's forms refs #7551 --- .../application/forms/AdminAccountPage.php | 35 +++++++++---------- .../application/forms/AuthBackendPage.php | 15 ++++---- .../application/forms/AuthenticationPage.php | 13 ++++--- .../forms/DatabaseCreationPage.php | 23 ++++++------ .../application/forms/DbResourcePage.php | 11 +++--- .../application/forms/GeneralConfigPage.php | 5 ++- .../forms/LdapDiscoveryConfirmPage.php | 6 ++-- .../application/forms/LdapDiscoveryPage.php | 13 +++---- .../application/forms/LdapResourcePage.php | 10 +++--- .../application/forms/PreferencesPage.php | 15 ++++---- .../setup/application/forms/WelcomePage.php | 5 ++- 11 files changed, 69 insertions(+), 82 deletions(-) diff --git a/modules/setup/application/forms/AdminAccountPage.php b/modules/setup/application/forms/AdminAccountPage.php index 6ef791d4e..3b2e6ec9f 100644 --- a/modules/setup/application/forms/AdminAccountPage.php +++ b/modules/setup/application/forms/AdminAccountPage.php @@ -74,16 +74,15 @@ class AdminAccountPage extends Form $choices = array(); if ($this->backendConfig['backend'] !== 'db') { - $choices['by_name'] = mt('setup', 'By Name', 'setup.admin'); + $choices['by_name'] = $this->translate('By Name', 'setup.admin'); $this->addElement( 'text', 'by_name', array( 'required' => isset($formData['user_type']) && $formData['user_type'] === 'by_name', 'value' => $this->getUsername(), - 'label' => mt('setup', 'Username'), - 'description' => mt( - 'setup', + 'label' => $this->translate('Username'), + 'description' => $this->translate( 'Define the initial administrative account by providing a username that reflects' . ' a user created later or one that is authenticated using external mechanisms' ) @@ -94,21 +93,20 @@ class AdminAccountPage extends Form if ($this->backendConfig['backend'] === 'db' || $this->backendConfig['backend'] === 'ldap') { $users = $this->fetchUsers(); if (false === empty($users)) { - $choices['existing_user'] = mt('setup', 'Existing User'); + $choices['existing_user'] = $this->translate('Existing User'); $this->addElement( 'select', 'existing_user', array( 'required' => isset($formData['user_type']) && $formData['user_type'] === 'existing_user', - 'label' => mt('setup', 'Username'), + 'label' => $this->translate('Username'), 'description' => sprintf( - mt( - 'setup', + $this->translate( 'Choose a user reported by the %s backend as the initial administrative account', 'setup.admin' ), $this->backendConfig['backend'] === 'db' - ? mt('setup', 'database', 'setup.admin.authbackend') + ? $this->translate('database', 'setup.admin.authbackend') : 'LDAP' ), 'multiOptions' => array_combine($users, $users) @@ -118,16 +116,15 @@ class AdminAccountPage extends Form } if ($this->backendConfig['backend'] === 'db') { - $choices['new_user'] = mt('setup', 'New User'); + $choices['new_user'] = $this->translate('New User'); $required = isset($formData['user_type']) && $formData['user_type'] === 'new_user'; $this->addElement( 'text', 'new_user', array( 'required' => $required, - 'label' => mt('setup', 'Username'), - 'description' => mt( - 'setup', + 'label' => $this->translate('Username'), + 'description' => $this->translate( 'Enter the username to be used when creating an initial administrative account' ) ) @@ -137,8 +134,8 @@ class AdminAccountPage extends Form 'new_user_password', array( 'required' => $required, - 'label' => mt('setup', 'Password'), - 'description' => mt('setup', 'Enter the password to assign to the newly created account') + 'label' => $this->translate('Password'), + 'description' => $this->translate('Enter the password to assign to the newly created account') ) ); $this->addElement( @@ -146,8 +143,8 @@ class AdminAccountPage extends Form 'new_user_2ndpass', array( 'required' => $required, - 'label' => mt('setup', 'Repeat password'), - 'description' => mt('setup', 'Please repeat the password given above to avoid typing errors'), + 'label' => $this->translate('Repeat password'), + 'description' => $this->translate('Please repeat the password given above to avoid typing errors'), 'validators' => array( array('identical', false, array('new_user_password')) ) @@ -179,7 +176,7 @@ class AdminAccountPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Administration', 'setup.page.title'), + 'value' => $this->translate('Administration', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -215,7 +212,7 @@ class AdminAccountPage extends Form } if ($data['user_type'] === 'new_user' && array_search($data['new_user'], $this->fetchUsers()) !== false) { - $this->getElement('new_user')->addError(mt('setup', 'Username already exists.')); + $this->getElement('new_user')->addError($this->translate('Username already exists.')); return false; } diff --git a/modules/setup/application/forms/AuthBackendPage.php b/modules/setup/application/forms/AuthBackendPage.php index bd820d352..ced0d9c59 100644 --- a/modules/setup/application/forms/AuthBackendPage.php +++ b/modules/setup/application/forms/AuthBackendPage.php @@ -62,7 +62,7 @@ class AuthBackendPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Authentication Backend', 'setup.page.title'), + 'value' => $this->translate('Authentication Backend', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -71,20 +71,17 @@ class AuthBackendPage extends Form ); if ($this->config['type'] === 'db') { - $note = mt( - 'setup', + $note = $this->translate( 'As you\'ve chosen to use a database for authentication all you need ' . 'to do now is defining a name for your first authentication backend.' ); } elseif ($this->config['type'] === 'ldap') { - $note = mt( - 'setup', + $note = $this->translate( 'Before you are able to authenticate using the LDAP connection defined earlier you need to' . ' provide some more information so that Icinga Web 2 is able to locate account details.' ); } else { // if ($this->config['type'] === 'autologin' - $note = mt( - 'setup', + $note = $this->translate( 'You\'ve chosen to authenticate using a web server\'s mechanism so it may be necessary' . ' to adjust usernames before any permissions, restrictions, etc. are being applied.' ); @@ -150,8 +147,8 @@ class AuthBackendPage extends Form 'order' => 2, 'ignore' => true, 'required' => true, - 'label' => mt('setup', 'Skip Validation'), - 'description' => mt('setup', 'Check this to not to validate authentication using this backend') + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate('Check this to not to validate authentication using this backend') ) ); } diff --git a/modules/setup/application/forms/AuthenticationPage.php b/modules/setup/application/forms/AuthenticationPage.php index 2a579e670..88db9c6d8 100644 --- a/modules/setup/application/forms/AuthenticationPage.php +++ b/modules/setup/application/forms/AuthenticationPage.php @@ -29,7 +29,7 @@ class AuthenticationPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Authentication', 'setup.page.title'), + 'value' => $this->translate('Authentication', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -40,8 +40,7 @@ class AuthenticationPage extends Form 'note', 'description', array( - 'value' => mt( - 'setup', + 'value' => $this->translate( 'Please choose how you want to authenticate when accessing Icinga Web 2.' . ' Configuring backend specific details follows in a later step.' ) @@ -50,20 +49,20 @@ class AuthenticationPage extends Form $backendTypes = array(); if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) { - $backendTypes['db'] = t('Database'); + $backendTypes['db'] = $this->translate('Database'); } if (Platform::extensionLoaded('ldap')) { $backendTypes['ldap'] = 'LDAP'; } - $backendTypes['autologin'] = t('Autologin'); + $backendTypes['autologin'] = $this->translate('Autologin'); $this->addElement( 'select', 'type', array( 'required' => true, - 'label' => mt('setup', 'Authentication Type'), - 'description' => mt('setup', 'The type of authentication to use when accessing Icinga Web 2'), + 'label' => $this->translate('Authentication Type'), + 'description' => $this->translate('The type of authentication to use when accessing Icinga Web 2'), 'multiOptions' => $backendTypes ) ); diff --git a/modules/setup/application/forms/DatabaseCreationPage.php b/modules/setup/application/forms/DatabaseCreationPage.php index ec4a77ee1..be2974a52 100644 --- a/modules/setup/application/forms/DatabaseCreationPage.php +++ b/modules/setup/application/forms/DatabaseCreationPage.php @@ -90,7 +90,7 @@ class DatabaseCreationPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Database Setup', 'setup.page.title'), + 'value' => $this->translate('Database Setup', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -101,8 +101,7 @@ class DatabaseCreationPage extends Form 'note', 'description', array( - 'value' => mt( - 'setup', + 'value' => $this->translate( 'It seems that either the database you defined earlier does not yet exist and cannot be created' . ' using the provided access credentials or the database does not have the required schema to ' . 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.' @@ -116,16 +115,16 @@ class DatabaseCreationPage extends Form 'username', array( 'required' => false === $skipValidation, - 'label' => mt('setup', 'Username'), - 'description' => mt('setup', 'A user which is able to create databases and/or touch the database schema') + 'label' => $this->translate('Username'), + 'description' => $this->translate('A user which is able to create databases and/or touch the database schema') ) ); $this->addElement( 'password', 'password', array( - 'label' => mt('setup', 'Password'), - 'description' => mt('setup', 'The password for the database user defined above') + 'label' => $this->translate('Password'), + 'description' => $this->translate('The password for the database user defined above') ) ); @@ -182,7 +181,7 @@ class DatabaseCreationPage extends Form // form need to be granted to create databases, users... if (false === $db->checkPrivileges($this->databaseSetupPrivileges)) { $this->addError( - mt('setup', 'The provided credentials cannot be used to create the database and/or the user.') + $this->translate('The provided credentials cannot be used to create the database and/or the user.') ); $this->addSkipValidationCheckbox(); return false; @@ -191,8 +190,7 @@ class DatabaseCreationPage extends Form // ...and to grant all required usage privileges to others if (false === $db->isGrantable($this->databaseUsagePrivileges)) { $this->addError(sprintf( - mt( - 'setup', + $this->translate( 'The provided credentials cannot be used to grant all required privileges to the login "%s".' ), $this->config['username'] @@ -215,9 +213,8 @@ class DatabaseCreationPage extends Form array( 'order' => 2, 'required' => true, - 'label' => mt('setup', 'Skip Validation'), - 'description' => mt( - 'setup', + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( 'Check this to not to validate the ability to login and required privileges' ) ) diff --git a/modules/setup/application/forms/DbResourcePage.php b/modules/setup/application/forms/DbResourcePage.php index 4a6535324..1901d8ca9 100644 --- a/modules/setup/application/forms/DbResourcePage.php +++ b/modules/setup/application/forms/DbResourcePage.php @@ -39,7 +39,7 @@ class DbResourcePage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Database Resource', 'setup.page.title'), + 'value' => $this->translate('Database Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -50,8 +50,7 @@ class DbResourcePage extends Form 'note', 'description', array( - 'value' => mt( - 'setup', + 'value' => $this->translate( 'Now please configure your database resource. Note that the database itself does not need to' . ' exist at this time as it is going to be created once the wizard is about to be finished.' ) @@ -121,8 +120,10 @@ class DbResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => mt('setup', 'Skip Validation'), - 'description' => mt('setup', 'Check this to not to validate connectivity with the given database server') + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( + 'Check this to not to validate connectivity with the given database server' + ) ) ); } diff --git a/modules/setup/application/forms/GeneralConfigPage.php b/modules/setup/application/forms/GeneralConfigPage.php index 309c1784d..e0a9d0fab 100644 --- a/modules/setup/application/forms/GeneralConfigPage.php +++ b/modules/setup/application/forms/GeneralConfigPage.php @@ -29,7 +29,7 @@ class GeneralConfigPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Application Configuration', 'setup.page.title'), + 'value' => $this->translate('Application Configuration', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -40,8 +40,7 @@ class GeneralConfigPage extends Form 'note', 'description', array( - 'value' => mt( - 'setup', + 'value' => $this->translate( 'Now please adjust all application and logging related configuration options to fit your needs.' ) ) diff --git a/modules/setup/application/forms/LdapDiscoveryConfirmPage.php b/modules/setup/application/forms/LdapDiscoveryConfirmPage.php index f76cbee07..66fd39001 100644 --- a/modules/setup/application/forms/LdapDiscoveryConfirmPage.php +++ b/modules/setup/application/forms/LdapDiscoveryConfirmPage.php @@ -82,7 +82,7 @@ EOT; 'note', 'title', array( - 'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'), + 'value' => $this->translate('LDAP Discovery Results', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -94,7 +94,7 @@ EOT; 'description', array( 'value' => sprintf( - mt('setup', 'The following directory service has been found on domain "%s":'), + $this->translate('The following directory service has been found on domain "%s":'), $this->config['domain'] ) ) @@ -119,7 +119,7 @@ EOT; 'confirm', array( 'value' => '1', - 'label' => mt('setup', 'Use this configuration?') + 'label' => $this->translate('Use this configuration?') ) ); } diff --git a/modules/setup/application/forms/LdapDiscoveryPage.php b/modules/setup/application/forms/LdapDiscoveryPage.php index 8c61eb379..26b43803b 100644 --- a/modules/setup/application/forms/LdapDiscoveryPage.php +++ b/modules/setup/application/forms/LdapDiscoveryPage.php @@ -36,7 +36,7 @@ class LdapDiscoveryPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'), + 'value' => $this->translate('LDAP Discovery', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -47,8 +47,7 @@ class LdapDiscoveryPage extends Form 'note', 'description', array( - 'value' => mt( - 'setup', + 'value' => $this->translate( 'You can use this page to discover LDAP or ActiveDirectory servers ' . ' for authentication. If you don\' want to execute a discovery, just skip this step.' ) @@ -66,8 +65,8 @@ class LdapDiscoveryPage extends Form 'skip_validation', array( 'required' => true, - 'label' => mt('setup', 'Skip'), - 'description' => mt('setup', 'Do not discover LDAP servers and enter all settings manually.') + 'label' => $this->translate('Skip'), + 'description' => $this->translate('Do not discover LDAP servers and enter all settings manually.') ) ); } @@ -94,7 +93,9 @@ class LdapDiscoveryPage extends Form return true; } } - $this->addError(sprintf(t('Could not find any LDAP servers on the domain "%s".'), $data['domain'])); + $this->addError( + sprintf($this->translate('Could not find any LDAP servers on the domain "%s".'), $data['domain']) + ); return false; } diff --git a/modules/setup/application/forms/LdapResourcePage.php b/modules/setup/application/forms/LdapResourcePage.php index 49bed69c3..f003a7370 100644 --- a/modules/setup/application/forms/LdapResourcePage.php +++ b/modules/setup/application/forms/LdapResourcePage.php @@ -37,7 +37,7 @@ class LdapResourcePage extends Form 'note', 'title', array( - 'value' => mt('setup', 'LDAP Resource', 'setup.page.title'), + 'value' => $this->translate('LDAP Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -48,8 +48,7 @@ class LdapResourcePage extends Form 'note', 'description', array( - 'value' => mt( - 'setup', + 'value' => $this->translate( 'Now please configure your AD/LDAP resource. This will later ' . 'be used to authenticate users logging in to Icinga Web 2.' ) @@ -107,9 +106,8 @@ class LdapResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => mt('setup', 'Skip Validation'), - 'description' => mt( - 'setup', + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( 'Check this to not to validate connectivity with the given directory service' ) ) diff --git a/modules/setup/application/forms/PreferencesPage.php b/modules/setup/application/forms/PreferencesPage.php index 26fd048e1..07e011ee1 100644 --- a/modules/setup/application/forms/PreferencesPage.php +++ b/modules/setup/application/forms/PreferencesPage.php @@ -30,8 +30,7 @@ class PreferencesPage extends Form $this->getElement('type') ->setValue('db') ->setDescription( - mt( - 'setup', + $this->translate( 'Note that choosing "Database" causes Icinga Web 2 to use the same database as for authentication.' ) ); @@ -47,7 +46,7 @@ class PreferencesPage extends Form 'note', 'title', array( - 'value' => mt('setup', 'Preferences', 'setup.page.title'), + 'value' => $this->translate('Preferences', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -58,23 +57,23 @@ class PreferencesPage extends Form 'note', 'description', array( - 'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.') + 'value' => $this->translate('Please choose how Icinga Web 2 should store user preferences.') ) ); $storageTypes = array(); - $storageTypes['ini'] = t('File System (INI Files)'); + $storageTypes['ini'] = $this->translate('File System (INI Files)'); if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) { - $storageTypes['db'] = t('Database'); + $storageTypes['db'] = $this->translate('Database'); } - $storageTypes['null'] = t('Don\'t Store Preferences'); + $storageTypes['null'] = $this->translate('Don\'t Store Preferences'); $this->addElement( 'select', 'type', array( 'required' => true, - 'label' => t('User Preference Storage Type'), + 'label' => $this->translate('User Preference Storage Type'), 'multiOptions' => $storageTypes ) ); diff --git a/modules/setup/application/forms/WelcomePage.php b/modules/setup/application/forms/WelcomePage.php index 5da607683..66340ff25 100644 --- a/modules/setup/application/forms/WelcomePage.php +++ b/modules/setup/application/forms/WelcomePage.php @@ -32,9 +32,8 @@ class WelcomePage extends Form 'token', array( 'required' => true, - 'label' => mt('setup', 'Setup Token'), - 'description' => mt( - 'setup', + 'label' => $this->translate('Setup Token'), + 'description' => $this->translate( 'For security reasons we need to ensure that you are permitted to run this wizard.' . ' Please provide a token by following the instructions below.' ), From dbd69ba6935fb59de471123f3f55b01ad58ca167 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 19 Jan 2015 11:26:23 +0100 Subject: [PATCH 15/41] Replace t() and mt() with translate() in the application's forms refs #7551 --- .../forms/Authentication/LoginForm.php | 10 ++-- .../Authentication/AutologinBackendForm.php | 8 +-- .../Config/Authentication/DbBackendForm.php | 14 +++--- .../Config/Authentication/LdapBackendForm.php | 28 ++++++----- .../AuthenticationBackendConfigForm.php | 50 ++++++++++--------- .../AuthenticationBackendReorderForm.php | 2 +- .../Config/General/ApplicationConfigForm.php | 14 +++--- .../Config/General/LoggingConfigForm.php | 35 ++++++------- .../forms/Config/GeneralConfigForm.php | 4 +- .../forms/Config/Resource/DbResourceForm.php | 32 ++++++------ .../Config/Resource/FileResourceForm.php | 12 ++--- .../Config/Resource/LdapResourceForm.php | 32 +++++++----- .../Resource/LivestatusResourceForm.php | 14 +++--- .../forms/Config/ResourceConfigForm.php | 38 +++++++------- application/forms/ConfirmRemovalForm.php | 2 +- application/forms/Dashboard/DashletForm.php | 27 +++++----- application/forms/LdapDiscoveryForm.php | 14 +++--- application/forms/PreferenceForm.php | 22 ++++---- application/forms/Security/RoleForm.php | 26 +++++----- 19 files changed, 203 insertions(+), 181 deletions(-) diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index a6d69d15a..8be455dcc 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -18,7 +18,7 @@ class LoginForm extends Form public function init() { $this->setName('form_login'); - $this->setSubmitLabel(t('Login')); + $this->setSubmitLabel($this->translate('Login')); } /** @@ -31,8 +31,8 @@ class LoginForm extends Form 'username', array( 'required' => true, - 'label' => t('Username'), - 'placeholder' => t('Please enter your username...'), + 'label' => $this->translate('Username'), + 'placeholder' => $this->translate('Please enter your username...'), 'class' => false === isset($formData['username']) ? 'autofocus' : '' ) ); @@ -41,8 +41,8 @@ class LoginForm extends Form 'password', array( 'required' => true, - 'label' => t('Password'), - 'placeholder' => t('...and your password'), + 'label' => $this->translate('Password'), + 'placeholder' => $this->translate('...and your password'), 'class' => isset($formData['username']) ? 'autofocus' : '' ) ); diff --git a/application/forms/Config/Authentication/AutologinBackendForm.php b/application/forms/Config/Authentication/AutologinBackendForm.php index 97b5dfed7..cd09d38ac 100644 --- a/application/forms/Config/Authentication/AutologinBackendForm.php +++ b/application/forms/Config/Authentication/AutologinBackendForm.php @@ -30,8 +30,8 @@ class AutologinBackendForm extends Form 'name', array( 'required' => true, - 'label' => t('Backend Name'), - 'description' => t( + 'label' => $this->translate('Backend Name'), + 'description' => $this->translate( 'The name of this authentication provider that is used to differentiate it from others' ), 'validators' => array( @@ -52,8 +52,8 @@ class AutologinBackendForm extends Form 'text', 'strip_username_regexp', array( - 'label' => t('Filter Pattern'), - 'description' => t( + 'label' => $this->translate('Filter Pattern'), + 'description' => $this->translate( 'The regular expression to use to strip specific parts off from usernames.' . ' Leave empty if you do not want to strip off anything' ), diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 572a09c2e..f8a4fb832 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -53,8 +53,8 @@ class DbBackendForm extends Form 'name', array( 'required' => true, - 'label' => t('Backend Name'), - 'description' => t( + 'label' => $this->translate('Backend Name'), + 'description' => $this->translate( 'The name of this authentication provider that is used to differentiate it from others' ), ) @@ -64,8 +64,10 @@ class DbBackendForm extends Form 'resource', array( 'required' => true, - 'label' => t('Database Connection'), - 'description' => t('The database connection to use for authenticating with this provider'), + 'label' => $this->translate('Database Connection'), + 'description' => $this->translate( + 'The database connection to use for authenticating with this provider' + ), 'multiOptions' => false === empty($this->resources) ? array_combine($this->resources, $this->resources) : array() @@ -107,11 +109,11 @@ class DbBackendForm extends Form try { $dbUserBackend = new DbUserBackend(ResourceFactory::createResource($form->getResourceConfig())); if ($dbUserBackend->count() < 1) { - $form->addError(t('No users found under the specified database backend')); + $form->addError($this->translate('No users found under the specified database backend')); return false; } } catch (Exception $e) { - $form->addError(sprintf(t('Using the specified backend failed: %s'), $e->getMessage())); + $form->addError(sprintf($this->translate('Using the specified backend failed: %s'), $e->getMessage())); return false; } diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 9b48c3dbc..5915a0a10 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -54,8 +54,8 @@ class LdapBackendForm extends Form 'name', array( 'required' => true, - 'label' => t('Backend Name'), - 'description' => t( + 'label' => $this->translate('Backend Name'), + 'description' => $this->translate( 'The name of this authentication provider that is used to differentiate it from others' ) ) @@ -65,8 +65,8 @@ class LdapBackendForm extends Form 'resource', array( 'required' => true, - 'label' => t('LDAP Resource'), - 'description' => t('The resource to use for authenticating with this provider'), + 'label' => $this->translate('LDAP Resource'), + 'description' => $this->translate('The resource to use for authenticating with this provider'), 'multiOptions' => false === empty($this->resources) ? array_combine($this->resources, $this->resources) : array() @@ -77,8 +77,8 @@ class LdapBackendForm extends Form 'user_class', array( 'required' => true, - 'label' => t('LDAP User Object Class'), - 'description' => t('The object class used for storing users on the ldap server'), + 'label' => $this->translate('LDAP User Object Class'), + 'description' => $this->translate('The object class used for storing users on the ldap server'), 'value' => 'inetOrgPerson' ) ); @@ -87,8 +87,10 @@ class LdapBackendForm extends Form 'user_name_attribute', array( 'required' => true, - 'label' => t('LDAP User Name Attribute'), - 'description' => t('The attribute name used for storing the user name on the ldap server'), + 'label' => $this->translate('LDAP User Name Attribute'), + 'description' => $this->translate( + 'The attribute name used for storing the user name on the ldap server' + ), 'value' => 'uid' ) ); @@ -105,9 +107,11 @@ class LdapBackendForm extends Form 'base_dn', array( 'required' => false, - 'label' => t('Base DN'), - 'description' => t('The path where users can be found on the ldap server. ' . - ' Leave empty to select all users available on the specified resource.') + 'label' => $this->translate('Base DN'), + 'description' => $this->translate( + 'The path where users can be found on the ldap server. Leave ' . + 'empty to select all users available on the specified resource.' + ) ) ); return $this; @@ -146,7 +150,7 @@ class LdapBackendForm extends Form $form->addError($e->getMessage()); return false; } catch (Exception $e) { - $form->addError(sprintf(t('Unable to validate authentication: %s'), $e->getMessage())); + $form->addError(sprintf($this->translate('Unable to validate authentication: %s'), $e->getMessage())); return false; } diff --git a/application/forms/Config/AuthenticationBackendConfigForm.php b/application/forms/Config/AuthenticationBackendConfigForm.php index 12f407c69..076f8cb17 100644 --- a/application/forms/Config/AuthenticationBackendConfigForm.php +++ b/application/forms/Config/AuthenticationBackendConfigForm.php @@ -31,7 +31,7 @@ class AuthenticationBackendConfigForm extends ConfigForm public function init() { $this->setName('form_config_authbackend'); - $this->setSubmitLabel(t('Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -70,7 +70,7 @@ class AuthenticationBackendConfigForm extends ConfigForm } elseif ($type === 'autologin') { $form = new AutologinBackendForm(); } else { - throw new InvalidArgumentException(sprintf(t('Invalid backend type "%s" provided'), $type)); + throw new InvalidArgumentException(sprintf($this->translate('Invalid backend type "%s" provided'), $type)); } return $form; @@ -91,9 +91,9 @@ class AuthenticationBackendConfigForm extends ConfigForm { $name = isset($values['name']) ? $values['name'] : ''; if (! $name) { - throw new InvalidArgumentException(t('Authentication backend name missing')); + throw new InvalidArgumentException($this->translate('Authentication backend name missing')); } elseif ($this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Authentication backend already exists')); + throw new InvalidArgumentException($this->translate('Authentication backend already exists')); } unset($values['name']); @@ -114,11 +114,11 @@ class AuthenticationBackendConfigForm extends ConfigForm public function edit($name, array $values) { if (! $name) { - throw new InvalidArgumentException(t('Old authentication backend name missing')); + throw new InvalidArgumentException($this->translate('Old authentication backend name missing')); } elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) { - throw new InvalidArgumentException(t('New authentication backend name missing')); + throw new InvalidArgumentException($this->translate('New authentication backend name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Unknown authentication backend provided')); + throw new InvalidArgumentException($this->translate('Unknown authentication backend provided')); } $backendConfig = $this->config->getSection($name); @@ -144,9 +144,9 @@ class AuthenticationBackendConfigForm extends ConfigForm public function remove($name) { if (! $name) { - throw new InvalidArgumentException(t('Authentication backend name missing')); + throw new InvalidArgumentException($this->translate('Authentication backend name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Unknown authentication backend provided')); + throw new InvalidArgumentException($this->translate('Unknown authentication backend provided')); } $backendConfig = $this->config->getSection($name); @@ -167,9 +167,9 @@ class AuthenticationBackendConfigForm extends ConfigForm public function move($name, $position) { if (! $name) { - throw new InvalidArgumentException(t('Authentication backend name missing')); + throw new InvalidArgumentException($this->translate('Authentication backend name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Unknown authentication backend provided')); + throw new InvalidArgumentException($this->translate('Unknown authentication backend provided')); } $backendOrder = $this->config->keys(); @@ -208,10 +208,10 @@ class AuthenticationBackendConfigForm extends ConfigForm try { if ($authBackend === null) { // create new backend $this->add($this->getValues()); - $message = t('Authentication backend "%s" has been successfully created'); + $message = $this->translate('Authentication backend "%s" has been successfully created'); } else { // edit existing backend $this->edit($authBackend, $this->getValues()); - $message = t('Authentication backend "%s" has been successfully changed'); + $message = $this->translate('Authentication backend "%s" has been successfully changed'); } } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); @@ -237,11 +237,13 @@ class AuthenticationBackendConfigForm extends ConfigForm $authBackend = $this->request->getQuery('auth_backend'); if ($authBackend !== null) { if ($authBackend === '') { - throw new ConfigurationError(t('Authentication backend name missing')); + throw new ConfigurationError($this->translate('Authentication backend name missing')); } elseif (! $this->config->hasSection($authBackend)) { - throw new ConfigurationError(t('Unknown authentication backend provided')); + throw new ConfigurationError($this->translate('Unknown authentication backend provided')); } elseif ($this->config->getSection($authBackend)->backend === null) { - throw new ConfigurationError(sprintf(t('Backend "%s" has no `backend\' setting'), $authBackend)); + throw new ConfigurationError( + sprintf($this->translate('Backend "%s" has no `backend\' setting'), $authBackend) + ); } $configValues = $this->config->getSection($authBackend)->toArray(); @@ -257,7 +259,7 @@ class AuthenticationBackendConfigForm extends ConfigForm ); if (false === empty($autologinBackends)) { - throw new ConfigurationError(t('Could not find any resources for authentication')); + throw new ConfigurationError($this->translate('Could not find any resources for authentication')); } } } @@ -276,8 +278,8 @@ class AuthenticationBackendConfigForm extends ConfigForm array( 'order' => 0, 'ignore' => true, - 'label' => t('Force Changes'), - 'description' => t('Check this box to enforce changes without connectivity validation') + 'label' => $this->translate('Force Changes'), + 'description' => $this->translate('Check this box to enforce changes without connectivity validation') ) ); } @@ -291,7 +293,7 @@ class AuthenticationBackendConfigForm extends ConfigForm $backendType = isset($formData['type']) ? $formData['type'] : null; if (isset($this->resources['db'])) { - $backendTypes['db'] = t('Database'); + $backendTypes['db'] = $this->translate('Database'); } if (isset($this->resources['ldap']) && ($backendType === 'ldap' || Platform::extensionLoaded('ldap'))) { $backendTypes['ldap'] = 'LDAP'; @@ -304,7 +306,7 @@ class AuthenticationBackendConfigForm extends ConfigForm } ); if ($backendType === 'autologin' || empty($autologinBackends)) { - $backendTypes['autologin'] = t('Autologin'); + $backendTypes['autologin'] = $this->translate('Autologin'); } if ($backendType === null) { @@ -318,8 +320,10 @@ class AuthenticationBackendConfigForm extends ConfigForm 'ignore' => true, 'required' => true, 'autosubmit' => true, - 'label' => t('Backend Type'), - 'description' => t('The type of the resource to use for this authenticaton provider'), + 'label' => $this->translate('Backend Type'), + 'description' => $this->translate( + 'The type of the resource to use for this authenticaton provider' + ), 'multiOptions' => $backendTypes ) ); diff --git a/application/forms/Config/AuthenticationBackendReorderForm.php b/application/forms/Config/AuthenticationBackendReorderForm.php index 07200827a..a41224248 100644 --- a/application/forms/Config/AuthenticationBackendReorderForm.php +++ b/application/forms/Config/AuthenticationBackendReorderForm.php @@ -52,7 +52,7 @@ class AuthenticationBackendReorderForm extends ConfigForm try { if ($configForm->move($backendName, $position)->save()) { - Notification::success(t('Authentication order updated!')); + Notification::success($this->translate('Authentication order updated!')); } else { return false; } diff --git a/application/forms/Config/General/ApplicationConfigForm.php b/application/forms/Config/General/ApplicationConfigForm.php index 95ad22071..8f718ccdf 100644 --- a/application/forms/Config/General/ApplicationConfigForm.php +++ b/application/forms/Config/General/ApplicationConfigForm.php @@ -33,10 +33,10 @@ class ApplicationConfigForm extends Form 'text', 'global_module_path', array( - 'label' => t('Module Path'), + 'label' => $this->translate('Module Path'), 'required' => true, 'value' => implode(':', Icinga::app()->getModuleManager()->getModuleDirs()), - 'description' => t( + 'description' => $this->translate( 'Contains the directories that will be searched for available modules, separated by ' . 'colons. Modules that don\'t exist in these directories can still be symlinked in ' . 'the module folder, but won\'t show up in the list of disabled modules.' @@ -50,11 +50,11 @@ class ApplicationConfigForm extends Form array( 'required' => true, 'autosubmit' => true, - 'label' => t('User Preference Storage Type'), + 'label' => $this->translate('User Preference Storage Type'), 'multiOptions' => array( - 'ini' => t('File System (INI Files)'), - 'db' => t('Database'), - 'null' => t('Don\'t Store Preferences') + 'ini' => $this->translate('File System (INI Files)'), + 'db' => $this->translate('Database'), + 'null' => $this->translate('Don\'t Store Preferences') ) ) ); @@ -72,7 +72,7 @@ class ApplicationConfigForm extends Form array( 'required' => true, 'multiOptions' => $backends, - 'label' => t('Database Connection') + 'label' => $this->translate('Database Connection') ) ); } diff --git a/application/forms/Config/General/LoggingConfigForm.php b/application/forms/Config/General/LoggingConfigForm.php index 759c2a6e3..997bd558a 100644 --- a/application/forms/Config/General/LoggingConfigForm.php +++ b/application/forms/Config/General/LoggingConfigForm.php @@ -4,7 +4,6 @@ namespace Icinga\Forms\Config\General; -use Icinga\Application\Icinga; use Icinga\Application\Logger; use Icinga\Web\Form; use Icinga\Web\Form\Validator\WritablePathValidator; @@ -31,12 +30,12 @@ class LoggingConfigForm extends Form array( 'required' => true, 'autosubmit' => true, - 'label' => t('Logging Type'), - 'description' => t('The type of logging to utilize.'), + 'label' => $this->translate('Logging Type'), + 'description' => $this->translate('The type of logging to utilize.'), 'multiOptions' => array( 'syslog' => 'Syslog', - 'file' => t('File', 'app.config.logging.type'), - 'none' => t('None', 'app.config.logging.type') + 'file' => $this->translate('File', 'app.config.logging.type'), + 'none' => $this->translate('None', 'app.config.logging.type') ) ) ); @@ -47,13 +46,13 @@ class LoggingConfigForm extends Form 'logging_level', array( 'required' => true, - 'label' => t('Logging Level'), - 'description' => t('The maximum logging level to emit.'), + 'label' => $this->translate('Logging Level'), + 'description' => $this->translate('The maximum logging level to emit.'), 'multiOptions' => array( - Logger::$levels[Logger::ERROR] => t('Error', 'app.config.logging.level'), - Logger::$levels[Logger::WARNING] => t('Warning', 'app.config.logging.level'), - Logger::$levels[Logger::INFO] => t('Information', 'app.config.logging.level'), - Logger::$levels[Logger::DEBUG] => t('Debug', 'app.config.logging.level') + Logger::$levels[Logger::ERROR] => $this->translate('Error', 'app.config.logging.level'), + Logger::$levels[Logger::WARNING] => $this->translate('Warning', 'app.config.logging.level'), + Logger::$levels[Logger::INFO] => $this->translate('Information', 'app.config.logging.level'), + Logger::$levels[Logger::DEBUG] => $this->translate('Debug', 'app.config.logging.level') ) ) ); @@ -65,8 +64,10 @@ class LoggingConfigForm extends Form 'logging_application', array( 'required' => true, - 'label' => t('Application Prefix'), - 'description' => t('The name of the application by which to prefix syslog messages.'), + 'label' => $this->translate('Application Prefix'), + 'description' => $this->translate( + 'The name of the application by which to prefix syslog messages.' + ), 'value' => 'icingaweb2', 'validators' => array( array( @@ -91,8 +92,8 @@ class LoggingConfigForm extends Form // 'logging_facility', // array( // 'required' => true, -// 'label' => t('Facility'), -// 'description' => t('The syslog facility to utilize.'), +// 'label' => $this->translate('Facility'), +// 'description' => $this->translate('The syslog facility to utilize.'), // 'multiOptions' => array( // 'user' => 'LOG_USER' // ) @@ -104,8 +105,8 @@ class LoggingConfigForm extends Form 'logging_file', array( 'required' => true, - 'label' => t('File path'), - 'description' => t('The full path to the log file to write messages to.'), + 'label' => $this->translate('File path'), + 'description' => $this->translate('The full path to the log file to write messages to.'), 'value' => '/var/log/icingaweb2/icingaweb2.log', 'validators' => array(new WritablePathValidator()) ) diff --git a/application/forms/Config/GeneralConfigForm.php b/application/forms/Config/GeneralConfigForm.php index 0d81bb96b..7e3357d7b 100644 --- a/application/forms/Config/GeneralConfigForm.php +++ b/application/forms/Config/GeneralConfigForm.php @@ -20,7 +20,7 @@ class GeneralConfigForm extends ConfigForm public function init() { $this->setName('form_config_general'); - $this->setSubmitLabel(t('Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -52,7 +52,7 @@ class GeneralConfigForm extends ConfigForm } if ($this->save()) { - Notification::success(t('New configuration has successfully been stored')); + Notification::success($this->translate('New configuration has successfully been stored')); } else { return false; } diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 36e69e9e1..9e4027299 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -41,8 +41,8 @@ class DbResourceForm extends Form 'name', array( 'required' => true, - 'label' => t('Resource Name'), - 'description' => t('The unique name of this resource') + 'label' => $this->translate('Resource Name'), + 'description' => $this->translate('The unique name of this resource') ) ); $this->addElement( @@ -50,8 +50,8 @@ class DbResourceForm extends Form 'db', array( 'required' => true, - 'label' => t('Database Type'), - 'description' => t('The type of SQL database'), + 'label' => $this->translate('Database Type'), + 'description' => $this->translate('The type of SQL database'), 'multiOptions' => $dbChoices ) ); @@ -60,8 +60,8 @@ class DbResourceForm extends Form 'host', array ( 'required' => true, - 'label' => t('Host'), - 'description' => t('The hostname of the database'), + 'label' => $this->translate('Host'), + 'description' => $this->translate('The hostname of the database'), 'value' => 'localhost' ) ); @@ -70,8 +70,8 @@ class DbResourceForm extends Form 'port', array( 'required' => true, - 'label' => t('Port'), - 'description' => t('The port to use'), + 'label' => $this->translate('Port'), + 'description' => $this->translate('The port to use'), 'value' => 3306 ) ); @@ -80,8 +80,8 @@ class DbResourceForm extends Form 'dbname', array( 'required' => true, - 'label' => t('Database Name'), - 'description' => t('The name of the database to use') + 'label' => $this->translate('Database Name'), + 'description' => $this->translate('The name of the database to use') ) ); $this->addElement( @@ -89,8 +89,8 @@ class DbResourceForm extends Form 'username', array ( 'required' => true, - 'label' => t('Username'), - 'description' => t('The user name to use for authentication') + 'label' => $this->translate('Username'), + 'description' => $this->translate('The user name to use for authentication') ) ); $this->addElement( @@ -99,8 +99,8 @@ class DbResourceForm extends Form array( 'required' => true, 'renderPassword' => true, - 'label' => t('Password'), - 'description' => t('The password to use for authentication') + 'label' => $this->translate('Password'), + 'description' => $this->translate('The password to use for authentication') ) ); @@ -132,7 +132,9 @@ class DbResourceForm extends Form $resource = ResourceFactory::createResource(new ConfigObject($form->getValues())); $resource->getConnection()->getConnection(); } catch (Exception $e) { - $form->addError(t('Connectivity validation failed, connection to the given resource not possible.')); + $form->addError( + $this->translate('Connectivity validation failed, connection to the given resource not possible.') + ); return false; } diff --git a/application/forms/Config/Resource/FileResourceForm.php b/application/forms/Config/Resource/FileResourceForm.php index 8e2920313..960926114 100644 --- a/application/forms/Config/Resource/FileResourceForm.php +++ b/application/forms/Config/Resource/FileResourceForm.php @@ -30,8 +30,8 @@ class FileResourceForm extends Form 'name', array( 'required' => true, - 'label' => t('Resource Name'), - 'description' => t('The unique name of this resource') + 'label' => $this->translate('Resource Name'), + 'description' => $this->translate('The unique name of this resource') ) ); $this->addElement( @@ -39,8 +39,8 @@ class FileResourceForm extends Form 'filename', array( 'required' => true, - 'label' => t('Filepath'), - 'description' => t('The filename to fetch information from'), + 'label' => $this->translate('Filepath'), + 'description' => $this->translate('The filename to fetch information from'), 'validators' => array(new ReadablePathValidator()) ) ); @@ -49,8 +49,8 @@ class FileResourceForm extends Form 'fields', array( 'required' => true, - 'label' => t('Pattern'), - 'description' => t('The regular expression by which to identify columns') + 'label' => $this->translate('Pattern'), + 'description' => $this->translate('The regular expression by which to identify columns') ) ); diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php index 6641b96bb..c113e2471 100644 --- a/application/forms/Config/Resource/LdapResourceForm.php +++ b/application/forms/Config/Resource/LdapResourceForm.php @@ -32,8 +32,8 @@ class LdapResourceForm extends Form 'name', array( 'required' => true, - 'label' => t('Resource Name'), - 'description' => t('The unique name of this resource') + 'label' => $this->translate('Resource Name'), + 'description' => $this->translate('The unique name of this resource') ) ); $this->addElement( @@ -41,8 +41,10 @@ class LdapResourceForm extends Form 'hostname', array( 'required' => true, - 'label' => t('Host'), - 'description' => t('The hostname or address of the LDAP server to use for authentication'), + 'label' => $this->translate('Host'), + 'description' => $this->translate( + 'The hostname or address of the LDAP server to use for authentication' + ), 'value' => 'localhost' ) ); @@ -51,8 +53,8 @@ class LdapResourceForm extends Form 'port', array( 'required' => true, - 'label' => t('Port'), - 'description' => t('The port of the LDAP server to use for authentication'), + 'label' => $this->translate('Port'), + 'description' => $this->translate('The port of the LDAP server to use for authentication'), 'value' => 389 ) ); @@ -61,8 +63,10 @@ class LdapResourceForm extends Form 'root_dn', array( 'required' => true, - 'label' => t('Root DN'), - 'description' => t('Only the root and its child nodes will be accessible on this resource.') + 'label' => $this->translate('Root DN'), + 'description' => $this->translate( + 'Only the root and its child nodes will be accessible on this resource.' + ) ) ); $this->addElement( @@ -70,8 +74,8 @@ class LdapResourceForm extends Form 'bind_dn', array( 'required' => true, - 'label' => t('Bind DN'), - 'description' => t('The user dn to use for querying the ldap server') + 'label' => $this->translate('Bind DN'), + 'description' => $this->translate('The user dn to use for querying the ldap server') ) ); $this->addElement( @@ -80,8 +84,8 @@ class LdapResourceForm extends Form array( 'required' => true, 'renderPassword' => true, - 'label' => t('Bind Password'), - 'description' => t('The password to use for querying the ldap server') + 'label' => $this->translate('Bind Password'), + 'description' => $this->translate('The password to use for querying the ldap server') ) ); @@ -119,7 +123,9 @@ class LdapResourceForm extends Form throw new Exception(); } } catch (Exception $e) { - $form->addError(t('Connectivity validation failed, connection to the given resource not possible.')); + $form->addError( + $this->translate('Connectivity validation failed, connection to the given resource not possible.') + ); return false; } diff --git a/application/forms/Config/Resource/LivestatusResourceForm.php b/application/forms/Config/Resource/LivestatusResourceForm.php index 2262cf583..996827228 100644 --- a/application/forms/Config/Resource/LivestatusResourceForm.php +++ b/application/forms/Config/Resource/LivestatusResourceForm.php @@ -33,8 +33,8 @@ class LivestatusResourceForm extends Form 'name', array( 'required' => true, - 'label' => t('Resource Name'), - 'description' => t('The unique name of this resource') + 'label' => $this->translate('Resource Name'), + 'description' => $this->translate('The unique name of this resource') ) ); $this->addElement( @@ -42,8 +42,8 @@ class LivestatusResourceForm extends Form 'socket', array( 'required' => true, - 'label' => t('Socket'), - 'description' => t('The path to your livestatus socket used for querying monitoring data'), + 'label' => $this->translate('Socket'), + 'description' => $this->translate('The path to your livestatus socket used for querying monitoring data'), 'value' => '/var/run/icinga2/cmd/livestatus' ) ); @@ -75,8 +75,10 @@ class LivestatusResourceForm extends Form try { $resource = ResourceFactory::createResource(new ConfigObject($form->getValues())); $resource->connect()->disconnect(); - } catch (Exception $e) { - $form->addError(t('Connectivity validation failed, connection to the given resource not possible.')); + } catch (Exception $_) { + $form->addError( + $this->translate('Connectivity validation failed, connection to the given resource not possible.') + ); return false; } diff --git a/application/forms/Config/ResourceConfigForm.php b/application/forms/Config/ResourceConfigForm.php index e7933c18f..67912142a 100644 --- a/application/forms/Config/ResourceConfigForm.php +++ b/application/forms/Config/ResourceConfigForm.php @@ -22,7 +22,7 @@ class ResourceConfigForm extends ConfigForm public function init() { $this->setName('form_config_resource'); - $this->setSubmitLabel(t('Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -43,7 +43,7 @@ class ResourceConfigForm extends ConfigForm } elseif ($type === 'file') { return new FileResourceForm(); } else { - throw new InvalidArgumentException(sprintf(t('Invalid resource type "%s" provided'), $type)); + throw new InvalidArgumentException(sprintf($this->translate('Invalid resource type "%s" provided'), $type)); } } @@ -62,9 +62,9 @@ class ResourceConfigForm extends ConfigForm { $name = isset($values['name']) ? $values['name'] : ''; if (! $name) { - throw new InvalidArgumentException(t('Resource name missing')); + throw new InvalidArgumentException($this->translate('Resource name missing')); } elseif ($this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Resource already exists')); + throw new InvalidArgumentException($this->translate('Resource already exists')); } unset($values['name']); @@ -85,11 +85,11 @@ class ResourceConfigForm extends ConfigForm public function edit($name, array $values) { if (! $name) { - throw new InvalidArgumentException(t('Old resource name missing')); + throw new InvalidArgumentException($this->translate('Old resource name missing')); } elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) { - throw new InvalidArgumentException(t('New resource name missing')); + throw new InvalidArgumentException($this->translate('New resource name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Unknown resource provided')); + throw new InvalidArgumentException($this->translate('Unknown resource provided')); } $resourceConfig = $this->config->getSection($name); @@ -111,9 +111,9 @@ class ResourceConfigForm extends ConfigForm public function remove($name) { if (! $name) { - throw new InvalidArgumentException(t('Resource name missing')); + throw new InvalidArgumentException($this->translate('Resource name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(t('Unknown resource provided')); + throw new InvalidArgumentException($this->translate('Unknown resource provided')); } $resourceConfig = $this->config->getSection($name); @@ -143,10 +143,10 @@ class ResourceConfigForm extends ConfigForm try { if ($resource === null) { // create new resource $this->add($this->getValues()); - $message = t('Resource "%s" has been successfully created'); + $message = $this->translate('Resource "%s" has been successfully created'); } else { // edit existing resource $this->edit($resource, $this->getValues()); - $message = t('Resource "%s" has been successfully changed'); + $message = $this->translate('Resource "%s" has been successfully changed'); } } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); @@ -172,9 +172,9 @@ class ResourceConfigForm extends ConfigForm $resource = $this->request->getQuery('resource'); if ($resource !== null) { if ($resource === '') { - throw new ConfigurationError(t('Resource name missing')); + throw new ConfigurationError($this->translate('Resource name missing')); } elseif (! $this->config->hasSection($resource)) { - throw new ConfigurationError(t('Unknown resource provided')); + throw new ConfigurationError($this->translate('Unknown resource provided')); } $configValues = $this->config->getSection($resource)->toArray(); @@ -197,8 +197,8 @@ class ResourceConfigForm extends ConfigForm array( 'order' => 0, 'ignore' => true, - 'label' => t('Force Changes'), - 'description' => t('Check this box to enforce changes without connectivity validation') + 'label' => $this->translate('Force Changes'), + 'description' => $this->translate('Check this box to enforce changes without connectivity validation') ) ); } @@ -211,14 +211,14 @@ class ResourceConfigForm extends ConfigForm $resourceType = isset($formData['type']) ? $formData['type'] : 'db'; $resourceTypes = array( - 'file' => t('File'), + 'file' => $this->translate('File'), 'livestatus' => 'Livestatus', ); if ($resourceType === 'ldap' || Platform::extensionLoaded('ldap')) { $resourceTypes['ldap'] = 'LDAP'; } if ($resourceType === 'db' || Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) { - $resourceTypes['db'] = t('SQL Database'); + $resourceTypes['db'] = $this->translate('SQL Database'); } $this->addElement( @@ -227,8 +227,8 @@ class ResourceConfigForm extends ConfigForm array( 'required' => true, 'autosubmit' => true, - 'label' => t('Resource Type'), - 'description' => t('The type of resource'), + 'label' => $this->translate('Resource Type'), + 'description' => $this->translate('The type of resource'), 'multiOptions' => $resourceTypes, 'value' => $resourceType ) diff --git a/application/forms/ConfirmRemovalForm.php b/application/forms/ConfirmRemovalForm.php index 02d7263df..6840db37d 100644 --- a/application/forms/ConfirmRemovalForm.php +++ b/application/forms/ConfirmRemovalForm.php @@ -17,6 +17,6 @@ class ConfirmRemovalForm extends Form public function init() { $this->setName('form_confirm_removal'); - $this->setSubmitLabel(t('Confirm Removal')); + $this->setSubmitLabel($this->translate('Confirm Removal')); } } diff --git a/application/forms/Dashboard/DashletForm.php b/application/forms/Dashboard/DashletForm.php index 6c38ff97e..e58ca8aba 100644 --- a/application/forms/Dashboard/DashletForm.php +++ b/application/forms/Dashboard/DashletForm.php @@ -26,7 +26,7 @@ class DashletForm extends Form { $this->setName('form_dashboard_addurl'); if (! $this->getSubmitLabel()) { - $this->setSubmitLabel(t('Add To Dashboard')); + $this->setSubmitLabel($this->translate('Add To Dashboard')); } $this->setAction(URL::fromRequest()); } @@ -66,9 +66,10 @@ class DashletForm extends Form 'url', array( 'required' => true, - 'label' => t('Url'), - 'description' => - t('Enter url being loaded in the dashlet. You can paste the full URL, including filters.') + 'label' => $this->translate('Url'), + 'description' => $this->translate( + 'Enter url being loaded in the dashlet. You can paste the full URL, including filters.' + ) ) ); $this->addElement( @@ -76,8 +77,8 @@ class DashletForm extends Form 'dashlet', array( 'required' => true, - 'label' => t('Dashlet Title'), - 'description' => t('Enter a title for the dashlet.') + 'label' => $this->translate('Dashlet Title'), + 'description' => $this->translate('Enter a title for the dashlet.') ) ); $this->addElement( @@ -95,9 +96,8 @@ class DashletForm extends Form 'pane', array( 'required' => true, - 'label' => t("New Dashboard Title"), - 'description' => - t('Enter a title for the new pane.') + 'label' => $this->translate("New Dashboard Title"), + 'description' => $this->translate('Enter a title for the new pane.') ) ); } else { @@ -106,10 +106,9 @@ class DashletForm extends Form 'pane', array( 'required' => true, - 'label' => t('Dashboard'), + 'label' => $this->translate('Dashboard'), 'multiOptions' => $panes, - 'description' => - t('Select a pane you want to add the dashlet.') + 'description' => $this->translate('Select a pane you want to add the dashlet.') ) ); } @@ -119,9 +118,9 @@ class DashletForm extends Form 'create_new_pane', array( 'required' => false, - 'label' => t('New dashboard'), + 'label' => $this->translate('New dashboard'), 'class' => 'autosubmit', - 'description' => t('Check this box if you want to add the dashlet to a new dashboard') + 'description' => $this->translate('Check this box if you want to add the dashlet to a new dashboard') ) ); } diff --git a/application/forms/LdapDiscoveryForm.php b/application/forms/LdapDiscoveryForm.php index 0fd0ea0d3..ea5f3a99e 100644 --- a/application/forms/LdapDiscoveryForm.php +++ b/application/forms/LdapDiscoveryForm.php @@ -26,8 +26,8 @@ class LdapDiscoveryForm extends Form 'domain', array( 'required' => true, - 'label' => t('Search Domain'), - 'description' => t('Search this domain for records of available servers.'), + 'label' => $this->translate('Search Domain'), + 'description' => $this->translate('Search this domain for records of available servers.'), ) ); @@ -36,7 +36,7 @@ class LdapDiscoveryForm extends Form 'note', 'additional_description', array( - 'value' => t('No Ldap servers found on this domain.' + 'value' => $this->translate('No Ldap servers found on this domain.' . ' You can try to specify host and port and try again, or just skip this step and ' . 'configure the server manually.' ) @@ -47,8 +47,8 @@ class LdapDiscoveryForm extends Form 'hostname', array( 'required' => false, - 'label' => t('Host'), - 'description' => t('IP or host name to search.'), + 'label' => $this->translate('Host'), + 'description' => $this->translate('IP or host name to search.'), ) ); @@ -57,8 +57,8 @@ class LdapDiscoveryForm extends Form 'port', array( 'required' => false, - 'label' => t('Port'), - 'description' => t('Port', 389), + 'label' => $this->translate('Port'), + 'description' => $this->translate('Port', 389), ) ); } diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index e3cfdf319..9b5a3ecf8 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -105,9 +105,9 @@ class PreferenceForm extends Form try { if ($this->getElement('btn_submit_preferences')->isChecked()) { $this->save(); - Notification::success(t('Preferences successfully saved')); + Notification::success($this->translate('Preferences successfully saved')); } else { - Notification::success(t('Preferences successfully saved for the current session')); + Notification::success($this->translate('Preferences successfully saved for the current session')); } } catch (Exception $e) { Logger::error($e); @@ -142,13 +142,13 @@ class PreferenceForm extends Form public function createElements(array $formData) { $languages = array(); - $languages['autodetect'] = sprintf(t('Browser (%s)', 'preferences.form'), $this->getLocale()); + $languages['autodetect'] = sprintf($this->translate('Browser (%s)', 'preferences.form'), $this->getLocale()); foreach (Translator::getAvailableLocaleCodes() as $language) { $languages[$language] = $language; } $tzList = array(); - $tzList['autodetect'] = sprintf(t('Browser (%s)', 'preferences.form'), $this->getDefaultTimezone()); + $tzList['autodetect'] = sprintf($this->translate('Browser (%s)', 'preferences.form'), $this->getDefaultTimezone()); foreach (DateTimeZone::listIdentifiers() as $tz) { $tzList[$tz] = $tz; } @@ -158,8 +158,8 @@ class PreferenceForm extends Form 'language', array( 'required' => true, - 'label' => t('Your Current Language'), - 'description' => t('Use the following language to display texts and messages'), + 'label' => $this->translate('Your Current Language'), + 'description' => $this->translate('Use the following language to display texts and messages'), 'multiOptions' => $languages, 'value' => substr(setlocale(LC_ALL, 0), 0, 5) ) @@ -170,8 +170,8 @@ class PreferenceForm extends Form 'timezone', array( 'required' => true, - 'label' => t('Your Current Timezone'), - 'description' => t('Use the following timezone for dates and times'), + 'label' => $this->translate('Your Current Timezone'), + 'description' => $this->translate('Use the following timezone for dates and times'), 'multiOptions' => $tzList, 'value' => $this->getDefaultTimezone() ) @@ -182,7 +182,7 @@ class PreferenceForm extends Form 'show_benchmark', array( 'required' => true, - 'label' => t('Use benchmark') + 'label' => $this->translate('Use benchmark') ) ); @@ -191,7 +191,7 @@ class PreferenceForm extends Form 'btn_submit_preferences', array( 'ignore' => true, - 'label' => t('Save to the Preferences'), + 'label' => $this->translate('Save to the Preferences'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'div')) @@ -204,7 +204,7 @@ class PreferenceForm extends Form 'btn_submit_session', array( 'ignore' => true, - 'label' => t('Save for the current Session'), + 'label' => $this->translate('Save for the current Session'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'div')) diff --git a/application/forms/Security/RoleForm.php b/application/forms/Security/RoleForm.php index b27a4ec8b..f32c0cab4 100644 --- a/application/forms/Security/RoleForm.php +++ b/application/forms/Security/RoleForm.php @@ -72,8 +72,8 @@ class RoleForm extends ConfigForm 'name', array( 'required' => true, - 'label' => t('Role Name'), - 'description' => t('The name of the role'), + 'label' => $this->translate('Role Name'), + 'description' => $this->translate('The name of the role'), 'ignore' => true ), ), @@ -81,24 +81,26 @@ class RoleForm extends ConfigForm 'textarea', 'users', array( - 'label' => t('Users'), - 'description' => t('Comma-separated list of users that are assigned to the role') + 'label' => $this->translate('Users'), + 'description' => $this->translate('Comma-separated list of users that are assigned to the role') ), ), array( 'textarea', 'groups', array( - 'label' => t('Groups'), - 'description' => t('Comma-separated list of groups that are assigned to the role') + 'label' => $this->translate('Groups'), + 'description' => $this->translate('Comma-separated list of groups that are assigned to the role') ), ), array( 'multiselect', 'permissions', array( - 'label' => t('Permissions Set'), - 'description' => t('The permissions to grant. You may select more than one permission'), + 'label' => $this->translate('Permissions Set'), + 'description' => $this->translate( + 'The permissions to grant. You may select more than one permission' + ), 'multiOptions' => $this->providedPermissions ) ) @@ -133,7 +135,7 @@ class RoleForm extends ConfigForm } if (! $this->config->hasSection($name)) { throw new InvalidArgumentException(sprintf( - t('Can\'t load role \'%s\'. Role does not exist'), + $this->translate('Can\'t load role \'%s\'. Role does not exist'), $name )); } @@ -174,7 +176,7 @@ class RoleForm extends ConfigForm } if ($this->config->hasSection($name)) { throw new InvalidArgumentException(sprintf( - t('Can\'t add role \'%s\'. Role already exists'), + $this->translate('Can\'t add role \'%s\'. Role already exists'), $name )); } @@ -200,7 +202,7 @@ class RoleForm extends ConfigForm } if (! $this->config->hasSection($name)) { throw new InvalidArgumentException(sprintf( - t('Can\'t remove role \'%s\'. Role does not exist'), + $this->translate('Can\'t remove role \'%s\'. Role does not exist'), $name )); } @@ -233,7 +235,7 @@ class RoleForm extends ConfigForm } else { if (! $this->config->hasSection($name)) { throw new InvalidArgumentException(sprintf( - t('Can\'t update role \'%s\'. Role does not exist'), + $this->translate('Can\'t update role \'%s\'. Role does not exist'), $name )); } From a57f1b00a97abba9b21c6a4e61590e5196911d97 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:41:49 +0100 Subject: [PATCH 16/41] rpm: Introduce config directory for packaged configuration files refs #4075 --- packages/files/{ => config}/modules/doc/config.ini | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/files/{ => config}/modules/doc/config.ini (100%) diff --git a/packages/files/modules/doc/config.ini b/packages/files/config/modules/doc/config.ini similarity index 100% rename from packages/files/modules/doc/config.ini rename to packages/files/config/modules/doc/config.ini From 601436208917af59b9e08fba8100bef4f6723c4d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:44:16 +0100 Subject: [PATCH 17/41] packages: Install custom setup module config w/ correct path to the schema files refs #4075 --- packages/files/config/modules/setup/config.ini | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 packages/files/config/modules/setup/config.ini diff --git a/packages/files/config/modules/setup/config.ini b/packages/files/config/modules/setup/config.ini new file mode 100644 index 000000000..5158aae99 --- /dev/null +++ b/packages/files/config/modules/setup/config.ini @@ -0,0 +1,2 @@ +[schema] +path = /usr/share/doc/icingaweb2/schema From 556610adc18c2ebe3c62936bd9d915a596b6c63b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 17:52:08 +0100 Subject: [PATCH 18/41] rpm: icingaweb2-common must not install any config file except the config directory refs #4075 --- icingaweb2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icingaweb2.spec b/icingaweb2.spec index 4fa670333..7520d336c 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -219,7 +219,7 @@ exit 0 %defattr(-,root,root) %{basedir}/application/locale %dir %{basedir}/modules -%attr(2770,root,%{icingawebgroup}) %config(noreplace) %{configdir} +%attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir} %files -n php-Icinga From ef412688e9f853643091748fdb4c57299541e1ef Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 18:10:19 +0100 Subject: [PATCH 19/41] setup: Require to set a path to the schema files refs #8232 --- modules/setup/library/Setup/Steps/DatabaseStep.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/setup/library/Setup/Steps/DatabaseStep.php b/modules/setup/library/Setup/Steps/DatabaseStep.php index c6ec2ef2b..006b6c9ed 100644 --- a/modules/setup/library/Setup/Steps/DatabaseStep.php +++ b/modules/setup/library/Setup/Steps/DatabaseStep.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Steps; use Exception; use PDOException; -use Icinga\Application\Icinga; use Icinga\Module\Setup\Step; use Icinga\Module\Setup\Utils\DbTool; use Icinga\Module\Setup\Exception\SetupException; @@ -71,7 +70,7 @@ class DatabaseStep extends Step $this->log(mt('setup', 'Database schema already exists...')); } else { $this->log(mt('setup', 'Creating database schema...')); - $db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/mysql.schema.sql'); + $db->import($this->data['schemaPath'] . '/mysql.schema.sql'); } if ($db->hasLogin($this->data['resourceConfig']['username'])) { @@ -122,7 +121,7 @@ class DatabaseStep extends Step $this->log(mt('setup', 'Database schema already exists...')); } else { $this->log(mt('setup', 'Creating database schema...')); - $db->import(Icinga::app()->getApplicationDir() . '/../etc/schema/pgsql.schema.sql'); + $db->import($this->data['schemaPath'] . '/pgsql.schema.sql'); } if ($db->hasLogin($this->data['resourceConfig']['username'])) { From 70f080313dc44bb85ba324c32f9d63171f3124d5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 18:10:54 +0100 Subject: [PATCH 20/41] setup: Use schema path from setup's config or default refs #8232 --- modules/setup/library/Setup/WebWizard.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/setup/library/Setup/WebWizard.php b/modules/setup/library/Setup/WebWizard.php index 102c2c6a0..68632e305 100644 --- a/modules/setup/library/Setup/WebWizard.php +++ b/modules/setup/library/Setup/WebWizard.php @@ -295,7 +295,9 @@ class WebWizard extends Wizard implements SetupWizard : null, 'adminPassword' => isset($pageData['setup_database_creation']['password']) ? $pageData['setup_database_creation']['password'] - : null + : null, + 'schemaPath' => Config::module('setup') + ->get('schema', 'path', Icinga::app()->getBaseDir('etc/schema')) )) ); } From 4819ebb6b22166d16c8bcfee8b9701220fdd0f23 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 16 Jan 2015 18:11:20 +0100 Subject: [PATCH 21/41] rpm: Install configuration for the setup module refs #4075 refs #8232 --- icingaweb2.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/icingaweb2.spec b/icingaweb2.spec index 7520d336c..83ba9b4a7 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -171,7 +171,7 @@ Icinga Web 2 vendor library Zend %install rm -rf %{buildroot} -mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir},%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{docsdir}} +mkdir -p %{buildroot}/{%{basedir}/{modules,library,public},%{bindir},%{configdir}/modules/setup,%{logdir},%{phpdir},%{wwwconfigdir},%{_sysconfdir}/bash_completion.d,%{docsdir}} cp -prv application doc %{buildroot}/%{basedir} cp -pv etc/bash_completion.d/icingacli %{buildroot}/%{_sysconfdir}/bash_completion.d/icingacli cp -prv modules/{monitoring,setup} %{buildroot}/%{basedir}/modules @@ -182,6 +182,7 @@ cp -pv packages/files/apache/icingaweb2.conf %{buildroot}/%{wwwconfigdir}/icinga cp -pv packages/files/bin/icingacli %{buildroot}/%{bindir} cp -pv packages/files/public/index.php %{buildroot}/%{basedir}/public cp -prv etc/schema %{buildroot}/%{docsdir} +cp -prv packages/files/config/modules/setup %{buildroot}/%{configdir}/modules/ %pre getent group icingacmd >/dev/null || groupadd -r icingacmd @@ -209,6 +210,7 @@ rm -rf %{buildroot} %attr(2775,root,%{icingawebgroup}) %dir %{logdir} %{docsdir} %docdir %{docsdir} +%attr(2770,root,%{icingawebgroup}) %config(noreplace) %{configdir}/modules/setup %pre common From f4ea24bfa07cdb1ec2a25b9ce2bcb369ca64041e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 10:50:27 +0100 Subject: [PATCH 22/41] rpm: Fix configuration files permissions refs #4075 --- icingaweb2.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/icingaweb2.spec b/icingaweb2.spec index 83ba9b4a7..c98a8c65f 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -210,7 +210,8 @@ rm -rf %{buildroot} %attr(2775,root,%{icingawebgroup}) %dir %{logdir} %{docsdir} %docdir %{docsdir} -%attr(2770,root,%{icingawebgroup}) %config(noreplace) %{configdir}/modules/setup +%attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules/setup +%attr(0660,root,%{icingawebgroup}) %config(noreplace) %{configdir}/modules/setup/config.ini %pre common @@ -222,6 +223,7 @@ exit 0 %{basedir}/application/locale %dir %{basedir}/modules %attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir} +%attr(2770,root,%{icingawebgroup}) %config(noreplace) %dir %{configdir}/modules %files -n php-Icinga From abc74c7fb505b9b089b51a3695f6f8597c0b597a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:11:59 +0100 Subject: [PATCH 23/41] monitoring/setup: Fix directory mode of the monitoring configuration directory We should introduce a CreateConfigDirectoryStep because module developers must not provide a directory mode but use our default. --- modules/monitoring/library/Monitoring/MonitoringWizard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/MonitoringWizard.php b/modules/monitoring/library/Monitoring/MonitoringWizard.php index 0ac4c7f63..f524a3d10 100644 --- a/modules/monitoring/library/Monitoring/MonitoringWizard.php +++ b/modules/monitoring/library/Monitoring/MonitoringWizard.php @@ -124,7 +124,7 @@ class MonitoringWizard extends Wizard implements SetupWizard $pageData = $this->getPageData(); $setup = new Setup(); - $setup->addStep(new MakeDirStep(array($this->getConfigDir() . '/modules/monitoring'), 0775)); + $setup->addStep(new MakeDirStep(array($this->getConfigDir() . '/modules/monitoring'), 2770)); $setup->addStep( new BackendStep(array( From c0444a81b24aea332b07eb1409af168c1c53f0c9 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:14:24 +0100 Subject: [PATCH 24/41] setup: Fix octdec for directory modes Modes prefixed w/ zero, e.g. 0775 require a string conversion before calling octdec. --- modules/setup/library/Setup/Utils/MakeDirStep.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setup/library/Setup/Utils/MakeDirStep.php b/modules/setup/library/Setup/Utils/MakeDirStep.php index 27919820b..d7813541b 100644 --- a/modules/setup/library/Setup/Utils/MakeDirStep.php +++ b/modules/setup/library/Setup/Utils/MakeDirStep.php @@ -21,7 +21,7 @@ class MakeDirStep extends Step public function __construct($paths, $dirmode) { $this->paths = $paths; - $this->dirmode = octdec($dirmode); + $this->dirmode = octdec((string) $dirmode); $this->errors = array(); } From 7fc70c5a0238963da56aa2fa0414219d8d0ab10e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:16:17 +0100 Subject: [PATCH 25/41] IniWriter: Don't allow read for others on new files --- library/Icinga/File/Ini/IniWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/File/Ini/IniWriter.php b/library/Icinga/File/Ini/IniWriter.php index 28ca53ff0..21402ab74 100644 --- a/library/Icinga/File/Ini/IniWriter.php +++ b/library/Icinga/File/Ini/IniWriter.php @@ -27,7 +27,7 @@ class IniWriter extends Zend_Config_Writer_FileAbstract * * @var int */ - public static $fileMode = 0664; + public static $fileMode = 0660; /** * Create a new INI writer From 599cb620d86a643b19dbc73a3015972f3ced256c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:23:43 +0100 Subject: [PATCH 26/41] Config: Don't throw NotReadableError if the file does not exist --- library/Icinga/Application/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index dcb837fde..ac37e8c69 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -292,7 +292,7 @@ class Config implements Countable, Iterator $config = new static(new ConfigObject(parse_ini_file($filepath, true))); $config->setConfigFile($filepath); return $config; - } else { + } elseif (@file_exists($filepath)) { throw new NotReadableError(t('Cannot read config file "%s". Permission denied'), $filepath); } From 87adbacb3beda6c7236dfdb2d535b41cc3910141 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:24:41 +0100 Subject: [PATCH 27/41] Config: Fix coding style --- library/Icinga/Application/Config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index ac37e8c69..676e237a4 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -322,7 +322,7 @@ class Config implements Countable, Iterator */ public static function app($configname = 'config', $fromDisk = false) { - if (!isset(self::$app[$configname]) || $fromDisk) { + if (! isset(self::$app[$configname]) || $fromDisk) { self::$app[$configname] = static::fromIni(static::resolvePath($configname . '.ini')); } @@ -341,12 +341,12 @@ class Config implements Countable, Iterator */ public static function module($modulename, $configname = 'config', $fromDisk = false) { - if (!isset(self::$modules[$modulename])) { + if (! isset(self::$modules[$modulename])) { self::$modules[$modulename] = array(); } $moduleConfigs = self::$modules[$modulename]; - if (!isset($moduleConfigs[$configname]) || $fromDisk) { + if (! isset($moduleConfigs[$configname]) || $fromDisk) { $moduleConfigs[$configname] = static::fromIni( static::resolvePath('modules/' . $modulename . '/' . $configname . '.ini') ); From ac503031a700506e1c1b3f958ae42aecf66d7932 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:25:06 +0100 Subject: [PATCH 28/41] Config: Fix PHPDoc for fromIni --- library/Icinga/Application/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index 676e237a4..361f5f11d 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -279,7 +279,7 @@ class Config implements Countable, Iterator * * @param string $file The file to parse * - * @throws NotReadableError When the file does not exist or cannot be read + * @throws NotReadableError When the file cannot be read */ public static function fromIni($file) { From 64d4bb089c4041b60e4feb4c106b369c29d48f94 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:31:35 +0100 Subject: [PATCH 29/41] monitoring/setup: Remove function for getting the configuration directory Getting the config directory is not a task for module wizards. --- .../library/Monitoring/MonitoringWizard.php | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/modules/monitoring/library/Monitoring/MonitoringWizard.php b/modules/monitoring/library/Monitoring/MonitoringWizard.php index f524a3d10..9c588e5b3 100644 --- a/modules/monitoring/library/Monitoring/MonitoringWizard.php +++ b/modules/monitoring/library/Monitoring/MonitoringWizard.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Monitoring; +use Icinga\Application\Icinga; use Icinga\Web\Form; use Icinga\Web\Wizard; use Icinga\Web\Request; @@ -124,7 +125,7 @@ class MonitoringWizard extends Wizard implements SetupWizard $pageData = $this->getPageData(); $setup = new Setup(); - $setup->addStep(new MakeDirStep(array($this->getConfigDir() . '/modules/monitoring'), 2770)); + $setup->addStep(new MakeDirStep(array(Icinga::app()->getConfigDir() . '/modules/monitoring'), 2770)); $setup->addStep( new BackendStep(array( @@ -159,21 +160,4 @@ class MonitoringWizard extends Wizard implements SetupWizard { return new Requirements(); } - - /** - * Return the configuration directory of Icinga Web 2 - * - * @return string - */ - protected function getConfigDir() - { - if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) { - $configDir = $_SERVER['ICINGAWEB_CONFIGDIR']; - } else { - $configDir = '/etc/icingaweb'; - } - - $canonical = realpath($configDir); - return $canonical ? $canonical : $configDir; - } } From ae4a9fe50ccca9a520c269a24c8f1949596988f4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 11:43:13 +0100 Subject: [PATCH 30/41] puppet: Use hiera for defining the icinga web group --- .puppet/hiera/common.yaml | 1 + .puppet/modules/icingaweb2/manifests/config.pp | 7 ++++--- .../icingaweb2/manifests/config/general.pp | 7 ++++--- .../icingaweb2/manifests/config/module.pp | 9 +++++---- .../profiles/icingaweb2_dev/manifests/init.pp | 17 +++++++++-------- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.puppet/hiera/common.yaml b/.puppet/hiera/common.yaml index c76b904bf..d7802181f 100644 --- a/.puppet/hiera/common.yaml +++ b/.puppet/hiera/common.yaml @@ -5,3 +5,4 @@ icingaweb2::web_path: icingaweb2 icingaweb2::db_user: icingaweb2 icingaweb2::db_pass: icingaweb2 icingaweb2::db_name: icingaweb2 +icingaweb2::group: icingaweb2 diff --git a/.puppet/modules/icingaweb2/manifests/config.pp b/.puppet/modules/icingaweb2/manifests/config.pp index 473d89d06..625c47b7a 100644 --- a/.puppet/modules/icingaweb2/manifests/config.pp +++ b/.puppet/modules/icingaweb2/manifests/config.pp @@ -1,14 +1,15 @@ class icingaweb2::config ( - $config = hiera('icingaweb2::config') + $config = hiera('icingaweb2::config'), + $web_group = hiera('icingaweb2::group') ) { - group { 'icingaweb': + group { $web_group: ensure => present, } file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]: ensure => directory, owner => 'root', - group => 'icingaweb', + group => $web_group, mode => '2770', } } diff --git a/.puppet/modules/icingaweb2/manifests/config/general.pp b/.puppet/modules/icingaweb2/manifests/config/general.pp index c2daec83f..8ccea172f 100644 --- a/.puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.puppet/modules/icingaweb2/manifests/config/general.pp @@ -1,14 +1,15 @@ define icingaweb2::config::general ( $source, - $config = hiera('icingaweb2::config'), - $replace = true + $config = hiera('icingaweb2::config'), + $web_group = hiera('icingaweb2::group'), + $replace = true ) { include icingaweb2::config file { "${config}/${name}.ini": content => template("${source}/${name}.ini.erb"), owner => 'root', - group => 'icingaweb', + group => $web_group, mode => 0660, replace => $replace, } diff --git a/.puppet/modules/icingaweb2/manifests/config/module.pp b/.puppet/modules/icingaweb2/manifests/config/module.pp index 69e5abd6b..19db02250 100644 --- a/.puppet/modules/icingaweb2/manifests/config/module.pp +++ b/.puppet/modules/icingaweb2/manifests/config/module.pp @@ -1,8 +1,9 @@ define icingaweb2::config::module ( $module, $source, - $config = hiera('icingaweb2::config'), - $replace = true + $config = hiera('icingaweb2::config'), + $web_group = hiera('icingaweb2::group'), + $replace = true ) { include icingaweb2::config @@ -10,7 +11,7 @@ define icingaweb2::config::module ( file { "${config}/modules/${module}": ensure => directory, owner => 'root', - group => 'icingaweb', + group => $web_group, mode => '2770', } } @@ -18,7 +19,7 @@ define icingaweb2::config::module ( file { "${config}/modules/${module}/${name}.ini": source => "${source}/modules/${module}/${name}.ini", owner => 'root', - group => 'icingaweb', + group => $web_group, mode => 0660, replace => $replace, } diff --git a/.puppet/profiles/icingaweb2_dev/manifests/init.pp b/.puppet/profiles/icingaweb2_dev/manifests/init.pp index 379f75247..157a9d80a 100644 --- a/.puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,10 +1,11 @@ class icingaweb2_dev ( - $config = hiera('icingaweb2::config'), - $log = hiera('icingaweb2::log'), - $web_path = hiera('icingaweb2::web_path'), - $db_user = hiera('icingaweb2::db_user'), - $db_pass = hiera('icingaweb2::db_pass'), - $db_name = hiera('icingaweb2::db_name'), + $config = hiera('icingaweb2::config'), + $log = hiera('icingaweb2::log'), + $web_path = hiera('icingaweb2::web_path'), + $db_user = hiera('icingaweb2::db_user'), + $db_pass = hiera('icingaweb2::db_pass'), + $db_name = hiera('icingaweb2::db_name'), + $web_group = hiera('icingaweb2::group'), ) { include apache include php @@ -28,7 +29,7 @@ class icingaweb2_dev ( Exec { path => '/usr/local/bin:/usr/bin:/bin' } # TODO(el): Enabling/disabling modules should be a resource - User <| alias == apache |> { groups +> 'icingaweb' } + User <| alias == apache |> { groups +> $web_group } -> exec { 'enable-monitoring-module': command => 'icingacli module enable monitoring', user => 'apache', @@ -50,7 +51,7 @@ class icingaweb2_dev ( file { $log_dir: ensure => directory, owner => 'root', - group => 'icingaweb', + group => $web_group, mode => '2775' } From 23bbf63b73a70933944175dcde709d47437330df Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 19 Jan 2015 13:44:16 +0100 Subject: [PATCH 31/41] Revert "Replace t() and mt() with translate() in the monitoring module's forms" This reverts commit 970006838cb2791091dfb2632b1c7eea9d4a243f. --- .../DisableNotificationsExpireCommandForm.php | 11 ++-- .../ToggleInstanceFeaturesCommandForm.php | 28 +++++----- .../Object/AcknowledgeProblemCommandForm.php | 34 ++++++------ .../Command/Object/AddCommentCommandForm.php | 13 +++-- .../Command/Object/CheckNowCommandForm.php | 4 +- .../Object/DeleteCommentCommandForm.php | 4 +- .../Object/DeleteDowntimeCommandForm.php | 4 +- .../Object/ProcessCheckResultCommandForm.php | 30 ++++++----- .../Object/ScheduleHostCheckCommandForm.php | 5 +- .../ScheduleHostDowntimeCommandForm.php | 16 +++--- .../ScheduleServiceCheckCommandForm.php | 17 +++--- .../ScheduleServiceDowntimeCommandForm.php | 34 ++++++------ .../ToggleObjectFeaturesCommandForm.php | 16 +++--- .../Config/Instance/LocalInstanceForm.php | 4 +- .../Config/Instance/RemoteInstanceForm.php | 16 +++--- .../RemoteInstanceKeyResourcePage.php | 54 ------------------- .../forms/Config/InstanceConfigForm.php | 34 ++++++------ .../forms/Config/SecurityConfigForm.php | 8 +-- .../application/forms/EventOverviewForm.php | 10 ++-- .../application/forms/Setup/BackendPage.php | 15 +++--- .../forms/Setup/IdoResourcePage.php | 11 ++-- .../application/forms/Setup/InstancePage.php | 5 +- .../forms/Setup/LivestatusResourcePage.php | 11 ++-- .../application/forms/Setup/SecurityPage.php | 5 +- .../application/forms/Setup/WelcomePage.php | 10 ++-- .../application/forms/StatehistoryForm.php | 42 +++++++-------- 26 files changed, 204 insertions(+), 237 deletions(-) delete mode 100644 modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php diff --git a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php index 21d926b58..0e64a4b03 100644 --- a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php @@ -21,7 +21,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm */ public function init() { - $this->setSubmitLabel($this->translate('Disable Notifications')); + $this->setSubmitLabel(mt('monitoring', 'Disable Notifications')); } /** @@ -30,7 +30,8 @@ class DisableNotificationsExpireCommandForm extends CommandForm */ public function getHelp() { - return $this->translate( + return mt( + 'monitoring', 'This command is used to disable host and service notifications for a specific time.' ); } @@ -48,8 +49,8 @@ class DisableNotificationsExpireCommandForm extends CommandForm 'expire_time', array( 'required' => true, - 'label' => $this->translate('Expire Time'), - 'description' => $this->translate('Set the expire time.'), + 'label' => mt('monitoring', 'Expire Time'), + 'description' => mt('monitoring', 'Set the expire time.'), 'value' => $expireTime ) ); @@ -66,7 +67,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm $disableNotifications ->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp()); $this->getTransport($this->request)->send($disableNotifications); - Notification::success($this->translate('Disabling host and service notifications..')); + Notification::success(mt('monitoring', 'Disabling host and service notifications..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php index 469c1b6eb..291619b2f 100644 --- a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php @@ -61,13 +61,13 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm if ((bool) $this->status->notifications_enabled) { $notificationDescription = sprintf( '%s', - $this->translate('Disable notifications for a specific time on a program-wide basis'), + mt('monitoring', 'Disable notifications for a specific time on a program-wide basis'), $this->getView()->href('monitoring/process/disable-notifications'), - $this->translate('Disable temporarily') + mt('monitoring', 'Disable temporarily') ); } elseif ($this->status->disable_notif_expire_time) { $notificationDescription = sprintf( - $this->translate('Notifications will be re-enabled in %s'), + mt('monitoring', 'Notifications will be re-enabled in %s'), $this->getView()->timeUntil($this->status->disable_notif_expire_time) ); } else { @@ -78,7 +78,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS, array( - 'label' => $this->translate('Active Host Checks Being Executed'), + 'label' => mt('monitoring', 'Active Host Checks Being Executed'), 'autosubmit' => true ) ), @@ -86,7 +86,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS, array( - 'label' => $this->translate('Active Service Checks Being Executed'), + 'label' => mt('monitoring', 'Active Service Checks Being Executed'), 'autosubmit' => true ) ), @@ -94,7 +94,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS, array( - 'label' => $this->translate('Event Handlers Enabled'), + 'label' => mt('monitoring', 'Event Handlers Enabled'), 'autosubmit' => true ) ), @@ -102,7 +102,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION, array( - 'label' => $this->translate('Flap Detection Enabled'), + 'label' => mt('monitoring', 'Flap Detection Enabled'), 'autosubmit' => true ) ), @@ -110,7 +110,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_NOTIFICATIONS, array( - 'label' => $this->translate('Notifications Enabled'), + 'label' => mt('monitoring', 'Notifications Enabled'), 'autosubmit' => true, 'description' => $notificationDescription, 'decorators' => array( @@ -129,7 +129,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING, array( - 'label' => $this->translate('Obsessing Over Hosts'), + 'label' => mt('monitoring', 'Obsessing Over Hosts'), 'autosubmit' => true ) ), @@ -137,7 +137,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING, array( - 'label' => $this->translate('Obsessing Over Services'), + 'label' => mt('monitoring', 'Obsessing Over Services'), 'autosubmit' => true ) ), @@ -145,7 +145,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS, array( - 'label' => $this->translate('Passive Host Checks Being Accepted'), + 'label' => mt('monitoring', 'Passive Host Checks Being Accepted'), 'autosubmit' => true ) ), @@ -153,7 +153,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS, array( - 'label' => $this->translate('Passive Service Checks Being Accepted'), + 'label' => mt('monitoring', 'Passive Service Checks Being Accepted'), 'autosubmit' => true ) ), @@ -161,7 +161,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA, array( - 'label' => $this->translate('Performance Data Being Processed'), + 'label' => mt('monitoring', 'Performance Data Being Processed'), 'autosubmit' => true ) ) @@ -198,7 +198,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm ->setEnabled($enabled); $this->getTransport($this->request)->send($toggleFeature); } - Notification::success($this->translate('Toggling feature..')); + Notification::success(mt('monitoring', 'Toggling feature..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php index df3731837..25ac76c25 100644 --- a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php @@ -31,7 +31,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm */ public function getHelp() { - return $this->translate( + return mt( + 'monitoring', 'This command is used to acknowledge host or service problems. When a problem is acknowledged,' . ' future notifications about problems are temporarily disabled until the host or service' . ' recovers.' @@ -50,8 +51,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => $this->translate('Comment'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Comment'), + 'description' => mt( + 'monitoring', 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -62,8 +64,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'persistent', array( - 'label' => $this->translate('Persistent Comment'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Persistent Comment'), + 'description' => mt( + 'monitoring', 'If you would like the comment to remain even when the acknowledgement is removed, check this' . ' option.' ) @@ -73,10 +76,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'expire', array( - 'label' => $this->translate('Use Expire Time'), - 'description' => $this->translate( - 'If the acknowledgement should expire, check this option.' - ), + 'label' => mt('monitoring', 'Use Expire Time'), + 'description' => mt('monitoring', 'If the acknowledgement should expire, check this option.'), 'autosubmit' => true ) ) @@ -88,9 +89,10 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'dateTimePicker', 'expire_time', array( - 'label' => $this->translate('Expire Time'), + 'label' => mt('monitoring', 'Expire Time'), 'value' => $expireTime, - 'description' => $this->translate( + 'description' => mt( + 'monitoring', 'Enter the expire date and time for this acknowledgement here. Icinga will delete the' . ' acknowledgement after this time expired.' ) @@ -112,9 +114,10 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'sticky', array( - 'label' => $this->translate('Sticky Acknowledgement'), + 'label' => mt('monitoring', 'Sticky Acknowledgement'), 'value' => true, - 'description' => $this->translate( + 'description' => mt( + 'monitoring', 'If you want the acknowledgement to disable notifications until the host or service recovers,' . ' check this option.' ) @@ -124,9 +127,10 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'notify', array( - 'label' => $this->translate('Send Notification'), + 'label' => mt('monitoring', 'Send Notification'), 'value' => true, - 'description' => $this->translate( + 'description' => mt( + 'monitoring', 'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,' . ' uncheck this option.' ) diff --git a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php index e7f7e91f9..f5adf6c71 100644 --- a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php @@ -29,7 +29,8 @@ class AddCommentCommandForm extends ObjectsCommandForm */ public function getHelp() { - return $this->translate( + return mt( + 'monitoring', 'This command is used to add host or service comments.' ); } @@ -46,8 +47,9 @@ class AddCommentCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => $this->translate('Comment'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Comment'), + 'description' => mt( + 'monitoring', 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -58,9 +60,10 @@ class AddCommentCommandForm extends ObjectsCommandForm 'checkbox', 'persistent', array( - 'label' => $this->translate('Persistent'), + 'label' => mt('monitoring', 'Persistent'), 'value' => true, - 'description' => $this->translate( + 'description' => mt( + 'monitoring', 'If you uncheck this option, the comment will automatically be deleted the next time Icinga is' . ' restarted.' ) diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index 1054aae05..01006683f 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -35,8 +35,8 @@ class CheckNowCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'type' => 'submit', - 'value' => $this->translate('Check now'), - 'label' => ' ' . $this->translate('Check now'), + 'value' => mt('monitoring', 'Check now'), + 'label' => ' ' . mt('monitoring', 'Check now'), 'decorators' => array('ViewHelper'), 'escape' => false, 'class' => 'link-like' diff --git a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php index 0f7858ad9..3d85afcec 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php @@ -55,7 +55,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'label' => 'X', - 'title' => $this->translate('Delete comment'), + 'title' => mt('monitoring', 'Delete comment'), 'decorators' => array('ViewHelper') ) ); @@ -80,7 +80,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success($this->translate('Deleting comment..')); + Notification::success(mt('monitoring', 'Deleting comment..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php index 43ca52b05..1c7095b82 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php @@ -55,7 +55,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'label' => 'X', - 'title' => $this->translate('Delete downtime'), + 'title' => mt('monitoring', 'Delete downtime'), 'decorators' => array('ViewHelper') ) ); @@ -80,7 +80,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success($this->translate('Deleting downtime..')); + Notification::success(mt('monitoring', 'Deleting downtime..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php index 44e248956..48ee00ab3 100644 --- a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php @@ -29,7 +29,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm */ public function getHelp() { - return $this->translate( + return mt( + 'monitoring', 'This command is used to submit passive host or service check results.' ); } @@ -52,17 +53,17 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'status', array( 'required' => true, - 'label' => $this->translate('Status'), - 'description' => $this->translate('The state this check result should report'), + 'label' => mt('monitoring', 'Status'), + 'description' => mt('monitoring', 'The state this check result should report'), 'multiOptions' => $object->getType() === $object::TYPE_HOST ? array( - ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'), - ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state'), - ProcessCheckResultCommand::HOST_UNREACHABLE => $this->translate('UNREACHABLE', 'icinga.state') + ProcessCheckResultCommand::HOST_UP => mt('monitoring', 'UP', 'icinga.state'), + ProcessCheckResultCommand::HOST_DOWN => mt('monitoring', 'DOWN', 'icinga.state'), + ProcessCheckResultCommand::HOST_UNREACHABLE => mt('monitoring', 'UNREACHABLE', 'icinga.state') ) : array( - ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_UNKNOWN => $this->translate('UNKNOWN', 'icinga.state') + ProcessCheckResultCommand::SERVICE_OK => mt('monitoring', 'OK', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_WARNING => mt('monitoring', 'WARNING', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_CRITICAL => mt('monitoring', 'CRITICAL', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_UNKNOWN => mt('monitoring', 'UNKNOWN', 'icinga.state') ) ) ); @@ -71,8 +72,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'output', array( 'required' => true, - 'label' => $this->translate('Output'), - 'description' => $this->translate('The plugin output of this check result') + 'label' => mt('monitoring', 'Output'), + 'description' => mt('monitoring', 'The plugin output of this check result') ) ); $this->addElement( @@ -80,8 +81,9 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'perfdata', array( 'allowEmpty' => true, - 'label' => $this->translate('Performance Data'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Performance Data'), + 'description' => mt( + 'monitoring', 'The performance data of this check result. Leave empty' . ' if this check result has no performance data' ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php index 949ec33e1..82a9b2e52 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php @@ -24,8 +24,9 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm 'checkbox', 'all_services', array( - 'label' => $this->translate('All Services'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'All Services'), + 'description' => mt( + 'monitoring', 'Schedule check for all services on the hosts and the hosts themselves.' ) ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php index f84069a9a..beb0793ef 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php @@ -27,8 +27,9 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm 'checkbox', 'all_services', array( - 'label' => $this->translate('All Services'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'All Services'), + 'description' => mt( + 'monitoring', 'Schedule downtime for all services on the hosts and the hosts themselves.' ) ) @@ -37,14 +38,15 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm 'select', 'child_hosts', array( - 'label' => $this->translate('Child Hosts'), + 'label' => mt('monitoring', 'Child Hosts'), 'required' => true, 'multiOptions' => array( - 0 => $this->translate('Do nothing with child hosts'), - 1 => $this->translate('Schedule triggered downtime for all child hosts'), - 2 => $this->translate('Schedule non-triggered downtime for all child hosts') + 0 => mt('monitoring', 'Do nothing with child hosts'), + 1 => mt('monitoring', 'Schedule triggered downtime for all child hosts'), + 2 => mt('monitoring', 'Schedule non-triggered downtime for all child hosts') ), - 'description' => $this->translate( + 'description' => mt( + 'monitoring', 'Define what should be done with the child hosts of the hosts.' ) ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php index b34472d49..9e04a2254 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php @@ -32,7 +32,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm */ public function getHelp() { - return $this->translate( + return mt( + 'monitoring', 'This command is used to schedule the next check of hosts or services. Icinga will re-queue the' . ' hosts or services to be checked at the time you specify.' ); @@ -51,7 +52,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'note', 'command-info', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'This command is used to schedule the next check of hosts or services. Icinga will re-queue the' . ' hosts or services to be checked at the time you specify.' ) @@ -62,10 +64,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'check_time', array( 'required' => true, - 'label' => $this->translate('Check Time'), - 'description' => $this->translate( - 'Set the date and time when the check should be scheduled.' - ), + 'label' => mt('monitoring', 'Check Time'), + 'description' => mt('monitoring', 'Set the date and time when the check should be scheduled.'), 'value' => $checkTime ) ), @@ -73,8 +73,9 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'checkbox', 'force_check', array( - 'label' => $this->translate('Force Check'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Force Check'), + 'description' => mt( + 'monitoring', 'If you select this option, Icinga will force a check regardless of both what time the' . ' scheduled check occurs and whether or not checks are enabled.' ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php index 4f66898f6..9961d4b65 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php @@ -42,7 +42,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm */ public function getHelp() { - return $this->translate( + return mt( + 'monitoring', 'This command is used to schedule host and service downtimes. During the specified downtime,' . ' Icinga will not send notifications out about the hosts and services. When the scheduled' . ' downtime expires, Icinga will send out notifications for the hosts and services as it' @@ -66,8 +67,9 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => $this->translate('Comment'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Comment'), + 'description' => mt( + 'monitoring', 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -79,8 +81,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'start', array( 'required' => true, - 'label' => $this->translate('Start Time'), - 'description' => $this->translate('Set the start date and time for the downtime.'), + 'label' => mt('monitoring', 'Start Time'), + 'description' => mt('monitoring', 'Set the start date and time for the downtime.'), 'value' => $start ) ), @@ -89,8 +91,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'end', array( 'required' => true, - 'label' => $this->translate('End Time'), - 'description' => $this->translate('Set the end date and time for the downtime.'), + 'label' => mt('monitoring', 'End Time'), + 'description' => mt('monitoring', 'Set the end date and time for the downtime.'), 'value' => $end ) ), @@ -100,16 +102,17 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm array( 'required' => true, 'autosubmit' => true, - 'label' => $this->translate('Type'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Type'), + 'description' => mt( + 'monitoring', 'If you select the fixed option, the downtime will be in effect between the start and end' . ' times you specify whereas a flexible downtime starts when the host or service enters a' . ' problem state sometime between the start and end times you specified and lasts as long' . ' as the duration time you enter. The duration fields do not apply for fixed downtimes.' ), 'multiOptions' => array( - self::FIXED => $this->translate('Fixed'), - self::FLEXIBLE => $this->translate('Flexible') + self::FIXED => mt('monitoring', 'Fixed'), + self::FLEXIBLE => mt('monitoring', 'Flexible') ), 'validators' => array( array( @@ -138,7 +141,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'hours', array( 'required' => true, - 'label' => $this->translate('Hours'), + 'label' => mt('monitoring', 'Hours'), 'value' => 2, 'min' => -1 ) @@ -148,7 +151,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'minutes', array( 'required' => true, - 'label' => $this->translate('Minutes'), + 'label' => mt('monitoring', 'Minutes'), 'value' => 0, 'min' => -1 ) @@ -158,8 +161,9 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm array('hours', 'minutes'), 'duration', array( - 'legend' => $this->translate('Flexible Duration'), - 'description' => $this->translate( + 'legend' => mt('monitoring', 'Flexible Duration'), + 'description' => mt( + 'monitoring', 'Enter here the duration of the downtime. The downtime will be automatically deleted after this' . ' time expired.' ), diff --git a/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php index bf0a1d8b1..c33527895 100644 --- a/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php @@ -33,7 +33,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_ACTIVE_CHECKS, array( - 'label' => $this->translate('Active Checks'), + 'label' => mt('monitoring', 'Active Checks'), 'autosubmit' => true ) ), @@ -41,7 +41,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_PASSIVE_CHECKS, array( - 'label' => $this->translate('Passive Checks'), + 'label' => mt('monitoring', 'Passive Checks'), 'autosubmit' => true ) ), @@ -49,7 +49,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_OBSESSING, array( - 'label' => $this->translate('Obsessing'), + 'label' => mt('monitoring', 'Obsessing'), 'autosubmit' => true ) ), @@ -57,7 +57,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_NOTIFICATIONS, array( - 'label' => $this->translate('Notifications'), + 'label' => mt('monitoring', 'Notifications'), 'autosubmit' => true ) ), @@ -65,7 +65,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_EVENT_HANDLER, array( - 'label' => $this->translate('Event Handler'), + 'label' => mt('monitoring', 'Event Handler'), 'autosubmit' => true ) ), @@ -73,7 +73,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_FLAP_DETECTION, array( - 'label' => $this->translate('Flap Detection'), + 'label' => mt('monitoring', 'Flap Detection'), 'autosubmit' => true ) ) @@ -95,7 +95,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm $element = $this->getElement($feature); $element->setChecked($object->{$feature}); if ((bool) $object->{$feature . '_changed'} === true) { - $element->setDescription($this->translate('changed')); + $element->setDescription(mt('monitoring', 'changed')); } } return $this; @@ -120,7 +120,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm } } } - Notification::success($this->translate('Toggling feature..')); + Notification::success(mt('monitoring', 'Toggling feature..')); return true; } } diff --git a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php index 405bac144..daabe7e02 100644 --- a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php @@ -28,9 +28,9 @@ class LocalInstanceForm extends Form 'path', array( 'required' => true, - 'label' => $this->translate('Command File'), + 'label' => mt('monitoring', 'Command File'), 'value' => '/var/run/icinga2/cmd/icinga2.cmd', - 'description' => $this->translate('Path to the local Icinga command file') + 'description' => mt('monitoring', 'Path to the local Icinga command file') ) ); return $this; diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index 47b2a0316..7c55f655a 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -29,8 +29,8 @@ class RemoteInstanceForm extends Form 'host', array( 'required' => true, - 'label' => $this->translate('Host'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Host'), + 'description' => mt('monitoring', 'Hostname or address of the remote Icinga instance' ) ) @@ -40,8 +40,8 @@ class RemoteInstanceForm extends Form 'port', array( 'required' => true, - 'label' => $this->translate('Port'), - 'description' => $this->translate('SSH port to connect to on the remote Icinga instance'), + 'label' => mt('monitoring', 'Port'), + 'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'), 'value' => 22 ) ), @@ -50,8 +50,8 @@ class RemoteInstanceForm extends Form 'user', array( 'required' => true, - 'label' => $this->translate('User'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'User'), + 'description' => mt('monitoring', 'User to log in as on the remote Icinga instance. Please note that key-based SSH login must be' . ' possible for this user' ) @@ -62,9 +62,9 @@ class RemoteInstanceForm extends Form 'path', array( 'required' => true, - 'label' => $this->translate('Command File'), + 'label' => mt('monitoring', 'Command File'), 'value' => '/var/run/icinga2/cmd/icinga2.cmd', - 'description' => $this->translate('Path to the Icinga command file on the remote Icinga instance') + 'description' => mt('monitoring', 'Path to the Icinga command file on the remote Icinga instance') ) ) )); diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php deleted file mode 100644 index 454c67d47..000000000 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceKeyResourcePage.php +++ /dev/null @@ -1,54 +0,0 @@ -addElement( - 'button', - Wizard::BTN_NEXT, - array( - 'type' => 'submit', - 'value' => $pageName, - 'label' => $this->translate('Save Changes'), - 'decorators' => array('ViewHelper') - ) - ); - } - - public function addPreviousButton($pageName) - { - - } -} diff --git a/modules/monitoring/application/forms/Config/InstanceConfigForm.php b/modules/monitoring/application/forms/Config/InstanceConfigForm.php index 5618f27ee..b89e48c0a 100644 --- a/modules/monitoring/application/forms/Config/InstanceConfigForm.php +++ b/modules/monitoring/application/forms/Config/InstanceConfigForm.php @@ -25,7 +25,7 @@ class InstanceConfigForm extends ConfigForm public function init() { $this->setName('form_config_monitoring_instance'); - $this->setSubmitLabel($this->translate('Save Changes')); + $this->setSubmitLabel(mt('monitoring', 'Save Changes')); } /** @@ -48,7 +48,7 @@ class InstanceConfigForm extends ConfigForm break; default: throw new InvalidArgumentException( - sprintf($this->translate('Invalid instance type "%s" given'), $type) + sprintf(mt('monitoring', 'Invalid instance type "%s" given'), $type) ); } return $form; @@ -69,10 +69,10 @@ class InstanceConfigForm extends ConfigForm { $name = isset($values['name']) ? $values['name'] : ''; if (! $name) { - throw new InvalidArgumentException($this->translate('Instance name missing')); + throw new InvalidArgumentException(mt('monitoring', 'Instance name missing')); } if ($this->config->hasSection($name)) { - throw new InvalidArgumentException($this->translate('Instance already exists')); + throw new InvalidArgumentException(mt('monitoring', 'Instance already exists')); } unset($values['name']); @@ -93,11 +93,11 @@ class InstanceConfigForm extends ConfigForm public function edit($name, array $values) { if (! $name) { - throw new InvalidArgumentException($this->translate('Old instance name missing')); + throw new InvalidArgumentException(mt('monitoring', 'Old instance name missing')); } elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) { - throw new InvalidArgumentException($this->translate('New instance name missing')); + throw new InvalidArgumentException(mt('monitoring', 'New instance name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException($this->translate('Unknown instance name provided')); + throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided')); } unset($values['name']); @@ -117,9 +117,9 @@ class InstanceConfigForm extends ConfigForm public function remove($name) { if (! $name) { - throw new InvalidArgumentException($this->translate('Instance name missing')); + throw new InvalidArgumentException(mt('monitoring', 'Instance name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException($this->translate('Unknown instance name provided')); + throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided')); } $instanceConfig = $this->config->getSection($name); @@ -136,10 +136,10 @@ class InstanceConfigForm extends ConfigForm $instanceName = $this->request->getQuery('instance'); if ($instanceName !== null) { if (! $instanceName) { - throw new ConfigurationError($this->translate('Instance name missing')); + throw new ConfigurationError(mt('monitoring', 'Instance name missing')); } if (! $this->config->hasSection($instanceName)) { - throw new ConfigurationError($this->translate('Unknown instance name given')); + throw new ConfigurationError(mt('monitoring', 'Unknown instance name given')); } $instanceConfig = $this->config->getSection($instanceName)->toArray(); @@ -158,10 +158,10 @@ class InstanceConfigForm extends ConfigForm try { if ($instanceName === null) { // create new instance $this->add($this->getValues()); - $message = $this->translate('Instance "%s" created successfully.'); + $message = mt('monitoring', 'Instance "%s" created successfully.'); } else { // edit existing instance $this->edit($instanceName, $this->getValues()); - $message = $this->translate('Instance "%s" edited successfully.'); + $message = mt('monitoring', 'Instance "%s" edited successfully.'); } } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); @@ -189,7 +189,7 @@ class InstanceConfigForm extends ConfigForm 'name', array( 'required' => true, - 'label' => $this->translate('Instance Name') + 'label' => mt('monitoring', 'Instance Name') ) ), array( @@ -198,10 +198,10 @@ class InstanceConfigForm extends ConfigForm array( 'required' => true, 'autosubmit' => true, - 'label' => $this->translate('Instance Type'), + 'label' => mt('monitoring', 'Instance Type'), 'multiOptions' => array( - LocalCommandFile::TRANSPORT => $this->translate('Local Command File'), - RemoteCommandFile::TRANSPORT => $this->translate('Remote Command File') + LocalCommandFile::TRANSPORT => mt('monitoring', 'Local Command File'), + RemoteCommandFile::TRANSPORT => mt('monitoring', 'Remote Command File') ), 'value' => $instanceType ) diff --git a/modules/monitoring/application/forms/Config/SecurityConfigForm.php b/modules/monitoring/application/forms/Config/SecurityConfigForm.php index b202f5938..40c0b7b8c 100644 --- a/modules/monitoring/application/forms/Config/SecurityConfigForm.php +++ b/modules/monitoring/application/forms/Config/SecurityConfigForm.php @@ -18,7 +18,7 @@ class SecurityConfigForm extends ConfigForm public function init() { $this->setName('form_config_monitoring_security'); - $this->setSubmitLabel($this->translate('Save Changes')); + $this->setSubmitLabel(mt('monitoring', 'Save Changes')); } /** @@ -29,7 +29,7 @@ class SecurityConfigForm extends ConfigForm $this->config->setSection('security', $this->getValues()); if ($this->save()) { - Notification::success($this->translate('New security configuration has successfully been stored')); + Notification::success(mt('monitoring', 'New security configuration has successfully been stored')); } else { return false; } @@ -54,8 +54,8 @@ class SecurityConfigForm extends ConfigForm array( 'allowEmpty' => true, 'value' => '*pw*,*pass*,community', - 'label' => $this->translate('Protected Custom Variables'), - 'description' => $this->translate( + 'label' => mt('monitoring', 'Protected Custom Variables'), + 'description' => mt('monitoring', 'Comma separated case insensitive list of protected custom variables.' . ' Use * as a placeholder for zero or more wildcard characters.' . ' Existance of those custom variables will be shown, but their values will be masked.' diff --git a/modules/monitoring/application/forms/EventOverviewForm.php b/modules/monitoring/application/forms/EventOverviewForm.php index dc697b940..25d268f76 100644 --- a/modules/monitoring/application/forms/EventOverviewForm.php +++ b/modules/monitoring/application/forms/EventOverviewForm.php @@ -44,7 +44,7 @@ class EventOverviewForm extends Form 'checkbox', 'statechange', array( - 'label' => $this->translate('State Changes'), + 'label' => t('State Changes'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->stateChangeFilter()->toQueryString()) === false ? 0 : 1 @@ -54,7 +54,7 @@ class EventOverviewForm extends Form 'checkbox', 'downtime', array( - 'label' => $this->translate('Downtimes'), + 'label' => t('Downtimes'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->downtimeFilter()->toQueryString()) === false ? 0 : 1 @@ -64,7 +64,7 @@ class EventOverviewForm extends Form 'checkbox', 'comment', array( - 'label' => $this->translate('Comments'), + 'label' => t('Comments'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->commentFilter()->toQueryString()) === false ? 0 : 1 @@ -74,7 +74,7 @@ class EventOverviewForm extends Form 'checkbox', 'notification', array( - 'label' => $this->translate('Notifications'), + 'label' => t('Notifications'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->notificationFilter()->toQueryString()) === false ? 0 : 1 @@ -84,7 +84,7 @@ class EventOverviewForm extends Form 'checkbox', 'flapping', array( - 'label' => $this->translate('Flapping'), + 'label' => t('Flapping'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->flappingFilter()->toQueryString()) === false ? 0 : 1 diff --git a/modules/monitoring/application/forms/Setup/BackendPage.php b/modules/monitoring/application/forms/Setup/BackendPage.php index b5ab2ffd6..1f6ef6894 100644 --- a/modules/monitoring/application/forms/Setup/BackendPage.php +++ b/modules/monitoring/application/forms/Setup/BackendPage.php @@ -20,7 +20,7 @@ class BackendPage extends Form 'note', 'title', array( - 'value' => $this->translate('Monitoring Backend', 'setup.page.title'), + 'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,7 +31,8 @@ class BackendPage extends Form 'note', 'description', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'Please configure below how Icinga Web 2 should retrieve monitoring information.' ) ) @@ -43,8 +44,8 @@ class BackendPage extends Form array( 'required' => true, 'value' => 'icinga', - 'label' => $this->translate('Backend Name'), - 'description' => $this->translate('The identifier of this backend') + 'label' => mt('monitoring', 'Backend Name'), + 'description' => mt('monitoring', 'The identifier of this backend') ) ); @@ -59,10 +60,8 @@ class BackendPage extends Form 'type', array( 'required' => true, - 'label' => $this->translate('Backend Type'), - 'description' => $this->translate( - 'The data source used for retrieving monitoring information' - ), + 'label' => mt('monitoring', 'Backend Type'), + 'description' => mt('monitoring', 'The data source used for retrieving monitoring information'), 'multiOptions' => $resourceTypes ) ); diff --git a/modules/monitoring/application/forms/Setup/IdoResourcePage.php b/modules/monitoring/application/forms/Setup/IdoResourcePage.php index c28b52e6b..189d65fea 100644 --- a/modules/monitoring/application/forms/Setup/IdoResourcePage.php +++ b/modules/monitoring/application/forms/Setup/IdoResourcePage.php @@ -28,7 +28,7 @@ class IdoResourcePage extends Form 'note', 'title', array( - 'value' => $this->translate('Monitoring IDO Resource', 'setup.page.title'), + 'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -39,7 +39,8 @@ class IdoResourcePage extends Form 'note', 'description', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'Please fill out the connection details below to access' . ' the IDO database of your monitoring environment.' ) @@ -90,10 +91,8 @@ class IdoResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => $this->translate('Skip Validation'), - 'description' => $this->translate( - 'Check this to not to validate connectivity with the given database server' - ) + 'label' => t('Skip Validation'), + 'description' => t('Check this to not to validate connectivity with the given database server') ) ); } diff --git a/modules/monitoring/application/forms/Setup/InstancePage.php b/modules/monitoring/application/forms/Setup/InstancePage.php index 8f151554d..dccfd1d91 100644 --- a/modules/monitoring/application/forms/Setup/InstancePage.php +++ b/modules/monitoring/application/forms/Setup/InstancePage.php @@ -20,7 +20,7 @@ class InstancePage extends Form 'note', 'title', array( - 'value' => $this->translate('Monitoring Instance', 'setup.page.title'), + 'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,7 +31,8 @@ class InstancePage extends Form 'note', 'description', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'Please define the settings specific to your monitoring instance below.' ) ) diff --git a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php index 245d2abcc..4faa17416 100644 --- a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php +++ b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php @@ -28,7 +28,7 @@ class LivestatusResourcePage extends Form 'note', 'title', array( - 'value' => $this->translate('Monitoring Livestatus Resource', 'setup.page.title'), + 'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -39,7 +39,8 @@ class LivestatusResourcePage extends Form 'note', 'description', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'Please fill out the connection details below to access the Livestatus' . ' socket interface for your monitoring environment.' ) @@ -90,10 +91,8 @@ class LivestatusResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => $this->translate('Skip Validation'), - 'description' => $this->translate( - 'Check this to not to validate connectivity with the given Livestatus socket' - ) + 'label' => t('Skip Validation'), + 'description' => t('Check this to not to validate connectivity with the given Livestatus socket') ) ); } diff --git a/modules/monitoring/application/forms/Setup/SecurityPage.php b/modules/monitoring/application/forms/Setup/SecurityPage.php index ba8083e50..0c7d3d1de 100644 --- a/modules/monitoring/application/forms/Setup/SecurityPage.php +++ b/modules/monitoring/application/forms/Setup/SecurityPage.php @@ -20,7 +20,7 @@ class SecurityPage extends Form 'note', 'title', array( - 'value' => $this->translate('Monitoring Security', 'setup.page.title'), + 'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,7 +31,8 @@ class SecurityPage extends Form 'note', 'description', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'To protect your monitoring environment against prying eyes please fill out the settings below.' ) ) diff --git a/modules/monitoring/application/forms/Setup/WelcomePage.php b/modules/monitoring/application/forms/Setup/WelcomePage.php index f79eb6c62..d910e2e01 100644 --- a/modules/monitoring/application/forms/Setup/WelcomePage.php +++ b/modules/monitoring/application/forms/Setup/WelcomePage.php @@ -19,7 +19,10 @@ class WelcomePage extends Form 'note', 'welcome', array( - 'value' => $this->translate('Welcome to the configuration of the monitoring module for Icinga Web 2!'), + 'value' => mt( + 'monitoring', + 'Welcome to the configuration of the monitoring module for Icinga Web 2!' + ), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,7 +34,7 @@ class WelcomePage extends Form 'note', 'core_hint', array( - 'value' => $this->translate('This is the core module for Icinga Web 2.') + 'value' => mt('monitoring', 'This is the core module for Icinga Web 2.') ) ); @@ -39,7 +42,8 @@ class WelcomePage extends Form 'note', 'description', array( - 'value' => $this->translate( + 'value' => mt( + 'monitoring', 'It offers various status and reporting views with powerful filter capabilities that allow' . ' you to keep track of the most important events in your monitoring environment.' ) diff --git a/modules/monitoring/application/forms/StatehistoryForm.php b/modules/monitoring/application/forms/StatehistoryForm.php index d859f5815..9fa1bdc26 100644 --- a/modules/monitoring/application/forms/StatehistoryForm.php +++ b/modules/monitoring/application/forms/StatehistoryForm.php @@ -19,7 +19,7 @@ class StatehistoryForm extends Form public function init() { $this->setName('form_event_overview'); - $this->setSubmitLabel($this->translate('Apply')); + $this->setSubmitLabel(mt('monitoring', 'Apply')); } /** @@ -65,14 +65,14 @@ class StatehistoryForm extends Form 'select', 'from', array( - 'label' => $this->translate('From'), + 'label' => mt('monitoring', 'From'), 'value' => $this->getRequest()->getParam('from', strtotime('3 months ago')), 'multiOptions' => array( - strtotime('midnight 3 months ago') => $this->translate('3 Months'), - strtotime('midnight 4 months ago') => $this->translate('4 Months'), - strtotime('midnight 8 months ago') => $this->translate('8 Months'), - strtotime('midnight 12 months ago') => $this->translate('1 Year'), - strtotime('midnight 24 months ago') => $this->translate('2 Years') + strtotime('midnight 3 months ago') => mt('monitoring', '3 Months'), + strtotime('midnight 4 months ago') => mt('monitoring', '4 Months'), + strtotime('midnight 8 months ago') => mt('monitoring', '8 Months'), + strtotime('midnight 12 months ago') => mt('monitoring', '1 Year'), + strtotime('midnight 24 months ago') => mt('monitoring', '2 Years') ), 'class' => 'autosubmit' ) @@ -81,10 +81,10 @@ class StatehistoryForm extends Form 'select', 'to', array( - 'label' => $this->translate('To'), + 'label' => mt('monitoring', 'To'), 'value' => $this->getRequest()->getParam('to', time()), 'multiOptions' => array( - time() => $this->translate('Today') + time() => mt('monitoring', 'Today') ), 'class' => 'autosubmit' ) @@ -95,11 +95,11 @@ class StatehistoryForm extends Form 'select', 'objecttype', array( - 'label' => $this->translate('Object type'), + 'label' => mt('monitoring', 'Object type'), 'value' => $objectType, 'multiOptions' => array( - 'services' => $this->translate('Services'), - 'hosts' => $this->translate('Hosts') + 'services' => mt('monitoring', 'Services'), + 'hosts' => mt('monitoring', 'Hosts') ), 'class' => 'autosubmit' ) @@ -113,13 +113,13 @@ class StatehistoryForm extends Form 'select', 'state', array( - 'label' => $this->translate('State'), + 'label' => mt('monitoring', 'State'), 'value' => $serviceState, 'multiOptions' => array( - 'cnt_critical_hard' => $this->translate('Critical'), - 'cnt_warning_hard' => $this->translate('Warning'), - 'cnt_unknown_hard' => $this->translate('Unknown'), - 'cnt_ok' => $this->translate('Ok') + 'cnt_critical_hard' => mt('monitoring', 'Critical'), + 'cnt_warning_hard' => mt('monitoring', 'Warning'), + 'cnt_unknown_hard' => mt('monitoring', 'Unknown'), + 'cnt_ok' => mt('monitoring', 'Ok') ), 'class' => 'autosubmit' ) @@ -133,12 +133,12 @@ class StatehistoryForm extends Form 'select', 'state', array( - 'label' => $this->translate('State'), + 'label' => mt('monitoring', 'State'), 'value' => $hostState, 'multiOptions' => array( - 'cnt_up' => $this->translate('Up'), - 'cnt_down_hard' => $this->translate('Down'), - 'cnt_unreachable_hard' => $this->translate('Unreachable') + 'cnt_up' => mt('monitoring', 'Up'), + 'cnt_down_hard' => mt('monitoring', 'Down'), + 'cnt_unreachable_hard' => mt('monitoring', 'Unreachable') ), 'class' => 'autosubmit' ) From 7082ebaf7beb8d27db0f304b84ac728d1934d30f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 19 Jan 2015 13:47:01 +0100 Subject: [PATCH 32/41] Replace t() and mt() with translate() in the monitoring module's forms refs #7551 --- .../DisableNotificationsExpireCommandForm.php | 11 +++-- .../ToggleInstanceFeaturesCommandForm.php | 28 ++++++------- .../Object/AcknowledgeProblemCommandForm.php | 34 +++++++-------- .../Command/Object/AddCommentCommandForm.php | 13 +++--- .../Command/Object/CheckNowCommandForm.php | 4 +- .../Object/DeleteCommentCommandForm.php | 4 +- .../Object/DeleteDowntimeCommandForm.php | 4 +- .../Object/ProcessCheckResultCommandForm.php | 30 +++++++------ .../Object/ScheduleHostCheckCommandForm.php | 5 +-- .../ScheduleHostDowntimeCommandForm.php | 16 ++++--- .../ScheduleServiceCheckCommandForm.php | 17 ++++---- .../ScheduleServiceDowntimeCommandForm.php | 34 +++++++-------- .../ToggleObjectFeaturesCommandForm.php | 16 +++---- .../Config/Instance/LocalInstanceForm.php | 4 +- .../Config/Instance/RemoteInstanceForm.php | 16 +++---- .../forms/Config/InstanceConfigForm.php | 34 +++++++-------- .../forms/Config/SecurityConfigForm.php | 8 ++-- .../application/forms/EventOverviewForm.php | 10 ++--- .../application/forms/Setup/BackendPage.php | 15 +++---- .../forms/Setup/IdoResourcePage.php | 11 ++--- .../application/forms/Setup/InstancePage.php | 5 +-- .../forms/Setup/LivestatusResourcePage.php | 11 ++--- .../application/forms/Setup/SecurityPage.php | 5 +-- .../application/forms/Setup/WelcomePage.php | 10 ++--- .../application/forms/StatehistoryForm.php | 42 +++++++++---------- 25 files changed, 183 insertions(+), 204 deletions(-) diff --git a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php index 0e64a4b03..21d926b58 100644 --- a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php @@ -21,7 +21,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm */ public function init() { - $this->setSubmitLabel(mt('monitoring', 'Disable Notifications')); + $this->setSubmitLabel($this->translate('Disable Notifications')); } /** @@ -30,8 +30,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to disable host and service notifications for a specific time.' ); } @@ -49,8 +48,8 @@ class DisableNotificationsExpireCommandForm extends CommandForm 'expire_time', array( 'required' => true, - 'label' => mt('monitoring', 'Expire Time'), - 'description' => mt('monitoring', 'Set the expire time.'), + 'label' => $this->translate('Expire Time'), + 'description' => $this->translate('Set the expire time.'), 'value' => $expireTime ) ); @@ -67,7 +66,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm $disableNotifications ->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp()); $this->getTransport($this->request)->send($disableNotifications); - Notification::success(mt('monitoring', 'Disabling host and service notifications..')); + Notification::success($this->translate('Disabling host and service notifications..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php index 291619b2f..469c1b6eb 100644 --- a/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/ToggleInstanceFeaturesCommandForm.php @@ -61,13 +61,13 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm if ((bool) $this->status->notifications_enabled) { $notificationDescription = sprintf( '%s', - mt('monitoring', 'Disable notifications for a specific time on a program-wide basis'), + $this->translate('Disable notifications for a specific time on a program-wide basis'), $this->getView()->href('monitoring/process/disable-notifications'), - mt('monitoring', 'Disable temporarily') + $this->translate('Disable temporarily') ); } elseif ($this->status->disable_notif_expire_time) { $notificationDescription = sprintf( - mt('monitoring', 'Notifications will be re-enabled in %s'), + $this->translate('Notifications will be re-enabled in %s'), $this->getView()->timeUntil($this->status->disable_notif_expire_time) ); } else { @@ -78,7 +78,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_ACTIVE_HOST_CHECKS, array( - 'label' => mt('monitoring', 'Active Host Checks Being Executed'), + 'label' => $this->translate('Active Host Checks Being Executed'), 'autosubmit' => true ) ), @@ -86,7 +86,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_ACTIVE_SERVICE_CHECKS, array( - 'label' => mt('monitoring', 'Active Service Checks Being Executed'), + 'label' => $this->translate('Active Service Checks Being Executed'), 'autosubmit' => true ) ), @@ -94,7 +94,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_EVENT_HANDLERS, array( - 'label' => mt('monitoring', 'Event Handlers Enabled'), + 'label' => $this->translate('Event Handlers Enabled'), 'autosubmit' => true ) ), @@ -102,7 +102,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_FLAP_DETECTION, array( - 'label' => mt('monitoring', 'Flap Detection Enabled'), + 'label' => $this->translate('Flap Detection Enabled'), 'autosubmit' => true ) ), @@ -110,7 +110,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_NOTIFICATIONS, array( - 'label' => mt('monitoring', 'Notifications Enabled'), + 'label' => $this->translate('Notifications Enabled'), 'autosubmit' => true, 'description' => $notificationDescription, 'decorators' => array( @@ -129,7 +129,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING, array( - 'label' => mt('monitoring', 'Obsessing Over Hosts'), + 'label' => $this->translate('Obsessing Over Hosts'), 'autosubmit' => true ) ), @@ -137,7 +137,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_SERVICE_OBSESSING, array( - 'label' => mt('monitoring', 'Obsessing Over Services'), + 'label' => $this->translate('Obsessing Over Services'), 'autosubmit' => true ) ), @@ -145,7 +145,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PASSIVE_HOST_CHECKS, array( - 'label' => mt('monitoring', 'Passive Host Checks Being Accepted'), + 'label' => $this->translate('Passive Host Checks Being Accepted'), 'autosubmit' => true ) ), @@ -153,7 +153,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PASSIVE_SERVICE_CHECKS, array( - 'label' => mt('monitoring', 'Passive Service Checks Being Accepted'), + 'label' => $this->translate('Passive Service Checks Being Accepted'), 'autosubmit' => true ) ), @@ -161,7 +161,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm 'checkbox', ToggleInstanceFeatureCommand::FEATURE_PERFORMANCE_DATA, array( - 'label' => mt('monitoring', 'Performance Data Being Processed'), + 'label' => $this->translate('Performance Data Being Processed'), 'autosubmit' => true ) ) @@ -198,7 +198,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm ->setEnabled($enabled); $this->getTransport($this->request)->send($toggleFeature); } - Notification::success(mt('monitoring', 'Toggling feature..')); + Notification::success($this->translate('Toggling feature..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php index 25ac76c25..df3731837 100644 --- a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php @@ -31,8 +31,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to acknowledge host or service problems. When a problem is acknowledged,' . ' future notifications about problems are temporarily disabled until the host or service' . ' recovers.' @@ -51,9 +50,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => mt('monitoring', 'Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Comment'), + 'description' => $this->translate( 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -64,9 +62,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'persistent', array( - 'label' => mt('monitoring', 'Persistent Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Persistent Comment'), + 'description' => $this->translate( 'If you would like the comment to remain even when the acknowledgement is removed, check this' . ' option.' ) @@ -76,8 +73,10 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'expire', array( - 'label' => mt('monitoring', 'Use Expire Time'), - 'description' => mt('monitoring', 'If the acknowledgement should expire, check this option.'), + 'label' => $this->translate('Use Expire Time'), + 'description' => $this->translate( + 'If the acknowledgement should expire, check this option.' + ), 'autosubmit' => true ) ) @@ -89,10 +88,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'dateTimePicker', 'expire_time', array( - 'label' => mt('monitoring', 'Expire Time'), + 'label' => $this->translate('Expire Time'), 'value' => $expireTime, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'Enter the expire date and time for this acknowledgement here. Icinga will delete the' . ' acknowledgement after this time expired.' ) @@ -114,10 +112,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'sticky', array( - 'label' => mt('monitoring', 'Sticky Acknowledgement'), + 'label' => $this->translate('Sticky Acknowledgement'), 'value' => true, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'If you want the acknowledgement to disable notifications until the host or service recovers,' . ' check this option.' ) @@ -127,10 +124,9 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'checkbox', 'notify', array( - 'label' => mt('monitoring', 'Send Notification'), + 'label' => $this->translate('Send Notification'), 'value' => true, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,' . ' uncheck this option.' ) diff --git a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php index f5adf6c71..e7f7e91f9 100644 --- a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php @@ -29,8 +29,7 @@ class AddCommentCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to add host or service comments.' ); } @@ -47,9 +46,8 @@ class AddCommentCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => mt('monitoring', 'Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Comment'), + 'description' => $this->translate( 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -60,10 +58,9 @@ class AddCommentCommandForm extends ObjectsCommandForm 'checkbox', 'persistent', array( - 'label' => mt('monitoring', 'Persistent'), + 'label' => $this->translate('Persistent'), 'value' => true, - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'If you uncheck this option, the comment will automatically be deleted the next time Icinga is' . ' restarted.' ) diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index 01006683f..1054aae05 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -35,8 +35,8 @@ class CheckNowCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'type' => 'submit', - 'value' => mt('monitoring', 'Check now'), - 'label' => ' ' . mt('monitoring', 'Check now'), + 'value' => $this->translate('Check now'), + 'label' => ' ' . $this->translate('Check now'), 'decorators' => array('ViewHelper'), 'escape' => false, 'class' => 'link-like' diff --git a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php index 3d85afcec..0f7858ad9 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php @@ -55,7 +55,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'label' => 'X', - 'title' => mt('monitoring', 'Delete comment'), + 'title' => $this->translate('Delete comment'), 'decorators' => array('ViewHelper') ) ); @@ -80,7 +80,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success(mt('monitoring', 'Deleting comment..')); + Notification::success($this->translate('Deleting comment..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php index 1c7095b82..43ca52b05 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php @@ -55,7 +55,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm array( 'ignore' => true, 'label' => 'X', - 'title' => mt('monitoring', 'Delete downtime'), + 'title' => $this->translate('Delete downtime'), 'decorators' => array('ViewHelper') ) ); @@ -80,7 +80,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm if (! empty($redirect)) { $this->setRedirectUrl($redirect); } - Notification::success(mt('monitoring', 'Deleting downtime..')); + Notification::success($this->translate('Deleting downtime..')); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php index 48ee00ab3..44e248956 100644 --- a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php @@ -29,8 +29,7 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to submit passive host or service check results.' ); } @@ -53,17 +52,17 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'status', array( 'required' => true, - 'label' => mt('monitoring', 'Status'), - 'description' => mt('monitoring', 'The state this check result should report'), + 'label' => $this->translate('Status'), + 'description' => $this->translate('The state this check result should report'), 'multiOptions' => $object->getType() === $object::TYPE_HOST ? array( - ProcessCheckResultCommand::HOST_UP => mt('monitoring', 'UP', 'icinga.state'), - ProcessCheckResultCommand::HOST_DOWN => mt('monitoring', 'DOWN', 'icinga.state'), - ProcessCheckResultCommand::HOST_UNREACHABLE => mt('monitoring', 'UNREACHABLE', 'icinga.state') + ProcessCheckResultCommand::HOST_UP => $this->translate('UP', 'icinga.state'), + ProcessCheckResultCommand::HOST_DOWN => $this->translate('DOWN', 'icinga.state'), + ProcessCheckResultCommand::HOST_UNREACHABLE => $this->translate('UNREACHABLE', 'icinga.state') ) : array( - ProcessCheckResultCommand::SERVICE_OK => mt('monitoring', 'OK', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_WARNING => mt('monitoring', 'WARNING', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_CRITICAL => mt('monitoring', 'CRITICAL', 'icinga.state'), - ProcessCheckResultCommand::SERVICE_UNKNOWN => mt('monitoring', 'UNKNOWN', 'icinga.state') + ProcessCheckResultCommand::SERVICE_OK => $this->translate('OK', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_WARNING => $this->translate('WARNING', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_CRITICAL => $this->translate('CRITICAL', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_UNKNOWN => $this->translate('UNKNOWN', 'icinga.state') ) ) ); @@ -72,8 +71,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'output', array( 'required' => true, - 'label' => mt('monitoring', 'Output'), - 'description' => mt('monitoring', 'The plugin output of this check result') + 'label' => $this->translate('Output'), + 'description' => $this->translate('The plugin output of this check result') ) ); $this->addElement( @@ -81,9 +80,8 @@ class ProcessCheckResultCommandForm extends ObjectsCommandForm 'perfdata', array( 'allowEmpty' => true, - 'label' => mt('monitoring', 'Performance Data'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Performance Data'), + 'description' => $this->translate( 'The performance data of this check result. Leave empty' . ' if this check result has no performance data' ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php index 82a9b2e52..949ec33e1 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php @@ -24,9 +24,8 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm 'checkbox', 'all_services', array( - 'label' => mt('monitoring', 'All Services'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('All Services'), + 'description' => $this->translate( 'Schedule check for all services on the hosts and the hosts themselves.' ) ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php index beb0793ef..f84069a9a 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php @@ -27,9 +27,8 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm 'checkbox', 'all_services', array( - 'label' => mt('monitoring', 'All Services'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('All Services'), + 'description' => $this->translate( 'Schedule downtime for all services on the hosts and the hosts themselves.' ) ) @@ -38,15 +37,14 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm 'select', 'child_hosts', array( - 'label' => mt('monitoring', 'Child Hosts'), + 'label' => $this->translate('Child Hosts'), 'required' => true, 'multiOptions' => array( - 0 => mt('monitoring', 'Do nothing with child hosts'), - 1 => mt('monitoring', 'Schedule triggered downtime for all child hosts'), - 2 => mt('monitoring', 'Schedule non-triggered downtime for all child hosts') + 0 => $this->translate('Do nothing with child hosts'), + 1 => $this->translate('Schedule triggered downtime for all child hosts'), + 2 => $this->translate('Schedule non-triggered downtime for all child hosts') ), - 'description' => mt( - 'monitoring', + 'description' => $this->translate( 'Define what should be done with the child hosts of the hosts.' ) ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php index 9e04a2254..b34472d49 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php @@ -32,8 +32,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to schedule the next check of hosts or services. Icinga will re-queue the' . ' hosts or services to be checked at the time you specify.' ); @@ -52,8 +51,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'note', 'command-info', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'This command is used to schedule the next check of hosts or services. Icinga will re-queue the' . ' hosts or services to be checked at the time you specify.' ) @@ -64,8 +62,10 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'check_time', array( 'required' => true, - 'label' => mt('monitoring', 'Check Time'), - 'description' => mt('monitoring', 'Set the date and time when the check should be scheduled.'), + 'label' => $this->translate('Check Time'), + 'description' => $this->translate( + 'Set the date and time when the check should be scheduled.' + ), 'value' => $checkTime ) ), @@ -73,9 +73,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'checkbox', 'force_check', array( - 'label' => mt('monitoring', 'Force Check'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Force Check'), + 'description' => $this->translate( 'If you select this option, Icinga will force a check regardless of both what time the' . ' scheduled check occurs and whether or not checks are enabled.' ) diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php index 9961d4b65..4f66898f6 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php @@ -42,8 +42,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm */ public function getHelp() { - return mt( - 'monitoring', + return $this->translate( 'This command is used to schedule host and service downtimes. During the specified downtime,' . ' Icinga will not send notifications out about the hosts and services. When the scheduled' . ' downtime expires, Icinga will send out notifications for the hosts and services as it' @@ -67,9 +66,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'comment', array( 'required' => true, - 'label' => mt('monitoring', 'Comment'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Comment'), + 'description' => $this->translate( 'If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.' @@ -81,8 +79,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'start', array( 'required' => true, - 'label' => mt('monitoring', 'Start Time'), - 'description' => mt('monitoring', 'Set the start date and time for the downtime.'), + 'label' => $this->translate('Start Time'), + 'description' => $this->translate('Set the start date and time for the downtime.'), 'value' => $start ) ), @@ -91,8 +89,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'end', array( 'required' => true, - 'label' => mt('monitoring', 'End Time'), - 'description' => mt('monitoring', 'Set the end date and time for the downtime.'), + 'label' => $this->translate('End Time'), + 'description' => $this->translate('Set the end date and time for the downtime.'), 'value' => $end ) ), @@ -102,17 +100,16 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm array( 'required' => true, 'autosubmit' => true, - 'label' => mt('monitoring', 'Type'), - 'description' => mt( - 'monitoring', + 'label' => $this->translate('Type'), + 'description' => $this->translate( 'If you select the fixed option, the downtime will be in effect between the start and end' . ' times you specify whereas a flexible downtime starts when the host or service enters a' . ' problem state sometime between the start and end times you specified and lasts as long' . ' as the duration time you enter. The duration fields do not apply for fixed downtimes.' ), 'multiOptions' => array( - self::FIXED => mt('monitoring', 'Fixed'), - self::FLEXIBLE => mt('monitoring', 'Flexible') + self::FIXED => $this->translate('Fixed'), + self::FLEXIBLE => $this->translate('Flexible') ), 'validators' => array( array( @@ -141,7 +138,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'hours', array( 'required' => true, - 'label' => mt('monitoring', 'Hours'), + 'label' => $this->translate('Hours'), 'value' => 2, 'min' => -1 ) @@ -151,7 +148,7 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'minutes', array( 'required' => true, - 'label' => mt('monitoring', 'Minutes'), + 'label' => $this->translate('Minutes'), 'value' => 0, 'min' => -1 ) @@ -161,9 +158,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm array('hours', 'minutes'), 'duration', array( - 'legend' => mt('monitoring', 'Flexible Duration'), - 'description' => mt( - 'monitoring', + 'legend' => $this->translate('Flexible Duration'), + 'description' => $this->translate( 'Enter here the duration of the downtime. The downtime will be automatically deleted after this' . ' time expired.' ), diff --git a/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php b/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php index c33527895..bf0a1d8b1 100644 --- a/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ToggleObjectFeaturesCommandForm.php @@ -33,7 +33,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_ACTIVE_CHECKS, array( - 'label' => mt('monitoring', 'Active Checks'), + 'label' => $this->translate('Active Checks'), 'autosubmit' => true ) ), @@ -41,7 +41,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_PASSIVE_CHECKS, array( - 'label' => mt('monitoring', 'Passive Checks'), + 'label' => $this->translate('Passive Checks'), 'autosubmit' => true ) ), @@ -49,7 +49,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_OBSESSING, array( - 'label' => mt('monitoring', 'Obsessing'), + 'label' => $this->translate('Obsessing'), 'autosubmit' => true ) ), @@ -57,7 +57,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_NOTIFICATIONS, array( - 'label' => mt('monitoring', 'Notifications'), + 'label' => $this->translate('Notifications'), 'autosubmit' => true ) ), @@ -65,7 +65,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_EVENT_HANDLER, array( - 'label' => mt('monitoring', 'Event Handler'), + 'label' => $this->translate('Event Handler'), 'autosubmit' => true ) ), @@ -73,7 +73,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm 'checkbox', ToggleObjectFeatureCommand::FEATURE_FLAP_DETECTION, array( - 'label' => mt('monitoring', 'Flap Detection'), + 'label' => $this->translate('Flap Detection'), 'autosubmit' => true ) ) @@ -95,7 +95,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm $element = $this->getElement($feature); $element->setChecked($object->{$feature}); if ((bool) $object->{$feature . '_changed'} === true) { - $element->setDescription(mt('monitoring', 'changed')); + $element->setDescription($this->translate('changed')); } } return $this; @@ -120,7 +120,7 @@ class ToggleObjectFeaturesCommandForm extends ObjectsCommandForm } } } - Notification::success(mt('monitoring', 'Toggling feature..')); + Notification::success($this->translate('Toggling feature..')); return true; } } diff --git a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php index daabe7e02..405bac144 100644 --- a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php @@ -28,9 +28,9 @@ class LocalInstanceForm extends Form 'path', array( 'required' => true, - 'label' => mt('monitoring', 'Command File'), + 'label' => $this->translate('Command File'), 'value' => '/var/run/icinga2/cmd/icinga2.cmd', - 'description' => mt('monitoring', 'Path to the local Icinga command file') + 'description' => $this->translate('Path to the local Icinga command file') ) ); return $this; diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index 7c55f655a..47b2a0316 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -29,8 +29,8 @@ class RemoteInstanceForm extends Form 'host', array( 'required' => true, - 'label' => mt('monitoring', 'Host'), - 'description' => mt('monitoring', + 'label' => $this->translate('Host'), + 'description' => $this->translate( 'Hostname or address of the remote Icinga instance' ) ) @@ -40,8 +40,8 @@ class RemoteInstanceForm extends Form 'port', array( 'required' => true, - 'label' => mt('monitoring', 'Port'), - 'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'), + 'label' => $this->translate('Port'), + 'description' => $this->translate('SSH port to connect to on the remote Icinga instance'), 'value' => 22 ) ), @@ -50,8 +50,8 @@ class RemoteInstanceForm extends Form 'user', array( 'required' => true, - 'label' => mt('monitoring', 'User'), - 'description' => mt('monitoring', + 'label' => $this->translate('User'), + 'description' => $this->translate( 'User to log in as on the remote Icinga instance. Please note that key-based SSH login must be' . ' possible for this user' ) @@ -62,9 +62,9 @@ class RemoteInstanceForm extends Form 'path', array( 'required' => true, - 'label' => mt('monitoring', 'Command File'), + 'label' => $this->translate('Command File'), 'value' => '/var/run/icinga2/cmd/icinga2.cmd', - 'description' => mt('monitoring', 'Path to the Icinga command file on the remote Icinga instance') + 'description' => $this->translate('Path to the Icinga command file on the remote Icinga instance') ) ) )); diff --git a/modules/monitoring/application/forms/Config/InstanceConfigForm.php b/modules/monitoring/application/forms/Config/InstanceConfigForm.php index b89e48c0a..5618f27ee 100644 --- a/modules/monitoring/application/forms/Config/InstanceConfigForm.php +++ b/modules/monitoring/application/forms/Config/InstanceConfigForm.php @@ -25,7 +25,7 @@ class InstanceConfigForm extends ConfigForm public function init() { $this->setName('form_config_monitoring_instance'); - $this->setSubmitLabel(mt('monitoring', 'Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -48,7 +48,7 @@ class InstanceConfigForm extends ConfigForm break; default: throw new InvalidArgumentException( - sprintf(mt('monitoring', 'Invalid instance type "%s" given'), $type) + sprintf($this->translate('Invalid instance type "%s" given'), $type) ); } return $form; @@ -69,10 +69,10 @@ class InstanceConfigForm extends ConfigForm { $name = isset($values['name']) ? $values['name'] : ''; if (! $name) { - throw new InvalidArgumentException(mt('monitoring', 'Instance name missing')); + throw new InvalidArgumentException($this->translate('Instance name missing')); } if ($this->config->hasSection($name)) { - throw new InvalidArgumentException(mt('monitoring', 'Instance already exists')); + throw new InvalidArgumentException($this->translate('Instance already exists')); } unset($values['name']); @@ -93,11 +93,11 @@ class InstanceConfigForm extends ConfigForm public function edit($name, array $values) { if (! $name) { - throw new InvalidArgumentException(mt('monitoring', 'Old instance name missing')); + throw new InvalidArgumentException($this->translate('Old instance name missing')); } elseif (! ($newName = isset($values['name']) ? $values['name'] : '')) { - throw new InvalidArgumentException(mt('monitoring', 'New instance name missing')); + throw new InvalidArgumentException($this->translate('New instance name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided')); + throw new InvalidArgumentException($this->translate('Unknown instance name provided')); } unset($values['name']); @@ -117,9 +117,9 @@ class InstanceConfigForm extends ConfigForm public function remove($name) { if (! $name) { - throw new InvalidArgumentException(mt('monitoring', 'Instance name missing')); + throw new InvalidArgumentException($this->translate('Instance name missing')); } elseif (! $this->config->hasSection($name)) { - throw new InvalidArgumentException(mt('monitoring', 'Unknown instance name provided')); + throw new InvalidArgumentException($this->translate('Unknown instance name provided')); } $instanceConfig = $this->config->getSection($name); @@ -136,10 +136,10 @@ class InstanceConfigForm extends ConfigForm $instanceName = $this->request->getQuery('instance'); if ($instanceName !== null) { if (! $instanceName) { - throw new ConfigurationError(mt('monitoring', 'Instance name missing')); + throw new ConfigurationError($this->translate('Instance name missing')); } if (! $this->config->hasSection($instanceName)) { - throw new ConfigurationError(mt('monitoring', 'Unknown instance name given')); + throw new ConfigurationError($this->translate('Unknown instance name given')); } $instanceConfig = $this->config->getSection($instanceName)->toArray(); @@ -158,10 +158,10 @@ class InstanceConfigForm extends ConfigForm try { if ($instanceName === null) { // create new instance $this->add($this->getValues()); - $message = mt('monitoring', 'Instance "%s" created successfully.'); + $message = $this->translate('Instance "%s" created successfully.'); } else { // edit existing instance $this->edit($instanceName, $this->getValues()); - $message = mt('monitoring', 'Instance "%s" edited successfully.'); + $message = $this->translate('Instance "%s" edited successfully.'); } } catch (InvalidArgumentException $e) { Notification::error($e->getMessage()); @@ -189,7 +189,7 @@ class InstanceConfigForm extends ConfigForm 'name', array( 'required' => true, - 'label' => mt('monitoring', 'Instance Name') + 'label' => $this->translate('Instance Name') ) ), array( @@ -198,10 +198,10 @@ class InstanceConfigForm extends ConfigForm array( 'required' => true, 'autosubmit' => true, - 'label' => mt('monitoring', 'Instance Type'), + 'label' => $this->translate('Instance Type'), 'multiOptions' => array( - LocalCommandFile::TRANSPORT => mt('monitoring', 'Local Command File'), - RemoteCommandFile::TRANSPORT => mt('monitoring', 'Remote Command File') + LocalCommandFile::TRANSPORT => $this->translate('Local Command File'), + RemoteCommandFile::TRANSPORT => $this->translate('Remote Command File') ), 'value' => $instanceType ) diff --git a/modules/monitoring/application/forms/Config/SecurityConfigForm.php b/modules/monitoring/application/forms/Config/SecurityConfigForm.php index 40c0b7b8c..b202f5938 100644 --- a/modules/monitoring/application/forms/Config/SecurityConfigForm.php +++ b/modules/monitoring/application/forms/Config/SecurityConfigForm.php @@ -18,7 +18,7 @@ class SecurityConfigForm extends ConfigForm public function init() { $this->setName('form_config_monitoring_security'); - $this->setSubmitLabel(mt('monitoring', 'Save Changes')); + $this->setSubmitLabel($this->translate('Save Changes')); } /** @@ -29,7 +29,7 @@ class SecurityConfigForm extends ConfigForm $this->config->setSection('security', $this->getValues()); if ($this->save()) { - Notification::success(mt('monitoring', 'New security configuration has successfully been stored')); + Notification::success($this->translate('New security configuration has successfully been stored')); } else { return false; } @@ -54,8 +54,8 @@ class SecurityConfigForm extends ConfigForm array( 'allowEmpty' => true, 'value' => '*pw*,*pass*,community', - 'label' => mt('monitoring', 'Protected Custom Variables'), - 'description' => mt('monitoring', + 'label' => $this->translate('Protected Custom Variables'), + 'description' => $this->translate( 'Comma separated case insensitive list of protected custom variables.' . ' Use * as a placeholder for zero or more wildcard characters.' . ' Existance of those custom variables will be shown, but their values will be masked.' diff --git a/modules/monitoring/application/forms/EventOverviewForm.php b/modules/monitoring/application/forms/EventOverviewForm.php index 25d268f76..dc697b940 100644 --- a/modules/monitoring/application/forms/EventOverviewForm.php +++ b/modules/monitoring/application/forms/EventOverviewForm.php @@ -44,7 +44,7 @@ class EventOverviewForm extends Form 'checkbox', 'statechange', array( - 'label' => t('State Changes'), + 'label' => $this->translate('State Changes'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->stateChangeFilter()->toQueryString()) === false ? 0 : 1 @@ -54,7 +54,7 @@ class EventOverviewForm extends Form 'checkbox', 'downtime', array( - 'label' => t('Downtimes'), + 'label' => $this->translate('Downtimes'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->downtimeFilter()->toQueryString()) === false ? 0 : 1 @@ -64,7 +64,7 @@ class EventOverviewForm extends Form 'checkbox', 'comment', array( - 'label' => t('Comments'), + 'label' => $this->translate('Comments'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->commentFilter()->toQueryString()) === false ? 0 : 1 @@ -74,7 +74,7 @@ class EventOverviewForm extends Form 'checkbox', 'notification', array( - 'label' => t('Notifications'), + 'label' => $this->translate('Notifications'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->notificationFilter()->toQueryString()) === false ? 0 : 1 @@ -84,7 +84,7 @@ class EventOverviewForm extends Form 'checkbox', 'flapping', array( - 'label' => t('Flapping'), + 'label' => $this->translate('Flapping'), 'class' => 'autosubmit', 'decorators' => $decorators, 'value' => strpos($url, $this->flappingFilter()->toQueryString()) === false ? 0 : 1 diff --git a/modules/monitoring/application/forms/Setup/BackendPage.php b/modules/monitoring/application/forms/Setup/BackendPage.php index 1f6ef6894..b5ab2ffd6 100644 --- a/modules/monitoring/application/forms/Setup/BackendPage.php +++ b/modules/monitoring/application/forms/Setup/BackendPage.php @@ -20,7 +20,7 @@ class BackendPage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'), + 'value' => $this->translate('Monitoring Backend', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,8 +31,7 @@ class BackendPage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please configure below how Icinga Web 2 should retrieve monitoring information.' ) ) @@ -44,8 +43,8 @@ class BackendPage extends Form array( 'required' => true, 'value' => 'icinga', - 'label' => mt('monitoring', 'Backend Name'), - 'description' => mt('monitoring', 'The identifier of this backend') + 'label' => $this->translate('Backend Name'), + 'description' => $this->translate('The identifier of this backend') ) ); @@ -60,8 +59,10 @@ class BackendPage extends Form 'type', array( 'required' => true, - 'label' => mt('monitoring', 'Backend Type'), - 'description' => mt('monitoring', 'The data source used for retrieving monitoring information'), + 'label' => $this->translate('Backend Type'), + 'description' => $this->translate( + 'The data source used for retrieving monitoring information' + ), 'multiOptions' => $resourceTypes ) ); diff --git a/modules/monitoring/application/forms/Setup/IdoResourcePage.php b/modules/monitoring/application/forms/Setup/IdoResourcePage.php index 189d65fea..c28b52e6b 100644 --- a/modules/monitoring/application/forms/Setup/IdoResourcePage.php +++ b/modules/monitoring/application/forms/Setup/IdoResourcePage.php @@ -28,7 +28,7 @@ class IdoResourcePage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'), + 'value' => $this->translate('Monitoring IDO Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -39,8 +39,7 @@ class IdoResourcePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please fill out the connection details below to access' . ' the IDO database of your monitoring environment.' ) @@ -91,8 +90,10 @@ class IdoResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => t('Skip Validation'), - 'description' => t('Check this to not to validate connectivity with the given database server') + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( + 'Check this to not to validate connectivity with the given database server' + ) ) ); } diff --git a/modules/monitoring/application/forms/Setup/InstancePage.php b/modules/monitoring/application/forms/Setup/InstancePage.php index dccfd1d91..8f151554d 100644 --- a/modules/monitoring/application/forms/Setup/InstancePage.php +++ b/modules/monitoring/application/forms/Setup/InstancePage.php @@ -20,7 +20,7 @@ class InstancePage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'), + 'value' => $this->translate('Monitoring Instance', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,8 +31,7 @@ class InstancePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please define the settings specific to your monitoring instance below.' ) ) diff --git a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php index 4faa17416..245d2abcc 100644 --- a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php +++ b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php @@ -28,7 +28,7 @@ class LivestatusResourcePage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'), + 'value' => $this->translate('Monitoring Livestatus Resource', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -39,8 +39,7 @@ class LivestatusResourcePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'Please fill out the connection details below to access the Livestatus' . ' socket interface for your monitoring environment.' ) @@ -91,8 +90,10 @@ class LivestatusResourcePage extends Form 'skip_validation', array( 'required' => true, - 'label' => t('Skip Validation'), - 'description' => t('Check this to not to validate connectivity with the given Livestatus socket') + 'label' => $this->translate('Skip Validation'), + 'description' => $this->translate( + 'Check this to not to validate connectivity with the given Livestatus socket' + ) ) ); } diff --git a/modules/monitoring/application/forms/Setup/SecurityPage.php b/modules/monitoring/application/forms/Setup/SecurityPage.php index 0c7d3d1de..ba8083e50 100644 --- a/modules/monitoring/application/forms/Setup/SecurityPage.php +++ b/modules/monitoring/application/forms/Setup/SecurityPage.php @@ -20,7 +20,7 @@ class SecurityPage extends Form 'note', 'title', array( - 'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'), + 'value' => $this->translate('Monitoring Security', 'setup.page.title'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -31,8 +31,7 @@ class SecurityPage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'To protect your monitoring environment against prying eyes please fill out the settings below.' ) ) diff --git a/modules/monitoring/application/forms/Setup/WelcomePage.php b/modules/monitoring/application/forms/Setup/WelcomePage.php index d910e2e01..f79eb6c62 100644 --- a/modules/monitoring/application/forms/Setup/WelcomePage.php +++ b/modules/monitoring/application/forms/Setup/WelcomePage.php @@ -19,10 +19,7 @@ class WelcomePage extends Form 'note', 'welcome', array( - 'value' => mt( - 'monitoring', - 'Welcome to the configuration of the monitoring module for Icinga Web 2!' - ), + 'value' => $this->translate('Welcome to the configuration of the monitoring module for Icinga Web 2!'), 'decorators' => array( 'ViewHelper', array('HtmlTag', array('tag' => 'h2')) @@ -34,7 +31,7 @@ class WelcomePage extends Form 'note', 'core_hint', array( - 'value' => mt('monitoring', 'This is the core module for Icinga Web 2.') + 'value' => $this->translate('This is the core module for Icinga Web 2.') ) ); @@ -42,8 +39,7 @@ class WelcomePage extends Form 'note', 'description', array( - 'value' => mt( - 'monitoring', + 'value' => $this->translate( 'It offers various status and reporting views with powerful filter capabilities that allow' . ' you to keep track of the most important events in your monitoring environment.' ) diff --git a/modules/monitoring/application/forms/StatehistoryForm.php b/modules/monitoring/application/forms/StatehistoryForm.php index 9fa1bdc26..d859f5815 100644 --- a/modules/monitoring/application/forms/StatehistoryForm.php +++ b/modules/monitoring/application/forms/StatehistoryForm.php @@ -19,7 +19,7 @@ class StatehistoryForm extends Form public function init() { $this->setName('form_event_overview'); - $this->setSubmitLabel(mt('monitoring', 'Apply')); + $this->setSubmitLabel($this->translate('Apply')); } /** @@ -65,14 +65,14 @@ class StatehistoryForm extends Form 'select', 'from', array( - 'label' => mt('monitoring', 'From'), + 'label' => $this->translate('From'), 'value' => $this->getRequest()->getParam('from', strtotime('3 months ago')), 'multiOptions' => array( - strtotime('midnight 3 months ago') => mt('monitoring', '3 Months'), - strtotime('midnight 4 months ago') => mt('monitoring', '4 Months'), - strtotime('midnight 8 months ago') => mt('monitoring', '8 Months'), - strtotime('midnight 12 months ago') => mt('monitoring', '1 Year'), - strtotime('midnight 24 months ago') => mt('monitoring', '2 Years') + strtotime('midnight 3 months ago') => $this->translate('3 Months'), + strtotime('midnight 4 months ago') => $this->translate('4 Months'), + strtotime('midnight 8 months ago') => $this->translate('8 Months'), + strtotime('midnight 12 months ago') => $this->translate('1 Year'), + strtotime('midnight 24 months ago') => $this->translate('2 Years') ), 'class' => 'autosubmit' ) @@ -81,10 +81,10 @@ class StatehistoryForm extends Form 'select', 'to', array( - 'label' => mt('monitoring', 'To'), + 'label' => $this->translate('To'), 'value' => $this->getRequest()->getParam('to', time()), 'multiOptions' => array( - time() => mt('monitoring', 'Today') + time() => $this->translate('Today') ), 'class' => 'autosubmit' ) @@ -95,11 +95,11 @@ class StatehistoryForm extends Form 'select', 'objecttype', array( - 'label' => mt('monitoring', 'Object type'), + 'label' => $this->translate('Object type'), 'value' => $objectType, 'multiOptions' => array( - 'services' => mt('monitoring', 'Services'), - 'hosts' => mt('monitoring', 'Hosts') + 'services' => $this->translate('Services'), + 'hosts' => $this->translate('Hosts') ), 'class' => 'autosubmit' ) @@ -113,13 +113,13 @@ class StatehistoryForm extends Form 'select', 'state', array( - 'label' => mt('monitoring', 'State'), + 'label' => $this->translate('State'), 'value' => $serviceState, 'multiOptions' => array( - 'cnt_critical_hard' => mt('monitoring', 'Critical'), - 'cnt_warning_hard' => mt('monitoring', 'Warning'), - 'cnt_unknown_hard' => mt('monitoring', 'Unknown'), - 'cnt_ok' => mt('monitoring', 'Ok') + 'cnt_critical_hard' => $this->translate('Critical'), + 'cnt_warning_hard' => $this->translate('Warning'), + 'cnt_unknown_hard' => $this->translate('Unknown'), + 'cnt_ok' => $this->translate('Ok') ), 'class' => 'autosubmit' ) @@ -133,12 +133,12 @@ class StatehistoryForm extends Form 'select', 'state', array( - 'label' => mt('monitoring', 'State'), + 'label' => $this->translate('State'), 'value' => $hostState, 'multiOptions' => array( - 'cnt_up' => mt('monitoring', 'Up'), - 'cnt_down_hard' => mt('monitoring', 'Down'), - 'cnt_unreachable_hard' => mt('monitoring', 'Unreachable') + 'cnt_up' => $this->translate('Up'), + 'cnt_down_hard' => $this->translate('Down'), + 'cnt_unreachable_hard' => $this->translate('Unreachable') ), 'class' => 'autosubmit' ) From 2d957205eff8103e155cf90677854eabc94578de Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 19 Jan 2015 13:47:53 +0100 Subject: [PATCH 33/41] Using $this when not in object context, doesn't work. refs #7551 --- application/forms/Config/Authentication/DbBackendForm.php | 4 ++-- application/forms/Config/Authentication/LdapBackendForm.php | 2 +- application/forms/Config/Resource/DbResourceForm.php | 2 +- application/forms/Config/Resource/LdapResourceForm.php | 2 +- application/forms/Config/Resource/LivestatusResourceForm.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index f8a4fb832..d3a5af51d 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -109,11 +109,11 @@ class DbBackendForm extends Form try { $dbUserBackend = new DbUserBackend(ResourceFactory::createResource($form->getResourceConfig())); if ($dbUserBackend->count() < 1) { - $form->addError($this->translate('No users found under the specified database backend')); + $form->addError($form->translate('No users found under the specified database backend')); return false; } } catch (Exception $e) { - $form->addError(sprintf($this->translate('Using the specified backend failed: %s'), $e->getMessage())); + $form->addError(sprintf($form->translate('Using the specified backend failed: %s'), $e->getMessage())); return false; } diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 5915a0a10..1b8fc3f11 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -150,7 +150,7 @@ class LdapBackendForm extends Form $form->addError($e->getMessage()); return false; } catch (Exception $e) { - $form->addError(sprintf($this->translate('Unable to validate authentication: %s'), $e->getMessage())); + $form->addError(sprintf($form->translate('Unable to validate authentication: %s'), $e->getMessage())); return false; } diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 9e4027299..97dd951d1 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -133,7 +133,7 @@ class DbResourceForm extends Form $resource->getConnection()->getConnection(); } catch (Exception $e) { $form->addError( - $this->translate('Connectivity validation failed, connection to the given resource not possible.') + $form->translate('Connectivity validation failed, connection to the given resource not possible.') ); return false; } diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php index c113e2471..3293546c5 100644 --- a/application/forms/Config/Resource/LdapResourceForm.php +++ b/application/forms/Config/Resource/LdapResourceForm.php @@ -124,7 +124,7 @@ class LdapResourceForm extends Form } } catch (Exception $e) { $form->addError( - $this->translate('Connectivity validation failed, connection to the given resource not possible.') + $form->translate('Connectivity validation failed, connection to the given resource not possible.') ); return false; } diff --git a/application/forms/Config/Resource/LivestatusResourceForm.php b/application/forms/Config/Resource/LivestatusResourceForm.php index 996827228..e893a4657 100644 --- a/application/forms/Config/Resource/LivestatusResourceForm.php +++ b/application/forms/Config/Resource/LivestatusResourceForm.php @@ -77,7 +77,7 @@ class LivestatusResourceForm extends Form $resource->connect()->disconnect(); } catch (Exception $_) { $form->addError( - $this->translate('Connectivity validation failed, connection to the given resource not possible.') + $form->translate('Connectivity validation failed, connection to the given resource not possible.') ); return false; } From 56640fa64fd6ab1371d2aec54442258766b1614f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 13:50:03 +0100 Subject: [PATCH 34/41] postgres: Use timestamp comparison instead of timezone offset comparison for detecting the default timestamp refs #7919 --- .../library/Monitoring/Backend/Ido/Query/IdoQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index f2e5bd15f..cf6968ea3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -324,8 +324,8 @@ abstract class IdoQuery extends DbQuery $value = preg_replace('/ COLLATE .+$/', '', $value); $value = preg_replace('/inet_aton\(([[:word:].]+)\)/i', '$1::inet - \'0.0.0.0\'', $value); $value = preg_replace( - '/(UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\)))/i', - 'CASE WHEN ($1 = EXTRACT(TIMEZONE FROM NOW()) * -1) THEN 0 ELSE $1 END', + '/UNIX_TIMESTAMP(\((?>[^()]|(?-1))*\))/i', + 'CASE WHEN ($1 < \'1970-01-03 00:00:00+00\'::timestamp with time zone) THEN 0 ELSE UNIX_TIMESTAMP($1) END', $value ); } From ae927cf043779e631e45516e5dadb2c27c6fc436 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 13:53:39 +0100 Subject: [PATCH 35/41] puppet/postgres: Allow connections made by Icinga 2 fixes #8109 --- .puppet/modules/pgsql/templates/pg_hba.conf.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.puppet/modules/pgsql/templates/pg_hba.conf.erb b/.puppet/modules/pgsql/templates/pg_hba.conf.erb index f6fb19ebf..c37e6ffd4 100644 --- a/.puppet/modules/pgsql/templates/pg_hba.conf.erb +++ b/.puppet/modules/pgsql/templates/pg_hba.conf.erb @@ -71,6 +71,11 @@ local icinga icinga trust host icinga icinga 127.0.0.1/32 trust host icinga icinga ::1/128 trust +# icinga2 +local icinga2 icinga2 trust +host icinga2 icinga2 127.0.0.1/32 trust +host icinga2 icinga2 ::1/128 trust + # icinga_unittest local icinga_unittest icinga_unittest trust host icinga_unittest icinga_unittest 127.0.0.1/32 trust From 10ebc3432c0a81ef52f41679aeaae49ea088f2ad Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 14:17:59 +0100 Subject: [PATCH 36/41] monitoring: Do not strip_tags when viewing host output in the host list refs #8248 --- modules/monitoring/application/views/scripts/list/hosts.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 2f339b1bf..4d60eacf4 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -115,7 +115,7 @@ if ($hosts->count() === 0) { array('style' => 'font-weight: normal') ) ?>) -

escape(substr(strip_tags($host->host_output), 0, 10000)) ?>

+

escape(substr($host->host_output, 0, 10000)) ?>

extraColumns as $col): ?> escape($host->$col) ?> From f56ffd3426671aeb28ba4fb682ef019e1769f264 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 14:18:46 +0100 Subject: [PATCH 37/41] monitoring: Do not strip_tags when viewing service output in the service list refs #8248 --- .../monitoring/application/views/scripts/list/services.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 8ef6f7fe8..26249b710 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -112,7 +112,7 @@ foreach ($services as $service): (host_state, true)); ?>)
-

escape(substr(strip_tags($service->service_output), 0, 10000)); ?>

+

escape(substr($service->service_output, 0, 10000)); ?>

extraColumns as $col): ?> escape($service->$col) ?> From a0a3241d1c42d138a588478f4199d3cdcd887d75 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 14:20:37 +0100 Subject: [PATCH 38/41] lib: Add String::ellipsis() --- library/Icinga/Util/String.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/library/Icinga/Util/String.php b/library/Icinga/Util/String.php index 248ab0d34..69fb26927 100644 --- a/library/Icinga/Util/String.php +++ b/library/Icinga/Util/String.php @@ -36,4 +36,22 @@ class String { return str_replace(' ', '', ucwords(str_replace($separator, ' ', strtolower($name)))); } + + /** + * Add ellipsis when a string is longer than max length + * + * @param string $string + * @param int $maxLength + * @param string $ellipsis + * + * @return string + */ + public static function ellipsis($string, $maxLength, $ellipsis = '...') + { + if (strlen($string) > $maxLength) { + return substr($string, 0, $maxLength - strlen($ellipsis)) . $ellipsis; + } + + return $string; + } } From a1a36301fe551bb3957f2c7da93892bd93cc653e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 14:20:57 +0100 Subject: [PATCH 39/41] View: Add string helpers --- library/Icinga/Web/View/helpers/string.php | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 library/Icinga/Web/View/helpers/string.php diff --git a/library/Icinga/Web/View/helpers/string.php b/library/Icinga/Web/View/helpers/string.php new file mode 100644 index 000000000..1d79d885a --- /dev/null +++ b/library/Icinga/Web/View/helpers/string.php @@ -0,0 +1,8 @@ +addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis = '...') { + return String::ellipsis($string, $maxLength, $ellipsis); +}); From 7580d57c1d85d281ffdd5fe5d165167cd693b962 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 14:21:55 +0100 Subject: [PATCH 40/41] monitoring: Use the ellipsis string helper when viewing plugin output in host and service list --- modules/monitoring/application/views/scripts/list/hosts.phtml | 2 +- .../monitoring/application/views/scripts/list/services.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 4d60eacf4..920a77e01 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -115,7 +115,7 @@ if ($hosts->count() === 0) { array('style' => 'font-weight: normal') ) ?>) -

escape(substr($host->host_output, 0, 10000)) ?>

+

escape($this->ellipsis($host->host_output, 10000)) ?>

extraColumns as $col): ?> escape($host->$col) ?> diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 26249b710..0b63c7887 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -112,7 +112,7 @@ foreach ($services as $service): (host_state, true)); ?>)
-

escape(substr($service->service_output, 0, 10000)); ?>

+

escape($this->ellipsis($service->service_output, 10000)); ?>

extraColumns as $col): ?> escape($service->$col) ?> From 5ccd29049060e7f25bab85449b7410da06387245 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 19 Jan 2015 15:07:37 +0100 Subject: [PATCH 41/41] puppet/postgres: Allow connections made by Icinga Web 2 --- .puppet/modules/pgsql/templates/pg_hba.conf.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.puppet/modules/pgsql/templates/pg_hba.conf.erb b/.puppet/modules/pgsql/templates/pg_hba.conf.erb index c37e6ffd4..ca98bebd8 100644 --- a/.puppet/modules/pgsql/templates/pg_hba.conf.erb +++ b/.puppet/modules/pgsql/templates/pg_hba.conf.erb @@ -86,6 +86,11 @@ local icingaweb icingaweb trust host icingaweb icingaweb 127.0.0.1/32 trust host icingaweb icingaweb ::1/128 trust +# icingaweb2 +local <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> trust +host <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> 127.0.0.1/32 trust +host <%= scope.function_hiera(['icingaweb2::db_user']) %> <%= scope.function_hiera(['icingaweb2::db_user']) %> ::1/128 trust + # "local" is for Unix domain socket connections only local all all ident # IPv4 local connections: