From db4cfa7df62d5911bc5a0edcdc59236c39aede08 Mon Sep 17 00:00:00 2001 From: CHItA Date: Thu, 11 Jun 2015 19:32:11 +0200 Subject: [ticket/13740] Add navigation bar support for the installer Also added various UI elements and texts. [ci skip] PHPBB3-13740 --- phpBB/install/controller/helper.php | 24 ++++-- phpBB/install/controller/install.php | 108 +++++++++++++++++++++------ phpBB/install/controller/install_index.php | 79 -------------------- phpBB/install/controller/installer_index.php | 79 ++++++++++++++++++++ 4 files changed, 184 insertions(+), 106 deletions(-) delete mode 100644 phpBB/install/controller/install_index.php create mode 100644 phpBB/install/controller/installer_index.php (limited to 'phpBB/install/controller') diff --git a/phpBB/install/controller/helper.php b/phpBB/install/controller/helper.php index 7a5e20406d..0df1ae71a4 100644 --- a/phpBB/install/controller/helper.php +++ b/phpBB/install/controller/helper.php @@ -157,13 +157,25 @@ class helper { // @todo Sort navs by order - foreach ($entry[0] as $sub_entry) + foreach ($entry[0] as $name => $sub_entry) { - $this->template->assign_block_vars('l_block1', array( - 'L_TITLE' => $this->language->lang($sub_entry['label']), - 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), - 'U_TITLE' => $this->route($sub_entry['route']), - )); + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) + { + $this->template->assign_block_vars('l_block2', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), + 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), + 'STAGE_NAME' => $name, + )); + } + else + { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } } } } diff --git a/phpBB/install/controller/install.php b/phpBB/install/controller/install.php index 4021c5625b..c1329b6456 100644 --- a/phpBB/install/controller/install.php +++ b/phpBB/install/controller/install.php @@ -13,7 +13,16 @@ namespace phpbb\install\controller; +use phpbb\install\helper\config; +use phpbb\install\helper\navigation\navigation_provider; use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpFoundation\Response; +use phpbb\install\helper\iohandler\factory; +use phpbb\install\controller\helper; +use phpbb\template\template; +use phpbb\request\request_interface; +use phpbb\install\installer; +use phpbb\language\language; /** * Controller for installing phpBB @@ -21,51 +30,72 @@ use Symfony\Component\HttpFoundation\StreamedResponse; class install { /** - * @var \phpbb\install\controller\helper + * @var helper */ protected $controller_helper; /** - * @var \phpbb\install\helper\iohandler\factory + * @var config + */ + protected $installer_config; + + /** + * @var factory */ protected $iohandler_factory; /** - * @var \phpbb\template\template + * @var navigation_provider + */ + protected $menu_provider; + + /** + * @var language + */ + protected $language; + + /** + * @var template */ protected $template; /** - * @var \phpbb\request\request_interface + * @var request_interface */ protected $request; /** - * @var \phpbb\install\installer + * @var installer */ protected $installer; /** * Constructor * - * @param helper $helper - * @param \phpbb\install\helper\iohandler\factory $factory - * @param \phpbb\request\request_interface $request - * @param \phpbb\install\installer $installer + * @param helper $helper + * @param config $install_config + * @param factory $factory + * @param navigation_provider $nav_provider + * @param language $language + * @param request_interface $request + * @param installer $installer */ - public function __construct(helper $helper, \phpbb\install\helper\iohandler\factory $factory, \phpbb\template\template $template, \phpbb\request\request_interface $request, \phpbb\install\installer $installer) + public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer) { - $this->controller_helper = $helper; - $this->iohandler_factory = $factory; - $this->template = $template; - $this->request = $request; - $this->installer = $installer; + $this->controller_helper = $helper; + $this->installer_config = $install_config; + $this->iohandler_factory = $factory; + $this->menu_provider = $nav_provider; + $this->language = $language; + $this->template = $template; + $this->request = $request; + $this->installer = $installer; } /** * Controller logic * - * @return \Symfony\Component\HttpFoundation\Response|StreamedResponse + * @return Response|StreamedResponse */ public function handle() { @@ -86,13 +116,38 @@ class install } // Set the appropriate input-output handler - //$this->installer->set_iohandler($this->iohandler_factory->get()); + $this->installer->set_iohandler($this->iohandler_factory->get()); - if ($this->request->is_ajax()) + // Set up navigation + $nav_data = $this->installer_config->get_navigation_data(); + /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ + $iohandler = $this->iohandler_factory->get(); + + // Set active navigation stage + if (isset($nav_data['active']) && is_array($nav_data['active'])) { - // @todo: remove this line, and use the above - $this->installer->set_iohandler($this->iohandler_factory->get()); + $iohandler->set_active_stage_menu($nav_data['active']); + $this->menu_provider->set_nav_property($nav_data['active'], array( + 'selected' => true, + 'completed' => false, + )); + } + + // Set finished navigation stages + if (isset($nav_data['finished']) && is_array($nav_data['finished'])) + { + foreach ($nav_data['finished'] as $finished_stage) + { + $iohandler->set_finished_stage_menu($finished_stage); + $this->menu_provider->set_nav_property($finished_stage, array( + 'selected' => false, + 'completed' => true, + )); + } + } + if ($this->request->is_ajax()) + { $installer = $this->installer; $response = new StreamedResponse(); $response->setCallback(function() use ($installer) { @@ -106,9 +161,20 @@ class install // Determine whether the installation was started or not if (true) { + // Set active stage + $this->menu_provider->set_nav_property( + array('install', 0, 'introduction'), + array( + 'selected' => true, + 'completed' => false, + ) + ); + // If not, let's render the welcome page $this->template->assign_vars(array( - 'SHOW_INSTALL_START_FORM' => true, + 'SHOW_INSTALL_START_FORM' => true, + 'TITLE' => $this->language->lang('INSTALL_INTRO'), + 'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'), )); return $this->controller_helper->render('installer_install.html', 'INSTALL'); } diff --git a/phpBB/install/controller/install_index.php b/phpBB/install/controller/install_index.php deleted file mode 100644 index c61d68f7fb..0000000000 --- a/phpBB/install/controller/install_index.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ - -namespace phpbb\install\controller; - -class install_index -{ - /** - * @var helper - */ - protected $helper; - - /** - * @var \phpbb\language\language - */ - protected $language; - - /** - * @var \phpbb\template\template - */ - protected $template; - - /** - * @var string - */ - protected $phpbb_root_path; - - /** - * Constructor - * - * @param helper $helper - * @param \phpbb\language\language $language - * @param \phpbb\template\template $template - * @param string $phpbb_root_path - */ - public function __construct(helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $phpbb_root_path) - { - $this->helper = $helper; - $this->language = $language; - $this->template = $template; - $this->phpbb_root_path = $phpbb_root_path; - } - - public function handle($mode) - { - switch ($mode) - { - case "intro": - $title = $this->language->lang('INTRODUCTION_TITLE'); - $body = $this->language->lang('INTRODUCTION_BODY'); - break; - case "support": - $title = $this->language->lang('SUPPORT_TITLE'); - $body = $this->language->lang('SUPPORT_BODY'); - break; - case "license": - $title = $this->language->lang('LICENSE_TITLE'); - $body = implode("
\n", file($this->phpbb_root_path . 'docs/LICENSE.txt')); - break; - } - - $this->template->assign_vars(array( - 'TITLE' => $title, - 'BODY' => $body, - )); - - return $this->helper->render('install_main.html', $title); - } -} diff --git a/phpBB/install/controller/installer_index.php b/phpBB/install/controller/installer_index.php new file mode 100644 index 0000000000..3d5224f1be --- /dev/null +++ b/phpBB/install/controller/installer_index.php @@ -0,0 +1,79 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +class installer_index +{ + /** + * @var helper + */ + protected $helper; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param helper $helper + * @param \phpbb\language\language $language + * @param \phpbb\template\template $template + * @param string $phpbb_root_path + */ + public function __construct(helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $phpbb_root_path) + { + $this->helper = $helper; + $this->language = $language; + $this->template = $template; + $this->phpbb_root_path = $phpbb_root_path; + } + + public function handle($mode) + { + switch ($mode) + { + case "intro": + $title = $this->language->lang('INTRODUCTION_TITLE'); + $body = $this->language->lang('INTRODUCTION_BODY'); + break; + case "support": + $title = $this->language->lang('SUPPORT_TITLE'); + $body = $this->language->lang('SUPPORT_BODY'); + break; + case "license": + $title = $this->language->lang('LICENSE_TITLE'); + $body = implode("
\n", file($this->phpbb_root_path . 'docs/LICENSE.txt')); + break; + } + + $this->template->assign_vars(array( + 'TITLE' => $title, + 'BODY' => $body, + )); + + return $this->helper->render('install_main.html', $title); + } +} -- cgit v1.2.1