Ensure that the SummaryPage has a unique name when being utilized

refs #8191
This commit is contained in:
Johannes Meyer 2015-01-21 11:44:44 +01:00
parent fdb3988efd
commit 573c1046bb
5 changed files with 12 additions and 6 deletions

View File

@ -37,7 +37,7 @@ class MonitoringWizard extends Wizard implements SetupWizard
$this->addPage(new LivestatusResourcePage()); $this->addPage(new LivestatusResourcePage());
$this->addPage(new InstancePage()); $this->addPage(new InstancePage());
$this->addPage(new SecurityPage()); $this->addPage(new SecurityPage());
$this->addPage(new SummaryPage()); $this->addPage(new SummaryPage(array('name' => 'setup_monitoring_summary')));
} }
/** /**
@ -47,7 +47,7 @@ class MonitoringWizard extends Wizard implements SetupWizard
{ {
if ($page->getName() === 'setup_requirements') { if ($page->getName() === 'setup_requirements') {
$page->setRequirements($this->getRequirements()); $page->setRequirements($this->getRequirements());
} elseif ($page->getName() === 'setup_summary') { } elseif ($page->getName() === 'setup_monitoring_summary') {
$page->setSummary($this->getSetup()->getSummary()); $page->setSummary($this->getSetup()->getSummary());
$page->setSubjectTitle(mt('monitoring', 'the monitoring module', 'setup.summary.subject')); $page->setSubjectTitle(mt('monitoring', 'the monitoring module', 'setup.summary.subject'));
} elseif ( } elseif (

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Setup\Forms; namespace Icinga\Module\Setup\Forms;
use LogicException;
use Icinga\Web\Form; use Icinga\Web\Form;
/** /**
@ -30,7 +31,12 @@ class SummaryPage extends Form
*/ */
public function init() public function init()
{ {
$this->setName('setup_summary'); if ($this->getName() === $this->filterName(get_class($this))) {
throw new LogicException(
'When utilizing ' . get_class($this) . ' it is required to set a unique name by using the form options'
);
}
$this->setViewScript('form/setup-summary.phtml'); $this->setViewScript('form/setup-summary.phtml');
} }

View File

@ -20,7 +20,7 @@ use Icinga\Web\Wizard;
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
<form id="<?= $form->getName(); ?>" name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>"> <form id="<?= $form->getName(); ?>" name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>" class="summary">
<?= $form->getElement($form->getTokenElementName()); ?> <?= $form->getElement($form->getTokenElementName()); ?>
<?= $form->getElement($form->getUidElementName()); ?> <?= $form->getElement($form->getUidElementName()); ?>
<div class="buttons"> <div class="buttons">

View File

@ -94,7 +94,7 @@ class WebWizard extends Wizard implements SetupWizard
$this->addPage(new AdminAccountPage()); $this->addPage(new AdminAccountPage());
$this->addPage(new GeneralConfigPage()); $this->addPage(new GeneralConfigPage());
$this->addPage(new DatabaseCreationPage()); $this->addPage(new DatabaseCreationPage());
$this->addPage(new SummaryPage()); $this->addPage(new SummaryPage(array('name' => 'setup_summary')));
} }
/** /**

View File

@ -270,7 +270,7 @@
} }
} }
form#setup_summary { form.summary {
clear: left; clear: left;
} }
} }