diff --git a/datamodels/2.x/itop-hub-connector/myextensions.php b/datamodels/2.x/itop-hub-connector/myextensions.php
index daad94009..9ec167c7a 100644
--- a/datamodels/2.x/itop-hub-connector/myextensions.php
+++ b/datamodels/2.x/itop-hub-connector/myextensions.php
@@ -1,22 +1,15 @@
SetBreadCrumbEntry('ui-hub-myextensions', Dict::S('Menu:iTopHub:MyExtensions'), Dict::S('Menu:iTopHub:MyExtensions+'), '', 'fas fa-puzzle-piece', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
-function DisplayExtensionInfo(Webpage $oPage, iTopExtension $oExtension)
+
+function GetExtensionInfoComponent(iTopExtension $oExtension): UIBlock
{
- $oPage->add('
');
- if ($oExtension->sInstalledVersion == '') {
- $oPage->add(''.$oExtension->sLabel.' '.Dict::Format('UI:About:Extension_Version', $oExtension->sVersion).' '.Dict::S('iTopHub:ExtensionNotInstalled').'');
- } else {
- $oPage->add(''.$oExtension->sLabel.' '.Dict::Format('UI:About:Extension_Version', $oExtension->sInstalledVersion));
+ $sExtensionDescription = Dict::Format('UI:About:Extension_Version', $oExtension->sVersion);
+ if (!empty($oExtension->sLabel)) {
+ $sExtensionDescription .= '
'.$oExtension->sDescription.'';
}
- $oPage->add(''.$oExtension->sDescription.'
');
- $oPage->add('');
+
+ return AlertUIBlockFactory::MakeForInformation($oExtension->sLabel, $sExtensionDescription)
+ ->SetIsClosable(false)
+ ->SetIsCollapsible(true)
+ ->SetOpenedByDefault(false);
}
-// Main program
+
try {
$oExtensionsMap = new iTopExtensionsMap();
$oExtensionsMap->LoadChoicesFromDatabase(MetaModel::GetConfig());
- $oPage->add(''.Dict::S('iTopHub:InstalledExtensions').'
');
+ $oPage->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('iTopHub:InstalledExtensions')));
- $oPage->add('');
+
+ //--- add extension button START
$sUrl = utils::GetAbsoluteUrlModulePage('itop-hub-connector', 'launch.php', array('target' => 'browse_extensions'));
- $oPage->add('');
+ $oInstallExtButton = ButtonUIBlockFactory::MakeNeutral(Dict::S('iTopHub:GetMoreExtensions'), 'install-extensions-button')
+ ->SetOnClickJsCode("window.location.href='$sUrl'");
+ $oPage->AddSubBlock($oInstallExtButton);
+ //--- add extension button END
- // Display the section about "manually deployed" extensions, only if there are some already
- $iCount = 0;
- foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) {
- if ($oExtension->sSource == iTopExtension::SOURCE_MANUAL) {
- $iCount++;
+
+ /**------------------------------------------------------------------------------------------------------
+ * Remotely deployed ext
+ */
+ $oFieldsetRemote = FieldSetUIBlockFactory::MakeStandard(Dict::S('iTopHub:ExtensionCategory:Remote'));
+ $oPage->AddUiBlock($oFieldsetRemote);
+ $oFieldsetRemote->AddHtml(Dict::S('iTopHub:ExtensionCategory:Remote+'));
+
+ $aRemotelyDeployedExt = array_filter($oExtensionsMap->GetAllExtensions(), static function ($oExtension) {
+ return ($oExtension->sSource === iTopExtension::SOURCE_REMOTE);
+ });
+ $iRemotelyDeployedExtCount = count($aRemotelyDeployedExt);
+
+ if ($iRemotelyDeployedExtCount === 0) {
+ $oFieldsetRemote->AddHtml(''.Dict::S('iTopHub:NoExtensionInThisCategory').'
');
+ } else {
+ foreach ($aRemotelyDeployedExt as $oExtension) {
+ $oFieldsetRemote->AddSubBlock(GetExtensionInfoComponent($oExtension));
}
}
- if ($iCount > 0) {
- $oPage->add('');
$sExtensionsDirTooltip = json_encode(APPROOT.'extensions');
$oPage->add_style(
<<