mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°6154 - n:n Read - tooltip, buttons tooltips on edit widgets
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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}');
|
||||
}
|
||||
|
||||
|
||||
@@ -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));",
|
||||
);
|
||||
|
||||
@@ -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);",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user