-
Notifications
You must be signed in to change notification settings - Fork 283
N°8955 UI blocks in setup #830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Timmy38
merged 4 commits into
feature/uninstallation
from
feature/8955_UIBlocks_in_setup
Mar 10, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a08ac1e
N°8955 Add UIBlocks markup in the setup
Timmy38 122874e
N°8955 Restore portal warning, graying disabled & unchecked choices
Timmy38 9d7a9c3
N°8955 Rewrite CSS rule to improve readability
Timmy38 0103ba4
N°8955 Add tests, replace padding with margin
Timmy38 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
css/backoffice/blocks-integrations/_extension-details-with-extension-details.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /* | ||
| * @copyright Copyright (C) 2010-2026 Combodo SAS | ||
| * @license http://opensource.org/licenses/AGPL-3.0 | ||
| */ | ||
|
|
||
| $ibo-extension-details--margin-top: $ibo-spacing-300 !default; | ||
|
|
||
| .ibo-extension-details + .ibo-extension-details, | ||
| .ibo-extension-details--information--description .ibo-extension-details { | ||
| margin-top: $ibo-extension-details--margin-top; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,7 +202,6 @@ protected function DisplayStep($oPage) | |
| $oPage->add_style("div.choice { margin: 0.5em;}"); | ||
| $oPage->add_style("div.choice a { text-decoration:none; font-weight: bold; color: #1C94C4 }"); | ||
| $oPage->add_style("div.description { margin-left: 2em; }"); | ||
| $oPage->add_style(".choice-disabled { color: #999; }"); | ||
| $oPage->add_style("input.unremovable { accent-color: orangered;}"); | ||
|
|
||
| $sManualInstallError = SetupUtils::CheckManualInstallDirEmpty( | ||
|
|
@@ -638,7 +637,6 @@ protected function GetStepInfo($idx = null) | |
| if ($index + 1 >= count($this->aSteps)) { | ||
| //make sure we also cache next step as well | ||
| $aOptions = $this->oExtensionsMap->GetAllExtensionsOptionInfo($bRemoteExtensionsShouldBeMandatory); | ||
|
|
||
| // Display this step of the wizard only if there is something to display | ||
| if (count($aOptions) > 0) { | ||
| $this->aSteps[] = [ | ||
|
|
@@ -672,7 +670,7 @@ public function ComputeChoiceFlags(array $aChoice, string $sChoiceId, array $aSe | |
| $oITopExtension = $this->oExtensionsMap->GetFromExtensionCode($aChoice['extension_code']); | ||
| //If the extension is missing from disk, it won't exist in the ExtensionsMap, thus returning null | ||
| $bCanBeUninstalled = isset($aChoice['uninstallable']) ? $aChoice['uninstallable'] === true || $aChoice['uninstallable'] === 'yes' : $oITopExtension->CanBeUninstalled(); | ||
| $bSelected = isset($aSelectedComponents[$sChoiceId]) && ($aSelectedComponents[$sChoiceId] == $sChoiceId); | ||
| $bSelected = isset($aSelectedComponents[$sChoiceId]) && ($aSelectedComponents[$sChoiceId] === $sChoiceId); | ||
| $bMissingFromDisk = isset($aChoice['missing']) && $aChoice['missing'] === true; | ||
| $bMandatory = (isset($aChoice['mandatory']) && $aChoice['mandatory']); | ||
| $bInstalled = $bMissingFromDisk || $oITopExtension->bInstalled; | ||
|
|
@@ -719,7 +717,7 @@ public function ComputeChoiceFlags(array $aChoice, string $sChoiceId, array $aSe | |
| ]; | ||
| } | ||
|
|
||
| protected function DisplayOptions($oPage, $aStepInfo, $aSelectedComponents, $aDefaults, $sParentId = '', $bAllDisabled = false) | ||
| public function DisplayOptions($oPage, $aStepInfo, $aSelectedComponents, $aDefaults, $sParentId = '', $bAllDisabled = false) | ||
| { | ||
| $aOptions = $aStepInfo['options'] ?? []; | ||
| $aAlternatives = $aStepInfo['alternatives'] ?? []; | ||
|
|
@@ -728,107 +726,124 @@ protected function DisplayOptions($oPage, $aStepInfo, $aSelectedComponents, $aDe | |
|
|
||
| foreach ($aOptions as $index => $aChoice) { | ||
| $sChoiceId = $sParentId.self::$SEP.$index; | ||
| $sDataId = 'data-id="'.utils::EscapeHtml($aChoice['extension_code']).'"'; | ||
| $sId = utils::EscapeHtml($aChoice['extension_code']); | ||
| $aFlags = $this->ComputeChoiceFlags($aChoice, $sChoiceId, $aSelectedComponents, $bAllDisabled, $bDisableUninstallCheck, $this->bUpgrade); | ||
|
|
||
| $sTooltip = ''; | ||
| $sUnremovable = ''; | ||
| if ($aFlags['missing']) { | ||
| $sTooltip .= '<div class="setup-extension-tag removed">source removed</div>'; | ||
| } | ||
| if ($aFlags['installed']) { | ||
| $sTooltip .= '<div class="setup-extension-tag checked installed">installed</div>'; | ||
| $sTooltip .= '<div class="setup-extension-tag unchecked tobeuninstalled">to be uninstalled</div>'; | ||
| } else { | ||
| $sTooltip .= '<div class="setup-extension-tag checked tobeinstalled">to be installed</div>'; | ||
| $sTooltip .= '<div class="setup-extension-tag unchecked notinstalled">not installed</div>'; | ||
| } | ||
| if (!$aFlags['uninstallable']) { | ||
| $sTooltip .= '<div class="setup-extension-tag notuninstallable">cannot be uninstalled</div>'; | ||
| } | ||
| if ($aFlags['disabled'] && !$aFlags['checked'] && !$aFlags['uninstallable'] && !$bDisableUninstallCheck) { | ||
| $this->bCanMoveForward = false;//Disable "Next" | ||
| } | ||
| $sChecked = $aFlags['checked'] ? ' checked ' : ''; | ||
| $sDisabled = $aFlags['disabled'] ? ' disabled data-disabled="disabled" ' : ''; | ||
| $sMissingModule = $aFlags['missing'] ? 'setup-extension--missing' : ''; | ||
|
|
||
| $sHiddenInput = $aFlags['disabled'] && $aFlags['checked'] ? '<input type="hidden" name="choice['.$sChoiceId.']" value="'.$sChoiceId.'"/>' : ''; | ||
| $oPage->add('<div class="choice '.$sMissingModule.'" '.$sDataId.'><input class="wiz-choice '.$sUnremovable.'" id="'.$sId.'" name="choice['.$sChoiceId.']" type="checkbox" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/>'.$sHiddenInput.' '); | ||
| $this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $aFlags['disabled'], $sTooltip); | ||
| $oPage->add('</div>'); | ||
| $this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $sChoiceId, $aFlags); | ||
| } | ||
|
|
||
| $sChoiceName = null; | ||
| $sDisabled = ''; | ||
| $bDisabled = false; | ||
| $sChoiceIdNone = null; | ||
| foreach ($aAlternatives as $index => $aChoice) { | ||
| $sChoiceId = $sParentId.self::$SEP.$index; | ||
| if ($sChoiceName == null) { | ||
| $sChoiceName = $sChoiceId; // All radios share the same name | ||
| } | ||
| $bIsDefault = array_key_exists($sChoiceName, $aDefaults) && ($aDefaults[$sChoiceName] == $sChoiceId); | ||
| //Defaults contains previous installation choices during upgrade | ||
| $bIsDefault = array_key_exists($sChoiceName, $aDefaults) && ($aDefaults[$sChoiceName] === $sChoiceId); | ||
| $bMandatory = (isset($aChoice['mandatory']) && $aChoice['mandatory']) || ($this->bUpgrade && $bIsDefault); | ||
| if ($bMandatory || $bAllDisabled) { | ||
| // One choice is mandatory, all alternatives are disabled | ||
| $sDisabled = ' disabled data-disabled="disabled"'; | ||
| $bDisabled = true; | ||
| } | ||
| if ((!isset($aChoice['sub_options']) || (count($aChoice['sub_options']) == 0)) && (!isset($aChoice['modules']) || (count($aChoice['modules']) == 0))) { | ||
| if ((!isset($aChoice['sub_options']) || (count($aChoice['sub_options']) === 0)) && (!isset($aChoice['modules']) || (count($aChoice['modules']) === 0))) { | ||
| //If there is no modules in the choice AND it has no sub choices, it is an empty choice. | ||
| $sChoiceIdNone = $sChoiceId; // the "None" / empty choice | ||
| } | ||
| } | ||
|
|
||
| if (!array_key_exists($sChoiceName, $aDefaults) || ($aDefaults[$sChoiceName] == $sChoiceIdNone)) { | ||
| if (!array_key_exists($sChoiceName, $aDefaults) || ($aDefaults[$sChoiceName] === $sChoiceIdNone)) { | ||
| // The "none" choice does not disable the selection !! | ||
| $sDisabled = ''; | ||
| $bDisabled = false; | ||
| } | ||
|
|
||
| foreach ($aAlternatives as $index => $aChoice) { | ||
| $sAttributes = ''; | ||
| $sChoiceId = $sParentId.self::$SEP.$index; | ||
| $sDataId = 'data-id="'.utils::EscapeHtml($aChoice['extension_code']).'"'; | ||
| $sId = utils::EscapeHtml($aChoice['extension_code']); | ||
| if ($sChoiceName == null) { | ||
| if ($sChoiceName === null) { | ||
| $sChoiceName = $sChoiceId; // All radios share the same name | ||
| } | ||
| $bIsDefault = array_key_exists($sChoiceName, $aDefaults) && ($aDefaults[$sChoiceName] == $sChoiceId); | ||
| $bSelected = isset($aSelectedComponents[$sChoiceName]) && ($aSelectedComponents[$sChoiceName] == $sChoiceId); | ||
| if (!isset($aSelectedComponents[$sChoiceName]) && ($sChoiceIdNone != null)) { | ||
| $bSelected = isset($aSelectedComponents[$sChoiceName]) && ($aSelectedComponents[$sChoiceName] === $sChoiceId); | ||
| if (!isset($aSelectedComponents[$sChoiceName]) && ($sChoiceIdNone !== null)) { | ||
| // No choice selected, select the "None" option | ||
| $bSelected = ($sChoiceId == $sChoiceIdNone); | ||
| $bSelected = ($sChoiceId === $sChoiceIdNone); | ||
| } | ||
| $bMandatory = (isset($aChoice['mandatory']) && $aChoice['mandatory']) || ($this->bUpgrade && $bIsDefault); | ||
|
|
||
| if ($bSelected) { | ||
| $sAttributes = ' checked '; | ||
| } | ||
| $sHidden = ''; | ||
| if ($bMandatory && $bDisabled) { | ||
| $sAttributes = ' checked '; | ||
| $sHidden = '<input type="hidden" name="choice['.$sChoiceName.']" value="'.$sChoiceId.'"/>'; | ||
| } | ||
| $oPage->add('<div class="choice" '.$sDataId.'><input class="wiz-choice" id="'.$sId.'" name="choice['.$sChoiceName.']" type="radio"'.$sAttributes.' value="'.$sChoiceId.'"'.$sDisabled.'/>'.$sHidden.' '); | ||
| $this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled && !$bSelected); | ||
| $oPage->add('</div>'); | ||
| $aFlags = $this->ComputeChoiceFlags($aChoice, $sChoiceId, $aSelectedComponents, $bAllDisabled, $bDisableUninstallCheck, $this->bUpgrade); | ||
| //ComputeChoiceFlags does not completely compute alternative flags | ||
| $aFlags['disabled'] = $bDisabled; | ||
| $aFlags['checked'] = $bSelected; | ||
| $this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceName, $sChoiceId, $aFlags, 'radio'); | ||
| } | ||
| } | ||
|
|
||
| protected function DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled = false, $sTooltip = '') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method could be tests by providing a mock and having different display usecases... that would help next developers that will have to enhance this rendering |
||
| protected function DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceName, $sChoiceId, $aFlags, $sInputType = 'checkbox') | ||
| { | ||
| $sMoreInfo = (isset($aChoice['more_info']) && ($aChoice['more_info'] != '')) ? '<a class="setup--wizard-choice--more-info" target="_blank" href="'.$aChoice['more_info'].'">More information</a>' : ''; | ||
| $sSourceLabel = $aChoice['source_label'] ?? ''; | ||
| $sMoreInfo = (isset($aChoice['more_info']) && ($aChoice['more_info'] != '')) ? ' | ||
| <a class="setup--wizard-choice--more-info" target="_blank" href="'.$aChoice['more_info'].'"> | ||
| <i class="setup-extension--icon fas fa-external-link-alt" title="More information"></i> | ||
| </a>' : ''; | ||
| $sDescription = isset($aChoice['description']) ? utils::EscapeHtml($aChoice['description']) : ''; | ||
| $sId = utils::EscapeHtml($aChoice['extension_code']); | ||
| $sDataId = 'data-id="'.utils::EscapeHtml($aChoice['extension_code']).'"'; | ||
| $sDisabled = $aFlags['disabled'] ? ' disabled data-disabled="disabled"' : ''; | ||
| $sChecked = $aFlags['checked'] ? ' checked ' : ''; | ||
| $sHiddenInput = $aFlags['disabled'] && $aFlags['checked'] ? '<input type="hidden" name="choice['.$sChoiceName.']" value="'.$sChoiceId.'"/>' : ''; | ||
|
|
||
| $oPage->add('<label class="setup--wizard-choice--label" for="'.$sId.'">'.$sSourceLabel.'<b>'.utils::EscapeHtml($aChoice['title']).'</b>'.' '.$sTooltip.'</label> '.$sMoreInfo.''); | ||
| $sDescription = isset($aChoice['description']) ? utils::EscapeHtml($aChoice['description']) : ''; | ||
| $oPage->add('<div class="setup--wizard-choice--description description">'.$sDescription.'<span id="sub_choices'.$sId.'">'); | ||
| $sTooltip = ''; | ||
| if ($aFlags['missing']) { | ||
| $sTooltip .= '<span class="ibo-badge ibo-block ibo-is-red" title="The local extension folder has been removed from the disk. This will force the uninstallation of this extension." >source removed</span>'; | ||
| } | ||
| if ($aFlags['installed']) { | ||
| $sTooltip .= '<span class="ibo-badge ibo-block checked ibo-is-green" title="This extension is part of the current installation." >installed</span>'; | ||
|
|
||
| $sTooltip .= '<span class="ibo-badge ibo-block unchecked ibo-is-red" title="This extension will be uninstalled during the setup." >to be uninstalled</span>'; | ||
| } else { | ||
| $sTooltip .= '<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span>'; | ||
| $sTooltip .= '<span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>'; | ||
| } | ||
| if (!$aFlags['uninstallable']) { | ||
| $sTooltip .= '<span class="ibo-badge ibo-block ibo-is-orange" title="Once this extension has been installed, it should not be uninstalled." >cannot be uninstalled</span>'; | ||
| } | ||
|
|
||
| $sMetadata = ''; | ||
| if (isset($aChoice['version']) && isset($aChoice['source_label'])) { | ||
| $sMetadata = '<span>v'.$aChoice['version'].'</span><span>'.$aChoice['source_label'].'</span>'; | ||
| } | ||
| $sChoiceDisabled = $aFlags['disabled'] && !$aFlags['checked'] ? 'choice-disabled' : ''; | ||
|
|
||
| $oPage->add(' | ||
| <div class="ibo-extension-details ibo-content-block ibo-block '.$sChoiceDisabled.'" '.$sDataId.'> | ||
| <div class="ibo-extension-details--actions"> | ||
| <input class="wiz-choice" id="'.$sId.'" name="choice['.$sChoiceName.']" type="'.$sInputType.'" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/> | ||
| '.$sHiddenInput.' | ||
| </div> | ||
| <div class="ibo-extension-details--information"> | ||
| <div class="ibo-extension-details--information--label"> | ||
| <label for="'.$sId.'"><b>'.utils::EscapeHtml($aChoice['title']).'</b></label> | ||
| '.$sMoreInfo.' | ||
| '.$sTooltip.' | ||
| </div> | ||
| <div class="ibo-extension-details--information--metadata"> | ||
| '.$sMetadata.' | ||
| </div> | ||
| <div class="ibo-extension-details--information--description"> | ||
| '.$sDescription.' | ||
| '); | ||
| $bSubOptionsDisabled = $aFlags['disabled'] && (!$aFlags['installed'] || $sInputType === 'checkbox'); | ||
| if (isset($aChoice['sub_options'])) { | ||
| $this->DisplayOptions($oPage, $aChoice['sub_options'], $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled); | ||
| $oPage->add('<div id="sub_choices'.$sId.'">'); | ||
| $this->DisplayOptions($oPage, $aChoice['sub_options'], $aSelectedComponents, $aDefaults, $sChoiceId, $bSubOptionsDisabled); | ||
| $oPage->add('</div>'); | ||
| } | ||
| $oPage->add('</span></div>'); | ||
| $oPage->add(' | ||
| </div> | ||
| </div> | ||
| </div> | ||
| '); | ||
| } | ||
|
|
||
| protected function GetSourceFilePath() | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.