Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fae2e3a
Added condition on description and error message in aria-describedby
Apr 16, 2024
7a326df
Merge pull request #1192 from adobe/acc/err
barshat7 Apr 17, 2024
06d1f11
FORMS-12203: Added localization changes and test cases (#1152)
shivangimittal791 Apr 17, 2024
c770451
FORMS-13851 Support for language in date picker and number input (#1169)
rismehta Apr 18, 2024
7851278
FORMS-12822 : format should not be visible when no pattern is selecte…
AnurudraS Apr 22, 2024
63e3561
FORMS-14013 - Fixing default value check in dropdown (#1199)
TalmizAhmed Apr 23, 2024
1c11f2a
Revert "FORMS-14013 - Fixing default value check in dropdown (#1199)"
rismehta Apr 23, 2024
4d09843
FORMS-13209 - Added support for form submission handlers and correcte…
arunattri26 Apr 23, 2024
ef7330d
FORMS-13935 update examples for aemcomponents.dev (#1204)
barshat7 Apr 29, 2024
8118d35
FORMS-14013 - Testcase added - Fixing Dropdown that had a selected va…
TalmizAhmed Apr 29, 2024
4995557
Forms 11746 allow attaching same file (#1201)
rajatofficial Apr 29, 2024
33ddc31
Read-only is not working in file-attachment (#1200)
pavi41 Apr 30, 2024
9de36fd
Readonly & Disable were not working in TNC component (#1211)
pavi41 May 2, 2024
9e94891
FORMS-14018 - Fix for dropdown not working when enumNames are not pro…
TalmizAhmed May 2, 2024
c227001
Moving to 15860 image (#1212)
rismehta May 2, 2024
4446d6b
FORMS-13811 | Adding rendition for hCaptcha (#1174)
navneet-ag May 3, 2024
e9b4d42
[FORMS-11581] Enabled Draft functionality for V2 (#1209)
girotraapankaj May 7, 2024
e23a818
adding source property in sling model of image component to get dam a…
deepprakash345 May 7, 2024
cf9da81
eds semantic html without a separate selector (#1194)
deepprakash345 May 7, 2024
81b807d
add data-cmp-valid attribute for checkboxgroup and radiobutton (#1225)
barshat7 May 9, 2024
8779579
Exclude from DoR is not working for text field in AF2
May 9, 2024
40f1b66
Merge pull request #1226 from adobe/textDrawDoR
devgurjar May 9, 2024
36444a5
Removed space between the short desc if long desc is not present
May 3, 2024
9536076
Refactored code of space removal in description
May 9, 2024
995b58d
Merge pull request #1228 from adobe/acc/space-remove-two
barshat7 May 9, 2024
686026c
Merge branch 'master' into devtomaster-9-May-2024
barshat7 May 9, 2024
3381636
formatting
barshat7 May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,31 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
package com.adobe.cq.forms.core.components.internal.form;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.SlingObject;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.adobe.cq.forms.core.components.models.form.FormContainer;
import com.adobe.cq.forms.core.components.models.form.FormStructureParser;
import com.adobe.cq.forms.core.components.util.ComponentUtils;
import com.adobe.cq.forms.core.components.views.Views;
import com.fasterxml.jackson.databind.ObjectMapper;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = FormStructureParser.class)
public class FormStructureParserImpl implements FormStructureParser {

private static final Logger logger = LoggerFactory.getLogger(FormStructureParserImpl.class);
@SlingObject(injectionStrategy = InjectionStrategy.OPTIONAL)
@Nullable
private SlingHttpServletRequest request;
Expand Down Expand Up @@ -104,4 +112,19 @@ private String getFormContainerPath(Resource resource) {

return getFormContainerPath(resource.getParent());
}

public String getFormDefinition() {
String result = null;
FormContainer formContainer = resource.adaptTo(FormContainer.class);
try {
ObjectMapper mapper = new ObjectMapper();
Writer writer = new StringWriter();
// return publish view specific properties only for runtime
mapper.writerWithView(Views.Publish.class).writeValue(writer, formContainer);
result = writer.toString();
} catch (IOException e) {
logger.error("Unable to generate json from resource");
}
return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2024 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.form;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.SlingObject;
import org.jetbrains.annotations.Nullable;

import com.adobe.cq.forms.core.components.models.form.HtlUtil;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = HtlUtil.class)
public class HtlUtilImpl implements HtlUtil {
@SlingObject(injectionStrategy = InjectionStrategy.OPTIONAL)
@Nullable
private SlingHttpServletRequest request;

public Boolean isEdgeDeliveryRequest() {
if (request != null) {
Object isEdgeDelivery = request.getAttribute("com.adobe.aem.wcm.franklin.internal.servlets.FranklinDeliveryServlet");
return isEdgeDelivery != null && isEdgeDelivery.equals(Boolean.TRUE);
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
package com.adobe.cq.forms.core.components.internal.models.v1.form;

import java.io.IOException;
import java.util.Map;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.jcr.RepositoryException;

Expand Down Expand Up @@ -45,6 +47,8 @@
extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class StaticImageImpl extends AbstractFormComponentImpl implements StaticImage {

public static final String DAM_REPO_PATH = "fd:repoPath";

private Image image;

@SlingObject
Expand All @@ -62,6 +66,10 @@ public class StaticImageImpl extends AbstractFormComponentImpl implements Static
@org.jetbrains.annotations.Nullable
protected String description; // long description as per current spec

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "fileReference")
@Nullable
protected String fileReference;

/**
* Returns the source where the image is present.
*
Expand Down Expand Up @@ -120,4 +128,13 @@ public String getLinkUrl() {
return null;
}
}

@Override
public @Nonnull Map<String, Object> getProperties() {
Map<String, Object> properties = super.getProperties();
if (fileReference != null && fileReference.length() > 0) {
properties.put(DAM_REPO_PATH, fileReference);
}
return properties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.adobe.aemds.guide.common.GuideContainer;
import com.adobe.aemds.guide.service.GuideSchemaType;
Expand Down Expand Up @@ -63,6 +65,7 @@
public class FormContainerImpl extends AbstractContainerImpl implements FormContainer {
protected static final String RESOURCE_TYPE = "core/fd/components/form/container/v2/container";

private static final Logger logger = LoggerFactory.getLogger(FormContainerImpl.class);
private static final String DOR_TYPE = "dorType";
private static final String DOR_TEMPLATE_REF = "dorTemplateRef";
private static final String DOR_TEMPLATE_TYPE = "dorTemplateType";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,5 +362,4 @@ default void visit(Consumer<ComponentExporter> callback) throws Exception {}
default String getParentPagePath() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ public interface FormStructureParser {
* @return true if this resource or one of its children is a form container, else false
*/
Boolean containsFormContainer();

/**
* @since com.adobe.cq.forms.core.components.models.form 5.4.1
*
* @return form definition json in Publish view
*/
String getFormDefinition();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2024 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.models.form;

import org.osgi.annotation.versioning.ProviderType;

@ProviderType
public interface HtlUtil {
/**
* Checks whether this request has been originated from edge delivery services
*
* @return {Boolean} true if the request is from edge delivery services, false otherwise
* @since com.adobe.cq.forms.core.components.models.form 5.3.2
*/
Boolean isEdgeDeliveryRequest();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
* version, is bound to this proxy component resource type.
* </p>
*/
@Version("5.4.0") // aligning this with release/650 since af2-rest-api is compiled with 5.2.0 in release/650

@Version("5.4.1") // aligning this with release/650 since af2-rest-api is compiled with 5.2.0 in release/650
package com.adobe.cq.forms.core.components.models.form;

import org.osgi.annotation.versioning.Version;
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
Expand All @@ -31,7 +29,6 @@
import org.slf4j.LoggerFactory;

import com.adobe.cq.forms.core.components.models.form.Field;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

Expand Down Expand Up @@ -80,14 +77,6 @@ public abstract class AbstractFieldImpl extends AbstractBaseImpl implements Fiel
@Nullable
protected Integer maxLength;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dorExclusion")
@Default(booleanValues = false)
protected boolean dorExclusion;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dorColspan")
@Nullable
protected String dorColspan;

/** number and date constraint **/

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "minimumDate")
Expand Down Expand Up @@ -116,16 +105,6 @@ public abstract class AbstractFieldImpl extends AbstractBaseImpl implements Fiel

/** number and date constraint **/

/**
* Returns dorBindRef of the form field
*
* @return dorBindRef of the field
* @since com.adobe.cq.forms.core.components.util 2.1.0
*/
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dorBindRef")
@Nullable
protected String dorBindRef;

@SlingObject
private Resource resource;

Expand Down Expand Up @@ -197,17 +176,4 @@ public String getDataFormat() {
return dataFormat;
}

@Override
@JsonIgnore
public Map<String, Object> getDorProperties() {
Map<String, Object> customDorProperties = new LinkedHashMap<>();
customDorProperties.put("dorExclusion", dorExclusion);
if (dorColspan != null) {
customDorProperties.put("dorColspan", dorColspan);
}
if (dorBindRef != null) {
customDorProperties.put("dorBindRef", dorBindRef);
}
return customDorProperties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ public class AbstractFormComponentImpl extends AbstractComponentImpl implements
@SlingObject
private Resource resource;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dorExclusion")
@Default(booleanValues = false)
protected boolean dorExclusion;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dorColspan")
@Nullable
protected String dorColspan;

/**
* Returns dorBindRef of the form field
*
* @return dorBindRef of the field
* @since com.adobe.cq.forms.core.components.util 4.0.0
*/
@JsonIgnore
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dorBindRef")
@Nullable
protected String dorBindRef;

/**
* Flag indicating if the data layer is enabled.
*/
Expand Down Expand Up @@ -473,4 +492,18 @@ private Map<String, String> getCustomProperties() {
return Collections.emptyMap();
}
}

@Override
@JsonIgnore
public Map<String, Object> getDorProperties() {
Map<String, Object> customDorProperties = new LinkedHashMap<>();
customDorProperties.put("dorExclusion", dorExclusion);
if (dorColspan != null) {
customDorProperties.put("dorColspan", dorColspan);
}
if (dorBindRef != null) {
customDorProperties.put("dorBindRef", dorBindRef);
}
return customDorProperties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
package com.adobe.cq.forms.core.components.internal.models.v1.form;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
Expand All @@ -34,6 +35,9 @@
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
import com.day.cq.wcm.api.NameConstants;
import com.day.cq.wcm.msm.api.MSMNameConstants;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;

Expand Down Expand Up @@ -85,6 +89,17 @@ void testFormContainerPath() {
assertEquals(FORM_CONTAINER_PATH, formStructureParser.getFormContainerPath());
}

@Test
void testFormDefinition() throws JsonProcessingException {
String path = FORM_CONTAINER_PATH;
FormStructureParser formStructureParser = getFormStructureParserUnderTest(path);
String formDef = formStructureParser.getFormDefinition();
HashMap<String, Object> formJson = (HashMap<String, Object>) new ObjectMapper().readValue(formDef,
new TypeReference<Map<String, Object>>() {});
assertNotNull(formStructureParser.getFormDefinition());
assertEquals(formJson.get("fieldType"), "form");
}

@Test
void testFormContainerPathEmbedWithoutIframe() {
FormStructureParser formStructureParser = getFormStructureParserUnderTest(JCR_CONTENT_PATH, FORM_CONTAINER_PATH);
Expand Down
Loading