diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 84dd69a4b..71455900e 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -976,7 +976,7 @@ HTML FormHelper::DisableAttributeBlobInputs($this->sTargetClass, $aFormExtraParams); if(FormHelper::HasMandatoryAttributeBlobInputs($oNewObj)){ - $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal()); + $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), $aFormExtraParams); diff --git a/application/ui.linksdirectwidget.class.inc.php b/application/ui.linksdirectwidget.class.inc.php index a3ed0a4d8..aeaa817d4 100644 --- a/application/ui.linksdirectwidget.class.inc.php +++ b/application/ui.linksdirectwidget.class.inc.php @@ -145,7 +145,7 @@ JS FormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams); if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){ - $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal()); + $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aFormExtraParams); diff --git a/dictionaries/ui/application/object/cs.dictionary.itop.object.php b/dictionaries/ui/application/object/cs.dictionary.itop.object.php index 282b2ceb9..a46ff03a2 100644 --- a/dictionaries/ui/application/object/cs.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/cs.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/da.dictionary.itop.object.php b/dictionaries/ui/application/object/da.dictionary.itop.object.php index 959419313..5d89e3b05 100644 --- a/dictionaries/ui/application/object/da.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/da.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/de.dictionary.itop.object.php b/dictionaries/ui/application/object/de.dictionary.itop.object.php index a95f8c016..6ef14c428 100644 --- a/dictionaries/ui/application/object/de.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/de.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Object:Modal:Title' => 'Ein Objekt erstellen', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/en.dictionary.itop.object.php b/dictionaries/ui/application/object/en.dictionary.itop.object.php index 7cf687207..1113adf93 100644 --- a/dictionaries/ui/application/object/en.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/en.dictionary.itop.object.php @@ -19,5 +19,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:Object:Modal:Title' => 'Create an object', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php b/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php index 5ad65e4c8..bc9d62afa 100644 --- a/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/es_cr.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/fr.dictionary.itop.object.php b/dictionaries/ui/application/object/fr.dictionary.itop.object.php index 792babcc9..7b254ca75 100644 --- a/dictionaries/ui/application/object/fr.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/fr.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('FR FR', 'French', 'Français', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui n\'est pas supporté en mode pop-up. La création/modification de cet objet risque d\'être incomplète et pourra être complété dans un formulaire en pleine page.', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être renseigné en mode pop-up. La création de cet objet sera incomplète et pourra être complétée dans un formulaire en pleine page.', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être renseigné en mode pop-up. Cet objet est incomplet, il peut être complété dans un formulaire en pleine page.', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être modifié en mode pop-up.', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/hu.dictionary.itop.object.php b/dictionaries/ui/application/object/hu.dictionary.itop.object.php index a560ec76b..ab8574f8a 100644 --- a/dictionaries/ui/application/object/hu.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/hu.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/it.dictionary.itop.object.php b/dictionaries/ui/application/object/it.dictionary.itop.object.php index ab9669d04..972ea841b 100644 --- a/dictionaries/ui/application/object/it.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/it.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/ja.dictionary.itop.object.php b/dictionaries/ui/application/object/ja.dictionary.itop.object.php index cf384f357..b4c85de69 100644 --- a/dictionaries/ui/application/object/ja.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/ja.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/nl.dictionary.itop.object.php b/dictionaries/ui/application/object/nl.dictionary.itop.object.php index 69f069982..5f29fb1ae 100644 --- a/dictionaries/ui/application/object/nl.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/nl.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/pl.dictionary.itop.object.php b/dictionaries/ui/application/object/pl.dictionary.itop.object.php index 80e8c71a1..55ca5209d 100644 --- a/dictionaries/ui/application/object/pl.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/pl.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('PL PL', 'Polish', 'Polski', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php b/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php index 8bb1a9327..2091f4a93 100644 --- a/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/pt_br.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/ru.dictionary.itop.object.php b/dictionaries/ui/application/object/ru.dictionary.itop.object.php index 68ef89486..573d73e56 100644 --- a/dictionaries/ui/application/object/ru.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/ru.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/sk.dictionary.itop.object.php b/dictionaries/ui/application/object/sk.dictionary.itop.object.php index 86588dbdb..f0c0c195c 100644 --- a/dictionaries/ui/application/object/sk.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/sk.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/tr.dictionary.itop.object.php b/dictionaries/ui/application/object/tr.dictionary.itop.object.php index 8c54de0a3..23d1c6784 100644 --- a/dictionaries/ui/application/object/tr.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/tr.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php b/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php index 49d3d2038..6d882f966 100644 --- a/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php +++ b/dictionaries/ui/application/object/zh_cn.dictionary.itop.object.php @@ -18,5 +18,7 @@ */ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Object:Modal:Title' => 'Create an object~~', - 'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~', + 'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~', + 'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~', )); \ No newline at end of file diff --git a/sources/Application/Helper/FormHelper.php b/sources/Application/Helper/FormHelper.php index 8d775f6b5..c9d22425f 100644 --- a/sources/Application/Helper/FormHelper.php +++ b/sources/Application/Helper/FormHelper.php @@ -25,6 +25,11 @@ use utils; */ class FormHelper { + public const ENUM_MANDATORY_BLOB_MODE_CREATE = 'Create'; + public const ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY = 'Modify'; + public const ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED = 'Modify:Filled'; + + /** * DisableAttributeBlobInputs. * @@ -58,6 +63,26 @@ class FormHelper } } + /** + * Returns an attribute code if the object has a mandatory attribute blob, null otherwise + * + * @see N°6861 - Display warning when creating/editing a mandatory blob in modal + * + * @param \DBObject $oObject + * + * @return string|null + * @throws \CoreException + */ + public static function GetMandatoryAttributeBlobInputs(DBObject $oObject) + { + foreach (MetaModel::ListAttributeDefs(get_class($oObject)) as $sAttCode => $oAttDef) { + if ($oAttDef instanceof AttributeBlob && (!$oAttDef->IsNullAllowed() || ($oObject->GetFormAttributeFlags($sAttCode) & OPT_ATT_MANDATORY))) { + return $sAttCode; + } + } + return null; + } + /** * Returns true if the object has a mandatory attribute blob * @@ -70,25 +95,29 @@ class FormHelper */ public static function HasMandatoryAttributeBlobInputs(DBObject $oObject): bool { - foreach (MetaModel::ListAttributeDefs(get_class($oObject)) as $sAttCode => $oAttDef) { - if ($oAttDef instanceof AttributeBlob && (!$oAttDef->IsNullAllowed() || ($oObject->GetFormAttributeFlags($sAttCode) & OPT_ATT_MANDATORY))) { - return true; - } - } - return false; + return self::GetMandatoryAttributeBlobInputs($oObject) !== null; } /** * Returns an Alert explaining what will happen when a mandatory attribute blob is displayed in a form * * @see N°6861 - Display warning when creating/editing a mandatory blob in modal + * @see self::ENUM_MANDATORY_BLOB_MODE_XXX + * + * @param string $sMode * * @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert */ - public static function GetAlertForMandatoryAttributeBlobInputsInModal(): Alert + public static function GetAlertForMandatoryAttributeBlobInputsInModal(string $sMode = self::ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY): Alert { - $oAlert = AlertUIBlockFactory::MakeForWarning('',Dict::S('UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text')); - return $oAlert; + $sMessage = Dict::S('UI:Object:Modal:'.$sMode.':MandatoryAttributeBlobInputs:Warning:Text'); + + // If the mandatory attribute is already filled, there's no risk to make an object incomplete so we display an information level alert + if($sMode === self::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED){ + return AlertUIBlockFactory::MakeForInformation('', $sMessage); + } + + return AlertUIBlockFactory::MakeForWarning('', $sMessage); } /** diff --git a/sources/Controller/Base/Layout/ObjectController.php b/sources/Controller/Base/Layout/ObjectController.php index 7ead393ce..ccd5cfe51 100644 --- a/sources/Controller/Base/Layout/ObjectController.php +++ b/sources/Controller/Base/Layout/ObjectController.php @@ -171,7 +171,7 @@ JS; FormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams); if(FormHelper::HasMandatoryAttributeBlobInputs($oObjToClone)){ - $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal()); + $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } $aFormExtraParams['js_handlers']['cancel_button_on_click'] = @@ -210,13 +210,14 @@ JS } return $oPage; } - + /** * @return \iTopWebPage|\AjaxPage Object edit form in its webpage * @throws \ApplicationException * @throws \ArchivedObjectException * @throws \CoreException * @throws \SecurityException + * @throws \Exception */ public function OperationModify() { @@ -298,7 +299,14 @@ JS; FormHelper::DisableAttributeBlobInputs($sClass, $aFormExtraParams); if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){ - $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal()); + $sMandatoryBlobAttCode = FormHelper::GetMandatoryAttributeBlobInputs($oObj); + $sAlertFormMandatoryAttMessageMode = FormHelper::ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY; + $oMandatoryBlobAttCodeValue = $oObj->Get($sMandatoryBlobAttCode); + // If the current value of the mandatory attribute is not empty, display a different message + if($oMandatoryBlobAttCodeValue instanceof \ormDocument && !$oMandatoryBlobAttCodeValue->IsEmpty()){ + $sAlertFormMandatoryAttMessageMode = FormHelper::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED; + } + $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal($sAlertFormMandatoryAttMessageMode)); } } else { $oPage = new iTopWebPage('', $bPrintable); diff --git a/sources/Controller/Links/LinkSetController.php b/sources/Controller/Links/LinkSetController.php index 3b8836bfd..95616f634 100644 --- a/sources/Controller/Links/LinkSetController.php +++ b/sources/Controller/Links/LinkSetController.php @@ -230,7 +230,7 @@ JS FormHelper::DisableAttributeBlobInputs($sRealClass, $aExtraParams); if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){ - $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal()); + $oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE)); } cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aExtraParams);