Add summary page

refs #7163
This commit is contained in:
Johannes Meyer 2014-10-02 17:11:00 +02:00
parent 0f302bfc0a
commit f29705fc59
4 changed files with 142 additions and 0 deletions

View File

@ -0,0 +1,52 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Form\Setup;
use Icinga\Web\Form;
/**
* Wizard page that displays a summary of what is going to be "done"
*/
class SummaryPage extends Form
{
/**
* The summary to show
*
* @var array
*/
protected $summary;
/**
* Initialize this page
*/
public function init()
{
$this->setName('setup_summary');
$this->setViewScript('form/setup-summary.phtml');
}
/**
* Set the summary to show
*
* @param array $summary
*
* @return self
*/
public function setSummary(array $summary)
{
$this->summary = $summary;
return $this;
}
/**
* Return the summary to show
*
* @return array
*/
public function getSummary()
{
return $this->summary;
}
}

View File

@ -0,0 +1,60 @@
<?php
use Icinga\Web\Wizard;
?>
<p><?= t(
'The wizard is now complete. You can review the changes supposed to be made before issuing the actual installation'
. ' of Icinga Web 2. Make sure that everything is correct (Feel free to navigate back to make any corrections!) so'
. ' that you can start using Icinga Web 2 right after the installation has been finished.'
); ?></p>
<div class="summary">
<?php foreach ($form->getSummary() as $pageTitle => $pageContent): ?>
<div class="page">
<h2><?= $pageTitle; ?></h2>
<?php if (is_array($pageContent)): ?>
<?php foreach ($pageContent as $paragraphTitle => $paragraphContent): ?>
<div class="paragraph">
<?php if (false === is_int($paragraphTitle)): ?>
<h3><?= $paragraphTitle; ?></h3>
<?php endif ?>
<?php if (is_array($paragraphContent)): ?>
<?php if (is_int(key($paragraphContent))): ?>
<ul class="topic">
<?php foreach ($paragraphContent as $listItem): ?>
<li><?= $listItem; ?></li>
<?php endforeach ?>
</ul>
<?php else: ?>
<?php foreach ($paragraphContent as $topicTitle => $topicContent): ?>
<div class="topic">
<h4><?= $topicTitle; ?></h4>
<?php if (is_array($topicContent)): ?>
<ul>
<?php foreach ($topicContent as $listItem): ?>
<li><?= $listItem; ?></li>
<?php endforeach ?>
</ul>
<?php else: ?>
<p><?= $topicContent; ?></p>
<?php endif ?>
</div>
<?php endforeach ?>
<?php endif ?>
<?php else: ?>
<p class="topic"><?= $paragraphContent; ?></p>
<?php endif ?>
</div>
<?php endforeach ?>
<?php else: ?>
<p class="paragraph"><?= $pageContent; ?></p>
<?php endif ?>
</div>
<?php endforeach ?>
<form id="<?= $form->getName(); ?>" name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>">
<?= $form->getElement($form->getTokenElementName()); ?>
<?= $form->getElement($form->getUidElementName()); ?>
<?= $form->getElement(Wizard::BTN_PREV); ?>
<?= $form->getElement(Wizard::BTN_NEXT)->setLabel(t('Install Icinga Web 2')); ?>
</form>
</div>

View File

@ -6,6 +6,7 @@ namespace Icinga\Application;
use PDOException;
use Icinga\Form\Setup\WelcomePage;
use Icinga\Form\Setup\SummaryPage;
use Icinga\Form\Setup\DbResourcePage;
use Icinga\Form\Setup\PreferencesPage;
use Icinga\Form\Setup\AuthBackendPage;
@ -68,6 +69,7 @@ class WebSetup extends Wizard implements SetupWizard
$this->addPage(new AdminAccountPage());
$this->addPage(new GeneralConfigPage());
$this->addPage(new DatabaseCreationPage());
$this->addPage(new SummaryPage());
}
/**
@ -109,6 +111,8 @@ class WebSetup extends Wizard implements SetupWizard
} elseif ($page->getName() === 'setup_database_creation') {
$page->setDatabasePrivileges($this->databaseSetupPrivileges);
$page->setResourceConfig($this->getPageData('setup_db_resource'));
} elseif ($page->getName() === 'setup_summary') {
$page->setSummary($this->getInstaller()->getSummary());
}
}

View File

@ -25,4 +25,30 @@
display: inline-block;
padding: 0.4em 0.2em 0;
}
}
#wizard div.summary {
div.page {
h2 {
font-size: 1.2em;
}
.paragraph {
margin-left: 2em;
h3 {
font-size: 1em;
}
.topic {
h4 {
font-size: 0.8em;
}
}
div.topic {
margin-left: 2em;
}
}
}
}