From 573c1046bbfd5dafa3929faf5684fb05d2ac04ec Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 21 Jan 2015 11:44:44 +0100 Subject: [PATCH] Ensure that the SummaryPage has a unique name when being utilized refs #8191 --- .../monitoring/library/Monitoring/MonitoringWizard.php | 4 ++-- modules/setup/application/forms/SummaryPage.php | 8 +++++++- .../application/views/scripts/form/setup-summary.phtml | 2 +- modules/setup/library/Setup/WebWizard.php | 2 +- public/css/icinga/setup.less | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/monitoring/library/Monitoring/MonitoringWizard.php b/modules/monitoring/library/Monitoring/MonitoringWizard.php index 9c588e5b3..a21ee9706 100644 --- a/modules/monitoring/library/Monitoring/MonitoringWizard.php +++ b/modules/monitoring/library/Monitoring/MonitoringWizard.php @@ -37,7 +37,7 @@ class MonitoringWizard extends Wizard implements SetupWizard $this->addPage(new LivestatusResourcePage()); $this->addPage(new InstancePage()); $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') { $page->setRequirements($this->getRequirements()); - } elseif ($page->getName() === 'setup_summary') { + } elseif ($page->getName() === 'setup_monitoring_summary') { $page->setSummary($this->getSetup()->getSummary()); $page->setSubjectTitle(mt('monitoring', 'the monitoring module', 'setup.summary.subject')); } elseif ( diff --git a/modules/setup/application/forms/SummaryPage.php b/modules/setup/application/forms/SummaryPage.php index 14ad93c56..9b42ec9d8 100644 --- a/modules/setup/application/forms/SummaryPage.php +++ b/modules/setup/application/forms/SummaryPage.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Setup\Forms; +use LogicException; use Icinga\Web\Form; /** @@ -30,7 +31,12 @@ class SummaryPage extends Form */ 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'); } diff --git a/modules/setup/application/views/scripts/form/setup-summary.phtml b/modules/setup/application/views/scripts/form/setup-summary.phtml index fa354feb5..676dcd52f 100644 --- a/modules/setup/application/views/scripts/form/setup-summary.phtml +++ b/modules/setup/application/views/scripts/form/setup-summary.phtml @@ -20,7 +20,7 @@ use Icinga\Web\Wizard; -
+ getElement($form->getTokenElementName()); ?> getElement($form->getUidElementName()); ?>
diff --git a/modules/setup/library/Setup/WebWizard.php b/modules/setup/library/Setup/WebWizard.php index a33b8c0d7..ad6f927cd 100644 --- a/modules/setup/library/Setup/WebWizard.php +++ b/modules/setup/library/Setup/WebWizard.php @@ -94,7 +94,7 @@ class WebWizard extends Wizard implements SetupWizard $this->addPage(new AdminAccountPage()); $this->addPage(new GeneralConfigPage()); $this->addPage(new DatabaseCreationPage()); - $this->addPage(new SummaryPage()); + $this->addPage(new SummaryPage(array('name' => 'setup_summary'))); } /** diff --git a/public/css/icinga/setup.less b/public/css/icinga/setup.less index 166e47ff8..8ca669bdd 100644 --- a/public/css/icinga/setup.less +++ b/public/css/icinga/setup.less @@ -270,7 +270,7 @@ } } - form#setup_summary { + form.summary { clear: left; } }