cq:editConfig not applying outside of parsys - aem

Cross-post from Adobe Community Forums: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__qugo-we_have_an_imagecom.html
We have an image component, its _cq_editConfig.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" 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"
cq:disableTargeting="{Boolean}true"
jcr:primaryType="cq:EditConfig">
<cq:dropTargets jcr:primaryType="nt:unstructured">
<image
jcr:primaryType="cq:DropTargetConfig"
accept="[image/.*]"
groups="[media]"
propertyName="./fileReference">
</image>
</cq:dropTargets>
</jcr:root>
We have a page component ("Blurb") which includes this component as the "featuredImage", as well as a "body" parsys which allows the same component to be used:
<div>
<h1>*Page Title</h1>
<cq:include path="pageTitle" resourceType="sitename/components/plainText"/>
</div>
<div>
<h1>*Featured Image</h1>
<cq:include path="featuredImage" resourceType="sitename/components/image"/>
</div>
<div>
<h1>*Body</h1>
<cq:include path="body" resourceType="sitename/components/page/blurb/parsys"/>
</div>
If I place a sitename/components/image component in the parsys, I can drag an image from the content finder onto the component to set it. The featuredImage, however, will not accept the drag-n-drop from the content finder (the "not allowed" cursor appears, dropping the image does nothing). If I open the featureImage's edit dialog, I can drag a content finder image to there. I am the admin user, there are no permission restrictions.
The same issue applies to text components configured for inline editing. When the text component is placed in the body parsys (or any parsys), the inline editor works. When the text component is placed outside of the parsys (Page Title in the example above), the inline editor will not appear.
Interestingly, when I change the Blurb page component use foundation components, the featuredImage drag-n-drop works, but the pageTitle inline editing does not.
<div>
<h1>*Page Title</h1>
<cq:include path="pageTitle" resourceType="foundation/components/text"/>
</div>
<div>
<h1>*Featured Image</h1>
<cq:include path="featuredImage" resourceType="foundation/components/image"/>
</div>
<div>
<h1>*Body</h1>
<cq:include path="body" resourceType="sitename/components/page/blurb/parsys"/>
</div>
Is this a WCM bug? Are our components' cq:editConfig definitions missing something?
EDIT: This is running on AEM 5.6.1.
Our Image component's .content.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Image (Custom)"
sling:resourceSuperType="foundation/components/image"
allowedParents="[*/parsys]"
componentGroup="Site Name Group"/>
And dialog.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"
jcr:primaryType="cq:Dialog"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<advanced
jcr:primaryType="cq:Widget"
path="/apps/sitename/components/image/tab_advanced.infinity.json"
xtype="cqinclude"/>
<image
jcr:primaryType="cq:Widget"
path="/apps/sitename/old/components/image/dialog/items/image.infinity.json"
xtype="cqinclude"/>
</items>
</jcr:root>
And the cqinclude'd /apps/sitename/components/image/tab_advanced.infinity.json
<?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"
jcr:primaryType="cq:Panel"
title="Advanced">
<items jcr:primaryType="cq:WidgetCollection">
<image
jcr:primaryType="cq:Widget"
collapsed="{Boolean}false"
collapsible="{Boolean}true"
title="Image"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<title
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldDescription="Required Field: If the Alt Text field is left blank, the image title will be used instead. "
fieldLabel="Image Title"
maxLength="{Long}60"
name="./jcr:title"
xtype="textfield"/>
<linkUrl
jcr:primaryType="cq:Widget"
fieldDescription="Optional Field: use the link field to specify where the image ought to link to."
fieldLabel="Link to"
name="./linkUrl"
regex="/^\\S*$/"
regexText="Please enter a valid link"
xtype="pathfield"/>
<alt
jcr:primaryType="cq:Widget"
fieldDescription="Optional Field: When text is entered into the Alt text field it will be used instead of the image Title. If the image is used as a link, the Alt text is used for the name of the link. For example <a href="http://slipsum.com/"> Visit Samuel L. Ipsum</a>"
fieldLabel="Alt Text"
maxLength="{Long}100"
name="./alt"
xtype="textfield"/>
<description
jcr:primaryType="cq:Widget"
fieldDescription="Optional Field: used to populate the image caption"
fieldLabel="Caption"
maxLength="{Long}256"
name="./jcr:caption"
xtype="textarea"/>
</items>
</image>
</items>
</jcr:root>
And /apps/sitename/old/components/image/dialog/items/image.infinity.json
<image
jcr:primaryType="cq:Widget"
allowUpload="{Boolean}false"
ddGroups="[media]"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
name="./file"
requestSuffix=".img.png"
title="Image"
xtype="html5smartimage"/>
Sample package for testing (with the text component inline editing) at: http://s000.tinyupload.com/index.php?file_id=05420490884931180108

