From 335f4aa83b061918a8fccc27636ac3bcf91f0cc3 Mon Sep 17 00:00:00 2001 From: Thomas Draier Date: Fri, 4 Aug 2023 09:14:12 +0200 Subject: [PATCH] BACKLOG-21361: Replaced most of systemName adapter by override (#924) --- .../ContentEditor/adaptSystemNameField.js | 35 +-------- .../adaptSystemNameField.spec.js | 77 ------------------- .../ContentEditor/useCreateFormDefinition.js | 7 +- .../ContentEditor/useEditFormDefinition.js | 7 +- .../api/forms/EditorFormServiceImpl.java | 37 +++++---- .../api/forms/FormGenerator.java | 2 +- .../api/forms/StaticDefinitionsRegistry.java | 28 +++++-- .../contenteditor/api/forms/model/Field.java | 8 +- .../api/forms/model/FieldSet.java | 8 +- .../utils/ContentEditorUtils.java | 10 +++ .../forms/jmix_systemNameReadonly.json | 1 + .../forms/jnt_page.json | 20 +++++ .../forms/nt_base.json | 6 +- .../resources/jcontent_en.properties | 6 ++ .../forms/cent_contentRetrievalCETest.json | 2 +- 15 files changed, 108 insertions(+), 146 deletions(-) delete mode 100644 src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.spec.js create mode 100644 src/main/resources/META-INF/jahia-content-editor-forms/forms/jnt_page.json diff --git a/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js b/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js index 1ed15ddc5..0f603709d 100644 --- a/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js +++ b/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.js @@ -1,5 +1,4 @@ import {Constants} from '~/ContentEditor/ContentEditor.constants'; -import {decodeSystemName} from '~/ContentEditor/utils'; const isContentOrFileNode = formData => { const pattern = '^/sites/[^/]*/(contents|files)$'; @@ -10,47 +9,17 @@ const isContentOrFileNode = formData => { }; // TODO completely get rid of this adapter -export const adaptSystemNameField = (rawData, formData, t, primaryNodeType, isCreate, readOnlyByMixin) => { +export const adaptSystemNameField = (formData, primaryNodeType) => { const systemNameField = formData.sections .flatMap(section => section.fieldSets) .flatMap(fieldSet => fieldSet.fields) .find(field => field.name.endsWith('_' + Constants.systemName.propertyName)); if (systemNameField) { - systemNameField.name = Constants.systemName.name; - - // Add i18ns label to field / should be in json field definition - systemNameField.displayName = t('jcontent:label.contentEditor.section.fieldSet.system.fields.systemName'); - - // Add description to the field / should be in json field definition, with specific overrides per "read only mixin" - // Parameterized resource bundles not supported yet - systemNameField.description = readOnlyByMixin ? - t('jcontent:label.contentEditor.section.fieldSet.system.fields.systemNameDescriptionReadOnly') : - t('jcontent:label.contentEditor.section.fieldSet.system.fields.systemNameDescription', {maxNameSize: window.contextJsParameters.config.maxNameSize}); - - // Add max name size validation / should be in json field definition - systemNameField.selectorOptions = [ - { - name: 'maxLength', - value: window.contextJsParameters.config.maxNameSize - } - ]; - // System name should be readonly for this specific nodetypes / should be in json overrides - if (readOnlyByMixin || - Constants.systemName.READONLY_FOR_NODE_TYPES.includes(primaryNodeType.name) || - isContentOrFileNode(formData) || - (!isCreate && !formData.nodeData.hasWritePermission) || - formData.nodeData.lockedAndCannotBeEdited) { + if (Constants.systemName.READONLY_FOR_NODE_TYPES.includes(primaryNodeType.name) || isContentOrFileNode(formData)) { systemNameField.readOnly = true; } } - - // Set initial value for system name / should be move to getInitialValues - if (isCreate) { - formData.initialValues[Constants.systemName.name] = rawData.jcr.result.newName; - } else { - formData.initialValues[Constants.systemName.name] = decodeSystemName(rawData.jcr.result.name); - } }; diff --git a/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.spec.js b/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.spec.js deleted file mode 100644 index 5223c16d2..000000000 --- a/src/javascript/ContentEditor/ContentEditor/adaptSystemNameField.spec.js +++ /dev/null @@ -1,77 +0,0 @@ -import {adaptSystemNameField} from './adaptSystemNameField'; -import {Constants} from '~/ContentEditor/ContentEditor.constants'; - -const t = val => val; - -describe('adaptFormData', () => { - let formData; - let rawData; - beforeEach(() => { - window.contextJsParameters = { - config: { - maxNameSize: 50 - } - }; - - formData = { - initialValues: [], - sections: [ - { - name: 'content', - fieldSets: [ - { - name: 'jnt:news', - fields: [] - } - ] - }, - { - name: 'options', - fieldSets: [ - { - name: 'nt:base', - fields: [ - { - name: Constants.systemName.name, - propertyName: Constants.systemName.propertyName, - readOnly: false, - selectorOptions: [{ - name: 'description-i18n-key', - value: 'jcontent:label.section.fieldSet.fields.systemNameDescription' - }] - } - ] - } - ] - } - ], - nodeData: { - hasWritePermission: true - }, - technicalInfo: [ - {label: 'Main content type', value: 'Folder'}, - {label: 'Full content type', value: 'jnt:folder'}, - {label: 'Path', value: '/sites/digitall/toto'}, - {label: 'UUID', value: '1c5ec63b-efa8-4e28-abb7-e60026cb8e3e'} - ] - }; - - rawData = { - jcr: { - result: { - newName: 'newName', - name: 'name' - } - } - }; - }); - - it('sets labels and initial data correctly', () => { - adaptSystemNameField(rawData, formData, t, 'nt:any', false, true); - expect(formData.sections[1].fieldSets[0].fields[0].displayName).toEqual('jcontent:label.contentEditor.section.fieldSet.system.fields.systemName'); - expect(formData.initialValues[Constants.systemName.name]).toEqual(rawData.jcr.result.name); - - adaptSystemNameField(rawData, formData, t, 'nt:any', true, true); - expect(formData.initialValues[Constants.systemName.name]).toEqual(rawData.jcr.result.newName); - }); -}); diff --git a/src/javascript/ContentEditor/ContentEditor/useCreateFormDefinition.js b/src/javascript/ContentEditor/ContentEditor/useCreateFormDefinition.js index 6547f0d43..e0e82eb3a 100644 --- a/src/javascript/ContentEditor/ContentEditor/useCreateFormDefinition.js +++ b/src/javascript/ContentEditor/ContentEditor/useCreateFormDefinition.js @@ -11,8 +11,11 @@ import {useFormDefinition} from '~/ContentEditor/ContentEditor/useFormDefinition const getInitialValues = (sections, nodeData) => { // Work in progress default value const wipInfo = {[Constants.wip.fieldName]: {status: nodeData.defaultWipInfo.status, languages: nodeData.defaultWipInfo.languages}}; + + const name = {[Constants.systemName.name]: nodeData.newName}; + // Retrieve fields and the return object contains the field name as the key and the field value as the value - return {...getFields(sections).reduce((result, field) => ({...result, ...getFieldValuesFromDefaultValues(field)}), {}), ...wipInfo}; + return {...getFields(sections).reduce((result, field) => ({...result, ...getFieldValuesFromDefaultValues(field)}), {}), ...wipInfo, ...name}; }; /** @@ -41,7 +44,7 @@ export const adaptCreateFormData = (data, lang, t, contentEditorConfigContext) = nodeTypeName: data.jcr.nodeTypeByName.name }; - adaptSystemNameField(data, formData, t, data.jcr.nodeTypeByName, true); + adaptSystemNameField(formData, data.jcr.nodeTypeByName); if (contentEditorConfigContext.name) { formData.initialValues[Constants.systemName.name] = contentEditorConfigContext.name; diff --git a/src/javascript/ContentEditor/ContentEditor/useEditFormDefinition.js b/src/javascript/ContentEditor/ContentEditor/useEditFormDefinition.js index 0a4effbd0..dd7a3d31c 100644 --- a/src/javascript/ContentEditor/ContentEditor/useEditFormDefinition.js +++ b/src/javascript/ContentEditor/ContentEditor/useEditFormDefinition.js @@ -7,6 +7,7 @@ import {adaptSections, getExpandedSections} from '~/ContentEditor/ContentEditor/ import {getFieldValuesFromDefaultValues} from '~/ContentEditor/ContentEditor/getFieldValuesFromDefaultValues'; import {EditFormQuery} from '~/ContentEditor/ContentEditor/edit.gql-queries'; import {useFormDefinition} from '~/ContentEditor/ContentEditor/useFormDefinitions'; +import {decodeSystemName} from '../utils'; // TODO https://jira.jahia.org/browse/TECH-300 @@ -31,8 +32,10 @@ const getInitialValues = (nodeData, sections) => { wipInfo[Constants.wip.fieldName] = {status: nodeData.defaultWipInfo.status, languages: nodeData.defaultWipInfo.languages}; } + const name = {[Constants.systemName.name]: decodeSystemName(nodeData.name)}; + // Return object contains fields and dynamic fieldSets - return {...nodeValues, ...extendsMixinFieldsDefaultValues, ...dynamicFieldSets, ...childrenOrderingFields, ...wipInfo}; + return {...nodeValues, ...extendsMixinFieldsDefaultValues, ...dynamicFieldSets, ...childrenOrderingFields, ...wipInfo, ...name}; }; const getChildrenOrderingFields = (nodeData, dynamicFieldSets) => { @@ -162,7 +165,7 @@ export const adaptEditFormData = (data, lang, t) => { nodeTypeName: nodeData.primaryNodeType.name }; - adaptSystemNameField(data, formData, t, nodeData.primaryNodeType, false, nodeData.isSystemNameReadOnlyMixin); + adaptSystemNameField(formData, nodeData.primaryNodeType); return formData; }; diff --git a/src/main/java/org/jahia/modules/contenteditor/api/forms/EditorFormServiceImpl.java b/src/main/java/org/jahia/modules/contenteditor/api/forms/EditorFormServiceImpl.java index 9d25b9db2..9ab1abf69 100644 --- a/src/main/java/org/jahia/modules/contenteditor/api/forms/EditorFormServiceImpl.java +++ b/src/main/java/org/jahia/modules/contenteditor/api/forms/EditorFormServiceImpl.java @@ -36,6 +36,7 @@ import org.jahia.services.content.nodetypes.initializers.ChoiceListInitializer; import org.jahia.services.content.nodetypes.initializers.ChoiceListInitializerService; import org.jahia.services.content.nodetypes.initializers.ChoiceListValue; +import org.jahia.settings.SettingsBean; import org.jahia.utils.i18n.Messages; import org.osgi.framework.Bundle; import org.osgi.service.component.annotations.Component; @@ -196,6 +197,11 @@ private Form getEditorForm(ExtendedNodeType primaryNodeType, JCRNodeWrapper exis boolean forceReadOnly = field.getExtendedPropertyDefinition() != null && field.getExtendedPropertyDefinition().isInternationalized() ? !i18nFieldsEditable : !sharedFieldsEditable; field.setReadOnly((field.isReadOnly() != null && field.isReadOnly()) || forceReadOnly); + if (field.getSelectorOptionsMap() != null && field.getSelectorOptionsMap().size() > 0) { + field.setSelectorOptionsMap(field.getSelectorOptionsMap().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, entry -> SettingsBean.getInstance().replaceBySubsitutor((String) entry.getValue())))); + } + if (field.getValueConstraints() != null && field.getExtendedPropertyDefinition() != null) { List valueConstraints = getValueConstraints(primaryNodeType, field, existingNode, parentNode, locale, new HashMap<>()); if (valueConstraints != null && !valueConstraints.isEmpty()) { @@ -245,25 +251,24 @@ public static String resolveResourceKey(String key, Locale locale, JCRSiteNode s return key; } logger.debug("Resources key: {}", key); - String baseName = null; - String value; - if (key.contains("@")) { - if (key.contains("resources.")) { - baseName = StringUtils.substringAfter(key, "@"); - key = StringUtils.substringBefore(key, "@"); - } else { - baseName = StringUtils.substringBefore(key, "@"); - key = StringUtils.substringAfter(key, "@"); - } + String osgiBundleName = null; + + if (key.contains(":")) { + osgiBundleName = StringUtils.substringBefore(key, ":"); + key = StringUtils.substringAfter(key, ":"); } - value = Messages.get(baseName, site != null ? site.getTemplatePackage() : null, key, locale, StringUtils.EMPTY); - if (StringUtils.isEmpty(value) && baseName != null) { - JahiaTemplatesPackage jahiaTemplatesPackage = ServicesRegistry.getInstance().getJahiaTemplateManagerService().getTemplatePackageRegistry().lookupById(baseName); - value = Messages.get(baseName, jahiaTemplatesPackage, key, locale, StringUtils.EMPTY); - } else if (value == null) { - value = Messages.getInternal(key, locale); + // First lookup in site templates (with dependencies and internal resources) + String value = Messages.get(null, site.getTemplatePackage(), key, locale, StringUtils.EMPTY); + + if (StringUtils.isEmpty(value) && osgiBundleName != null) { + // Then look in module resources (with dependencies and internal resources) + JahiaTemplatesPackage jahiaTemplatesPackage = ServicesRegistry.getInstance().getJahiaTemplateManagerService().getTemplatePackageRegistry().lookupById(osgiBundleName); + value = Messages.get(null, jahiaTemplatesPackage, key, locale, StringUtils.EMPTY); } + // Replace placeholders in labels + value = SettingsBean.getInstance().replaceBySubsitutor(value); + return value; } diff --git a/src/main/java/org/jahia/modules/contenteditor/api/forms/FormGenerator.java b/src/main/java/org/jahia/modules/contenteditor/api/forms/FormGenerator.java index a51be665c..b1e11574a 100644 --- a/src/main/java/org/jahia/modules/contenteditor/api/forms/FormGenerator.java +++ b/src/main/java/org/jahia/modules/contenteditor/api/forms/FormGenerator.java @@ -141,7 +141,7 @@ public static Field generateEditorFormField(ExtendedItemDefinition itemDefinitio String errorMessageKey = itemDefinition.getResourceBundleKey() + ".constraint.error.message"; if (itemDefinition.getDeclaringNodeType().getTemplatePackage() != null) { - errorMessageKey += "@" + itemDefinition.getDeclaringNodeType().getTemplatePackage().getResourceBundleName(); + errorMessageKey = itemDefinition.getDeclaringNodeType().getTemplatePackage().getName() + ":" + errorMessageKey; } String selectorType = SelectorType.nameFromValue(propertyDefinition.getSelector()); diff --git a/src/main/java/org/jahia/modules/contenteditor/api/forms/StaticDefinitionsRegistry.java b/src/main/java/org/jahia/modules/contenteditor/api/forms/StaticDefinitionsRegistry.java index 5c710df28..b3a028ccc 100644 --- a/src/main/java/org/jahia/modules/contenteditor/api/forms/StaticDefinitionsRegistry.java +++ b/src/main/java/org/jahia/modules/contenteditor/api/forms/StaticDefinitionsRegistry.java @@ -24,12 +24,11 @@ package org.jahia.modules.contenteditor.api.forms; import com.fasterxml.jackson.databind.ObjectMapper; -import org.jahia.modules.contenteditor.api.forms.model.Field; -import org.jahia.modules.contenteditor.api.forms.model.FieldSet; -import org.jahia.modules.contenteditor.api.forms.model.Form; -import org.jahia.modules.contenteditor.api.forms.model.Section; +import org.jahia.modules.contenteditor.api.forms.model.*; +import org.jahia.modules.contenteditor.utils.ContentEditorUtils; import org.jahia.services.content.nodetypes.ExtendedNodeType; import org.jahia.services.content.nodetypes.NodeTypeRegistry; +import org.jetbrains.annotations.Nullable; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; @@ -139,8 +138,14 @@ public void registerForm(URL editorFormURL, Bundle bundle) { for (FieldSet fieldSet : section.getFieldSets()) { initFieldSet(fieldSet, bundle); } + + section.setLabelKey(ContentEditorUtils.getLabelKey(section.getLabelKey(), bundle)); + section.setDescriptionKey(ContentEditorUtils.getLabelKey(section.getDescriptionKey(), bundle)); } + form.setLabelKey(ContentEditorUtils.getLabelKey(form.getLabelKey(), bundle)); + form.setDescriptionKey(ContentEditorUtils.getLabelKey(form.getDescriptionKey(), bundle)); + forms.add(form); formsByBundle.computeIfAbsent(bundle, b -> new ArrayList<>()).add(form); logger.info("Successfully loaded static form for name {} from {}", form.getNodeType().getName(), editorFormURL); @@ -196,6 +201,10 @@ private static void initFieldSet(FieldSet fieldSet, Bundle originBundle) { if (fieldSet.getPriority() == null) { fieldSet.setPriority(1.); } + + fieldSet.setLabelKey(ContentEditorUtils.getLabelKey(fieldSet.getLabelKey(), originBundle)); + fieldSet.setDescriptionKey(ContentEditorUtils.getLabelKey(fieldSet.getDescriptionKey(), originBundle)); + for (Field field : fieldSet.getFields()) { try { if (field.getDeclaringNodeType() != null) { @@ -205,8 +214,17 @@ private static void initFieldSet(FieldSet fieldSet, Bundle originBundle) { } catch (NoSuchNodeTypeException e) { throw new RuntimeException(e); } + + field.setLabelKey(ContentEditorUtils.getLabelKey(field.getLabelKey(), originBundle)); + field.setDescriptionKey(ContentEditorUtils.getLabelKey(field.getDescriptionKey(), originBundle)); + field.setErrorMessageKey(ContentEditorUtils.getLabelKey(field.getErrorMessageKey(), originBundle)); + + if (field.getValueConstraints() != null) { + for (FieldValueConstraint valueConstraint : field.getValueConstraints()) { + valueConstraint.setDisplayValueKey(ContentEditorUtils.getLabelKey(valueConstraint.getDisplayValueKey(), originBundle)); + } + } } } - } diff --git a/src/main/java/org/jahia/modules/contenteditor/api/forms/model/Field.java b/src/main/java/org/jahia/modules/contenteditor/api/forms/model/Field.java index 625729905..2de2cb969 100644 --- a/src/main/java/org/jahia/modules/contenteditor/api/forms/model/Field.java +++ b/src/main/java/org/jahia/modules/contenteditor/api/forms/model/Field.java @@ -245,11 +245,11 @@ public void initializeLabel(Locale uiLocale, JCRSiteNode site, ExtendedNodeType } private void initializeLabelFromItemDefinition(ExtendedItemDefinition definition, Locale uiLocale, JCRSiteNode site, ExtendedNodeType nodeType) { - String suffix = nodeType.getTemplatePackage() != null ? "@" + nodeType.getTemplatePackage().getResourceBundleName() : ""; + String prefix = nodeType.getTemplatePackage() != null ? nodeType.getTemplatePackage().getBundle().getSymbolicName() + ":" : ""; String key = definition.getResourceBundleKey(nodeType); - label = StringUtils.isEmpty(label) ? StringEscapeUtils.unescapeHtml(resolveResourceKey(key + suffix, uiLocale, site)) : label; - description = StringUtils.isEmpty(description) ? Sanitizers.FORMATTING.sanitize(resolveResourceKey(key + ".ui.tooltip" + suffix, uiLocale, site)) : description; - errorMessage = StringUtils.isEmpty(errorMessage)? Sanitizers.FORMATTING.sanitize(resolveResourceKey(key + ".constraint.error.message" + suffix, uiLocale, site)) : errorMessage; + label = StringUtils.isEmpty(label) ? StringEscapeUtils.unescapeHtml(resolveResourceKey(prefix + key, uiLocale, site)) : label; + description = StringUtils.isEmpty(description) ? Sanitizers.FORMATTING.sanitize(resolveResourceKey(prefix + key + ".ui.tooltip", uiLocale, site)) : description; + errorMessage = StringUtils.isEmpty(errorMessage)? Sanitizers.FORMATTING.sanitize(resolveResourceKey(prefix + key + ".constraint.error.message", uiLocale, site)) : errorMessage; } public void mergeWith(Field otherField) { diff --git a/src/main/java/org/jahia/modules/contenteditor/api/forms/model/FieldSet.java b/src/main/java/org/jahia/modules/contenteditor/api/forms/model/FieldSet.java index af33a29a8..51244a289 100644 --- a/src/main/java/org/jahia/modules/contenteditor/api/forms/model/FieldSet.java +++ b/src/main/java/org/jahia/modules/contenteditor/api/forms/model/FieldSet.java @@ -197,13 +197,13 @@ public void initializeLabel(Locale uiLocale, JCRSiteNode site) { description = description == null && descriptionKey != null ? resolveResourceKey(descriptionKey, uiLocale, site) : description; if (nodeType != null) { - String suffix = nodeType.getTemplatePackage() != null ? "@" + nodeType.getTemplatePackage().getResourceBundleName() : ""; + String prefix = nodeType.getTemplatePackage() != null ? nodeType.getTemplatePackage().getBundle().getSymbolicName() + ":" : ""; String key = JCRContentUtils.replaceColon(nodeType.getName()); - label = StringUtils.isEmpty(label) ? StringEscapeUtils.unescapeHtml(resolveResourceKey(key + suffix, uiLocale, site)) : label; - description = StringUtils.isEmpty(description) ? Sanitizers.FORMATTING.sanitize(resolveResourceKey(key + ".ui.tooltip" + suffix, uiLocale, site)) : description; + label = StringUtils.isEmpty(label) ? StringEscapeUtils.unescapeHtml(resolveResourceKey(prefix + key, uiLocale, site)) : label; + description = StringUtils.isEmpty(description) ? Sanitizers.FORMATTING.sanitize(resolveResourceKey(prefix + key + ".ui.tooltip", uiLocale, site)) : description; label = StringUtils.isEmpty(label) ? StringUtils.substringAfter(nodeType.getName(), ":") : label; - description = StringUtils.isEmpty(description) ? Sanitizers.FORMATTING.sanitize(resolveResourceKey(key + "_description" + suffix, uiLocale, site)) : description; + description = StringUtils.isEmpty(description) ? Sanitizers.FORMATTING.sanitize(resolveResourceKey(prefix + key + "_description", uiLocale, site)) : description; } } diff --git a/src/main/java/org/jahia/modules/contenteditor/utils/ContentEditorUtils.java b/src/main/java/org/jahia/modules/contenteditor/utils/ContentEditorUtils.java index af13bc7bd..524bddf91 100644 --- a/src/main/java/org/jahia/modules/contenteditor/utils/ContentEditorUtils.java +++ b/src/main/java/org/jahia/modules/contenteditor/utils/ContentEditorUtils.java @@ -35,6 +35,7 @@ import org.jahia.services.content.nodetypes.ExtendedNodeType; import org.jahia.services.content.nodetypes.NodeTypeRegistry; import org.jahia.utils.LanguageCodeConverters; +import org.osgi.framework.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pl.touk.throwing.ThrowingConsumer; @@ -177,4 +178,13 @@ public static JCRNodeWrapper resolveNodeFromPathorUUID(String uuidOrPath, Locale } } + public static String getLabelKey(String key, Bundle originBundle) { + if (!StringUtils.isEmpty(key) && !key.contains(":") && originBundle != null) { + return originBundle.getSymbolicName() + ":" + key; + } + + return key; + } + + } diff --git a/src/main/resources/META-INF/jahia-content-editor-forms/forms/jmix_systemNameReadonly.json b/src/main/resources/META-INF/jahia-content-editor-forms/forms/jmix_systemNameReadonly.json index fbd65ad14..f350aa6d4 100644 --- a/src/main/resources/META-INF/jahia-content-editor-forms/forms/jmix_systemNameReadonly.json +++ b/src/main/resources/META-INF/jahia-content-editor-forms/forms/jmix_systemNameReadonly.json @@ -11,6 +11,7 @@ "fields": [ { "name": "ce:systemName", + "descriptionKey": "jcontent:label.contentEditor.section.fieldSet.system.fields.systemNameDescriptionReadOnly", "readOnly": true } ] diff --git a/src/main/resources/META-INF/jahia-content-editor-forms/forms/jnt_page.json b/src/main/resources/META-INF/jahia-content-editor-forms/forms/jnt_page.json new file mode 100644 index 000000000..c0529c526 --- /dev/null +++ b/src/main/resources/META-INF/jahia-content-editor-forms/forms/jnt_page.json @@ -0,0 +1,20 @@ +{ + "nodeType": "jnt:page", + "priority": 3.0, + "sections": [ + { + "name": "content", + "fieldSets": [ + { + "name": "
", + "fields": [ + { + "name": "ce:systemName", + "descriptionKey": "label.contentEditor.section.fieldSet.system.fields.systemNameDescriptionPage" + } + ] + } + ] + } + ] +} diff --git a/src/main/resources/META-INF/jahia-content-editor-forms/forms/nt_base.json b/src/main/resources/META-INF/jahia-content-editor-forms/forms/nt_base.json index e4961e122..f439810bb 100644 --- a/src/main/resources/META-INF/jahia-content-editor-forms/forms/nt_base.json +++ b/src/main/resources/META-INF/jahia-content-editor-forms/forms/nt_base.json @@ -41,9 +41,13 @@ { "rank": 0.0, "name": "ce:systemName", - "descriptionKey": "", + "labelKey": "label.contentEditor.section.fieldSet.system.fields.systemName", + "descriptionKey": "label.contentEditor.section.fieldSet.system.fields.systemNameDescription", "requiredType": "String", "selectorType": "SystemName", + "selectorOptionsMap": { + "maxLength": "${jahia:jahia.jcr.maxNameSize}" + }, "i18n": false, "readOnly": false, "multiple": false, diff --git a/src/main/resources/resources/jcontent_en.properties b/src/main/resources/resources/jcontent_en.properties index 800cdd47f..388aab567 100644 --- a/src/main/resources/resources/jcontent_en.properties +++ b/src/main/resources/resources/jcontent_en.properties @@ -4,3 +4,9 @@ label.permission.additionalAccordionAccess.description=Display the "Additional" label.permission.contentFolderAccordionAccess.description=Display the "Content folders" accordion in jContent label.permission.mediaAccordionAccess.description=Display the "Media" accordion in jContent label.permission.pagesAccordionAccess.description=Display the "Pages" accordion in jContent + +label.contentEditor.section.fieldSet.system.displayName=System +label.contentEditor.section.fieldSet.system.fields.systemName=System name +label.contentEditor.section.fieldSet.system.fields.systemNameDescription=${jahia:jahia.jcr.maxNameSize} characters maximum. +label.contentEditor.section.fieldSet.system.fields.systemNameDescriptionPage=${jahia:jahia.jcr.maxNameSize} characters maximum. Used to build the URL for pages if no vanity URL is set in advanced options. +label.contentEditor.section.fieldSet.system.fields.systemNameDescriptionReadOnly=The system name cannot be changed. diff --git a/tests/jahia-module/src/main/resources/META-INF/jahia-content-editor-forms/forms/cent_contentRetrievalCETest.json b/tests/jahia-module/src/main/resources/META-INF/jahia-content-editor-forms/forms/cent_contentRetrievalCETest.json index 98fa276d1..f5bf227c7 100644 --- a/tests/jahia-module/src/main/resources/META-INF/jahia-content-editor-forms/forms/cent_contentRetrievalCETest.json +++ b/tests/jahia-module/src/main/resources/META-INF/jahia-content-editor-forms/forms/cent_contentRetrievalCETest.json @@ -20,7 +20,7 @@ "rank": 5.0, "name": "jcr:title", "declaringNodeType": "mix:title", - "labelKey": "content-editor-test-module@label.textoverride", + "labelKey": "content-editor-test-module:label.textoverride", "descriptionKey": "label.information" } ]