From 311d5001304519225f2d0bd85d53c29df15a5a52 Mon Sep 17 00:00:00 2001 From: Ikshu Jain Date: Sun, 2 Aug 2026 20:09:41 +0530 Subject: [PATCH 1/2] FORMS-26490: Adobe Sign Block SP24 --- .../internal/form/FormConstants.java | 3 + .../models/v1/form/AdobeSignBlockImpl.java | 122 +++++++++++++++ .../components/models/form/FieldType.java | 1 + .../form/adobesignblock/.content.xml | 7 + .../form/adobesignblock/_cq_template.xml | 8 + .../settings/wcm/policies/.content.xml | 4 +- .../samples/adobesignblock/.content.xml | 7 + ui.af.apps/pom.xml | 3 + .../.content.xml | 5 + .../core-forms-adobesign-placeholder/css.txt | 2 + .../css/adobesignplaceholder.css | 52 ++++++ .../resources/images/checkbox.svg | 16 ++ .../resources/images/dropdown_chevron.svg | 12 ++ .../resources/images/radiobutton.svg | 18 +++ .../.content.xml | 2 +- .../v1/adobesignblock/.content.xml | 10 ++ .../v1/adobesignblock/_cq_dialog/.content.xml | 148 ++++++++++++++++++ .../v1/adobesignblock/_cq_editConfig.xml | 101 ++++++++++++ .../v1/adobesignblock/_cq_template.xml | 8 + .../v1/adobesignblock/adobesignblock.html | 43 +++++ .../v1/adobesignblock/clientlibs/.content.xml | 4 + .../clientlibs/editor/.content.xml | 5 + .../clientlibs/site/.content.xml | 7 + .../v1/adobesignblock/clientlibs/site/css.txt | 2 + .../site/css/adobesignblockview.css | 65 ++++++++ .../v1/adobesignblock/clientlibs/site/js.txt | 2 + .../clientlibs/site/js/adobesignblockview.js | 120 ++++++++++++++ .../site/resources/images/checkbox.svg | 16 ++ .../resources/images/dropdown_chevron.svg | 12 ++ .../site/resources/images/radiobutton.svg | 18 +++ .../editorhook/js/toolbaractionhook.js | 17 +- 31 files changed, 833 insertions(+), 7 deletions(-) create mode 100644 bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/AdobeSignBlockImpl.java create mode 100644 examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/.content.xml create mode 100644 examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/_cq_template.xml create mode 100644 it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/adobesignblock/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-adobesign-placeholder/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-adobesign-placeholder/css.txt create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-adobesign-placeholder/css/adobesignplaceholder.css create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-adobesign-placeholder/resources/images/checkbox.svg create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-adobesign-placeholder/resources/images/dropdown_chevron.svg create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/af-clientlibs/core-forms-adobesign-placeholder/resources/images/radiobutton.svg create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/_cq_dialog/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/_cq_editConfig.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/_cq_template.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/adobesignblock.html create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/editor/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/.content.xml create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/css.txt create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/css/adobesignblockview.css create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/js.txt create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/js/adobesignblockview.js create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/resources/images/checkbox.svg create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/resources/images/dropdown_chevron.svg create mode 100644 ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/adobesignblock/v1/adobesignblock/clientlibs/site/resources/images/radiobutton.svg diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java index 5d7c410231..7e88f9a7a6 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java @@ -146,4 +146,7 @@ private FormConstants() { /** The resource type for date time input field v1 */ public static final String RT_FD_FORM_DATETIME_V1 = RT_FD_FORM_PREFIX + "datetime/v1/datetime"; + /** The resource type for Adobe Sign Block v1 */ + public static final String RT_FD_FORM_ADOBE_SIGN_BLOCK_V1 = RT_FD_FORM_PREFIX + "adobesignblock/v1/adobesignblock"; + } diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/AdobeSignBlockImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/AdobeSignBlockImpl.java new file mode 100644 index 0000000000..56fa640389 --- /dev/null +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/AdobeSignBlockImpl.java @@ -0,0 +1,122 @@ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Copyright 2026 Adobe + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +package com.adobe.cq.forms.core.components.internal.models.v1.form; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Default; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy; +import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; + +import com.adobe.cq.export.json.ComponentExporter; +import com.adobe.cq.export.json.ExporterConstants; +import com.adobe.cq.forms.core.components.internal.form.FormConstants; +import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; +import com.adobe.cq.forms.core.components.models.form.Base; +import com.adobe.cq.forms.core.components.models.form.FieldType; +import com.adobe.cq.forms.core.components.models.form.Text; +import com.adobe.cq.forms.core.components.util.AbstractBaseImpl; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; + +/** + * Sling Model for the Adobe Sign Block core component. + * + *

+ * Extends {@link AbstractBaseImpl} (same base as all other form field components) so it participates correctly in + * form-model serialisation and test casting. Implements the {@link Text} interface — replicating the rich-text value + * and fieldType behaviour from {@link TextImpl} — while inheriting: + *

+ * + */ +@Model( + adaptables = { SlingHttpServletRequest.class, Resource.class }, + adapters = { Text.class, Base.class, + ComponentExporter.class }, + resourceType = { FormConstants.RT_FD_FORM_ADOBE_SIGN_BLOCK_V1 }) +@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION) +public class AdobeSignBlockImpl extends AbstractBaseImpl implements Text { + + private static final Pattern ADOBE_SIGN_TAG_PATTERN = Pattern.compile("\\{\\{[*]?([^:]*)_es_:"); + + @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.PN_TEXT_IS_RICH) + @Default(booleanValues = false) + private boolean textIsRich; + + @Override + public String getValue() { + return translate("value", value); + } + + @Override + public boolean isRichText() { + return textIsRich; + } + + /** + * Excluded from JSON; the rich-text content is surfaced via {@link #getValue()}. + */ + @Override + @JsonIgnore + public String getText() { + return getValue(); + } + + @Override + public String getFieldType() { + return FieldType.ADOBE_SIGN_BLOCK.getValue(); + } + + /** + * Returns the names of Adobe Sign text-tag fields embedded in this block's HTML content + * (e.g. {@code {{Signature1_es_:signer1:signature}}} yields {@code "Signature1"}). + * Returns {@code null} when no text tags are present so the property is omitted from JSON. + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + public String[] getAdobeSignFields() { + String blockValue = getValue(); + if (blockValue != null && !blockValue.isEmpty()) { + List fieldNames = new ArrayList<>(); + Set seen = new HashSet<>(); + Matcher matcher = ADOBE_SIGN_TAG_PATTERN.matcher(blockValue); + while (matcher.find()) { + String fieldName = matcher.group(1); + if (seen.add(fieldName)) { + fieldNames.add(fieldName); + } + } + if (!fieldNames.isEmpty()) { + return fieldNames.toArray(new String[0]); + } + } + return null; + } +} diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java index afe215afd1..c704c82db1 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FieldType.java @@ -30,6 +30,7 @@ public enum FieldType { DROP_DOWN("drop-down"), RADIO_GROUP("radio-group"), PLAIN_TEXT("plain-text"), + ADOBE_SIGN_BLOCK("adobe-sign-block"), CHECKBOX("checkbox"), BUTTON("button"), PANEL("panel"), diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/.content.xml new file mode 100644 index 0000000000..8dddf859a6 --- /dev/null +++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/.content.xml @@ -0,0 +1,7 @@ + + diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/_cq_template.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/_cq_template.xml new file mode 100644 index 0000000000..0badb91e77 --- /dev/null +++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/adobesignblock/_cq_template.xml @@ -0,0 +1,8 @@ + + diff --git a/it/content/src/main/content/jcr_root/conf/core-components-it/settings/wcm/policies/.content.xml b/it/content/src/main/content/jcr_root/conf/core-components-it/settings/wcm/policies/.content.xml index f8a5146990..894d852ab6 100755 --- a/it/content/src/main/content/jcr_root/conf/core-components-it/settings/wcm/policies/.content.xml +++ b/it/content/src/main/content/jcr_root/conf/core-components-it/settings/wcm/policies/.content.xml @@ -12,7 +12,7 @@ jcr:primaryType="nt:unstructured" jcr:title="Core Components Examples - Root" sling:resourceType="wcm/core/components/policy/policy" - components="[/libs/wcm/foundation/components/responsivegrid,group:Core Components Examples,group:.core-wcm,group:.core-wcm-form,group:Core Components Examples - Adaptive Form,group:Core Components Examples - Forms And Communications Portal]"> + components="[/libs/wcm/foundation/components/responsivegrid,group:Core Components Examples,group:.core-wcm,group:.core-wcm-form,group:Core Components Examples - Adaptive Form,group:Core Components Examples - Forms And Communications Portal,group:Adobe Sign - Adaptive Form]"> + components="[group:Core Components Examples - Adaptive Form,group:Core Components Examples - Forms And Communications Portal,group:Adobe Sign - Adaptive Form]"> diff --git a/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/adobesignblock/.content.xml b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/adobesignblock/.content.xml new file mode 100644 index 0000000000..d9e7865114 --- /dev/null +++ b/it/content/src/main/content/jcr_root/content/forms/af/core-components-it/samples/adobesignblock/.content.xml @@ -0,0 +1,7 @@ + +