Since I don't have the full source I can only guess which problem you are actually experiencing. I see one of the following as the possible reasons:
You either do not provide the CQ editor classes as described here
Your custom parsys is misconfigured, try replacing it with the foundation one.
I tried to reproduce the issue, but didn't succeeded, it's working for me. I created this sample project for you.

Related

How to wrap 2 components in a div from the template content.xml file?

I have two components that should be configured in a cq template, in the content.xml file (in the jcr:content node).
I don't have a page component for my template, so I cannot do something like this:
<div class="wrapper_div">
<cq:include resourceType="/my/first/component"/>
<cq:include resourceType="/my/second/component"/>
</div>
Is there a way to define a div container from within content.xml?
There can be one trick, you can add below to your content.xml file of your template.
<jcr:content
jcr:primaryType="cq:PageContent"
sling:resourceType="path/of/page/page-component">
<par
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys">
<simple
jcr:lastModified="{Date}2015-05-05T12:16:19.895+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="path/components/content/component1"/>
<simple1
jcr:lastModified="{Date}2015-05-05T12:16:19.895+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="path/components/content/component2"/>
</par>
</jcr:content>
</jcr:root>
This will create the content nodes for the page using this template, but to make this work you must have parsys included in your rendering page component path/of/page/page-component e.g. <cq:include path="par" resourceType="foundation/components/parsys" />
Also there are some other ways like to add node of cq:template under your page component to pre populate the components.
Hope this will help.

custom page properties for different templates cq5

I am trying to add different custom page properties for different templates in Adobe CQ5. I have tried to to over-ride the default page component in apps/project-name/components and customized the page-properties in the dialog; but it changed the page-properties for all the pages. Is there a way using which we can get different custom page properties for different templates in the page properties dialog ?
Well there is one clumsy way.
The xtype cqinclude can help. It has a path attribute that points to a dialog-resource that is to be included (in JSON format). That path is to be requested via Ajax. So you can create a servlet that returns dialog's elements in JSON format depending on referer's template. Then use it in your basic template's dialog.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"
jcr:primaryType="cq:Dialog"
stateful="false"
xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection">
<tabs jcr:primaryType="cq:TabPanel">
<items jcr:primaryType="cq:WidgetCollection">
<basic
jcr:primaryType="cq:Widget"
path="/libs/foundation/components/page/tab_basic.infinity.json"
xtype="cqinclude"/>
<advanced
jcr:primaryType="cq:Widget"
path="/libs/foundation/components/page/tab_advanced.infinity.json"
xtype="cqinclude"/>
<image
jcr:primaryType="cq:Widget"
path="/libs/foundation/components/page/tab_image.infinity.json"
xtype="cqinclude"/>
<cloudservices
jcr:primaryType="cq:Widget"
path="/libs/foundation/components/page/tab_cloudservices.infinity.json"
xtype="cqinclude"/>
<blueprint
jcr:primaryType="cq:Widget"
path="/libs/foundation/components/page/tab_blueprint.infinity.json"
xtype="cqinclude"/>
<livecopy
jcr:primaryType="cq:Widget"
path="/libs/foundation/components/page/tab_livecopy.infinity.json"
xtype="cqinclude"/>
<custom
jcr:primaryType="cq:Widget"
path="/services/MyServlet"
xtype="cqinclude"/>
</items>
</tabs>
</items>
</jcr:root>
But I advise you to use it only if there is no other choice.
Templates alone are not enough to have separate page properties. You'll need different page components where you can define the dialog. You can still have one base component and the exact same JSPs for the rendering and just override the dialog, if you use the inheritance (sling:resourceSuperType).

CQ5 AEM - multifieldpanel doesn't remove node from crx

