parent
51bac035ac
commit
429e09aae2
|
@ -4,7 +4,6 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
use Icinga\Web\Session;
|
||||
use Icinga\Web\Wizard\Page;
|
||||
use Icinga\Web\Wizard\Wizard;
|
||||
use Icinga\Web\Controller\ActionController;
|
||||
|
||||
|
@ -36,12 +35,14 @@ class InstallController extends ActionController
|
|||
$wizard = $this->createWizard();
|
||||
$wizard->navigate(); // Needs to be called before isSubmittedAndValid() as this creates the form
|
||||
|
||||
if ($wizard->isSubmittedAndValid() && $wizard->isFinished()) {
|
||||
// TODO: Run the installer (Who creates an installer? How do we handle module installers?)
|
||||
$this->dropConfiguration(); // TODO: Should only be done if the installation has been successfully completed
|
||||
$this->view->installer = '';
|
||||
} else {
|
||||
$this->storeConfiguration($wizard->getConfig());
|
||||
if ($wizard->isSubmittedAndValid()) {
|
||||
if ($wizard->isFinished()) {
|
||||
// TODO: Run the installer (Who creates an installer? How do we handle module installers?)
|
||||
$this->dropConfiguration(); // TODO: Should only be done if the installation has been successfully completed
|
||||
$this->view->installer = '';
|
||||
} else {
|
||||
$this->storeConfiguration($wizard->getConfig());
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->wizard = $wizard;
|
||||
|
@ -60,14 +61,14 @@ class InstallController extends ActionController
|
|||
$wizard->setConfiguration($this->loadConfiguration());
|
||||
$wizard->addPages(
|
||||
array(
|
||||
'1st step' => new Page(),
|
||||
'2nd step' => new Page(),
|
||||
'3rd step' => new Page(),
|
||||
'a wizard' => array(
|
||||
'4th step' => new Page(),
|
||||
'5th step' => new Page()
|
||||
),
|
||||
'last step' => new Page()
|
||||
// t('Welcome') => 'Icinga\Form\Install\WelcomePage',
|
||||
// t('Requirements') => 'Icinga\Form\Install\RequirementsPage',
|
||||
// t('Authentication') => 'Icinga\Form\Install\AuthenticationPage',
|
||||
// t('Administration') => 'Icinga\Form\Install\AdministrationPage',
|
||||
// t('Preferences') => 'Icinga\Form\Install\PreferencesPage',
|
||||
t('Logging') => 'Icinga\Form\Install\LoggingPage',
|
||||
// t('Database Setup') => 'Icinga\Form\Install\DatabasePage',
|
||||
// t('Summary') => 'Icinga\Form\Install\SummaryPage'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -22,6 +22,14 @@ class Page extends Form
|
|||
*/
|
||||
protected $title = '';
|
||||
|
||||
/**
|
||||
* Overwrite this to initialize this wizard page
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title for this wizard page
|
||||
*
|
||||
|
|
|
@ -41,16 +41,18 @@ class Wizard extends Page
|
|||
*/
|
||||
public function addPage(Page $page)
|
||||
{
|
||||
$ident = $this->generatePageIdentifier($page);
|
||||
$wizardConfig = $this->getConfig();
|
||||
if ($wizardConfig->get($ident) === null) {
|
||||
$wizardConfig->{$ident} = new Zend_Config(array(), true);
|
||||
if (!($pageName = $page->getName())) {
|
||||
throw new ProgrammingError('Wizard page "' . get_class($page) . '" has no unique name');
|
||||
}
|
||||
|
||||
$page->setTokenDisabled(); // Usually default for pages, but not for wizards
|
||||
$page->setConfiguration($wizardConfig->{$ident});
|
||||
$wizardConfig = $this->getConfig();
|
||||
if ($wizardConfig->get($pageName) === null) {
|
||||
$wizardConfig->{$pageName} = new Zend_Config(array(), true);
|
||||
}
|
||||
|
||||
$page->setConfiguration($wizardConfig->{$pageName});
|
||||
$page->setRequest($this->getRequest());
|
||||
$page->setName($ident);
|
||||
$page->setTokenDisabled(); // Usually default for pages, but not for wizards
|
||||
$this->pages[] = $page;
|
||||
}
|
||||
|
||||
|
@ -263,30 +265,6 @@ class Wizard extends Page
|
|||
$config->{$currentPage->getName()} = $currentPage->getConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a unique identifier for the given page
|
||||
*
|
||||
* @param Page $page The page for which to return the identifier
|
||||
*
|
||||
* @return string The page's unique identifier
|
||||
*/
|
||||
protected function generatePageIdentifier(Page $page)
|
||||
{
|
||||
if (($name = $page->getName())) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
$pageClass = get_class($page);
|
||||
$wizardConfig = $this->getConfig();
|
||||
|
||||
if ($wizardConfig->get('page_names') === null || $wizardConfig->page_names->get($pageClass) === null) {
|
||||
$wizardConfig->page_names = $wizardConfig->get('page_names', new Zend_Config(array(), true));
|
||||
$wizardConfig->page_names->{$pageClass} = sprintf('%06x', mt_rand(0, 0xffffff));
|
||||
}
|
||||
|
||||
return $wizardConfig->page_names->{$pageClass};
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the current wizard page
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue