How to use cq:editConfig Property in AEM 6.0 - aem

In AEM 6.0, I am having a component and, it has a text field and one video file uploader. I want to enable the drag and drop of this video from the content finder. My normal upload using the dialog is working, but this drag and drop is not working. I searched and found out that I can do this by using cq:editConfig. Can somebidy tell me that how can I do this?

Define the cq:dropTargets, as a child of the cq:editConfig node to configure the list of drop targets that can accept a drop from an asset of the content finder.
In your case, for a video, you can refer the foundation/components/video whose edit config is shown below.
<cq:editConfig jcr:primaryType="cq:EditConfig" cq:layout="editbar">
<cq:dropTargets jcr:primaryType="nt:unstructured">
<video jcr:primaryType="cq:DropTargetConfig" propertyName="./asset">
<parameters jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/video"/>
</video>
</cq:dropTargets>
</cq:editConfig>
Also make sure you specify the ddGroups and ddAccept properties on the html5smartfile widget used for video file upload component.
Refer Configuring the Edit Behaviour of a component to get more insights on configuring the edit config and its child nodes.

You must be careful doing this because it can have an unexpected side effect of changing your component type to the type specified in the drop target.
To avoid that happening, you can distinguish between component type and target type by using this format:
<cq:dropTargets jcr:primaryType="nt:unstructured">
<video
jcr:primaryType="cq:DropTargetConfig"
accept="[video/.*]"
propertyName="./asset">
<parameters
jcr:primaryType="nt:unstructured"
sling:resourceType="myfolder/components/videoandtext">
<video
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/video"
/>
</parameters>
</video>
</cq:dropTargets>
See here for more info: Drop Target Issue

Related

AEM6.5 cannot user path for selecting video in video component

We would like the editors to be able to use the path selector as well as drag and drop when they select an MP4 file for the video component. At the moment only the drag and drop for video file works. That means, only when you drag and drop an MP4 file from Assets will this be taken into account for the video component. For the image component one can drag an drop an image from Assets or select it using the path.
I am attaching the video component _cq_diaglog/.content.xml
<file jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
name="./videoFile"
fieldLabel="Video"
fileNameParameter="./videoFileName"
fileReferenceParameter="./videoFileReference"
title="MP4-Video"
mimeTypes="[video/mp4]"
uploadUrl="${suffix.path}"
allowUpload="{Boolean}${not empty cqDesign.allowUpload ? cqDesign.allowUpload : false}"
autoStart="{Boolean}false"
multiple="{Boolean}false"
required="{Boolean}true"
useHTML5="{Boolean}true"
class="cq-droptarget"/>
as well as the video component _cq_editConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:EditConfig">
<cq:dropTargets jcr:primaryType="cq:DropTargetConfig">
<video
jcr:primaryType="nt:unstructured"
accept="[video/mp4]"
groups="[media]"
propertyName="./videoFileReference"/>
</cq:dropTargets>
</jcr:root>
I am also attaching two screenhost pictures from the editor where we would like the editors to be able to select a video by browsing the path:
It turned out the Videos in DAM did not have thumbnails under Renditions. After adding thumbnail renditions for a video one can add it using the Path selector. Everything was ok with code and configuration just content was missing.

Add granite:data to cq dialog textfield

I am trying to create a validation function for a textfield depending on the content of other textfield in a cq dialog in AEM 6.5.
I am trying to send within the cq:data the textfield name but I can get AEM to render these data attributes on DOM.
This is a piece of the cq dialog
<creditsTitle
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Credits Title"
name="./creditsTitle_t"/>
<creditsValue
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Credits"
validation="custo-validation"
name="./creditsValue_t">
<granite:data jcr:primaryType="nt:unstructured"
dependent-name="creditsTitle_t"/> </creditsValue>
And here is a ss of what gets rendered:
I want to be able to send to the "custo-validation" a parameter with the name of the field that it needs to check,in this case is the one above (creditsTitle_t), but it can be anywhere.
So far the only way I have found is with the granite:data but i can't get it working
Your code looks good. just make sure you're adding the granite namespace at the top of the file
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:granite="http://www.adobe.com/jcr/granite/1.0"
sling:resourceType="cq/gui/components/authoring/dialog"
....