I need to create a component (say componentA) whose aim is to allow a user to add a variable number of components (choosing from componentB and componentC). So componentA is like a parsys which contains others components.
I'm using a multifieldpanel to create a component's dialog with a user controlled number of field. Something like this:
The problem is when I try to eliminate one of the elements added directly from the dialog of componentA: the element is effectively eliminated from the dialog but it actually remains inside the CRX.
My CRX is something like:
componentA
componentASon_0
componentASon_1
If I remove the component (componentASon_0 or componentASon_1) with a "right-click and delete" it works properly.
Any advice?
Here a snippet of the dialog relative to the componentA:
<tabMain
jcr:primaryType="cq:Widget"
title="myPanelTitle"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<settings jcr:primaryType="cq:Widget"
fieldLabel="Payment Settings"
fieldDescription="Click the '+' to add a new block"
name="./settings"
xtype="multifield">
<fieldConfig
jcr:primaryType="cq:Widget"
xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<component
jcr:primaryType="nt:unstructured"
defaultValue="Choose a component"
fieldLabel="Component"
type="select"
value=""
key="componentType"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<componentB
jcr:primaryType="nt:unstructured"
text="ComponentB"
value="/apps/project/components/commons/componentB"/>
<componentC
jcr:primaryType="nt:unstructured"
text="ComponentC"
value="/apps/project/components/commons/componentC"/>
</options>
</component>
</items>
</fieldConfig>
</settings>
</items>
</tabMain>

AEM: Trying to reuse existing image dialog in other dialog. Tabs within tab not working when including the image dialog using cqinclude

I've a component with a dialog that has multiple tabs. Some of the tabs are widget of xtype="html5smartimage" to accept image and other tabs are meant to accept different image parameter.
I've split the dialog in two parts to make tab system available for reuse by other component. Here it goes:
imageComponent
tab_image_information.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"
jcr:primaryType="cq:TabPanel"
activeTab="0"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<imageTab1 jcr:primaryType="cq:Widget"
itemId="imageTab1"
cropParameter="./image1/imageCrop"
ddGroups="[media]"
fileNameParameter="./image1/fileName"
fileReferenceParameter="./image1/fileReference"
blankText="An image is required"
name="./image1/file"
requestSuffix="/image1.img.png"
rotateParameter="./image1/imageRotate"
sizeLimit="100"
height="250"
title="Desktop Image"
uploadUrl="/tmp/upload/*"
xtype="html5smartimage" />
<imageTab2 jcr:primaryType="cq:Widget"
itemId="imageTab2"
cropParameter="./image2/imageCrop"
ddGroups="[media]"
fileNameParameter="./image2/fileName"
fileReferenceParameter="./image2/fileReference"
blankText="An image is required"
name="./image2/file"
requestSuffix="/image2.img.png"
rotateParameter="./image2/imageRotate"
sizeLimit="100"
height="250"
title="Tablet Image"
uploadUrl="/tmp/upload/*"
xtype="html5smartimage" />
<imageDetails jcr:primaryType="cq:Widget"
title="Image Details"
height="250"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<displayWidth jcr:primaryType="cq:Widget"
fieldDescription="Set display width for the image."
fieldLabel="Display Width"
name="./displayWidth"
xtype="textfield"/>
<displayHeight jcr:primaryType="cq:Widget"
fieldDescription="Set display height for the image."
fieldLabel="Display Height"
name="./displayHeight"
xtype="textfield"/>
<image1ResType jcr:primaryType="cq:Widget"
ignoreData="{Boolean}true"
name="./image1/sling:resourceType"
value="foundation/components/image"
xtype="hidden" />
<image2ResType jcr:primaryType="cq:Widget"
ignoreData="{Boolean}true"
name="./image2/sling:resourceType"
value="foundation/components/image"
xtype="hidden" />
</items>
</imageDetails>
</items>
</jcr:root>
and in dialog.xml I did:
<?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"
jcr:primaryType="cq:Dialog"
title="Image Selection"
xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection">
<imageSelection jcr:primaryType="cq:Widget"
path="/apps/myproject/components/content/imageComponent/tab_image_information.infinity.json"
xtype="cqinclude"/>
</items>
</jcr:root>
This component itself is working great.
Now I need to write another component (myComponent) whose dialog will have two tabs - one for basic information and the other tab will
have functionality of the imageCompnent. So I'm trying to include tab_image_information using infinity.json. Here goes myComponent:
myComponent
tab_basic_information.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"
jcr:primaryType="cq:Panel"
title="Component Information"
width="500">
<items jcr:primaryType="cq:WidgetCollection">
<text1 jcr:primaryType="cq:Widget"
fieldLabel="Headline"
name="./text1"
xtype="textfield"
maxlength="42"/>
<text2 jcr:primaryType="cq:Widget"
fieldLabel="Sub head"
name="./text2"
xtype="textfield"
maxlength="42"/>
</items>
</jcr:root>
and the dialog.xml is like:
<?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"
jcr:primaryType="cq:Dialog"
title="My Component"
xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection">
<tabs jcr:primaryType="cq:TabPanel">
<items jcr:primaryType="cq:WidgetCollection">
<componentInformation
jcr:primaryType="cq:Widget"
path="/apps/myproject/components/content/myComponent/tab_basic_information.infinity.json"
xtype="cqinclude"/>
<componentImageSelection
jcr:primaryType="cq:Widget"
title="Component Image Selection"
xtype="panel"
width="500">
<items jcr:primaryType="cq:WidgetCollection">
<imageSelection
jcr:primaryType="cq:Widget"
path="/apps/myproject/components/content/imageComponent/tab_image_information.infinity.json"
xtype="cqinclude"/>
</items>
</componentImageSelection>
</items>
</tabs>
</items>
</jcr:root>
Inclusion of tab_image_information within myComponent dialog is happening, but it not laying out properly, neither it is saving the information of that tab(componentImageSelection).
Any suggestion is highly appreciated.
Your tab_image_information is correct and is of type cq:TabPanel while the other tab_basic_information is of type cq:Panel instead try using cq:TabPanel for it. I think this should resolve the layout issue, this is just my initial guess better add screenshot to get more understanding of what is exact layout issue. On the saving part what is getting saved in JCR ? See the request in network tab when you post your data i.e. when you are done configuring and click ok. One more way to store data in JCR is to create your custom servlet to post the data instead of using the OOTB one. Hope this helps. Also tag your question with extjs this will really help on layout issues.

