From cf6413044b496f2a06171dc096dd4484e98715c9 Mon Sep 17 00:00:00 2001 From: Ernesto Baschny <ernst@cron-it.de> Date: Wed, 12 Mar 2014 19:36:04 +0100 Subject: [PATCH] [TASK] Re-added the 1-2-3 bullets in the Step Installer Resolves: #56941 Releases: 6.2 Change-Id: I5dfabf2c5df8c495fbdce30cb170260d2656e6b4 Reviewed-on: https://review.typo3.org/28425 Reviewed-by: Stefan Neufeind Tested-by: Stefan Neufeind Reviewed-by: Nicole Cordes Tested-by: Nicole Cordes --- .../Action/Step/AbstractStepAction.php | 62 +++++++++++++++++++ .../Action/Step/DatabaseConnect.php | 1 + .../Controller/Action/Step/DatabaseData.php | 1 + .../Controller/Action/Step/DatabaseSelect.php | 1 + .../Action/Step/DefaultConfiguration.php | 1 + .../Action/Step/EnvironmentAndFolders.php | 1 + .../Controller/Action/Step/StepInterface.php | 23 +++++++ .../Classes/Controller/StepController.php | 10 +++ .../Partials/Action/Step/StepCounter.html | 5 ++ .../Action/Step/DatabaseConnect.html | 4 +- .../Templates/Action/Step/DatabaseData.html | 1 + .../Templates/Action/Step/DatabaseSelect.html | 2 + .../Action/Step/DefaultConfiguration.html | 2 + .../Action/Step/EnvironmentAndFolders.html | 2 + .../Stylesheets/Action/Step/General.css | 34 +++++++++- 15 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 typo3/sysext/install/Resources/Private/Partials/Action/Step/StepCounter.html diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php b/typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php index e982079056ca..f650bd0af821 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/AbstractStepAction.php @@ -29,4 +29,66 @@ namespace TYPO3\CMS\Install\Controller\Action\Step; */ abstract class AbstractStepAction extends \TYPO3\CMS\Install\Controller\Action\AbstractAction implements StepInterface { + /** + * @var int Current step position + */ + protected $currentStep = 0; + + /** + * @var int Total number of available steps + */ + protected $totalSteps = 0; + + /** + * Tell the action which position it has in the list of actions + * + * @param int $current The current position + * @param int $total The total number of steps + * @return void + */ + public function setStepsCounter($current, $total) { + $this->currentStep = $current; + $this->totalSteps = $total; + } + + /** + * Gets current position + * + * @return int + */ + public function getCurrentStep() { + return $this->currentStep; + } + + /** + * Gets total steps + * + * @return int + */ + public function getTotalSteps() { + return $this->totalSteps; + } + + /** + * @return void + */ + protected function assignSteps() { + $steps = array(); + $currentStep = $this->getCurrentStep(); + $totalSteps = $this->getTotalSteps(); + for ($i = 1; $i <= $totalSteps; $i++) { + $class = ''; + if ($i == $currentStep) { + $class = 'cur'; + } elseif ($i < $currentStep) { + $class = 'prev'; + } + $steps[] = array( + 'number' => $i, + 'class' => $class, + 'total' => $totalSteps, + ); + } + $this->view->assign('steps', $steps); + } } diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php index 37f3a3f108ff..2471c5c76d55 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php @@ -246,6 +246,7 @@ class DatabaseConnect extends AbstractStepAction { ->assign('renderConnectDetailsPort', TRUE) ->assign('renderConnectDetailsSocket', TRUE); } + $this->assignSteps(); return $this->view->render(); } diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php index 6d3af1a39d93..0d147ca5ae96 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php @@ -101,6 +101,7 @@ class DatabaseData extends AbstractStepAction { * @return string Rendered content */ protected function executeAction() { + $this->assignSteps(); return $this->view->render(); } diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php index 62d6f0625f09..04845da24d08 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php @@ -131,6 +131,7 @@ class DatabaseSelect extends AbstractStepAction { $isInitialInstallationInProgress = $configurationManager->getConfigurationValueByPath('SYS/isInitialInstallationInProgress'); $this->view->assign('databaseList', $this->getDatabaseList($isInitialInstallationInProgress)); $this->view->assign('isInitialInstallationInProgress', $isInitialInstallationInProgress); + $this->assignSteps(); return $this->view->render(); } diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php b/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php index 38ce12949a65..eb5210b8f254 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php @@ -99,6 +99,7 @@ class DefaultConfiguration extends AbstractStepAction { * @return string Rendered content */ protected function executeAction() { + $this->assignSteps(); return $this->view->render(); } } diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php b/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php index 808a10f3e204..670d8422d409 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php @@ -125,6 +125,7 @@ class EnvironmentAndFolders extends AbstractStepAction { ) { $this->view->assign('errorsOrWarningsFromStatus', TRUE); } + $this->assignSteps(); return $this->view->render(!empty($alerts)); } diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/StepInterface.php b/typo3/sysext/install/Classes/Controller/Action/Step/StepInterface.php index 5e0cf47de2d9..e3291d37b083 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/StepInterface.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/StepInterface.php @@ -43,4 +43,27 @@ interface StepInterface { * @return boolean TRUE if this step needs to be executed */ public function needsExecution(); + + /** + * Tell the action which position it has in the list of actions + * + * @param int $current The current position + * @param int $total The total number of steps + * @return void + */ + public function setStepsCounter($current, $total); + + /** + * Gets current position + * + * @return int + */ + public function getCurrentStep(); + + /** + * Gets total steps + * + * @return int + */ + public function getTotalSteps(); } diff --git a/typo3/sysext/install/Classes/Controller/StepController.php b/typo3/sysext/install/Classes/Controller/StepController.php index 71426797d735..6496a2915463 100644 --- a/typo3/sysext/install/Classes/Controller/StepController.php +++ b/typo3/sysext/install/Classes/Controller/StepController.php @@ -123,6 +123,11 @@ class StepController extends AbstractController { } if ($needsExecution) { + if ($this->isInitialInstallationInProgress()) { + $currentStep = (array_search($action, $this->authenticationActions) + 1); + $totalSteps = count($this->authenticationActions); + $stepAction->setStepsCounter($currentStep, $totalSteps); + } $stepAction->setMessages($this->session->getMessagesAndFlush()); $this->output($stepAction->handle()); } else { @@ -387,6 +392,11 @@ class StepController extends AbstractController { ) { /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $action */ $action = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Step\\EnvironmentAndFolders'); + if ($this->isInitialInstallationInProgress()) { + $currentStep = (array_search('environmentAndFolders', $this->authenticationActions) + 1); + $totalSteps = count($this->authenticationActions); + $action->setStepsCounter($currentStep, $totalSteps); + } $action->setController('step'); $action->setAction('environmentAndFolders'); if (count($errorMessagesFromExecute) > 0) { diff --git a/typo3/sysext/install/Resources/Private/Partials/Action/Step/StepCounter.html b/typo3/sysext/install/Resources/Private/Partials/Action/Step/StepCounter.html new file mode 100644 index 000000000000..5388ffa03763 --- /dev/null +++ b/typo3/sysext/install/Resources/Private/Partials/Action/Step/StepCounter.html @@ -0,0 +1,5 @@ +<ul class="steps_123"> + <f:for each="{steps}" as="step"> + <li class="{step.class}"><span>{step.number}</span></li> + </f:for> +</ul> diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseConnect.html b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseConnect.html index da5a160e75c7..83f2eec98d49 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseConnect.html +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseConnect.html @@ -3,7 +3,9 @@ <f:layout name="Step" /> <f:section name="Content"> - <h3>Database connection:</h3> + <f:render partial="Action/Step/StepCounter.html" arguments="{steps: steps}" /> + + <h3>Database connection</h3> <p> If you have not already created a username and password to access the database, please do so now. diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseData.html b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseData.html index 5d747a48fbeb..38ba85048689 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseData.html +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseData.html @@ -3,6 +3,7 @@ <f:layout name="Step" /> <f:section name="Content"> + <f:render partial="Action/Step/StepCounter.html" arguments="{steps: steps}" /> <h3>Create user and import base data</h3> diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseSelect.html b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseSelect.html index a39b4a4614b4..858b7437cf0c 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseSelect.html +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseSelect.html @@ -3,6 +3,8 @@ <f:layout name="Step" /> <f:section name="Content"> + <f:render partial="Action/Step/StepCounter.html" arguments="{steps: steps}" /> + <h3>Select database</h3> <f:if condition="{isInitialInstallationInProgress}"> diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DefaultConfiguration.html b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DefaultConfiguration.html index a88df95f0ffe..fbf52a5ff86b 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Action/Step/DefaultConfiguration.html +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Step/DefaultConfiguration.html @@ -3,6 +3,8 @@ <f:layout name="Step" /> <f:section name="Content"> + <f:render partial="Action/Step/StepCounter.html" arguments="{steps: steps}" /> + <h3>Installation done!</h3> <p> diff --git a/typo3/sysext/install/Resources/Private/Templates/Action/Step/EnvironmentAndFolders.html b/typo3/sysext/install/Resources/Private/Templates/Action/Step/EnvironmentAndFolders.html index ce3e1a53bf1c..7d962470e248 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Action/Step/EnvironmentAndFolders.html +++ b/typo3/sysext/install/Resources/Private/Templates/Action/Step/EnvironmentAndFolders.html @@ -3,6 +3,8 @@ <f:layout name="Step" /> <f:section name="Content"> + <f:render partial="Action/Step/StepCounter.html" arguments="{steps: steps}" /> + <h3>System environment check</h3> <p> diff --git a/typo3/sysext/install/Resources/Public/Stylesheets/Action/Step/General.css b/typo3/sysext/install/Resources/Public/Stylesheets/Action/Step/General.css index 8162b7328b8a..079661ee9cac 100644 --- a/typo3/sysext/install/Resources/Public/Stylesheets/Action/Step/General.css +++ b/typo3/sysext/install/Resources/Public/Stylesheets/Action/Step/General.css @@ -288,7 +288,8 @@ button span.t3-install-form-button-icon-negative { } #t3-install-box-body h3 { - margin: 0.75em 0 2em; + margin: 0.75em 0 1em; + clear: left; } .t3-install-login #t3-install-box-body h3 { @@ -427,3 +428,34 @@ h3 { #stepInstaller-databaseSelect ul li input.radio { vertical-align: top; } + +#t3-install-box-body .steps_123 { + list-style: none; + padding: 0; + margin: 0.5em 0 0 0; + font-size: 25px; +} +#t3-install-box-body .steps_123 li { + float: left; + text-align: center; + width: 40px; + height: 30px; + margin-right: 10px; + padding-bottom: 1em; +} +#t3-install-box-body .steps_123 li span { + background-color: #d1d1d1; + padding-top: 10px; + width: 100%; + height: 100%; + display: block; + text-decoration: none !important; + color: #fff !important; + border-radius: 50px; +} +#t3-install-box-body .steps_123 li.cur span { + background-color: #FF8700; +} +#t3-install-box-body .steps_123 li.prev span { + background-color: #585858; +} -- GitLab