cq:showOnCreate not working with RTE on Page properties

We are using an RTE field in the page properties. The issue here is, this field doesn't render in the page properties when author is creating the page. Is this a known issue with AEM? Is there any workaround for this?
<bannerText
cq:showOnCreate="{Boolean}true"
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/richtext"
fieldLabel="Banner text"
fieldDescription="This text describes the banner message."
required="true"
name="./bannerText"
useFixedInlineToolbar="{Boolean}true">
<rtePlugins jcr:primaryType="nt:unstructured">
<format
....
<bannerText?>
PS: We are using AEM 6.5
Thanks in advance!

AEM 6.5 Pre-populate fileUpload image field in cq dialog

New to AEM, I am trying to programatically populate an fileUpload image dropzone, and silently triggered its drop event as if user had manually drop an image asset to it. Is there a way to do this?
Say I have a cq_dialog with two fileUpload image fields (set to no upload, only droppable from asset allowed), one was already populated prior, the other is empty. Upon dialog load, I want to populate the empty one with the image asset from the populated one as a default.
The snippets of the cq_dialog looks like this:
<imageontopWrap
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
class="layout-showhide-targets"
showhidetargetvalue="imageontop">
<items jcr:primaryType="nt:unstructured">
<image1
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
autoStart="{Boolean}false"
allowUpload="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image Asset"
fileReferenceParameter="./myImageTopPath"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./myImageTop"
title="Upload Image Asset"
useHTML5="{Boolean}true"/>
<altText1
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Alt Text"
name="./myImageTopAltText"/>
</items>
</imageontopWrap>
<imageonleftWrap
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
class="layout-showhide-targets"
showhidetargetvalue="imageonleft">
<items jcr:primaryType="nt:unstructured">
<image2
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
autoStart="{Boolean}false"
allowUpload="{Boolean}false"
class="cq-droptarget"
fieldLabel="Image Asset"
fileReferenceParameter="./myImageLeftPath"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./myImageLeft"
title="Upload Image Asset"
useHTML5="{Boolean}true"/>
<altText2
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Alt Text"
name="./myImageLeftAltText"/>
</items>
</imageonleftWrap>
I had created a clientLib for this cq_dialog, just wasn't sure the js codes to copy the image reference and trigger the drop using script.
Any help is much appreciated.
Here is the mechanism through you can achive what you require I hope. I am not sure about the exact js code though for which you have to do some googling on listners.
On dialog load, store the reference of the first image drop container in a js variable.
Then find the path of the image that is being stored/authored in the first image container.
Populate the same path in the second image drop path.
As I said, above is just a mechanism to help how you can achive your requirement.

Fetch Text and Values both from Touch UI Dropdown in AEM

I have a static list of drop down,but i want to fetch both value and Text from the drop down in AEM touch UI.
<articleType
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
fieldLabel="Article Type"
name="./articleType">
<items jcr:primaryType="nt:unstructured">
<select
jcr:primaryType="nt:unstructured"
text="Select Icon"
value=""/>
<article
jcr:primaryType="nt:unstructured"
text="Article"
value="article"/>
<video
jcr:primaryType="nt:unstructured"
text="Video"
value="video"/>
<infographic
jcr:primaryType="nt:unstructured"
text="Infographic"
value="graph"/>
</items>
</articleType>
Now I want to fetch it like <i class="article-icon icon" />. I can fetch "icon class" from "value" but i need to always have some test conditions to fetch the text.
So i want a solution for this.
I have used data sources for this kind of requirements. In the example listed below, a jsp file is used. You can very well create WCMUsePojo class and call it in a HTML to refer the dynamic text and value pairs.
Please check:
https://helpx.adobe.com/experience-manager/using/creating-granite-datasource.html