N°5904 - Use attribute linked set edit mode to enable actions in view (improvement)

This commit is contained in:
bdalsass
2023-02-08 14:34:46 +01:00
committed by GitHub
parent 372888c7a7
commit 86a208a86d
8 changed files with 160 additions and 171 deletions

View File

@@ -2172,7 +2172,7 @@ class MenuBlock extends DisplayBlock
if ($bIsCreationInModalAllowed === true) {
$oAddLinkActionButton = ButtonUIBlockFactory::MakeIconAction(
'fas fa-plus',
Dict::S('UI:DisplayBlock:List:AddEntry:Tooltip'),
Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)),
'UI:Links:New',
'',
false
@@ -2326,9 +2326,9 @@ class MenuBlock extends DisplayBlock
protected function AddNewObjectMenuAction(array &$aActions, string $sClass, string $sDefaultValuesAsUrlParams = ''): void
{
$aActions['UI:Menu:New'] = [
'label' => Dict::S('UI:Menu:New'),
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=new&class=$sClass{$sDefaultValuesAsUrlParams}"),
] + $this->GetDefaultParamsForMenuAction();
'label' => Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)),
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=new&class=$sClass{$sDefaultValuesAsUrlParams}"),
] + $this->GetDefaultParamsForMenuAction();
}
/**

View File

@@ -20,23 +20,26 @@
Dict::Add('EN US', 'English', 'English', array(
// Action row
'UI:Links:ActionRow:Detach' => 'Detach',
'UI:Links:ActionRow:Detach+' => 'Detach this object',
'UI:Links:ActionRow:Detach:Confirmation' => 'Do you really want to detach <b>{item}</b> from current object ?',
'UI:Links:ActionRow:Detach' => 'Remove',
'UI:Links:ActionRow:Detach+' => 'Remove this object',
'UI:Links:ActionRow:Detach:Confirmation' => 'Do you really want to remove <b>{item}</b> from current object ?',
'UI:Links:ActionRow:Delete' => 'Delete',
'UI:Links:ActionRow:Delete+' => 'Delete this object',
'UI:Links:ActionRow:Delete:Confirmation' => 'Do you really want to delete <b>{item}</b> from current object ?',
'UI:Links:ActionRow:Modify' => 'Modify',
'UI:Links:ActionRow:Modify+' => 'Modify this object',
'UI:Links:ActionRow:Modify:Modal:Title' => 'Modify an object',
// Action
'UI:Links:New:Modal:Title' => 'Create an object',
// Bulk
'UI:Links:Bulk:LinkWillBeCreatedForAllObjects' => 'Link all objects',
'UI:Links:Bulk:LinkWillBeDeletedFromAllObjects' => 'Unlink all objects',
'UI:Links:Bulk:LinkWillBeCreatedFor1Object' => 'Link one object',
'UI:Links:Bulk:LinkWillBeDeletedFrom1Object' => 'Unlink one object',
'UI:Links:Bulk:LinkWillBeCreatedForXObjects' => 'Link {count} objects',
'UI:Links:Bulk:LinkWillBeDeletedFromXObjects' => 'Unlink {count} objects',
'UI:Links:Bulk:LinkWillBeCreatedForAllObjects' => 'Add to all objects',
'UI:Links:Bulk:LinkWillBeDeletedFromAllObjects' => 'Remove from all objects',
'UI:Links:Bulk:LinkWillBeCreatedFor1Object' => 'Add to one object',
'UI:Links:Bulk:LinkWillBeDeletedFrom1Object' => 'Remove from one object',
'UI:Links:Bulk:LinkWillBeCreatedForXObjects' => 'Add {count} objects',
'UI:Links:Bulk:LinkWillBeDeletedFromXObjects' => 'Remove {count} objects',
'UI:Links:Bulk:LinkExistForAllObjects' => 'All objets are already linked',
'UI:Links:Bulk:LinkExistForOneObject' => 'One object is linked',
'UI:Links:Bulk:LinkExistForXObjects' => '{count} objects are linked',

View File

@@ -20,23 +20,26 @@
Dict::Add('FR FR', 'French', 'Français', array(
// Action row
'UI:Links:ActionRow:Detach' => 'Détacher',
'UI:Links:ActionRow:Detach+' => 'Détacher cet objet',
'UI:Links:ActionRow:Detach:Confirmation' => 'Voulez-vous détacher <b>{item}</b> de l\'objet courant ?',
'UI:Links:ActionRow:Detach' => 'Enlever',
'UI:Links:ActionRow:Detach+' => 'Enlever cet objet',
'UI:Links:ActionRow:Detach:Confirmation' => 'Voulez-vous Enlever <b>{item}</b> de l\'objet courant ?',
'UI:Links:ActionRow:Delete' => 'Supprimer',
'UI:Links:ActionRow:Delete+' => 'Supprimer cet objet',
'UI:Links:ActionRow:Delete:Confirmation' => 'Voulez-vous supprimer <b>{item}</b> de l\'objet courant ?',
'UI:Links:ActionRow:Modify' => 'Modifier',
'UI:Links:ActionRow:Modify+' => 'Modifier cet object',
'UI:Links:ActionRow:Modify:Modal:Title' => 'Modifier un object',
// Action
'UI:Links:New:Modal:Title' => 'Créer un object',
// Bulk
'UI:Links:Bulk:LinkWillBeCreatedForAllObjects' => 'Lier à tous les objets',
'UI:Links:Bulk:LinkWillBeDeletedFromAllObjects' => 'Détacher de tous les objets',
'UI:Links:Bulk:LinkWillBeCreatedFor1Object' => 'Lier à un objet',
'UI:Links:Bulk:LinkWillBeDeletedFrom1Object' => 'Détacher de un objet',
'UI:Links:Bulk:LinkWillBeCreatedForXObjects' => 'Lier à {count} objets',
'UI:Links:Bulk:LinkWillBeDeletedFromXObjects' => 'Détacher de {count} objets',
'UI:Links:Bulk:LinkWillBeCreatedForAllObjects' => 'Ajouter à tous les objets',
'UI:Links:Bulk:LinkWillBeDeletedFromAllObjects' => 'Enlever de tous les objets',
'UI:Links:Bulk:LinkWillBeCreatedFor1Object' => 'Ajouter à un objet',
'UI:Links:Bulk:LinkWillBeDeletedFrom1Object' => 'Enlever de un objet',
'UI:Links:Bulk:LinkWillBeCreatedForXObjects' => 'Ajouter à {count} objets',
'UI:Links:Bulk:LinkWillBeDeletedFromXObjects' => 'Enlever de {count} objets',
'UI:Links:Bulk:LinkExistForAllObjects' => 'Tous les objets sont déjà liés',
'UI:Links:Bulk:LinkExistForOneObject' => 'Un objet est lié',
'UI:Links:Bulk:LinkExistForXObjects' => '{count} objets sont liés',

View File

@@ -190,35 +190,35 @@ class BlockDirectLinksEditTable 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
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral('Link', 'link');
$oActionButtonLink->AddDataAttribute('action', 'add');
$oActionButtonLink->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('selectToAdd');");
$oToolbar->AddSubBlock($oActionButtonLink);
break;
case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place'
$oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral('Create', 'create');
$oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())));
$oActionButtonCreate->AddDataAttribute('action', 'create');
$oActionButtonCreate->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');");
$oToolbar->AddSubBlock($oActionButtonCreate);
$oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral('Delete', 'delete');
$oActionButtonDelete->AddDataAttribute('action', 'delete');
break;
case LINKSET_EDITMODE_INPLACE: // The whole linkset can be edited 'in-place'
case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu
$oActionButtonCreate = ButtonUIBlockFactory::MakeNeutral(Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())));
$oActionButtonCreate->AddDataAttribute('action', 'create');
$oActionButtonCreate->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('createRow');");
$oToolbar->AddSubBlock($oActionButtonCreate);
$oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Delete'));
$oActionButtonDelete->AddDataAttribute('action', 'delete');
$oActionButtonDelete->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');");
$oToolbar->AddSubBlock($oActionButtonDelete);
break;
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral('Unlink', 'unlink');
$oActionButtonUnlink->AddDataAttribute('action', 'detach');
$oActionButtonUnlink->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('removeSelection');");
$oToolbar->AddSubBlock($oActionButtonUnlink);
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral('Link', 'link');
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral(Dict::Format('UI:AddAnExisting_Class', MetaModel::GetName($this->oAttributeLinkedSet->GetLinkedClass())));
$oActionButtonLink->AddDataAttribute('action', 'add');
$oActionButtonLink->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('selectToAdd');");
$oToolbar->AddSubBlock($oActionButtonLink);
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Remove'));
$oActionButtonUnlink->AddDataAttribute('action', 'detach');
$oActionButtonUnlink->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('removeSelection');");
$oToolbar->AddSubBlock($oActionButtonUnlink);
break;
case LINKSET_EDITMODE_ACTIONS: // Show the usual 'Actions' popup menu
default:
}
@@ -226,7 +226,6 @@ class BlockDirectLinksEditTable extends UIContentBlock
return $oToolbar;
}
/**
* Return table rows.
*
@@ -277,28 +276,35 @@ class BlockDirectLinksEditTable extends UIContentBlock
{
$aRowActions = array();
if (!LinkSetModel::ConvertEditModeToReadOnly($this->oAttributeLinkedSet)) {
// until a full link set refactoring (continue using edit_mode property)
switch ($this->oAttributeLinkedSet->GetEditMode()) {
case LINKSET_EDITMODE_NONE: // The linkset is read-only
break;
switch (LinkSetModel::ConvertEditModeToRelationType($this->oAttributeLinkedSet)) {
case LINKSET_EDITMODE_ADDONLY: // The only possible action is to open (in a new window) the form to create a new object
break;
case LINKSET_RELATIONTYPE_LINK:
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
);
break;
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+',
'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:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
);
break;
default:
case LINKSET_RELATIONTYPE_PROPERTY:
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Delete',
'tooltip' => 'UI:Links:ActionRow:Delete+',
'icon_classes' => 'fas fa-trash',
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
);
break;
}
}
return $aRowActions;

View File

@@ -49,7 +49,7 @@ class BlockDirectLinksViewTable extends AbstractBlockLinksViewTable
}
// Add creation in modal if the linkset is not readonly
if (!$this->oAttDef->GetReadOnly()) {
if ($this->oAttDef->GetEditMode() != LINKSET_EDITMODE_NONE) {
$aExtraParams['creation_in_modal_is_allowed'] = true;
$aExtraParams['creation_in_modal_js_handler'] = "{$this->GetWidgetName()}.links_view_table('CreateLinkedObject');";
}
@@ -62,44 +62,63 @@ class BlockDirectLinksViewTable extends AbstractBlockLinksViewTable
{
$aRowActions = array();
if (!LinkSetModel::ConvertEditModeToReadOnly($this->oAttDef)) {
// until a full link set refactoring (continue using edit_mode property)
switch ($this->oAttDef->GetEditMode()) {
case LINKSET_EDITMODE_NONE: // The linkset is read-only
break;
switch (LinkSetModel::ConvertEditModeToRelationType($this->oAttDef)) {
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:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
break;
case LINKSET_RELATIONTYPE_LINK:
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DetachLinkedObject', aRowData['{$this->sTargetClass}/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Detach:Confirmation',
'message_row_data' => "{$this->sTargetClass}/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
break;
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+',
'icon_classes' => 'fas fa-trash',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Delete:Confirmation',
'message_row_data' => "{$this->sTargetClass}/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
break;
case LINKSET_RELATIONTYPE_PROPERTY:
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Delete',
'tooltip' => 'UI:Links:ActionRow:Delete+',
'icon_classes' => 'fas fa-trash',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Delete:Confirmation',
'message_row_data' => "{$this->sTargetClass}/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
break;
}
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DetachLinkedObject', aRowData['{$this->sTargetClass}/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Detach:Confirmation',
'message_row_data' => "{$this->sTargetClass}/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['{$this->oAttDef->GetLinkedClass()}/_key_/raw']);",
);
break;
default:
break;
}
return $aRowActions;

View File

@@ -187,19 +187,16 @@ class BlockIndirectLinksEditTable extends UIContentBlock
}
// Toolbar and actions
if (!LinkSetModel::ConvertEditModeToReadOnly($this->oAttributeLinkedSetIndirect)) {
$oToolbar = ToolbarUIBlockFactory::MakeForButton();
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral('Unlink');
$oActionButtonUnlink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.RemoveSelected();");
$oActionButtonUnlink->AddDataAttribute('action', 'detach');
$oToolbar->AddSubBlock($oActionButtonUnlink);
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral('Link');
$oActionButtonLink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.AddObjects();");
$oActionButtonLink->AddDataAttribute('action', 'add');
$oToolbar->AddSubBlock($oActionButtonLink);
$oTablePanel->AddToolbarBlock($oToolbar);
}
$oToolbar = ToolbarUIBlockFactory::MakeForButton();
$oActionButtonUnlink = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Remove'));
$oActionButtonUnlink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.RemoveSelected();");
$oActionButtonUnlink->AddDataAttribute('action', 'detach');
$oToolbar->AddSubBlock($oActionButtonUnlink);
$oActionButtonLink = ButtonUIBlockFactory::MakeNeutral(Dict::Format('UI:AddAnExisting_Class', MetaModel::GetName($this->oAttributeLinkedSetIndirect->GetLinkedClass())));
$oActionButtonLink->SetOnClickJsCode("oWidget{$this->oUILinksWidget->GetInputId()}.AddObjects();");
$oActionButtonLink->AddDataAttribute('action', 'add');
$oToolbar->AddSubBlock($oActionButtonLink);
$oTablePanel->AddToolbarBlock($oToolbar);
$oTablePanel->AddSubBlock($oDataTable);
$this->AddSubBlock($oTablePanel);
@@ -424,14 +421,12 @@ JS
{
$aRowActions = array();
if (!LinkSetModel::ConvertEditModeToReadOnly($this->oAttributeLinkedSetIndirect)) {
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);",
);
}
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);",
);
return $aRowActions;
}

View File

@@ -75,28 +75,24 @@ class BlockIndirectLinksViewTable extends AbstractBlockLinksViewTable
{
$aRowActions = array();
if (!LinkSetModel::ConvertEditModeToReadOnly($this->oAttDef)) {
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['Link/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Detach:Confirmation',
'message_row_data' => "Remote/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'icon_classes' => 'fas fa-minus',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['Link/_key_/raw'], oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Detach:Confirmation',
'message_row_data' => "Remote/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw']);",
);
}
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw']);",
);
return $aRowActions;
}

View File

@@ -74,37 +74,4 @@ class LinkSetModel
}
/**
* Convert edit_mode to relation type.
*
* @return string|null
*/
static public function ConvertEditModeToRelationType(AttributeLinkedSet $oAttDef): ?string
{
switch ($oAttDef->GetEditMode()) {
case LINKSET_EDITMODE_INPLACE:
return LINKSET_RELATIONTYPE_PROPERTY;
case LINKSET_EDITMODE_ADDREMOVE:
return LINKSET_RELATIONTYPE_LINK;
default:
return null;
}
}
/**
* Convert edit_mode to read only.
*
* @return bool
*/
static public function ConvertEditModeToReadOnly(AttributeLinkedSet $oAttDef): bool
{
switch ($oAttDef->GetEditMode()) {
case LINKSET_EDITMODE_NONE:
case LINKSET_EDITMODE_ADDONLY:
return true;
default:
return false;
}
}
}