From b880345a8a897b3fe600ef94a0fee5bb5f2f8558 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:46:04 +0200 Subject: Adding upstream version 1.1.0. Signed-off-by: Daniel Baumann --- application/controllers/ConfigController.php | 25 ++++++++ application/controllers/GraphController.php | 41 +++++++++++++ application/controllers/IndexController.php | 25 ++++++++ application/forms/Config/GeneralConfigForm.php | 62 ++++++++++++++++++++ application/locale/de_DE/LC_MESSAGES/pnp.mo | Bin 0 -> 1237 bytes application/locale/de_DE/LC_MESSAGES/pnp.po | 77 +++++++++++++++++++++++++ application/locale/it_IT/LC_MESSAGES/pnp.mo | Bin 0 -> 1238 bytes application/locale/it_IT/LC_MESSAGES/pnp.po | 67 +++++++++++++++++++++ application/views/scripts/config/index.phtml | 6 ++ application/views/scripts/index/iframe.phtml | 4 ++ 10 files changed, 307 insertions(+) create mode 100644 application/controllers/ConfigController.php create mode 100644 application/controllers/GraphController.php create mode 100644 application/controllers/IndexController.php create mode 100644 application/forms/Config/GeneralConfigForm.php create mode 100644 application/locale/de_DE/LC_MESSAGES/pnp.mo create mode 100644 application/locale/de_DE/LC_MESSAGES/pnp.po create mode 100644 application/locale/it_IT/LC_MESSAGES/pnp.mo create mode 100644 application/locale/it_IT/LC_MESSAGES/pnp.po create mode 100644 application/views/scripts/config/index.phtml create mode 100644 application/views/scripts/index/iframe.phtml (limited to 'application') diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php new file mode 100644 index 0000000..f6a0dcd --- /dev/null +++ b/application/controllers/ConfigController.php @@ -0,0 +1,25 @@ +assertPermission('config/modules'); + + $form = new GeneralConfigForm(); + $form->setIniConfig($this->Config()); + $form->handleRequest(); + + $this->view->form = $form; + $this->view->tabs = $this->Module()->getConfigTabs()->activate('config'); + } +} diff --git a/application/controllers/GraphController.php b/application/controllers/GraphController.php new file mode 100644 index 0000000..312b802 --- /dev/null +++ b/application/controllers/GraphController.php @@ -0,0 +1,41 @@ +getRequest()->getUrl(); + $queryString = $url->getQueryString(); + + $this->view->url = sprintf( + '%s/graph?%s', + $this->getBaseUrl(), + $queryString + ); + + $host = $this->getParam('host'); + $service = $this->getParam('srv'); + + $serviceTitle = ''; + if ($service && $service !== '_HOST_') { + $serviceTitle = sprintf(' | %s: %s', $this->translate('Service'), $service); + } + $this->view->title = $title = sprintf('%s: %s%s', + $this->translate('Host'), + $host, + $serviceTitle + ); + + $this->getTabs()->add('graph', array( + 'label' => $title, + 'url' => $url, + ))->activate('graph'); + + $this->setViewScript('index/iframe'); + } +} diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php new file mode 100644 index 0000000..7725268 --- /dev/null +++ b/application/controllers/IndexController.php @@ -0,0 +1,25 @@ +getTabs()->activate('pnp'); + + $defaultQuery = $this->Config()->get('pnp4nagios', 'default_query', 'host=.pnp-internal&srv=runtime'); + + $this->view->title = 'PNP'; + $this->view->url = sprintf( + '%s/graph?%s', + $this->getBaseUrl(), + $defaultQuery + ); + + $this->setViewScript('index/iframe'); + } +} diff --git a/application/forms/Config/GeneralConfigForm.php b/application/forms/Config/GeneralConfigForm.php new file mode 100644 index 0000000..d751055 --- /dev/null +++ b/application/forms/Config/GeneralConfigForm.php @@ -0,0 +1,62 @@ +setName('form_config_pnp4nagios_general'); + $this->setSubmitLabel($this->translate('Save Changes')); + } + + /** + * {@inheritdoc} + */ + public function createElements(array $formData) + { + $this->addElement( + 'text', + 'pnp4nagios_config_dir', + array( + 'value' => '/etc/pnp4nagios', + 'label' => $this->translate('PNP4Nagios configuration'), + 'description' => $this->translate('PNP4Nagios configuration path name (e.g. /etc/pnp4nagios)') + ) + ); + $this->addElement( + 'text', + 'pnp4nagios_base_url', + array( + 'value' => '/pnp4nagios', + 'label' => $this->translate('PNP4Nagios url'), + 'description' => $this->translate('The base URL of your PNP4Nagios installation (e.g. /pnp4nagios)') + ) + ); + + $this->addElement( + 'checkbox', + 'pnp4nagios_menu_disabled', + array( + 'label' => $this->translate('Disable menu entry'), + 'description' => $this->translate('Hide PNP from main menu') + ) + ); + + $this->addElement( + 'text', + 'pnp4nagios_default_query', + array( + 'value' => 'host=.pnp-internal&srv=runtime', + 'label' => $this->translate('Index query'), + 'description' => $this->translate('Default URL query for the index view: /pnp4nagios/graph?{query}') + ) + ); + } +} diff --git a/application/locale/de_DE/LC_MESSAGES/pnp.mo b/application/locale/de_DE/LC_MESSAGES/pnp.mo new file mode 100644 index 0000000..b7076cf Binary files /dev/null and b/application/locale/de_DE/LC_MESSAGES/pnp.mo differ diff --git a/application/locale/de_DE/LC_MESSAGES/pnp.po b/application/locale/de_DE/LC_MESSAGES/pnp.po new file mode 100644 index 0000000..8cd9a5c --- /dev/null +++ b/application/locale/de_DE/LC_MESSAGES/pnp.po @@ -0,0 +1,77 @@ +# Icinga Web 2 - Head for multiple monitoring backends. +# Copyright (C) 2015 Icinga Development Team +# This file is distributed under the same license as Pnp Module. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Pnp Module (1.0.0)\n" +"Report-Msgid-Bugs-To: dev@icinga.org\n" +"POT-Creation-Date: 2015-11-17 11:56+0100\n" +"PO-Revision-Date: 2015-11-17 12:01+0100\n" +"Last-Translator: Thomas Gelf \n" +"Language: de_DE\n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.5.4\n" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:224 +msgid "25 Hours" +msgstr "25 Stunden" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:223 +msgid "4 Hours" +msgstr "4 Stunden" + +#: /usr/local/icingaweb-modules/pnp/configuration.php:8 +msgid "Config" +msgstr "Konfiguration" + +#: /usr/local/icingaweb-modules/pnp/configuration.php:7 +msgid "Configure this module" +msgstr "Dieses Modul konfigurieren" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:226 +msgid "One Month" +msgstr "Ein Monat" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:225 +msgid "One Week" +msgstr "Eine Woche" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:227 +msgid "One Year" +msgstr "Ein Jahr" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:29 +msgid "PNP4Nagios configuration" +msgstr "PNP4Nagios Konfiguration" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:30 +msgid "PNP4Nagios configuration path name (e.g. /etc/pnp4nagios)" +msgstr "PNP4Nagios Konfigurationspfad (z.b. /etc/pnp4nagios)" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:38 +msgid "PNP4Nagios url" +msgstr "PNP4Nagios URL" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:16 +msgid "Save Changes" +msgstr "Ă„nderungen speichern" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:39 +msgid "The base URL of your PNP4Nagios installation (e.g. /pnp4nagios)" +msgstr "Basis-URL deiner PNP4Nagios installation (z.B. /pnp4nagios)" + +#~ msgid "" +#~ "Configuration form is still missing in this prototype. In case your " +#~ "PNP4Nagios config path is not %s or your base PNP4Nagios web url differs " +#~ "from %s please create a config file in %s following this example:" +#~ msgstr "" +#~ "Dieser Prototyp stellt noch kein Konfigurationsformular bereit. Sollte " +#~ "dein PNP4Nagios Konfigurationspfad nicht %s sein oder deine PNP4Nagios " +#~ "URL sich von %s unterscheiden erstelle bitte unter %s eine dem folgenden " +#~ "Beispiel entprechende Konfigurationsdatei:" diff --git a/application/locale/it_IT/LC_MESSAGES/pnp.mo b/application/locale/it_IT/LC_MESSAGES/pnp.mo new file mode 100644 index 0000000..0a72826 Binary files /dev/null and b/application/locale/it_IT/LC_MESSAGES/pnp.mo differ diff --git a/application/locale/it_IT/LC_MESSAGES/pnp.po b/application/locale/it_IT/LC_MESSAGES/pnp.po new file mode 100644 index 0000000..629b067 --- /dev/null +++ b/application/locale/it_IT/LC_MESSAGES/pnp.po @@ -0,0 +1,67 @@ +# Icinga Web 2 - Head for multiple monitoring backends. +# Copyright (C) 2015 Icinga Development Team +# This file is distributed under the same license as Pnp Module. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Pnp Module (1.0.0)\n" +"Report-Msgid-Bugs-To: dev@icinga.org\n" +"POT-Creation-Date: 2015-11-17 11:57+0100\n" +"PO-Revision-Date: 2015-11-17 11:59+0100\n" +"Last-Translator: Thomas Gelf \n" +"Language: it_IT\n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.5.4\n" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:224 +msgid "25 Hours" +msgstr "25 ore" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:223 +msgid "4 Hours" +msgstr "4 ore" + +#: /usr/local/icingaweb-modules/pnp/configuration.php:8 +msgid "Config" +msgstr "Configurazione" + +#: /usr/local/icingaweb-modules/pnp/configuration.php:7 +msgid "Configure this module" +msgstr "Configura questo modulo" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:226 +msgid "One Month" +msgstr "Un mese" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:225 +msgid "One Week" +msgstr "Una settimana" + +#: /usr/local/icingaweb-modules/pnp/library/Pnp/ProvidedHook/Grapher.php:227 +msgid "One Year" +msgstr "Un anno" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:29 +msgid "PNP4Nagios configuration" +msgstr "Configurazione PNP4Nagios" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:30 +msgid "PNP4Nagios configuration path name (e.g. /etc/pnp4nagios)" +msgstr "Directory della configurazione PNP4Nagios (es. /etc/pnp4nagios)" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:38 +msgid "PNP4Nagios url" +msgstr "URL PNP4Nagios" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:16 +msgid "Save Changes" +msgstr "Salva modifiche" + +#: /usr/local/icingaweb-modules/pnp/application/forms/Config/GeneralConfigForm.php:39 +msgid "The base URL of your PNP4Nagios installation (e.g. /pnp4nagios)" +msgstr "URL di base della tua installazione PNP4Nagios (es. /pnp4nagios)" diff --git a/application/views/scripts/config/index.phtml b/application/views/scripts/config/index.phtml new file mode 100644 index 0000000..4ca5e68 --- /dev/null +++ b/application/views/scripts/config/index.phtml @@ -0,0 +1,6 @@ +
+ +
+
+ +
\ No newline at end of file diff --git a/application/views/scripts/index/iframe.phtml b/application/views/scripts/index/iframe.phtml new file mode 100644 index 0000000..be0c35a --- /dev/null +++ b/application/views/scripts/index/iframe.phtml @@ -0,0 +1,4 @@ +
+ +
+ -- cgit v1.2.3