N°6154 N°6219 - Relations Read - tooltip, confirmation title and message (#486)

N°6154 - n:n Read - tooltip, confirmation title and message on Add-Edit-Remove
N°6219 - 1:n Read: tooltip, modal title and message on Add-Edit-Remove-Delete
This commit is contained in:
bdalsass
2023-04-28 14:43:53 +02:00
committed by GitHub
parent 269c1bf005
commit de35d941c1
28 changed files with 461 additions and 254 deletions

View File

@@ -49,9 +49,12 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
}
// Add creation in modal if the linkset is not readonly
if ($this->oAttDef->GetEditMode() != LINKSET_EDITMODE_NONE) {
$aExtraParams['creation_in_modal_is_allowed'] = true;
if (!$this->oAttDef->GetReadOnly() && $this->oAttDef->GetEditMode() != LINKSET_EDITMODE_NONE) {
$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');";
} else {
$aExtraParams['creation_disallowed'] = true;
}
return $aExtraParams;
@@ -69,30 +72,42 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
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+',
'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']);",
'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
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'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']);",
'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:ActionRow:Delete',
'tooltip' => 'UI:Links:ActionRow:Delete+',
'label' => 'UI:Links:Delete:Button',
'name' => 'DeleteButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_DELETE_BUTTON_TOOLTIP),
'icon_classes' => 'fas fa-trash',
'color' => Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
'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",
'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(),
],
);
@@ -100,19 +115,25 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
$aRowActions[] = array(
'label' => 'UI:Links:ActionRow:Modify',
'tooltip' => 'UI:Links:ActionRow:Modify+',
'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']);",
'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:ActionRow:Detach',
'tooltip' => 'UI:Links:ActionRow:Detach+',
'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);",
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DetachLinkedObject', aRowData['{$this->sTargetClass}/_key_/raw'], oTrElement, oTrElement);",
'confirmation' => [
'message' => 'UI:Links:ActionRow:Detach:Confirmation',
'message_row_data' => "{$this->sTargetClass}/hyperlink",
'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(),
],
);