diff --git a/sources/Application/UI/Links/AbstractBlockLinksViewTable.php b/sources/Application/UI/Links/AbstractBlockLinksViewTable.php index 3344bf510..3bbff1ba5 100644 --- a/sources/Application/UI/Links/AbstractBlockLinksViewTable.php +++ b/sources/Application/UI/Links/AbstractBlockLinksViewTable.php @@ -121,6 +121,7 @@ abstract class AbstractBlockLinksViewTable extends UIContentBlock */ private function InitHeader() { + // Linkset description as an informative alert $sDescription = $this->oAttDef->GetDescription(); if (utils::IsNotNullOrEmptyString($sDescription)) { $oAlert = AlertUIBlockFactory::MakeForInformation('', $sDescription); diff --git a/sources/Application/UI/Links/Direct/BlockDirectLinksEditTable.php b/sources/Application/UI/Links/Direct/BlockDirectLinksEditTable.php index 92abad62e..42574944e 100644 --- a/sources/Application/UI/Links/Direct/BlockDirectLinksEditTable.php +++ b/sources/Application/UI/Links/Direct/BlockDirectLinksEditTable.php @@ -17,6 +17,7 @@ use Combodo\iTop\Application\UI\Base\iUIBlock; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Dict; use MetaModel; +use utils; /** * Class BlockDirectLinksEditTable @@ -113,11 +114,12 @@ class BlockDirectLinksEditTable extends UIContentBlock */ private function InitUI() { - // MedallionIcon - $oClassIcon = new MedallionIcon(MetaModel::GetClassIcon($this->oUILinksDirectWidget->GetLinkedClass(), false)); - $oClassIcon->SetDescription($this->oAttributeLinkedSet->GetDescription()); - $oClassIcon->AddCSSClass('ibo-block-list--medallion'); - $this->AddSubBlock($oClassIcon); + // Linkset description as an informative alert + $sDescription = $this->oAttributeLinkedSet->GetDescription(); + if (utils::IsNotNullOrEmptyString($sDescription)) { + $oAlert = AlertUIBlockFactory::MakeForInformation('', $sDescription); + $this->AddSubBlock($oAlert); + } } /** @@ -139,8 +141,14 @@ class BlockDirectLinksEditTable extends UIContentBlock $aRowActions = $this->GetRowActions(); $oDatatable = DataTableUIBlockFactory::MakeForForm($this->oUILinksDirectWidget->GetInputId(), $aAttribs, $aRows, '', $aRowActions); $oDatatable->SetOptions(['select_mode' => 'custom', 'disable_hyperlinks' => true]); - $aTablePanel = PanelUIBlockFactory::MakeNeutral(''); - $aTablePanel->SetSubTitle(sprintf('Total: %d objects.', count($aRows))); + + // Panel + $aTablePanel = PanelUIBlockFactory::MakeForClass($this->oUILinksDirectWidget->GetLinkedClass(), $this->oAttributeLinkedSet->GetLabel()) + ->SetSubTitle(sprintf('Total: %d objects.', count($aRows))) + ->SetIcon(MetaModel::GetClassIcon($this->oUILinksDirectWidget->GetLinkedClass(), false)) + ->AddCSSClass('ibo-datatable-panel'); + + // Toolbar and actions $oToolbar = ToolbarUIBlockFactory::MakeForButton(); $oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral('Unlink'); $oActionButtonUnlink->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('instance')._removeSelection();"); @@ -153,6 +161,7 @@ class BlockDirectLinksEditTable extends UIContentBlock $oToolbar->AddSubBlock($oActionButtonCreate); $oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral('Delete'); $oActionButtonDelete->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('instance')._deleteSelection();"); + $oToolbar->AddSubBlock($oActionButtonDelete); $aTablePanel->AddToolbarBlock($oToolbar); $aTablePanel->AddSubBlock($oDatatable); diff --git a/sources/Application/UI/Links/Direct/BlockDirectLinksViewTable.php b/sources/Application/UI/Links/Direct/BlockDirectLinksViewTable.php index f66e164cc..0c1b3cae6 100644 --- a/sources/Application/UI/Links/Direct/BlockDirectLinksViewTable.php +++ b/sources/Application/UI/Links/Direct/BlockDirectLinksViewTable.php @@ -38,7 +38,7 @@ class BlockDirectLinksViewTable extends AbstractBlockLinksViewTable 'table_id' => $this->GetTableId(), 'row_actions' => $this->GetRowActions(), 'currentId' => $this->GetTableId(), - 'panel_title' => 'TODO: Replace with current tab label?', // TODO 3.1: What to put there: Tab label? Unlikely. Lnk class name? Unlikely. Maybe there should be a dedicated "label" property so we can define the label. + 'panel_title' => $this->oAttDef->GetLabel(), 'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false), ); diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinksEditTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinksEditTable.php index 31be81c8e..d4315abe2 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinksEditTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinksEditTable.php @@ -17,6 +17,7 @@ use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory; use Combodo\iTop\Application\UI\Base\iUIBlock; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use MetaModel; +use utils; /** * Class BlockIndirectLinksEditTable @@ -102,15 +103,16 @@ class BlockIndirectLinksEditTable extends UIContentBlock */ private function InitUI() { - // MedallionIcon - $oClassIcon = new MedallionIcon(MetaModel::GetClassIcon($this->oUILinksWidget->GetRemoteClass(), false)); - $oClassIcon->SetDescription($this->oAttributeLinkedSetIndirect->GetDescription()); - $oClassIcon->AddCSSClass('ibo-block-list--medallion'); - $this->AddSubBlock($oClassIcon); - // To prevent adding forms inside the main form $oDeferredBlock = new UIContentBlock("dlg_{$this->oUILinksWidget->GetLinkedSetId()}", ['ibo-block-indirect-links--edit--dialog']); $this->AddDeferredBlock($oDeferredBlock); + + // Linkset description as an informative alert + $sDescription = $this->oAttributeLinkedSetIndirect->GetDescription(); + if (utils::IsNotNullOrEmptyString($sDescription)) { + $oAlert = AlertUIBlockFactory::MakeForInformation('', $sDescription); + $this->AddSubBlock($oAlert); + } } /** @@ -156,7 +158,6 @@ class BlockIndirectLinksEditTable extends UIContentBlock */ public function InitTable(\WebPage $oPage, $oValue, $aArgs, $sFormPrefix, $oCurrentObj, $aTableConfig) { - $this->AddSubBlock(InputUIBlockFactory::MakeForHidden("{$sFormPrefix}{$this->oUILinksWidget->GetInputId()}", '', "{$sFormPrefix}{$this->oUILinksWidget->GetInputId()}")); $this->sWizHelper = 'oWizardHelper'.$sFormPrefix; $oValue->Rewind(); $aForm = array(); @@ -195,8 +196,14 @@ class BlockIndirectLinksEditTable extends UIContentBlock 'select_mode' => 'custom', 'disable_hyperlinks' => true, ]); - $aTablePanel = PanelUIBlockFactory::MakeNeutral(''); - $aTablePanel->SetSubTitle(sprintf('Total: %d objects.', count($aForm))); + + // Panel + $aTablePanel = PanelUIBlockFactory::MakeForClass($this->oUILinksWidget->GetRemoteClass(), $this->oAttributeLinkedSetIndirect->GetLabel()) + ->SetSubTitle(sprintf('Total: %d objects.', count($aForm))) + ->SetIcon(MetaModel::GetClassIcon($this->oUILinksWidget->GetRemoteClass(), false)) + ->AddCSSClass('ibo-datatable-panel'); + + // Toolbar and actions $oToolbar = ToolbarUIBlockFactory::MakeForButton(); $oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral('Unlink'); $oActionButtonUnlink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.RemoveSelected();"); @@ -208,6 +215,7 @@ class BlockIndirectLinksEditTable extends UIContentBlock $aTablePanel->AddSubBlock($oDataTable); $this->AddSubBlock($aTablePanel); + $this->AddSubBlock(InputUIBlockFactory::MakeForHidden("{$sFormPrefix}{$this->oUILinksWidget->GetInputId()}", '', "{$sFormPrefix}{$this->oUILinksWidget->GetInputId()}")); } /** diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinksViewTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinksViewTable.php index f0c67fbb3..57d1cc6c8 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinksViewTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinksViewTable.php @@ -50,7 +50,7 @@ class BlockIndirectLinksViewTable extends AbstractBlockLinksViewTable 'extra_fields' => $this->GetAttCodesToDisplay(), 'row_actions' => $this->GetRowActions(), 'currentId' => $this->GetTableId(), - 'panel_title' => 'TODO: Replace with current tab label?', // TODO 3.1: What to put there: Tab label? Unlikely. Lnk class name? Unlikely. Maybe there should be a dedicated "label" property so we can define the label. + 'panel_title' => $this->oAttDef->GetLabel(), 'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false), );