From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- .../views/scripts/form/setup-modules.phtml | 33 +++++ .../views/scripts/form/setup-requirements.phtml | 48 +++++++ .../views/scripts/form/setup-summary.phtml | 40 ++++++ .../views/scripts/form/setup-welcome.phtml | 120 ++++++++++++++++ .../application/views/scripts/index/index.phtml | 153 +++++++++++++++++++++ .../views/scripts/index/parts/finish.phtml | 34 +++++ .../views/scripts/index/parts/wizard.phtml | 1 + 7 files changed, 429 insertions(+) create mode 100644 modules/setup/application/views/scripts/form/setup-modules.phtml create mode 100644 modules/setup/application/views/scripts/form/setup-requirements.phtml create mode 100644 modules/setup/application/views/scripts/form/setup-summary.phtml create mode 100644 modules/setup/application/views/scripts/form/setup-welcome.phtml create mode 100644 modules/setup/application/views/scripts/index/index.phtml create mode 100644 modules/setup/application/views/scripts/index/parts/finish.phtml create mode 100644 modules/setup/application/views/scripts/index/parts/wizard.phtml (limited to 'modules/setup/application/views') diff --git a/modules/setup/application/views/scripts/form/setup-modules.phtml b/modules/setup/application/views/scripts/form/setup-modules.phtml new file mode 100644 index 0000000..e57c7dc --- /dev/null +++ b/modules/setup/application/views/scripts/form/setup-modules.phtml @@ -0,0 +1,33 @@ + +
+

translate('Modules', 'setup.page.title'); ?>

+

translate('The following modules were found in your Icinga Web 2 installation. To enable and configure a module, just tick it and click "Next".'); ?>

+getElements() as $element): ?> + getName(), array(Wizard::BTN_PREV, Wizard::BTN_NEXT, Wizard::PROGRESS_ELEMENT, $form->getTokenElementName(), $form->getUidElementName()))): ?> +
+
+

+
+ +
+
+ +
+ + + getElement($form->getTokenElementName()); ?> + getElement($form->getUidElementName()); ?> + getDisplayGroup('buttons'); ?> +
diff --git a/modules/setup/application/views/scripts/form/setup-requirements.phtml b/modules/setup/application/views/scripts/form/setup-requirements.phtml new file mode 100644 index 0000000..544f284 --- /dev/null +++ b/modules/setup/application/views/scripts/form/setup-requirements.phtml @@ -0,0 +1,48 @@ +getWizard()->getRequirements()->fulfilled()) { + $form->getElement(Wizard::BTN_NEXT)->setAttrib('disabled', 1); +} + +?> +

Icinga Web 2

+getWizard()->getRequirements(true); ?> +getWizard()->getPage('setup_modules')->getModuleWizards() as $moduleName => $wizard): ?> +

translate('Module'); ?>

+getRequirements(); ?> + +
+ getElement($form->getTokenElementName()); ?> + getElement($form->getUidElementName()); ?> +
+ getElement(Wizard::BTN_NEXT); + echo $double->setAttrib('class', 'double'); + ?> + getElement(Wizard::BTN_PREV); ?> + getElement(Wizard::BTN_NEXT); ?> + getElement(Wizard::PROGRESS_ELEMENT); ?> +
+ translate('You may also need to restart the web-server for the changes to take effect!'); ?> + qlink( + $this->translate('Refresh'), + null, + null, + array( + 'class' => 'button-link', + 'title' => $title, + 'aria-label' => sprintf($this->translate('Refresh the page; %s'), $title) + ) + ); ?> +
+
+
\ No newline at end of file diff --git a/modules/setup/application/views/scripts/form/setup-summary.phtml b/modules/setup/application/views/scripts/form/setup-summary.phtml new file mode 100644 index 0000000..3ad0265 --- /dev/null +++ b/modules/setup/application/views/scripts/form/setup-summary.phtml @@ -0,0 +1,40 @@ +getElement(Wizard::BTN_NEXT)->setAttrib( + 'class', + $form->getElement(Wizard::BTN_NEXT)->getAttrib('class') . ' finish' +); + +?> +

