diff --git a/application/ui.linksdirectwidget.class.inc.php b/application/ui.linksdirectwidget.class.inc.php index 3d3d77ebe..6488bffa8 100644 --- a/application/ui.linksdirectwidget.class.inc.php +++ b/application/ui.linksdirectwidget.class.inc.php @@ -84,7 +84,7 @@ class UILinksWidgetDirect public function Display(WebPage $oPage, $oValue, $aArgs, $sFormPrefix, $oCurrentObj) { $oBlock = new BlockDirectLinkSetEditTable($this, $this->sInputid); - $oBlock->InitTable($oPage, $oValue, $sFormPrefix); + $oBlock->InitTable($oPage, $oValue, $sFormPrefix, $oCurrentObj); return ConsoleBlockRenderer::RenderBlockTemplateInPage($oPage, $oBlock); } diff --git a/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php b/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php index ba0ac954c..173715ee3 100644 --- a/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php +++ b/sources/Application/UI/Links/AbstractBlockLinkSetViewTable.php @@ -127,7 +127,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock Dict::S("Class:{$this->sObjectClass}"), $this->oDbObject->Get('friendlyname'), $this->oAttDef->GetLabel(), - $this->sTargetClass, + Dict::S("Class:{$this->sTargetClass}"), $oDBObject !== null ? $oDBObject->Get('friendlyname') : '{item}'); } diff --git a/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php b/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php index 8ef4265b9..44377d30c 100644 --- a/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php +++ b/sources/Application/UI/Links/Direct/BlockDirectLinkSetEditTable.php @@ -131,10 +131,11 @@ class BlockDirectLinkSetEditTable extends UIContentBlock * @param WebPage $oPage * @param DBObjectSet $oValue * @param string $sFormPrefix + * @param $oCurrentObj * * @return void */ - public function InitTable(WebPage $oPage, iDBObjectSetIterator $oValue, string $sFormPrefix) + public function InitTable(WebPage $oPage, iDBObjectSetIterator $oValue, string $sFormPrefix, $oCurrentObj) { $this->sInputName = $sFormPrefix.'attr_'.$this->oUILinksDirectWidget->GetAttCode(); $this->sWizHelper = 'oWizardHelper'.$sFormPrefix; @@ -142,7 +143,7 @@ class BlockDirectLinkSetEditTable extends UIContentBlock try { $aAttribs = $this->oUILinksDirectWidget->GetTableConfig(); $aRows = $this->GetTableRows($oPage, $oValue); - $aRowActions = $this->GetRowActions(); + $aRowActions = $this->GetRowActions($oCurrentObj); $oDatatable = DataTableUIBlockFactory::MakeForForm($this->oUILinksDirectWidget->GetInputId(), $aAttribs, $aRows, '', $aRowActions); $oDatatable->SetOptions(['select_mode' => 'custom', 'disable_hyperlinks' => true]); @@ -275,12 +276,26 @@ class BlockDirectLinkSetEditTable extends UIContentBlock /** * Return row actions. * + * @param $oHostObject + * * @return \string[][] */ - private function GetRowActions(): array + private function GetRowActions($oHostObject): array { $aRowActions = array(); + $sDeleteButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel('UI:Links:Delete:Button+', '', true, + Dict::S("Class:{$this->oAttributeLinkedSet->GetHostClass()}"), + $oHostObject->Get('friendlyname'), + $this->oAttributeLinkedSet->GetLabel(), + Dict::S("Class:{$this->oUILinksDirectWidget->GetLinkedClass()}")); + + $sRemoveButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel('UI:Links:Remove:Button+', '', true, + Dict::S("Class:{$this->oAttributeLinkedSet->GetHostClass()}"), + $oHostObject->Get('friendlyname'), + $this->oAttributeLinkedSet->GetLabel(), + Dict::S("Class:{$this->oUILinksDirectWidget->GetLinkedClass()}")); + // until a full link set refactoring (continue using edit_mode property) switch ($this->oAttributeLinkedSet->GetEditMode()) { case LINKSET_EDITMODE_NONE: // The linkset is read-only @@ -292,8 +307,8 @@ class BlockDirectLinkSetEditTable extends UIContentBlock case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place' case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu $aRowActions[] = array( - 'label' => 'UI:Links:ActionRow:Delete', - 'tooltip' => 'UI:Links:ActionRow:Delete+', + 'label' => 'UI:Links:Delete:Button', + 'tooltip' => $sDeleteButtonTooltip, 'icon_classes' => 'fas fa-trash', 'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));", ); @@ -301,8 +316,8 @@ class BlockDirectLinkSetEditTable extends UIContentBlock case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place' $aRowActions[] = array( - 'label' => 'UI:Links:ActionRow:Detach', - 'tooltip' => 'UI:Links:ActionRow:Detach+', + 'label' => 'UI:Links:Remove:Button', + 'tooltip' => $sRemoveButtonTooltip, 'icon_classes' => 'fas fa-minus', 'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));", ); diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php index 3f1105cb7..a89eba502 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php @@ -166,7 +166,7 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock $this->iMaxAddedId = (int)$iMaxAddedId; // Datatable - $aRowActions = $this->GetRowActions(); + $aRowActions = $this->GetRowActions($oCurrentObj); $oDataTable = DataTableUIBlockFactory::MakeForForm("{$this->oUILinksWidget->GetAttCode()}{$this->oUILinksWidget->GetNameSuffix()}", $aTableConfig, $aForm, '', $aRowActions); $oDataTable->SetOptions([ 'select_mode' => 'custom', @@ -448,19 +448,26 @@ JS ); } - /** * Return row actions. * + * @param $oHostObject + * * @return \string[][] */ - private function GetRowActions(): array + private function GetRowActions($oHostObject): array { $aRowActions = array(); + $sRemoveButtonTooltip = $this->oAttributeLinkedSetIndirect->SearchSpecificLabel('UI:Links:Remove:Button+', '', true, + Dict::S("Class:{$this->oAttributeLinkedSetIndirect->GetHostClass()}"), + $oHostObject->Get('friendlyname'), + $this->oAttributeLinkedSetIndirect->GetLabel(), + Dict::S("Class:{$this->oUILinksWidget->GetRemoteClass()}")); + $aRowActions[] = array( - 'label' => 'UI:Links:ActionRow:Detach', - 'tooltip' => 'UI:Links:ActionRow:Detach+', + 'label' => 'UI:Links:Remove:Button', + 'tooltip' => $sRemoveButtonTooltip, 'icon_classes' => 'fas fa-minus', 'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);", );