mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-11 20:14:14 +01:00
* N°8955 Add UIBlocks markup in the setup
This commit is contained in:
@@ -23,4 +23,5 @@
|
||||
@import "field-badge-within-datatable";
|
||||
@import "jquery-blockui-within-dialog";
|
||||
@import "jquery-blockui-within-datatable";
|
||||
@import "badge-with-badge";
|
||||
@import "badge-with-badge";
|
||||
@import "extension-details-with-extension-details";
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @copyright Copyright (C) 2010-2026 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -41,9 +41,20 @@ $ibo-extension-details--actions--button--padding-x: $ibo-button--padding-x !defa
|
||||
padding-right: $ibo-extension-details--information--metadata--padding;
|
||||
}
|
||||
|
||||
.ibo-extension-details:has(input:checked) .ibo-badge.unchecked, .ibo-extension-details:has(input:not(:checked)) .ibo-badge.checked {
|
||||
display: none;
|
||||
//ibo-extension-details can have other ibo-extension-details inside its ibo-extension-details--information--description in the setup. We need to only affect direct children
|
||||
.ibo-extension-details:has(>.ibo-extension-details--actions input:is([type="checkbox"], [type="radio"]):checked){
|
||||
&>.ibo-extension-details--information>.ibo-extension-details--information--label .ibo-badge.unchecked {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
//Merging the two lines below with :is([type="checkbox"], [type="radio"]) will generate a warning in scss compiler
|
||||
.ibo-extension-details:has(>.ibo-extension-details--actions input[type="checkbox"]:not(:checked)),
|
||||
.ibo-extension-details:has(>.ibo-extension-details--actions input[type="radio"]:not(:checked)) {
|
||||
&>.ibo-extension-details--information>.ibo-extension-details--information--label .ibo-badge.checked {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.ibo-extension-details--actions > button {
|
||||
padding: $ibo-extension-details--actions--button--padding-y $ibo-extension-details--actions--button--padding-x;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -316,29 +316,34 @@ fieldset {
|
||||
background-color: #F7FAFC;
|
||||
padding: 10px;
|
||||
.wiz-choice{
|
||||
&:checked ~ .description {
|
||||
#itop-ticket-mgmt-simple-ticket-enhanced-portal:not(:checked),
|
||||
#itop-ticket-mgmt-itil-enhanced-portal:not(:checked) {
|
||||
~ .description::after {
|
||||
content: "Legacy portal is no longer part of iTop, by leaving this option unchecked your portal users won't be able to access iTop anymore.";
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
font-weight: bold;
|
||||
color: $legacy-portal-removal-text-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:not(:checked) ~ label .setup-extension-tag.checked{
|
||||
&:not(:checked) ~ label .checked{
|
||||
display:none;
|
||||
}
|
||||
&:checked ~ label .setup-extension-tag.unchecked{
|
||||
&:checked ~ label .unchecked{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-extension-details:has(>.ibo-extension-details--actions>input:checked) {
|
||||
.ibo-extension-details:has(#itop-ticket-mgmt-simple-ticket-enhanced-portal:not(:checked), #itop-ticket-mgmt-itil-enhanced-portal:not(:checked)) {
|
||||
.ibo-extension-details--information--description::after {
|
||||
content: "Legacy portal is no longer part of iTop, by leaving this option unchecked your portal users won't be able to access iTop anymore.";
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
font-weight: bold;
|
||||
color: $legacy-portal-removal-text-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-extension-details--information--metadata{
|
||||
color: $ibo-color-grey-800;
|
||||
}
|
||||
|
||||
.choice-disabled {
|
||||
color: $ibo-color-grey-700;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 1.17rem;
|
||||
@@ -633,6 +638,21 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-extension-details {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.ibo-extension-details--actions input{
|
||||
margin:0.2em 0.5em;
|
||||
width: 12px;
|
||||
}
|
||||
:not(.ibo-badge) ~ .ibo-badge{
|
||||
margin-left:0.5em;
|
||||
}
|
||||
.ibo-extension-details--information--label i{
|
||||
font-size : 0.9em;
|
||||
margin-left:0.3em;
|
||||
}
|
||||
|
||||
.setup--wizard-choice--label + .setup--wizard-choice--more-info {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<choice>
|
||||
<extension_code>itop-problem-mgmt</extension_code>
|
||||
<title>Problem Management</title>
|
||||
<description>Select this option track "Problems" in iTop.</description>
|
||||
<description>Select this option to track "Problems" in iTop.</description>
|
||||
<modules type="array">
|
||||
<module>itop-problem-mgmt</module>
|
||||
</modules>
|
||||
|
||||
@@ -409,6 +409,7 @@ class iTopExtensionsMap
|
||||
'source_label' => $this->GetExtensionSourceLabel($oExtension->sSource),
|
||||
'uninstallable' => $oExtension->CanBeUninstalled(),
|
||||
'missing' => $oExtension->bRemovedFromDisk,
|
||||
'version' => $oExtension->sVersion,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -417,26 +418,18 @@ class iTopExtensionsMap
|
||||
|
||||
protected function GetExtensionSourceLabel($sSource)
|
||||
{
|
||||
$sDecorationClass = '';
|
||||
$sResult = '';
|
||||
switch ($sSource) {
|
||||
case iTopExtension::SOURCE_MANUAL:
|
||||
$sResult = 'Local extensions folder';
|
||||
$sDecorationClass = 'fas fa-folder';
|
||||
break;
|
||||
|
||||
case iTopExtension::SOURCE_REMOTE:
|
||||
$sResult = (ITOP_APPLICATION == 'iTop') ? 'iTop Hub' : 'ITSM Designer';
|
||||
$sDecorationClass = (ITOP_APPLICATION == 'iTop') ? 'fc fc-chameleon-icon' : 'fa pencil-ruler';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sResult = '';
|
||||
}
|
||||
if ($sResult == '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<i class="setup-extension--icon '.$sDecorationClass.'" data-tooltip-content="'.$sResult.'"></i>';
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -202,7 +202,6 @@ class WizStepModulesChoice extends WizardStep
|
||||
$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 @@ EOF
|
||||
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 @@ EOF
|
||||
$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 @@ EOF
|
||||
];
|
||||
}
|
||||
|
||||
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,39 +726,16 @@ EOF
|
||||
|
||||
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) {
|
||||
@@ -768,67 +743,107 @@ EOF
|
||||
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 = '')
|
||||
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'] ?? '';
|
||||
$sId = utils::EscapeHtml($aChoice['extension_code']);
|
||||
|
||||
$oPage->add('<label class="setup--wizard-choice--label" for="'.$sId.'">'.$sSourceLabel.'<b>'.utils::EscapeHtml($aChoice['title']).'</b>'.' '.$sTooltip.'</label> '.$sMoreInfo.'');
|
||||
$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']) : '';
|
||||
$oPage->add('<div class="setup--wizard-choice--description description">'.$sDescription.'<span id="sub_choices'.$sId.'">');
|
||||
if (isset($aChoice['sub_options'])) {
|
||||
$this->DisplayOptions($oPage, $aChoice['sub_options'], $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled);
|
||||
$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.'"/>' : '';
|
||||
|
||||
$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>';
|
||||
}
|
||||
$oPage->add('</span></div>');
|
||||
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'])) {
|
||||
$oPage->add('<div id="sub_choices'.$sId.'">');
|
||||
$this->DisplayOptions($oPage, $aChoice['sub_options'], $aSelectedComponents, $aDefaults, $sChoiceId, $bSubOptionsDisabled);
|
||||
$oPage->add('</div>');
|
||||
}
|
||||
$oPage->add('
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
');
|
||||
}
|
||||
|
||||
protected function GetSourceFilePath()
|
||||
|
||||
16
tests/php-unit-tests/unitary-tests/setup/WebPageFake.php
Normal file
16
tests/php-unit-tests/unitary-tests/setup/WebPageFake.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class WebPageFake extends WebPage
|
||||
{
|
||||
public string $sContent = '';
|
||||
|
||||
public function __construct(string $s_title = '', bool $bPrintable = false)
|
||||
{
|
||||
//parent::__construct($s_title,$bPrintable);
|
||||
}
|
||||
|
||||
public function add($sContent)
|
||||
{
|
||||
$this->sContent .= $sContent;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Integration;
|
||||
|
||||
use Combodo\iTop\Application\WebPage\WebPage;
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use iTopExtension;
|
||||
use iTopExtensionsMap;
|
||||
@@ -9,6 +10,7 @@ use iTopExtensionsMapFake;
|
||||
use ModuleDiscovery;
|
||||
use WizardController;
|
||||
use WizStepModulesChoiceFake;
|
||||
use WepPageFake;
|
||||
use XMLParameters;
|
||||
|
||||
class WizStepModulesChoiceTest extends ItopTestCase
|
||||
@@ -18,6 +20,7 @@ class WizStepModulesChoiceTest extends ItopTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
$this->RequireOnceItopFile('/setup/unattended-install/InstallationFileService.php');
|
||||
require_once __DIR__.'/WebPageFake.php';
|
||||
require_once __DIR__.'/iTopExtensionsMapFake.php';
|
||||
require_once __DIR__.'/WizStepModulesChoiceFake.php';
|
||||
|
||||
@@ -927,4 +930,433 @@ class WizStepModulesChoiceTest extends ItopTestCase
|
||||
$this->oStep->GetSelectedModules($aStepInfo, ['_0' => '_0'], $aModules, '', '', $aExtensions);
|
||||
}
|
||||
|
||||
public function ProviderDisplayOptions()
|
||||
{
|
||||
return [
|
||||
'no choices' => [
|
||||
'aStepOptions' => [],
|
||||
'aStepAlternatives' => [],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => '',
|
||||
],
|
||||
'one not installed extension' => [
|
||||
'aStepOptions' => [
|
||||
[
|
||||
'extension_code' => 'itop-ext-not-installed',
|
||||
'title' => 'My extension',
|
||||
'description' => 'Do something',
|
||||
'more_info' => '',
|
||||
'modules' => [],
|
||||
'mandatory' => false,
|
||||
'source_label' => 'Local extensions folder',
|
||||
'uninstallable' => true,
|
||||
'missing' => false,
|
||||
'version' => '1.2.3',
|
||||
],
|
||||
],
|
||||
'aStepAlternatives' => [],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-ext-not-installed">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-ext-not-installed" name="choice[_0]" type="checkbox" value="_0" />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-ext-not-installed"><b>My extension</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span><span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
<span>v1.2.3</span><span>Local extensions folder</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do something
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
'one installed extension' => [
|
||||
'aStepOptions' => [
|
||||
[
|
||||
'extension_code' => 'itop-ext-installed',
|
||||
'title' => 'My extension',
|
||||
'description' => 'Do something',
|
||||
'more_info' => '',
|
||||
'modules' => [],
|
||||
'mandatory' => false,
|
||||
'source_label' => 'Local extensions folder',
|
||||
'uninstallable' => true,
|
||||
'missing' => false,
|
||||
'version' => '1.2.3',
|
||||
],
|
||||
],
|
||||
'aStepAlternatives' => [],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-ext-installed">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-ext-installed" name="choice[_0]" type="checkbox" value="_0" />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-ext-installed"><b>My extension</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-green" title="This extension is part of the current installation." >installed</span><span class="ibo-badge ibo-block unchecked ibo-is-red" title="This extension will be uninstalled during the setup." >to be uninstalled</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
<span>v1.2.3</span><span>Local extensions folder</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do something
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
|
||||
'one installed extension that cannot be uninstalled' => [
|
||||
'aStepOptions' => [
|
||||
[
|
||||
'extension_code' => 'itop-ext-installed',
|
||||
'title' => 'My extension',
|
||||
'description' => 'Do something',
|
||||
'more_info' => '',
|
||||
'modules' => [],
|
||||
'mandatory' => false,
|
||||
'source_label' => 'Local extensions folder',
|
||||
'uninstallable' => false,
|
||||
'missing' => false,
|
||||
'version' => '1.2.3',
|
||||
],
|
||||
],
|
||||
'aStepAlternatives' => [],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-ext-installed">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-ext-installed" name="choice[_0]" type="checkbox" value="_0" disabled data-disabled="disabled" checked />
|
||||
<input type="hidden" name="choice[_0]" value="_0"/>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-ext-installed"><b>My extension</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-green" title="This extension is part of the current installation." >installed</span><span class="ibo-badge ibo-block unchecked ibo-is-red" title="This extension will be uninstalled during the setup." >to be uninstalled</span><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>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
<span>v1.2.3</span><span>Local extensions folder</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do something
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
'one mandatory extension' => [
|
||||
'aStepOptions' => [
|
||||
[
|
||||
'extension_code' => 'itop-ext-not-installed',
|
||||
'title' => 'My extension',
|
||||
'description' => 'Do something',
|
||||
'more_info' => '',
|
||||
'modules' => [],
|
||||
'mandatory' => true,
|
||||
'source_label' => 'Local extensions folder',
|
||||
'uninstallable' => true,
|
||||
'missing' => false,
|
||||
'version' => '1.2.3',
|
||||
],
|
||||
],
|
||||
'aStepAlternatives' => [],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-ext-not-installed">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-ext-not-installed" name="choice[_0]" type="checkbox" value="_0" disabled data-disabled="disabled" checked />
|
||||
<input type="hidden" name="choice[_0]" value="_0"/>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-ext-not-installed"><b>My extension</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span><span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
<span>v1.2.3</span><span>Local extensions folder</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do something
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
'one choice alternative' => [
|
||||
'aStepOptions' => [],
|
||||
'aStepAlternatives' => [
|
||||
[
|
||||
'extension_code' => 'itop-alt-nothing',
|
||||
'title' => 'No Change',
|
||||
'description' => 'Do nothing',
|
||||
'modules' => [],
|
||||
],
|
||||
],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-alt-nothing">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-alt-nothing" name="choice[_0]" type="radio" value="_0" checked />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-alt-nothing"><b>No Change</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span><span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do nothing
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
'two choices alternative with non-empty installed' => [
|
||||
'aStepOptions' => [],
|
||||
'aStepAlternatives' => [
|
||||
[
|
||||
'extension_code' => 'itop-alt-something',
|
||||
'title' => 'Change',
|
||||
'description' => 'I am something',
|
||||
'modules' => [
|
||||
'itop-alt-module',
|
||||
],
|
||||
],
|
||||
[
|
||||
'extension_code' => 'itop-alt-nothing',
|
||||
'title' => 'No Change',
|
||||
'description' => 'Do nothing',
|
||||
'modules' => [],
|
||||
],
|
||||
],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-alt-something">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-alt-something" name="choice[_0]" type="radio" value="_0" />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-alt-something"><b>Change</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-green" title="This extension is part of the current installation." >installed</span><span class="ibo-badge ibo-block unchecked ibo-is-red" title="This extension will be uninstalled during the setup." >to be uninstalled</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
I am something
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-alt-nothing">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-alt-nothing" name="choice[_0]" type="radio" value="_1" checked />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-alt-nothing"><b>No Change</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span><span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do nothing
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
'two choices with sub options' => [
|
||||
'aStepOptions' => [],
|
||||
'aStepAlternatives' => [
|
||||
[
|
||||
'extension_code' => 'itop-alt-something',
|
||||
'title' => 'Change',
|
||||
'description' => 'I am something',
|
||||
'modules' => [],
|
||||
'sub_options' => [
|
||||
'options' => [
|
||||
[
|
||||
'extension_code' => 'itop-ext-not-installed',
|
||||
'title' => 'My extension',
|
||||
'description' => 'Do something',
|
||||
'more_info' => '',
|
||||
'modules' => [],
|
||||
'mandatory' => false,
|
||||
//'source_label' => '',
|
||||
'uninstallable' => true,
|
||||
'missing' => false,
|
||||
//'version' => '1.2.3',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'extension_code' => 'itop-alt-nothing',
|
||||
'title' => 'No Change',
|
||||
'description' => 'Do nothing',
|
||||
'modules' => [],
|
||||
],
|
||||
],
|
||||
|
||||
'aSelectedComponents' => [],
|
||||
'aDefaults' => [],
|
||||
'aExpectedHTML' => <<<HTML
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-alt-something">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-alt-something" name="choice[_0]" type="radio" value="_0" />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-alt-something"><b>Change</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-green" title="This extension is part of the current installation." >installed</span><span class="ibo-badge ibo-block unchecked ibo-is-red" title="This extension will be uninstalled during the setup." >to be uninstalled</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
I am something
|
||||
<div id="sub_choicesitop-alt-something">
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-ext-not-installed">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-ext-not-installed" name="choice[_0_0]" type="checkbox" value="_0_0" />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-ext-not-installed"><b>My extension</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span><span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do something
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block " data-id="itop-alt-nothing">
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="itop-alt-nothing" name="choice[_0]" type="radio" value="_1" checked />
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
<label for="itop-alt-nothing"><b>No Change</b></label>
|
||||
|
||||
<span class="ibo-badge ibo-block checked ibo-is-cyan" title="This extension will be installed during the setup." >to be installed</span><span class="ibo-badge ibo-block unchecked ibo-is-blue-grey" title="This extension is not part of the current installation." >not installed</span>
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--metadata">
|
||||
|
||||
</div>
|
||||
<div class="ibo-extension-details--information--description">
|
||||
Do nothing
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
HTML,
|
||||
],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider ProviderDisplayOptions
|
||||
*/
|
||||
public function testDisplayOptions($aStepOptions, $aStepAlternatives, $aSelectedComponents, $aDefaults, $sExpectedHTML)
|
||||
{
|
||||
$aExtensionsOnDiskOrDb = [
|
||||
'itop-ext-not-installed' => [
|
||||
'installed' => false,
|
||||
],
|
||||
'itop-ext-installed' => [
|
||||
'installed' => true,
|
||||
],
|
||||
'itop-alt-nothing' => [
|
||||
'installed' => false,
|
||||
],
|
||||
'itop-alt-something' => [
|
||||
'installed' => true,
|
||||
],
|
||||
];
|
||||
$this->oStep->setExtensionMap(iTopExtensionsMapFake::createFromArray($aExtensionsOnDiskOrDb));
|
||||
$aStepInfo = [
|
||||
'options' => $aStepOptions,
|
||||
'alternatives' => $aStepAlternatives,
|
||||
];
|
||||
$oPage = new \WebPageFake();
|
||||
|
||||
$this->oStep->DisplayOptions($oPage, $aStepInfo, $aSelectedComponents, $aDefaults);
|
||||
|
||||
$this->assertEquals($sExpectedHTML, $oPage->sContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
<choice>
|
||||
<extension_code>itop-problem-mgmt</extension_code>
|
||||
<title>Problem Management</title>
|
||||
<description>Select this option track "Problems" in iTop.</description>
|
||||
<description>Select this option to track "Problems" in iTop.</description>
|
||||
<modules type="array">
|
||||
<module>itop-problem-mgmt</module>
|
||||
</modules>
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
<choice>
|
||||
<extension_code>itop-problem-mgmt</extension_code>
|
||||
<title>Problem Management</title>
|
||||
<description>Select this option track "Problems" in iTop.</description>
|
||||
<description>Select this option to track "Problems" in iTop.</description>
|
||||
<modules type="array">
|
||||
<module>itop-problem-mgmt</module>
|
||||
</modules>
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
<choice>
|
||||
<extension_code>itop-problem-mgmt</extension_code>
|
||||
<title>Problem Management</title>
|
||||
<description>Select this option track "Problems" in iTop.</description>
|
||||
<description>Select this option to track "Problems" in iTop.</description>
|
||||
<modules type="array">
|
||||
<module>itop-problem-mgmt</module>
|
||||
</modules>
|
||||
|
||||
Reference in New Issue
Block a user