diff --git a/pages/UI.php b/pages/UI.php index ae4356c81..70ca8eafd 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -343,8 +343,6 @@ try switch($operation) { case 'new': // Form to create a new object - case 'apply_new': // Creation of a new object - case 'apply_modify': // Applying the modifications to an existing object case 'form_for_modify_all': // Form to modify multiple objects (bulk modify) case 'bulk_stimulus': // For to apply a stimulus to multiple objects case 'stimulus': // Form displayed when applying a stimulus (state change) diff --git a/sources/Controller/Base/Layout/ObjectController.php b/sources/Controller/Base/Layout/ObjectController.php index 1cf9a9b74..e9706641b 100644 --- a/sources/Controller/Base/Layout/ObjectController.php +++ b/sources/Controller/Base/Layout/ObjectController.php @@ -140,6 +140,7 @@ JS; } else { $oPage = new iTopWebPage('', $bPrintable); $oPage->DisableBreadCrumb(); + $this->AddRequiredForModificationJsFilesToPage($oPage); } $sClass = utils::ReadPostedParam('class', '', 'class'); @@ -265,8 +266,8 @@ JS; if ($this->IsHandlingXmlHttpRequest()) { $aResult['data'] = ['error_message' => $e->getHtmlMessage()]; } else { - $sObjKey = $oObj->GetKey(); - $sClassIcon = MetaModel::GetClassIcon($sClass, false); + $sClassLabel = MetaModel::GetName($sClass); + $sClassIcon = MetaModel::GetClassIcon($sClass); $sHeaderTitle = Dict::Format('UI:CreationTitle_Class', $sClassLabel); $oPage->set_title(Dict::Format('UI:CreationPageTitle_Class', $sClassLabel)); @@ -277,7 +278,8 @@ JS; $sWarnings = implode(', ', $aWarnings); $oPage->AddHeaderMessage($sWarnings, 'message_warning'); } - cmdbAbstractObject::DisplayCreationForm($oPage, $sClass, $oObj, [], ['transaction_id' => $sTransactionId]); + $oPage->SetContentLayout(PageContentFactory::MakeForObjectDetails($oObj, cmdbAbstractObject::ENUM_DISPLAY_MODE_CREATE)); + cmdbAbstractObject::DisplayCreationForm($oPage, $sClass, $oObj, [], ['transaction_id' => $sTransactionId, 'wizard_container' => 1, 'keep_source_object' => true]); } } } @@ -308,6 +310,7 @@ JS; } else { $oPage = new iTopWebPage('', $bPrintable); $oPage->DisableBreadCrumb(); + $this->AddRequiredForModificationJsFilesToPage($oPage); } $sClass = utils::ReadPostedParam('class', '', 'class'); @@ -510,6 +513,20 @@ JS; return $oPage; } + /** + * Add some JS files that are required during the modification of an object + * + * @param \iTopWebPage $oPage + * + * @return void + */ + protected function AddRequiredForModificationJsFilesToPage(iTopWebPage &$oPage): void + { + foreach (static::EnumRequiredForModificationJsFilesRelPaths() as $sJsFileRelPath) { + $oPage->add_linked_script("../$sJsFileRelPath"); + } + } + /** * @return string[] Rel. paths (to iTop root folder) of required JS files for object modification (create, edit, stimulus, ...) */