translate( + 'You\'ve configured %1$s successfully. You can review the changes supposed to be made before setting it up.' + . ' Make sure that everything is correct (Feel free to navigate back to make any corrections!) so' + . ' that you can start using %1$s right after it has successfully been set up.' + ), + $form->getSubjectTitle() +); ?>

+
+getSummary() as $pageHtml): ?> + +
+ +
+ + +
+
+ getElement($form->getTokenElementName()); ?> + getElement($form->getUidElementName()); ?> + getDisplayGroup('buttons'); ?> +
\ No newline at end of file diff --git a/modules/setup/application/views/scripts/form/setup-welcome.phtml b/modules/setup/application/views/scripts/form/setup-welcome.phtml new file mode 100644 index 0000000..1be68f3 --- /dev/null +++ b/modules/setup/application/views/scripts/form/setup-welcome.phtml @@ -0,0 +1,120 @@ +getConfigDir(); +$setupTokenPath = rtrim($configDir, '/') . '/setup.token'; +$cliPath = realpath(Icinga::app()->getApplicationDir() . '/../bin/icingacli'); + +$groupadd = null; +$docker = getenv('ICINGAWEB_OFFICIAL_DOCKER_IMAGE'); + +if (! (false === ($distro = Platform::getLinuxDistro(1)) || $distro === 'linux')) { + foreach (array( + 'groupadd -r icingaweb2' => array( + 'redhat', 'rhel', 'centos', 'fedora', + 'suse', 'sles', 'sled', 'opensuse' + ), + 'addgroup --system icingaweb2' => array('debian', 'ubuntu') + ) as $groupadd_ => $distros) { + if (in_array($distro, $distros)) { + $groupadd = $groupadd_; + break; + } + } + + switch ($distro) { + case 'redhat': + case 'rhel': + case 'centos': + case 'fedora': + $usermod = 'usermod -a -G icingaweb2 %s'; + $webSrvUser = 'apache'; + break; + case 'suse': + case 'sles': + case 'sled': + case 'opensuse': + $usermod = 'usermod -A icingaweb2 %s'; + $webSrvUser = 'wwwrun'; + break; + case 'debian': + case 'ubuntu': + $usermod = 'usermod -a -G icingaweb2 %s'; + $webSrvUser = 'www-data'; + break; + default: + $usermod = $webSrvUser = null; + } +} +?> +
+

translate('Welcome to the configuration of Icinga Web 2!') ?>

+ +

translate( + 'You\'ve already completed the configuration of Icinga Web 2. Note that most of your configuration' + . ' files will be overwritten in case you\'ll re-configure Icinga Web 2 using this wizard!' + ); ?>

+ +

translate( + 'This wizard will guide you through the configuration of Icinga Web 2. Once completed and successfully' + . ' finished you are able to log in and to explore all the new and stunning features!' + ); ?>

+ +
+ getElement('token'); ?> + getElement($form->getTokenElementName()); ?> + getElement($form->getUidElementName()); ?> +
+ getElement(Wizard::BTN_NEXT); ?> +
+
+
+

translate('Generating a New Setup Token'); ?>

+
+

translate( + 'To run this wizard a user needs to authenticate using a token which is usually' + . ' provided to him by an administrator who\'d followed the instructions below.' + ); ?>

+ +

translate('In any case, make sure that all of the following applies to your environment:'); ?>

+
    +
  • translate('A system group called "icingaweb2" exists'); ?>
  • + +
  • translate('The user "%s" is a member of the system group "icingaweb2"'), $phpUser); ?>
  • + +
  • translate('Your webserver\'s user is a member of the system group "icingaweb2"'); ?>
  • + +
+ +
+ escape($groupadd . ';') ?> + escape(sprintf($usermod, $phpUser ?: $webSrvUser) . ';') ?> +
+ +

translate('If you\'ve got the IcingaCLI installed you can do the following:'); ?>

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

translate('In case the IcingaCLI is missing you can create the token manually:'); ?>

+
+ su translate(''); ?> -s /bin/sh -c "mkdir -m 2770 ; chgrp icingaweb2 ; head -c 12 /dev/urandom | base64 | tee ; chmod 0660 ;"; +
+ +

