Merge branch 'support/3.2' into develop

This commit is contained in:
odain
2025-11-07 20:33:14 +01:00
1837 changed files with 33034 additions and 34549 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -125,14 +126,13 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
private function Init()
{
$this->sTargetClass = $this->GetTargetClass();
// User rights
$this->bIsAllowCreate = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_CREATE) == UR_ALLOWED_YES;
$this->bIsAllowModify = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_MODIFY) == UR_ALLOWED_YES;
$this->bIsAllowDelete = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_DELETE) == UR_ALLOWED_YES;
}
/**
* @param string $sKey
* @param \DBObject|null $oDBObject
@@ -143,12 +143,16 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
*/
public function GetDictionaryEntry(string $sKey, DBObject $oDBObject = null)
{
return $this->oAttDef->SearchSpecificLabel($sKey, '', true,
return $this->oAttDef->SearchSpecificLabel(
$sKey,
'',
true,
MetaModel::GetName($this->sObjectClass),
$this->oDbObject->Get('friendlyname'),
$this->oAttDef->GetLabel(),
MetaModel::GetName($this->sTargetClass),
$oDBObject !== null ? $oDBObject->Get('friendlyname') : '{item}');
$oDBObject !== null ? $oDBObject->Get('friendlyname') : '{item}'
);
}
/**
@@ -205,9 +209,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
$oBlock = new DisplayBlock($oLinkSet->GetFilter(), DisplayBlock::ENUM_STYLE_LIST_IN_OBJECT, false);
$this->AddSubBlock($oBlock->GetRenderContent($oPage, $aExtraParams, $this->sTableId));
}
/**
* GetTableId.
*
@@ -239,7 +241,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
* @throws ArchivedObjectException
* @throws CoreException
*/
abstract function GetExtraParam(): array;
abstract public function GetExtraParam(): array;
/**
* Return row actions.
@@ -250,7 +252,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
*
* @return string[][]
*/
abstract function GetRowActions(): array;
abstract public function GetRowActions(): array;
/**
* GetTargetClass.
@@ -260,8 +262,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
* @return string
* @throws Exception
*/
abstract function GetTargetClass(): string;
abstract public function GetTargetClass(): string;
/**
* GetAttCode.
@@ -302,4 +303,4 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
{
return "oWidget{$this->GetId()}";
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -93,10 +94,10 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
$this->oUILinksDirectWidget = $oUILinksDirectWidget;
// compute
$this->aLabels = array(
$this->aLabels = [
'creation_title' => Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())),
'selection_title' => Dict::Format('UI:SelectionOf_Class', MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())),
);
];
$oContext = new ApplicationContext();
$this->sSubmitUrl = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?'.$oContext->GetForLink();
@@ -182,8 +183,7 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
$oTablePanel->AddToolbarBlock($oToolbar);
$oTablePanel->AddSubBlock($oDatatable);
$this->AddSubBlock($oTablePanel);
}
catch (\Exception $e) {
} catch (\Exception $e) {
$oAlert = AlertUIBlockFactory::MakeForDanger('error', Dict::S('UI:Datatables:Language:Error'));
$oAlert->SetIsClosable(false);
$oAlert->SetIsCollapsible(false);
@@ -217,20 +217,20 @@ 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->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);
}
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);
}
if ($this->bIsAllowDelete) {
$oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Delete'));
$oActionButtonDelete->AddDataAttribute('action', 'delete')
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');");
$oToolbar->AddSubBlock($oActionButtonDelete);
}
if ($this->bIsAllowDelete) {
$oActionButtonDelete = ButtonUIBlockFactory::MakeNeutral(Dict::S('UI:Button:Delete'));
$oActionButtonDelete->AddDataAttribute('action', 'delete')
->SetOnClickJsCode("$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('deleteSelection');");
$oToolbar->AddSubBlock($oActionButtonDelete);
}
break;
case LINKSET_EDITMODE_ADDREMOVE: // The whole linkset can be edited 'in-place'
@@ -273,14 +273,14 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
private function GetTableRows(WebPage $oPage, iDBObjectSetIterator $oValue): array
{
// result data
$aRows = array();
$aRows = [];
// set pointer to start
$oValue->Rewind();
// create a row table for each value...
while ($oLinkObj = $oValue->Fetch()) {
$aRow = array();
$aRow = [];
$aRow['form::select'] = '<input type="checkbox" class="selectList'.$this->oUILinksDirectWidget->GetInputId().'" onClick="oWidget'.$this->oUILinksDirectWidget->GetInputId().'.directlinks(\'instance\')._onSelectChange();" value="'.$oLinkObj->GetKey().'"/>';
foreach ($this->oUILinksDirectWidget->GetZList() as $sLinkedAttCode) {
$aRow[$sLinkedAttCode] = $oLinkObj->GetAsHTML($sLinkedAttCode);
@@ -307,19 +307,27 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
*/
private function GetRowActions(DBObject $oHostObject): array
{
$aRowActions = array();
$aRowActions = [];
$sDeleteButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel('UI:Links:Delete:Button+', '', true,
$sDeleteButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel(
'UI:Links:Delete:Button+',
'',
true,
MetaModel::GetName($this->oAttributeLinkedSet->GetHostClass()),
$oHostObject->Get('friendlyname'),
$this->oAttributeLinkedSet->GetLabel(),
MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass()));
MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())
);
$sRemoveButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel('UI:Links:Remove:Button+', '', true,
$sRemoveButtonTooltip = $this->oAttributeLinkedSet->SearchSpecificLabel(
'UI:Links:Remove:Button+',
'',
true,
MetaModel::GetName($this->oAttributeLinkedSet->GetHostClass()),
$oHostObject->Get('friendlyname'),
$this->oAttributeLinkedSet->GetLabel(),
MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass()));
MetaModel::GetName($this->oUILinksDirectWidget->GetLinkedClass())
);
// until a full link set refactoring (continue using edit_mode property)
switch ($this->oAttributeLinkedSet->GetEditMode()) {
@@ -331,24 +339,24 @@ 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));",
);
}
if ($this->bIsAllowDelete) {
$aRowActions[] = [
'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'
if ($this->bIsAllowModify) {
$aRowActions[] = array(
$aRowActions[] = [
'label' => 'UI:Links:Remove:Button',
'tooltip' => $sRemoveButtonTooltip,
'icon_classes' => 'fas fa-minus',
'js_row_action' => "$('#{$this->oUILinksDirectWidget->GetInputId()}').directlinks('Remove', $(':checkbox', oTrElement));",
);
];
}
break;
@@ -358,4 +366,4 @@ class BlockDirectLinkSetEditTable extends UIContentBlock
return $aRowActions;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -31,7 +32,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
/** @inheritdoc * */
public function GetExtraParam(): array
{
$aExtraParams = array(
$aExtraParams = [
'target_attr' => $this->oAttDef->GetExtKeyToMe(),
'object_id' => $this->oDbObject->GetKey(),
'menu' => MetaModel::GetConfig()->Get('allow_menu_on_linkset'),
@@ -41,7 +42,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'currentId' => $this->GetTableId(),
'panel_title' => $this->oAttDef->GetLabel(),
'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false),
);
];
// Description
if ($this->oAttDef->HasDescription()) {
@@ -65,7 +66,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
/** @inheritdoc * */
public function GetRowActions(): array
{
$aRowActions = array();
$aRowActions = [];
// until a full link set refactoring (continue using edit_mode property)
switch ($this->oAttDef->GetEditMode()) {
@@ -74,7 +75,7 @@ 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
if ($this->bIsAllowModify) {
$aRowActions[] = array(
$aRowActions[] = [
'label' => 'UI:Links:ModifyObject:Button',
'name' => 'ModifyButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP),
@@ -83,47 +84,14 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'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',
'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->bIsAllowDelete) {
$aRowActions[] = array(
'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' => [
'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'
if ($this->bIsAllowModify) {
$aRowActions[] = array(
$aRowActions[] = [
'label' => 'UI:Links:ModifyObject:Button',
'name' => 'ModifyButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_BUTTON_TOOLTIP),
@@ -132,11 +100,44 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'metadata' => [
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_OBJECT_MODAL_TITLE),
],
);
];
}
if ($this->bIsAllowDelete) {
$aRowActions[] = [
'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' => [
'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'
if ($this->bIsAllowModify) {
$aRowActions[] = [
'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(
$aRowActions[] = [
'label' => 'UI:Links:Remove:Button',
'name' => 'RemoveButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
@@ -148,7 +149,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'row_data' => "{$this->sTargetClass}/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
];
}
break;
@@ -169,7 +170,7 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
*/
private function GetDefault(): array
{
$aDefaults = array($this->oAttDef->GetExtKeyToMe() => $this->oDbObject->GetKey());
$aDefaults = [$this->oAttDef->GetExtKeyToMe() => $this->oDbObject->GetKey()];
$oAppContext = new \ApplicationContext();
foreach ($oAppContext->GetNames() as $sKey) {
if (MetaModel::IsValidAttCode($this->sObjectClass, $sKey)) {
@@ -179,4 +180,4 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
return $aDefaults;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -149,7 +150,7 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock
$this->sWizHelper = 'oWizardHelper'.$sFormPrefix;
$oValue->Rewind();
$bAllowRemoteExtKeyEdit = $oValue->Count() <= utils::GetConfig()->Get('link_set_max_edit_ext_key');
$aForm = array();
$aForm = [];
$iMaxAddedId = 0;
$iAddedId = -1; // Unique id for new links
$this->aRemoved = json_decode(\utils::ReadPostedParam("attr_{$sFormPrefix}{$this->oUILinksWidget->GetAttCode()}_tbd", '[]', 'raw_data'), true);
@@ -174,7 +175,8 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock
$sAttCode = substr($sName, strlen($sPrefix));
$oCurrentLink->Set($sAttCode, $sValue);
$sEscapedValue = addslashes($sValue);
$oPage->add_ready_script(<<<EOF
$oPage->add_ready_script(
<<<EOF
oWidget{$this->oUILinksWidget->GetInputId()}.OnValueChange($sCurrentLinkId, $iAddedId, "$sAttCode", "$sEscapedValue");
EOF
);
@@ -190,8 +192,6 @@ EOF
$oLinkedObj = MetaModel::GetObject($this->oUILinksWidget->GetRemoteClass(), $oCurrentLink->Get($this->oUILinksWidget->GetExternalKeyToRemote()), false /* Must not be found */, true);
}
$iMaxAddedId = max($iMaxAddedId, $key);
$aForm[$key] = $this->GetFormRow($oPage, $oLinkedObj, $oCurrentLink, $aArgs, $oCurrentObj, $key, $bReadOnly, $bAllowRemoteExtKeyEdit);
}
@@ -267,8 +267,8 @@ EOF
public function GetFormRow(WebPage $oP, DBObject $oLinkedObj, $linkObjOrId, $aArgs, $oCurrentObj, $iUniqueId, $bReadOnly = false, $bAllowRemoteExtKeyEdit = true)
{
$sPrefix = "{$this->oUILinksWidget->GetAttCode()}{$this->oUILinksWidget->GetNameSuffix()}";
$aRow = array();
$aFieldsMap = array();
$aRow = [];
$aFieldsMap = [];
$iKey = 0;
if (is_object($linkObjOrId) && (!$linkObjOrId->IsNew())) {
@@ -299,23 +299,30 @@ EOF
}
$sState = $linkObjOrId->GetState();
$sRemoteKeySafeFieldId = $this->GetFieldId($aArgs['this']->GetKey(), $this->oUILinksWidget->GetExternalKeyToRemote());;
$sRemoteKeySafeFieldId = $this->GetFieldId($aArgs['this']->GetKey(), $this->oUILinksWidget->GetExternalKeyToRemote());
;
} else {
// form for creating a new record
if (is_object($linkObjOrId)) {
// New link existing only in memory
$oNewLinkObj = $linkObjOrId;
$iRemoteObjKey = $oNewLinkObj->Get($this->oUILinksWidget->GetExternalKeyToRemote());
$oNewLinkObj->Set($this->oUILinksWidget->GetExternalKeyToMe(),
$oCurrentObj); // Setting the extkey with the object also fills the related external fields
$oNewLinkObj->Set(
$this->oUILinksWidget->GetExternalKeyToMe(),
$oCurrentObj
); // Setting the extkey with the object also fills the related external fields
} else {
$iRemoteObjKey = $linkObjOrId;
$oNewLinkObj = MetaModel::NewObject($this->oUILinksWidget->GetLinkedClass());
$oRemoteObj = MetaModel::GetObject($this->oUILinksWidget->GetRemoteClass(), $iRemoteObjKey);
$oNewLinkObj->Set($this->oUILinksWidget->GetExternalKeyToRemote(),
$oRemoteObj); // Setting the extkey with the object alsoo fills the related external fields
$oNewLinkObj->Set($this->oUILinksWidget->GetExternalKeyToMe(),
$oCurrentObj); // Setting the extkey with the object also fills the related external fields
$oNewLinkObj->Set(
$this->oUILinksWidget->GetExternalKeyToRemote(),
$oRemoteObj
); // Setting the extkey with the object alsoo fills the related external fields
$oNewLinkObj->Set(
$this->oUILinksWidget->GetExternalKeyToMe(),
$oCurrentObj
); // Setting the extkey with the object also fills the related external fields
}
$sPrefix .= "[-$iUniqueId][";
$sNameSuffix = "]"; // To make a tabular form
@@ -328,20 +335,21 @@ EOF
if ($iUniqueId > 0) {
// Rows created with ajax call need OnLinkAdded call.
//
$oP->add_ready_script(
<<<EOF
$oP->add_ready_script(
<<<EOF
PrepareWidgets();
oWidget{$this->oUILinksWidget->GetInputId()}.OnLinkAdded($iUniqueId, $iRemoteObjKey);
EOF
);
);
} else {
// Rows added before loading the form don't have to call OnLinkAdded.
// Listeners are already present and DOM is not recreated
$iPositiveUniqueId = -$iUniqueId;
$oP->add_ready_script(<<<EOF
$oP->add_ready_script(
<<<EOF
oWidget{$this->oUILinksWidget->GetInputId()}.AddLink($iPositiveUniqueId, $iRemoteObjKey);
EOF
);
);
}
foreach ($this->oUILinksWidget->GetEditableFields() as $sFieldCode) {
@@ -353,11 +361,11 @@ EOF
$aFieldsMap[$sFieldCode] = $sSafeFieldId;
$sValue = $oNewLinkObj->Get($sFieldCode);
$oP->add_ready_script(
<<<JS
$oP->add_ready_script(
<<<JS
oWidget{$this->oUILinksWidget->GetInputId()}.OnValueChange($iKey, $iUniqueId, '$sFieldCode', '$sValue');
JS
);
);
}
$sState = '';
@@ -439,17 +447,17 @@ JS
$sFieldForHtml = $oAttDef->GetAsHTML($sValue);
} else {
$sFieldForHtml = cmdbAbstractObject::GetFormElementForField(
$oP,
$this->oUILinksWidget->GetLinkedClass(),
$sFieldCode,
$oAttDef,
$sValue,
$sDisplayValue,
$sSafeFieldId,
$sNameSuffix,
0,
$aArgs
);
$oP,
$this->oUILinksWidget->GetLinkedClass(),
$sFieldCode,
$oAttDef,
$sValue,
$sDisplayValue,
$sSafeFieldId,
$sNameSuffix,
0,
$aArgs
);
}
$aRow[$sRowFieldCode] = <<<HTML
@@ -494,24 +502,28 @@ JS
*/
private function GetRowActions(DBObject $oHostObject): array
{
$aRowActions = array();
$aRowActions = [];
$sRemoveButtonTooltip = $this->oAttributeLinkedSetIndirect->SearchSpecificLabel('UI:Links:Remove:Button+', '', true,
$sRemoveButtonTooltip = $this->oAttributeLinkedSetIndirect->SearchSpecificLabel(
'UI:Links:Remove:Button+',
'',
true,
MetaModel::GetName($this->oAttributeLinkedSetIndirect->GetHostClass()),
$oHostObject->Get('friendlyname'),
$this->oAttributeLinkedSetIndirect->GetLabel(),
MetaModel::GetName($this->oUILinksWidget->GetRemoteClass()));
MetaModel::GetName($this->oUILinksWidget->GetRemoteClass())
);
if ($this->bIsAllowDelete) {
$aRowActions[] = array(
$aRowActions[] = [
'label' => 'UI:Links:Remove:Button',
'tooltip' => $sRemoveButtonTooltip,
'icon_classes' => 'fas fa-minus',
'js_row_action' => "oWidget{$this->oUILinksWidget->GetInputId()}.Remove(oTrElement);",
);
];
}
return $aRowActions;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -29,8 +30,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
$oLinkingAttDef = MetaModel::GetAttributeDef($this->oAttDef->GetLinkedClass(), $this->oAttDef->GetExtKeyToRemote());
return $oLinkingAttDef->GetTargetClass();
}
catch (Exception $e) {
} catch (Exception $e) {
return '?';
}
}
@@ -38,7 +38,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
/** @inheritdoc */
public function GetExtraParam(): array
{
$aExtraParams = array(
$aExtraParams = [
'link_attr' => $this->oAttDef->GetExtKeyToMe(),
'object_id' => $this->oDbObject->GetKey(),
'target_attr' => $this->oAttDef->GetExtKeyToRemote(),
@@ -52,7 +52,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'currentId' => $this->GetTableId(),
'panel_title' => $this->oAttDef->GetLabel(),
'panel_icon' => MetaModel::GetClassIcon($this->GetTargetClass(), false),
);
];
// Description
if ($this->oAttDef->HasDescription()) {
@@ -60,7 +60,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
}
// Add creation in modal if creation allowed
if ( $this->bIsAllowCreate) {
if ($this->bIsAllowCreate) {
$aExtraParams['creation_in_modal'] = true;
$aExtraParams['creation_in_modal_tooltip'] = $this->GetDictionaryEntry(static::DICT_ADD_BUTTON_TOOLTIP);
$aExtraParams['creation_in_modal_form_title'] = $this->GetDictionaryEntry(static::DICT_ADD_MODAL_TITLE);
@@ -75,10 +75,10 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
/** @inheritdoc */
public function GetRowActions(): array
{
$aRowActions = array();
$aRowActions = [];
if ($this->bIsAllowModify) {
$aRowActions[] = array(
$aRowActions[] = [
'label' => 'UI:Links:ModifyLink:Button',
'name' => 'ModifyButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_BUTTON_TOOLTIP),
@@ -87,11 +87,11 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'metadata' => [
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_MODAL_TITLE),
],
);
];
}
if ($this->bIsAllowDelete) {
$aRowActions[] = array(
$aRowActions[] = [
'label' => 'UI:Links:Remove:Button',
'name' => 'RemoveButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
@@ -103,7 +103,7 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
'row_data' => "Remote/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
];
}
return $aRowActions;
@@ -126,4 +126,4 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
return $sAttCodesToDisplay;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -54,4 +55,4 @@ class BlockObjectPickerDialog extends UIContentBlock
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("count_{$this->oUILinksWidget->GetLinkedSetId()}", '0', "count_{$this->oUILinksWidget->GetLinkedSetId()}"));
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -50,7 +51,6 @@ class BlockLinkSetDisplayAsProperty extends UIContentBlock
/** @var string $sUIPage UI page */
private string $sUIPage;
/**
* Constructor.
*
@@ -133,7 +133,7 @@ class BlockLinkSetDisplayAsProperty extends UIContentBlock
// Friendly name
$sFriendlyNameForHtml = utils::HtmlEntities($aItem['friendlyname']);
// Full description
$sFullDescriptionForHtml = utils::HtmlEntities($aItem['full_description']);
@@ -163,4 +163,4 @@ class BlockLinkSetDisplayAsProperty extends UIContentBlock
."pages/$this->sUIPage?operation=details&class=$this->sTargetClass&id=$id$this->sAppContext"
.'" target="_self"';
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -39,7 +40,6 @@ use iDBObjectSetIterator;
*/
class LinkSetUIBlockFactory extends SetUIBlockFactory
{
/**
* Make a link set block.
*
@@ -131,4 +131,4 @@ class LinkSetUIBlockFactory extends SetUIBlockFactory
return $oSetUIBlock;
}
}
}