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

@@ -37,7 +37,8 @@ class Set extends AbstractInput
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/input/set/layout';
public const DEFAULT_JS_FILES_REL_PATH = [
'js/links/links_set_worker.js',
'js/links/links-set-worker.js',
'js/object/object-worker.js',
'js/selectize/plugin_combodo_add_button.js',
'js/selectize/plugin_combodo_auto_position.js',
'js/selectize/plugin_combodo_update_operations.js',

View File

@@ -36,8 +36,8 @@ abstract class AbstractBlockLinksViewTable extends UIContentBlock
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'application/links/layout';
public const DEFAULT_JS_FILES_REL_PATH = [
'js/links/links_view_table_widget.js',
'js/links/links_set_worker.js',
'js/objects/objects_worker.js',
'js/links/links-set-worker.js',
'js/object/object-worker.js',
'js/wizardhelper.js',
];

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);