mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-05 17:14:20 +01:00
WIP 3
This commit is contained in:
@@ -671,7 +671,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;
|
||||
@@ -745,7 +745,7 @@ EOF
|
||||
</div>');
|
||||
*/
|
||||
//$oPage->add('<div class="choice '.$sMissingModule.'" '.$sDataId.'><input class="wiz-choice " id="'.$sId.'" name="choice['.$sChoiceId.']" type="checkbox" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/>'.$sHiddenInput.' ');
|
||||
$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $aFlags);
|
||||
$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $sChoiceId, $aFlags);
|
||||
//$oPage->add('</div>');
|
||||
}
|
||||
$sChoiceName = null;
|
||||
@@ -780,17 +780,19 @@ EOF
|
||||
$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);
|
||||
$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);
|
||||
|
||||
echo'<br/>$aSelectedComponents = ';
|
||||
var_dump($aSelectedComponents);
|
||||
echo "Choice name is ".$sChoiceName."<br/>";
|
||||
if ($bSelected) {
|
||||
$sAttributes = ' checked ';
|
||||
}
|
||||
@@ -800,15 +802,19 @@ EOF
|
||||
$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.' ');
|
||||
|
||||
|
||||
|
||||
$aFlags = $this->ComputeChoiceFlags($aChoice, $sChoiceId, $aSelectedComponents, $bAllDisabled, $bDisableUninstallCheck, $this->bUpgrade);
|
||||
$aFlags['disabled'] = $bDisabled;
|
||||
$aFlags['checked'] = $bSelected;
|
||||
var_dump($aFlags);
|
||||
$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $aFlags, 'radio');
|
||||
$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceName, $sChoiceId, $aFlags, 'radio');
|
||||
//$oPage->add('</div>');
|
||||
}
|
||||
}
|
||||
|
||||
protected function DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $aFlags, $sInputType = 'checkbox')
|
||||
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>' : '';
|
||||
$sDescription = isset($aChoice['description']) ? utils::EscapeHtml($aChoice['description']) : '';
|
||||
@@ -816,7 +822,7 @@ EOF
|
||||
$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['.$sChoiceId.']" value="'.$sChoiceId.'"/>' : '';
|
||||
$sHiddenInput = $aFlags['disabled'] && $aFlags['checked'] ? '<input type="hidden" name="choice['.$sChoiceName.']" value="'.$sChoiceId.'"/>' : '';
|
||||
|
||||
$sTooltip = '';
|
||||
if ($aFlags['missing']) {
|
||||
@@ -834,15 +840,17 @@ EOF
|
||||
$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>';
|
||||
}
|
||||
|
||||
//width: 12px;
|
||||
$sMetadata = '';
|
||||
if ($aChoice['version'] && $aChoice['source_label']) {
|
||||
if (isset($aChoice['version']) && isset($aChoice['source_label'])) {
|
||||
$sMetadata = '<span>v'.$aChoice['version'].'</span><span>'.$aChoice['source_label'].'</span>';
|
||||
}
|
||||
|
||||
$oPage->add('
|
||||
<div class="ibo-extension-details ibo-content-block ibo-block" '.$sDataId.'>
|
||||
<div class="ibo-extension-details--actions">
|
||||
<input class="wiz-choice" id="'.$sId.'" name="choice['.$sChoiceId.']" type="'.$sInputType.'" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/>'.$sHiddenInput.'
|
||||
<input class="wiz-choice" id="'.$sId.'" name="choice['.$sChoiceId.']" type="'.$sInputType.'" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/>
|
||||
'.$sHiddenInput.'
|
||||
</div>
|
||||
<div class="ibo-extension-details--information">
|
||||
<div class="ibo-extension-details--information--label">
|
||||
|
||||
Reference in New Issue
Block a user