diff --git a/Utilities/FormImport/import.py b/Utilities/FormImport/import.py index 1d7f666677..4846cb9f05 100644 --- a/Utilities/FormImport/import.py +++ b/Utilities/FormImport/import.py @@ -583,6 +583,7 @@ def range_value_handler(self, questionnaire, row, datetime_limit): DefaultHeaders["REGIONS"] = HeaderColumn("regions", "regions") DefaultHeaders["SEARCH_PLACES_AROUND"] = HeaderColumn("searchPlacesAround", "searchPlacesAround") DefaultHeaders["TYPE_PROPERTY"] = HeaderColumn("type", "type") +DefaultHeaders["FORM_MODE_PROPERTY"] = HeaderColumn("formMode", "formMode") DefaultHeaders["VALIDATION_ERROR_TEXT"] = HeaderColumn("validationErrorText", "validationErrorText") DefaultHeaders["IS_RANGE"] = HeaderColumn("isRange", "isRange", boolean_handler) diff --git a/modules/data-entry/src/main/frontend/src/questionnaire/FormEntry.jsx b/modules/data-entry/src/main/frontend/src/questionnaire/FormEntry.jsx index d744885730..b76462bc65 100644 --- a/modules/data-entry/src/main/frontend/src/questionnaire/FormEntry.jsx +++ b/modules/data-entry/src/main/frontend/src/questionnaire/FormEntry.jsx @@ -142,8 +142,13 @@ let displaySection = (sectionDefinition, path, depth, existingAnswer, key, onCha } let displayInformation = (infoDefinition, key, classes, pageActive, isEdit, gridProps) => { + let isVisible = ( + (!infoDefinition.formMode || infoDefinition.formNode == "edit") && isEdit + || infoDefinition.formMode == "view" && !isEdit + || infoDefinition.formMode == "any" + ); return ( - isEdit && pageActive && infoDefinition.text && + isVisible && pageActive && infoDefinition.text && diff --git a/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information-hints.json b/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information-hints.json index 3e7e91ec78..113a91137e 100644 --- a/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information-hints.json +++ b/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information-hints.json @@ -1,4 +1,5 @@ { - "type": "Enables rendering the information card with a different styling depending on the nature and purpose of the info displayed:\n* **plain** is a card with no distinct background,\n* **info** sets a blue background,\n* **warning** sets an orange background,\n* **error** sets a red background,\n* **success** sets a green background." + "type": "Enables rendering the information card with a different styling depending on the nature and purpose of the info displayed:\n* **plain** is a card with no distinct background,\n* **info** sets a blue background,\n* **warning** sets an orange background,\n* **error** sets a red background,\n* **success** sets a green background.", + "formMode": "Whether the inforrmation box gets displayed when the form is in **edit** mode (default), in **view** mode, or in **any** mode." } diff --git a/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information.json b/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information.json index 49651a3bed..fbd82ef5c9 100644 --- a/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information.json +++ b/modules/data-entry/src/main/frontend/src/questionnaireEditor/Information.json @@ -7,6 +7,11 @@ "error": {}, "success" : {} }, + "formMode" : { + "edit": {}, + "view": {}, + "any" : {} + }, "text": "markdown" } ] diff --git a/modules/data-model/forms/api/src/main/resources/SLING-INF/nodetypes/forms.cnd b/modules/data-model/forms/api/src/main/resources/SLING-INF/nodetypes/forms.cnd index dc92e265f5..6505354350 100644 --- a/modules/data-model/forms/api/src/main/resources/SLING-INF/nodetypes/forms.cnd +++ b/modules/data-model/forms/api/src/main/resources/SLING-INF/nodetypes/forms.cnd @@ -253,8 +253,8 @@ + * (cards:ExternalLink) = cards:ExternalLink //----------------------------------------------------------------------------- -// An informative formatted text (markdown) displayed in edit mode to guide -// the user through filling out a form. +// An informative formatted text (markdown). Can be displayed in edit mode to guide +// the user through filling out a form, or in view mode to explain the data. [cards:Information] > sling:Folder, mix:referenceable // Attributes @@ -277,6 +277,10 @@ // success (green). Optional, defaults to plain styling when absent. - type (string) + // The form mode specifies when the Information is displayed: in "edit" mode, in "view" mode + // mode, or in "any" mode. Defaults to "edit" when absent. + - formMode (string) + //----------------------------------------------------------------------------- // A section is a collection of questions. [cards:Section] > sling:Folder, mix:referenceable