mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 10:08:45 +02:00
N°6251 - 1:n - Actions must not be proposed to user not allowed (#491)
This commit is contained in:
@@ -18,6 +18,7 @@ use DictExceptionMissingString;
|
||||
use DisplayBlock;
|
||||
use Exception;
|
||||
use MySQLException;
|
||||
use UserRights;
|
||||
use Utils;
|
||||
use WebPage;
|
||||
|
||||
@@ -71,6 +72,11 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
|
||||
protected string $sTableId;
|
||||
|
||||
// User rights
|
||||
protected bool $bIsAllowCreate;
|
||||
protected bool $bIsAllowModify;
|
||||
protected bool $bIsAllowDelete;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -110,6 +116,11 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
private function Init()
|
||||
{
|
||||
$this->sTargetClass = $this->GetTargetClass();
|
||||
|
||||
// User rights
|
||||
$this->bIsAllowCreate = UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_CREATE) == UR_ALLOWED_YES;
|
||||
$this->bIsAllowModify = UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_MODIFY) == UR_ALLOWED_YES;
|
||||
$this->bIsAllowDelete = UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_DELETE) == UR_ALLOWED_YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ use iDBObjectSetIterator;
|
||||
use MetaModel;
|
||||
use MySQLException;
|
||||
use UILinksWidgetDirect;
|
||||
use UserRights;
|
||||
use utils;
|
||||
use WebPage;
|
||||
|
||||
@@ -68,6 +69,11 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
|
||||
/** @var string $sJSDoSearch */
|
||||
public string $sJSDoSearch;
|
||||
|
||||
// User rights
|
||||
private bool $bIsAllowCreate;
|
||||
private bool $bIsAllowModify;
|
||||
private bool $bIsAllowDelete;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -114,6 +120,11 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
|
||||
private function Init()
|
||||
{
|
||||
$this->oAttributeLinkedSet = MetaModel::GetAttributeDef($this->oUILinksDirectWidget->GetClass(), $this->oUILinksDirectWidget->GetAttCode());
|
||||
|
||||
// User rights
|
||||
$this->bIsAllowCreate = UserRights::IsActionAllowed($this->oAttributeLinkedSet->GetLinkedClass(), UR_ACTION_CREATE) == UR_ALLOWED_YES;
|
||||
$this->bIsAllowModify = UserRights::IsActionAllowed($this->oAttributeLinkedSet->GetLinkedClass(), UR_ACTION_MODIFY) == UR_ALLOWED_YES;
|
||||
$this->bIsAllowDelete = UserRights::IsActionAllowed($this->oAttributeLinkedSet->GetLinkedClass(), UR_ACTION_DELETE) == UR_ALLOWED_YES;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,38 +203,48 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_ADDONLY: // The only possible action is to open (in a new window) the form to create a new object
|
||||
$oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Create'));
|
||||
$oActionButtonCreate->SetTooltip(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())))
|
||||
->AddDataAttribute('action', 'create')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');");
|
||||
$oToolbar->AddSubBlock($oActionButtonCreate);
|
||||
if ($this->bIsAllowCreate) {
|
||||
$oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Create'));
|
||||
$oActionButtonCreate->SetTooltip(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())))
|
||||
->AddDataAttribute('action', 'create')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');");
|
||||
$oToolbar->AddSubBlock($oActionButtonCreate);
|
||||
}
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place'
|
||||
case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu
|
||||
if ($this->bIsAllowCreate) {
|
||||
$oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Create'));
|
||||
$oActionButtonCreate->SetTooltip(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())))
|
||||
->AddDataAttribute('action', 'create')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');");
|
||||
->AddDataAttribute('action', 'create')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');");
|
||||
$oToolbar->AddSubBlock($oActionButtonCreate);
|
||||
|
||||
}
|
||||
|
||||
if ($this->bIsAllowDelete) {
|
||||
$oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Delete'));
|
||||
$oActionButtonDelete->AddDataAttribute('action', 'delete')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');");
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');");
|
||||
$oToolbar->AddSubBlock($oActionButtonDelete);
|
||||
}
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
|
||||
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Add'));
|
||||
$oActionButtonLink->SetTooltip(Dict::Format('UI:AddLinkedObjectsOf_Class', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())))
|
||||
->AddDataAttribute('action', 'add')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('selectToAdd');");
|
||||
$oToolbar->AddSubBlock($oActionButtonLink);
|
||||
|
||||
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Remove'));
|
||||
$oActionButtonUnlink->AddDataAttribute('action', 'detach')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('removeSelection');");
|
||||
$oToolbar->AddSubBlock($oActionButtonUnlink);
|
||||
if ($this->bIsAllowCreate) {
|
||||
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Add'));
|
||||
$oActionButtonLink->SetTooltip(Dict::Format('UI:AddLinkedObjectsOf_Class', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())))
|
||||
->AddDataAttribute('action', 'add')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('selectToAdd');");
|
||||
$oToolbar->AddSubBlock($oActionButtonLink);
|
||||
}
|
||||
|
||||
if ($this->bIsAllowDelete) {
|
||||
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Remove'));
|
||||
$oActionButtonUnlink->AddDataAttribute('action', 'detach')
|
||||
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('removeSelection');");
|
||||
$oToolbar->AddSubBlock($oActionButtonUnlink);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -307,21 +328,25 @@ 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
|
||||
if ($this->bIsAllowDelete) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Delete:Button',
|
||||
'tooltip' => $sDeleteButtonTooltip,
|
||||
'icon_classes' => 'fas fa-trash',
|
||||
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'tooltip' => $sRemoveButtonTooltip,
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
|
||||
);
|
||||
if ($this->bIsAllowModify) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'tooltip' => $sRemoveButtonTooltip,
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -49,7 +49,9 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
}
|
||||
|
||||
// Add creation in modal if the linkset is not readonly
|
||||
if (!$this->oAttDef->GetReadOnly() && $this->oAttDef->GetEditMode() != LINKSET_EDITMODE_NONE) {
|
||||
if (!$this->oAttDef->GetReadOnly()
|
||||
&& $this->oAttDef->GetEditMode() != LINKSET_EDITMODE_NONE
|
||||
&& $this->bIsAllowCreate) {
|
||||
$aExtraParams['creation_in_modal'] = true;
|
||||
$aExtraParams['creation_in_modal_tooltip'] = $this->GetDictionaryEntry(static::DICT_CREATE_BUTTON_TOOLTIP);
|
||||
$aExtraParams['creation_in_modal_js_handler'] = "{$this->GetWidgetName()}.links_view_table('CreateLinkedObject');";
|
||||
@@ -71,20 +73,23 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_ADDONLY: // The only possible action is to open (in a new window) the form to create a new object
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyObject:Button',
|
||||
'name' => 'ModifyButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-pen',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement, aRowData['{$this->sTargetClass}/friendlyname']);",
|
||||
'metadata' => [
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
if ($this->bIsAllowModify) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyObject:Button',
|
||||
'name' => 'ModifyButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-pen',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement, aRowData['{$this->sTargetClass}/friendlyname']);",
|
||||
'metadata' => [
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place'
|
||||
case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu
|
||||
if ($this->bIsAllowModify) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyObject:Button',
|
||||
'name' => 'ModifyButton',
|
||||
@@ -95,7 +100,9 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->bIsAllowDelete) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Delete:Button',
|
||||
'name' => 'DeleteButton',
|
||||
@@ -104,39 +111,45 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
'color' => Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement);",
|
||||
'confirmation' => [
|
||||
'title' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_TITLE),
|
||||
'message' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_MESSAGE),
|
||||
'confirm_button_class' => 'ibo-is-danger',
|
||||
'row_data' => "{$this->sTargetClass}/hyperlink",
|
||||
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
|
||||
],
|
||||
);
|
||||
'title' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_TITLE),
|
||||
'message' => $this->GetDictionaryEntry(static::DICT_DELETE_MODAL_MESSAGE),
|
||||
'confirm_button_class' => 'ibo-is-danger',
|
||||
'row_data' => "{$this->sTargetClass}/hyperlink",
|
||||
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
|
||||
],
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyObject:Button',
|
||||
'name' => 'ModifyButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-pen',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement, aRowData['{$this->sTargetClass}/friendlyname']);",
|
||||
'metadata' => [
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'name' => 'RemoveButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DetachLinkedObject', aRowData['{$this->sTargetClass}/_key_/raw'], oTrElement, oTrElement);",
|
||||
'confirmation' => [
|
||||
'title' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_TITLE),
|
||||
'message' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_MESSAGE),
|
||||
'row_data' => "{$this->sTargetClass}/hyperlink",
|
||||
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
|
||||
],
|
||||
);
|
||||
if ($this->bIsAllowModify) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyObject:Button',
|
||||
'name' => 'ModifyButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-pen',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement, aRowData['{$this->sTargetClass}/friendlyname']);",
|
||||
'metadata' => [
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->bIsAllowModify) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'name' => 'RemoveButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DetachLinkedObject', aRowData['{$this->sTargetClass}/_key_/raw'], oTrElement, oTrElement);",
|
||||
'confirmation' => [
|
||||
'title' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_TITLE),
|
||||
'message' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_MESSAGE),
|
||||
'row_data' => "{$this->sTargetClass}/hyperlink",
|
||||
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
|
||||
],
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -21,6 +21,7 @@ use Dict;
|
||||
use Exception;
|
||||
use MetaModel;
|
||||
use UILinksWidget;
|
||||
use UserRights;
|
||||
use utils;
|
||||
use WebPage;
|
||||
|
||||
@@ -64,6 +65,10 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock
|
||||
/** @var string */
|
||||
public string $sFormPrefix;
|
||||
|
||||
// User rights
|
||||
private bool $bIsAllowCreate;
|
||||
private bool $bIsAllowDelete;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -100,6 +105,11 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock
|
||||
private function Init()
|
||||
{
|
||||
$this->oAttributeLinkedSetIndirect = MetaModel::GetAttributeDef($this->oUILinksWidget->GetClass(), $this->oUILinksWidget->GetAttCode());
|
||||
|
||||
// User rights
|
||||
$this->bIsAllowCreate = UserRights::IsActionAllowed($this->oAttributeLinkedSetIndirect->GetLinkedClass(), UR_ACTION_CREATE) == UR_ALLOWED_YES;
|
||||
$this->bIsAllowModify = UserRights::IsActionAllowed($this->oAttributeLinkedSetIndirect->GetLinkedClass(), UR_ACTION_MODIFY) == UR_ALLOWED_YES;
|
||||
$this->bIsAllowDelete = UserRights::IsActionAllowed($this->oAttributeLinkedSetIndirect->GetLinkedClass(), UR_ACTION_DELETE) == UR_ALLOWED_YES;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,17 +217,22 @@ EOF
|
||||
|
||||
// Toolbar and actions
|
||||
$oToolbar = ToolbarUIBlockFactory::MakeForButton();
|
||||
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Remove'));
|
||||
$oActionButtonUnlink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.RemoveSelected();")
|
||||
->AddDataAttribute('action', 'detach');
|
||||
$oToolbar->AddSubBlock($oActionButtonUnlink);
|
||||
|
||||
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Add'));
|
||||
$oActionButtonLink->SetTooltip(Dict::Format('UI:AddLinkedObjectsOf_Class', MetaModel::GetName($this->oAttributeLinkedSetIndirect->GetLinkedClass())))
|
||||
->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.AddObjects();")
|
||||
->AddDataAttribute('action', 'add');
|
||||
$oToolbar->AddSubBlock($oActionButtonLink);
|
||||
|
||||
|
||||
if ($this->bIsAllowDelete) {
|
||||
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Remove'));
|
||||
$oActionButtonUnlink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.RemoveSelected();")
|
||||
->AddDataAttribute('action', 'detach');
|
||||
$oToolbar->AddSubBlock($oActionButtonUnlink);
|
||||
}
|
||||
|
||||
if ($this->bIsAllowCreate) {
|
||||
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Add'));
|
||||
$oActionButtonLink->SetTooltip(Dict::Format('UI:AddLinkedObjectsOf_Class', MetaModel::GetName($this->oAttributeLinkedSetIndirect->GetLinkedClass())))
|
||||
->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.AddObjects();")
|
||||
->AddDataAttribute('action', 'add');
|
||||
$oToolbar->AddSubBlock($oActionButtonLink);
|
||||
}
|
||||
|
||||
$oTablePanel->AddToolbarBlock($oToolbar);
|
||||
$oTablePanel->AddSubBlock($oDataTable);
|
||||
|
||||
@@ -482,12 +497,14 @@ JS
|
||||
$this->oAttributeLinkedSetIndirect->GetLabel(),
|
||||
Dict::S("Class:{$this->oUILinksWidget->GetRemoteClass()}"));
|
||||
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'tooltip' => $sRemoveButtonTooltip,
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);",
|
||||
);
|
||||
if ($this->bIsAllowDelete) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'tooltip' => $sRemoveButtonTooltip,
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);",
|
||||
);
|
||||
}
|
||||
|
||||
return $aRowActions;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
}
|
||||
|
||||
// Add creation in modal if the linkset is not readonly
|
||||
if (!$this->oAttDef->GetReadOnly()) {
|
||||
if (!$this->oAttDef->GetReadOnly()
|
||||
&& $this->bIsAllowCreate) {
|
||||
$aExtraParams['creation_in_modal'] = true;
|
||||
$aExtraParams['creation_in_modal_tooltip'] = $this->GetDictionaryEntry(static::BUTTON_TOOLTIP);
|
||||
$aExtraParams['creation_in_modal_js_handler'] = "{$this->GetWidgetName()}.links_view_table('CreateLinkedObject');";
|
||||
@@ -76,30 +77,34 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
{
|
||||
$aRowActions = array();
|
||||
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyLink:Button',
|
||||
'name' => 'ModifyButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-pen',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw'], oTrElement, aRowData['Remote/friendlyname']);",
|
||||
'metadata' => [
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
if ($this->bIsAllowModify) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:ModifyLink:Button',
|
||||
'name' => 'ModifyButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-pen',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw'], oTrElement, aRowData['Remote/friendlyname']);",
|
||||
'metadata' => [
|
||||
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_MODAL_TITLE),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'name' => 'RemoveButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['Link/_key_/raw'], oTrElement);",
|
||||
'confirmation' => [
|
||||
'title' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_TITLE),
|
||||
'message' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_MESSAGE),
|
||||
'row_data' => "Remote/hyperlink",
|
||||
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
|
||||
],
|
||||
);
|
||||
if ($this->bIsAllowDelete) {
|
||||
$aRowActions[] = array(
|
||||
'label' => 'UI:Links:Remove:Button',
|
||||
'name' => 'RemoveButton',
|
||||
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
|
||||
'icon_classes' => 'fas fa-minus',
|
||||
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['Link/_key_/raw'], oTrElement);",
|
||||
'confirmation' => [
|
||||
'title' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_TITLE),
|
||||
'message' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_MESSAGE),
|
||||
'row_data' => "Remote/hyperlink",
|
||||
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return $aRowActions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user