translate('Please see the %s for an extensive description on how to access and use this wizard.'), + '' . $this->translate('Icinga Web 2 documentation') . '' // TODO: Add link to iw2 docs which points to the installation topic + ); ?>

+
+
+
diff --git a/modules/setup/application/views/scripts/index/index.phtml b/modules/setup/application/views/scripts/index/index.phtml new file mode 100644 index 0000000..b2b3bda --- /dev/null +++ b/modules/setup/application/views/scripts/index/index.phtml @@ -0,0 +1,153 @@ +getPages(); +$finished = isset($success); +$configPages = array_slice($pages, 3, count($pages) - 4, true); +$currentPos = array_search($wizard->getCurrentPage(), $pages, true); +list($configPagesLeft, $configPagesRight) = array_chunk($configPages, (int)(count($configPages) / 2), true); + +$visitedPages = array_keys($wizard->getPageData()); +$maxProgress = max(array_merge([0], array_keys(array_filter( + $pages, + function ($page) use ($visitedPages) { return in_array($page->getName(), $visitedPages); } +)))); + +?> +
+
+ img('img/icinga-logo-big.png'); ?> +
+
+

translate('Welcome', 'setup.progress'); ?>

+ 0 ? 'complete' : ( + $maxProgress > 0 ? 'visited' : 'active' + ); ?> + + + + +
+
+
+

translate('Modules', 'setup.progress'); ?>

+ 1 ? ' complete' : ( + $maxProgress > 1 ? ' visited' : ( + $currentPos === 1 ? ' active' : '' + ) + ); ?> + + + + +
+ = $currentPos && $maxProgress === 1)): ?> + restartForm ?> + +
+
+

translate('Requirements', 'setup.progress'); ?>

+ 2 ? ' complete' : ( + $maxProgress > 2 ? ' visited' : ( + $currentPos === 2 ? ' active' : '' + ) + ); ?> + + + + +
+ = $currentPos && $maxProgress === 2)): ?> + restartForm ?> + +
+
+

translate('Configuration', 'setup.progress'); ?>

+ + + + +
+ + $page): ?> + 2 ? ' active' : '') + ); ?> + +
+ +
+ +
+ + +
+
+
+ + $page): ?> + 2 ? ' active' : '') + ); ?> + +
+ +
+ +
+ + +
+ 2 || $currentPos > 2): ?> + restartForm ?> + +
+
+

translate('Finish', 'setup.progress'); ?>

+ + + + + +
+
+
+
+
+ + render('index/parts/finish.phtml'); ?> + + render('index/parts/wizard.phtml'); ?> + +
+
+ diff --git a/modules/setup/application/views/scripts/index/parts/finish.phtml b/modules/setup/application/views/scripts/index/parts/finish.phtml new file mode 100644 index 0000000..dc5ba1c --- /dev/null +++ b/modules/setup/application/views/scripts/index/parts/finish.phtml @@ -0,0 +1,34 @@ +
+ +

translate('Congratulations! Icinga Web 2 has been successfully set up.'); ?>

+ +

translate('Sorry! Failed to set up Icinga Web 2 successfully.'); ?>

+ +
+ + qlink( + $this->translate('Login to Icinga Web 2'), + 'authentication/login', + null, + array( + 'class' => 'button-link login', + 'data-no-icinga-ajax' => true, + 'title' => $this->translate('Show the login page of Icinga Web 2') + ) + ); ?> + + qlink( + $this->translate('Back'), + null, + null, + array( + 'class' => 'button-link', + 'title' => $this->translate('Show previous wizard-page') + ) + ); ?> + +
+
+
diff --git a/modules/setup/application/views/scripts/index/parts/wizard.phtml b/modules/setup/application/views/scripts/index/parts/wizard.phtml new file mode 100644 index 0000000..94891f9 --- /dev/null +++ b/modules/setup/application/views/scripts/index/parts/wizard.phtml @@ -0,0 +1 @@ +getForm()->render(); ?> \ No newline at end of file -- cgit v1.2.3