Can multiple smartimage xtypes appear on one dialog tab in AEM?

The out of the box (OOTB) page properties dialog in Adobe Experience Manager (AEM) (CQ5) provides an Image tab. I would like to add a couple more images to the dialog, but I don't want to create a separate tab for each one.
For instance, is there a way to include an image on the "Advanced" tab within a dialogfielset? I tried this, but it does not seem to render properly.
One thing I am considering is to extend the slideshow xtype and each image would be a separate "slide"
Are there better approaches?
It's possible to have multiple smartimage xtypes on a tab!
Widgets API document for smartimage:
Note that the component is mainly designed for use on a separate
dialog tab. You may use the component inside a
CQ.Ext.layout.FormLayout optionally if you provide a suitable height
setting.
Here are codes for dialog:
<?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"
jcr:primaryType="cq:Dialog"
height="{Long}600"
title="dialog"
xtype="dialog">
<items
jcr:primaryType="cq:Widget"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<panel
jcr:primaryType="cq:Panel"
title="Panel with two Images">
<items jcr:primaryType="cq:WidgetCollection">
<firstimage
jcr:primaryType="cq:Widget"
cropParameter="./firstimage/imageCrop"
ddGroups="[media]"
fieldLabel="first image field"
fileNameParameter="./firstimage/fileName"
fileReferenceParameter="./firstimage/fileReference"
height="{Long}200"
name="./firstimage/file"
rotateParameter="./firstimage/imageRotate"
title="First Image"
width="{Long}200"
xtype="html5smartimage"/>
<secondimage
jcr:primaryType="cq:Widget"
cropParameter="./secondimage/imageCrop"
ddGroups="[media]"
fieldLabel="second image field"
fileNameParameter="./secondimage/fileName"
fileReferenceParameter="./secondimage/fileReference"
height="{Long}200"
name="./secondimage/file"
rotateParameter="./secondimage/imageRotate"
title="secondimage"
width="{Long}200"
xtype="html5smartimage"/>
</items>
</panel>
</items>
</items>
</jcr:root>
And the following is the result: