N°5976 - Add modal creation for linksets displayed with tagset-like widget (#469)

This commit is contained in:
Stephen Abello
2023-03-31 10:32:07 +02:00
committed by GitHub
parent a80506b8e8
commit 2758aaaa89
15 changed files with 253 additions and 111 deletions

View File

@@ -59,18 +59,14 @@ class LinksSetUIBlockFactory extends SetUIBlockFactory
// Set UI block for OQL
$oSetUIBlock = SetUIBlockFactory::MakeForOQL($sId, $sTargetClass, $oAttDef->GetValuesDef()->GetFilterExpression(), $sWizardHelperJsVarName);
$oSetUIBlock->AddJsFileRelPath('js/links/links_set.js');
$oSetUIBlock->AddJsFileRelPath('js/links/links-set.js');
// Remove add button for 3_1_lot1
// Linkset controller OperationCreateLinkedObject need the host object to exist, so if we are in creation of the host object (id=-1) the linked object creation doesn't work.
//
// // Add button behaviour
// if (in_array($oAttDef->GetEditMode(), [LINKSET_EDITMODE_ADDREMOVE, LINKSET_EDITMODE_ADDONLY, LINKSET_EDITMODE_INPLACE, LINKSET_EDITMODE_ACTIONS])
// && $oHostDbObject !== null) {
// $sHostClass = get_class($oHostDbObject);
// $oSetUIBlock->SetHasAddOptionButton(true);
// $oSetUIBlock->SetAddOptionButtonJsOnClick("CombodoLinkSet.CreateLinkedObject('{$oAttDef->GetLinkedClass()}', '{$oAttDef->GetCode()}', '{$sHostClass}', '{$oHostDbObject->GetKey()}', '{$sTargetField}', '{$sTargetClass}', oWidget{$oSetUIBlock->GetId()} );");
// }
// Add button behaviour
if (in_array($oAttDef->GetEditMode(), [LINKSET_EDITMODE_ADDREMOVE, LINKSET_EDITMODE_ADDONLY, LINKSET_EDITMODE_INPLACE, LINKSET_EDITMODE_ACTIONS])
&& $oHostDbObject !== null) {
$oSetUIBlock->SetHasAddOptionButton(true);
$oSetUIBlock->SetAddOptionButtonJsOnClick("iTopLinkSet.CreateLinkedObject('{$sTargetClass}', oWidget{$oSetUIBlock->GetId()} );");
}
// Current value
$aCurrentValues = LinkSetDataTransformer::Decode($oDbObjectSet, $sTargetClass, $sTargetField);