diff --git a/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php b/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php index 4d8b86a58..9b4f82a18 100644 --- a/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php +++ b/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanel.php @@ -63,8 +63,6 @@ class ActivityPanel extends UIBlock protected $bAreEntriesSorted; /** @var bool $bHasLifecycle True if the host object has a lifecycle */ protected $bHasLifecycle; - /** @var \Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm\CaseLogEntryForm $oActivityTabEntryForm New entry form for the activity tab which is different from the case log tabs */ - protected $oActivityTabEntryForm; /** @var \Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm\CaseLogEntryForm[] $aCaseLogTabsEntryForms */ protected $aCaseLogTabsEntryForms; @@ -532,6 +530,23 @@ class ActivityPanel extends UIBlock return !empty($this->aCaseLogTabsEntryForms[$sCaseLogId]); } + /** + * Whether the submission of the case logs present in the activity panel is autonomous or will be handled by another form + * + * @return bool + */ + public function IsCaseLogsSubmitAutonomous(): bool + { + $bIsAutonomous = true; + + foreach ($this->GetCaseLogTabsEntryForms() as $oCaseLogEntryForm) { + $bIsAutonomous = $oCaseLogEntryForm->IsSubmitAutonomous(); + break; + } + + return $bIsAutonomous; + } + /** * Return true if the host object has a lifecycle * @@ -554,42 +569,6 @@ class ActivityPanel extends UIBlock return $oDateTimeFormat->ToMomentJS(); } - /** - * Return the entry form for the activity tab - * - * @see $oActivityTabEntryForm - * @return \Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm\CaseLogEntryForm - */ - public function GetActivityTabEntryForm(): CaseLogEntryForm - { - return $this->oActivityTabEntryForm; - } - - /** - * Set the entry form for the activity tab - * - * @param \Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm\CaseLogEntryForm $oCaseLogEntryForm - * @see $oActivityTabEntryForm - * - * @return $this - * - */ - public function SetActivityTabEntryForm(CaseLogEntryForm $oCaseLogEntryForm) - { - $this->oActivityTabEntryForm = $oCaseLogEntryForm; - return $this; - } - - /** - * Return true is there is an entry form for the activity tab - * - * @return bool - */ - public function HasActivityTabEntryForm() - { - return $this->oActivityTabEntryForm !== null; - } - /** * @inheritdoc */ @@ -601,11 +580,6 @@ class ActivityPanel extends UIBlock $aSubBlocks[$oCaseLogEntryForm->GetId()] = $oCaseLogEntryForm; } - if ($this->HasActivityTabEntryForm()) { - $oNewEntryForm = $this->GetActivityTabEntryForm(); - $aSubBlocks[$oNewEntryForm->GetId()] = $oNewEntryForm; - } - return $aSubBlocks; } } \ No newline at end of file diff --git a/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php b/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php index 494e0dd92..0e747a984 100644 --- a/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php +++ b/sources/application/UI/Base/Layout/ActivityPanel/ActivityPanelFactory.php @@ -90,12 +90,6 @@ class ActivityPanelFactory } } - // Activity tab entry form is only in view mode - // As caselog tabs input will be attached to the main object form and submit button hidden, we can't have an entry form in the activity tab as it's not for a specific caselog - if($sMode === cmdbAbstractObject::ENUM_OBJECT_MODE_VIEW) { - $oActivityPanel->SetActivityTabEntryForm(CaseLogEntryFormFactory::MakeForActivityTab($oObject, $sMode)); - } - // Retrieve history changes (including case logs entries) // - Prepare query to retrieve changes $oChangesSearch = DBObjectSearch::FromOQL('SELECT CMDBChangeOp WHERE objclass = :obj_class AND objkey = :obj_key'); diff --git a/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryFormFactory.php b/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryFormFactory.php index 5691522c9..bacba7a04 100644 --- a/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryFormFactory.php +++ b/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryFormFactory.php @@ -43,18 +43,6 @@ class CaseLogEntryFormFactory return $oCaseLogEntryForm; } - public static function MakeForActivityTab(DBObject $oObject, string $sObjectMode = cmdbAbstractObject::DEFAULT_OBJECT_MODE) - { - $oCaseLogEntryForm = new CaseLogEntryForm(); - $oCaseLogEntryForm->SetSubmitModeFromHostObjectMode($sObjectMode) - ->AddMainActionButtons(static::PrepareCancelButton()) - ->AddMainActionButtons(static::PrepareSendButton()->SetLabel(Dict::S('UI:Button:AddEntryToWithChoice'))); - - $oCaseLogEntryForm->SetSendButtonPopoverMenu(static::PrepareTargetCaseLogSelectionPopoverMenu($oObject)); - - return $oCaseLogEntryForm; - } - /** * @return \Combodo\iTop\Application\UI\Base\Component\Button\Button */ @@ -122,43 +110,6 @@ JS } } - - return $oMenu; - } - - /** - * Return a PopoverMenu with the list of the caselog attributes of $oObject - * - * @param \DBObject $oObject - * - * @return \Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu - * @throws \CoreException - * @throws \Exception - */ - protected static function PrepareTargetCaseLogSelectionPopoverMenu(DBObject $oObject): PopoverMenu - { - $sObjClass = get_class($oObject); - - $oMenu = new PopoverMenu(); - $sSectionId = 'target-caselogs'; - $oMenu->AddSection($sSectionId); - - $sCaseLogEntryFormDataRole = CaseLogEntryForm::BLOCK_CODE; - - foreach(MetaModel::GetCaseLogs($sObjClass) as $sCaseLogAttCode) { - $oMenuItem = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem( - new JSPopupMenuItem( - CaseLogEntryForm::BLOCK_CODE.'--target-caselog--'.$sCaseLogAttCode, - MetaModel::GetLabel($sObjClass, $sCaseLogAttCode), - <<AddItem($sSectionId, $oMenuItem); - } - return $oMenu; } } \ No newline at end of file diff --git a/templates/base/layouts/activity-panel/layout.html.twig b/templates/base/layouts/activity-panel/layout.html.twig index 888b28e62..25dc369af 100644 --- a/templates/base/layouts/activity-panel/layout.html.twig +++ b/templates/base/layouts/activity-panel/layout.html.twig @@ -81,18 +81,11 @@ - {% if oUIBlock.HasActivityTabEntryForm() %} -
- {{ render_block(oUIBlock.GetActivityTabEntryForm()) }} -
- {% endif %} - {% if oUIBlock.HasActivityTabEntryForm() %} - {% if oUIBlock.GetActivityTabEntryForm().IsSubmitAutonomous() %} - - {% endif %} + {% if oUIBlock.IsCaseLogsSubmitAutonomous() %} + {% endif %}
{% if oUIBlock.GetGroupedEntries()|length > 0 %} diff --git a/templates/base/layouts/activity-panel/print.html.twig b/templates/base/layouts/activity-panel/print.html.twig index 75c90821f..700e4152d 100644 --- a/templates/base/layouts/activity-panel/print.html.twig +++ b/templates/base/layouts/activity-panel/print.html.twig @@ -35,19 +35,9 @@
- {% if oUIBlock.HasActivityTabEntryForm() %} -
- {{ render_block(oUIBlock.GetActivityTabEntryForm()) }} -
- {% endif %} - {% if oUIBlock.HasActivityTabEntryForm() %} - {% if oUIBlock.GetActivityTabEntryForm().IsSubmitAutonomous() %} - - {% endif %} - {% endif %}
{% if oUIBlock.GetGroupedEntries()|length > 0 %} {% for aEntryGroup in oUIBlock.GetGroupedEntries() %}