how to prevent cq:dialog inheritance - dialog

I am migrating classic ui dialogs to touch ui dialogs, I migrated the parent component dialog, I observed AEM is showing the parent dialogs tabs and properties in the child component as well. In the existing classic ui dialogs it doesnt inherit the parent properties whereas in the touch ui it does.
How can we achieve the same classic ui behavior in touch ui as well by preventing the dialog inheritance.
Please share details if anyone has information about this issue.

You can use the sling:hideChildren property to hide inherited tabs and properties. For example, let's say you wanted to hide the inherited permissions and cloudservices tabs, and customize the basic and advanced tabs:
...
<items jcr:primaryType="nt:unstructured">
<tabs
...>
<layout
.../>
<items
jcr:primaryType="nt:unstructured"
sling:hideChildren="[permissions,cloudservices]">
<basic
.../>
<advanced
.../>
</items>
</tabs>
</items>
...

Sling Resource Merging with AEM docs can be found here. Specifically look through the docs for the resource merger properties and how you can manipulate different properties.
The resource merger provides the following properties:
sling:hideProperties (String or String[])
Specifies the property, or list of properties, to hide.
The wildcard * hides all.
sling:hideResource (Boolean)
Indicates whether the resources should be completely hidden, including its children.
sling:hideChildren (String or String[])
Contains the child node, or list of child nodes, to hide. The properties of the node will be maintained.
The wildcard * hides all.
sling:orderBefore (String)
Contains the name of the sibling node that the current node should be positioned in front of.
These properties affect how the corresponding/original resources/properties (from /libs) are used by the overlay/override (often in /apps).

Add the
sling:hideChildren property
to the child component's dialog.
You can add this property to the immediate parent of the particular fieldset/tab/field that you need to hide.
Syntax:
Property Name: sling:hideChildren
Property Type: String or String[]
Property Value: Name of the immediate children, * hides them all
Example:
To hide the all the fields under properties tab of the below dialog:
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fixedcolums
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<properties
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<startLevel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
../>
<showHidden
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
../>
</items>
</properties>
</items>
</fixedcolums>
</items>
</content>
add the sling:hideChildren property to its immediate parent node, i.e., items (see below)
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fixedcolums
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured"
sling:hideChildren="*">
<properties
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<startLevel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
../>
<showHidden
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
../>
</items>
</properties>
</items>
</fixedcolums>
</items>
</content>
to hide only the startLevel field, add the sling:hideChildren property to its immediate parent node(see below)
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fixedcolums
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<properties
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured"
sling:hideChildren="startLevel">
<startLevel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
../>
<showHidden
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
../>
</items>
</properties>
</items>
</fixedcolums>
</items>
</content>

See AEM 6.1 User Interface Customization slide 9 for the "new" granite edit dialog inheritance ...
The We.Retail (AEM 6.2) edit dialog examples shows "hiding" each parent edit dialog tabs in the child component edit dialog ...

Related

How to use the AEM Asset Selector in a coral3 dialog?

As described on Adobe's page at https://helpx.adobe.com/experience-manager/6-3/assets/using/asset-selector.html AEM provides an OOTB asset selector which includes bigger image previews than the standard Coral3 pathfield or pathbrowser.
In the page above it also says that you can use the picker from a granite dialog:
http://localhost:4502/aem/assetpicker.html?dialog=true — Use these parameters to open the asset selector as Granite Dialog. This option is only applicable when you launch the asset selector through Granite Path Field, and configure it as pickerSrc URL.
I tried the following code in the dialog XML:
<image
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
name="./image/fileReference"
pickerSrc="/aem/assetpicker.html?dialog=true"
predicate="nosystem"
rootPath="/content/dam/"/>
The pathfield above does not seem seem to use the alternative picker specified with pickerSrc and behaves like a standard pathfield.
Also tried adding the extra URL parameters as specified in the pathfield docs but that made no change.
Any pointers as to what is wrong in the dialog definition?
The URL /aem/assetpicker.html is a vanity path you can use the absolute URL /libs/dam/gui/content/assetselector/jcr:content/body/items/assetselector.html however, this is not working properly.
You can try with commerce /gui/components/common/assetpicker with some additional clientLibs as mentioned below.
<assetpicker
jcr:primaryType="nt:unstructured"
jcr:title="Thumbnail"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<section
jcr:primaryType="nt:unstructured"
sling:resourceType="/libs/granite/ui/components/coral/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<thumbnail
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/coral/common/wcm/pagethumbnail"
page="${empty param.item ? requestPathInfo.suffix : param.item}"/>
<edit
jcr:primaryType="nt:unstructured"
sling:resourceType="commerce/gui/components/common/assetpicker"
name="./image/fileReference"
previewTarget=".foundation-layout-thumbnail-image coral-card-asset img"
text="Change"
type="image"/>
<charset
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/hidden"
ignoreData="{Boolean}true"
name="_charset_"
value="utf-8"/>
</items>
</section>
</items>
</column>
</items>
</assetpicker>
And the extraClientLibs property (multi) in your dialog node as below
extraClientlibs="[cq.common.wcm,core.wcm.page.properties,cq.wcm.msm.properties,cq.authoring.editor.plugin.commerce]"
In AEM 6.5, and possibly in earlier versions, it works with the OOTB granite pathfield without the need for any extra clientlibs:
<imagePathField
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="My Image"
name="./myimage/fileReference"
pickerSrc="/mnt/overlay/dam/cfm/admin/content/v2/associated-content/assetpicker.html?root=/content/dam&mode=single&filter=nosystem"
rootPath="/content/dam"/>

How to configure horizontal layout for aem touch ui dialog

I have a touch ui requirement where I need to place 2 text boxes side by side like the older ExtJs size widget. Is there a layout I can set to item to place those objects next to each other. For the older implementation I had written a custom widget with hbox layout. I think this should be supported now but cant find it in the docs. Any references will help. Thanks
You should use fixedColumn layout
Please note that you will not see the columns in floating dialog mode, this layout is intended for fullscreen dialog, see the screenshots.
Here is an example I put together:
<?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"
jcr:primaryType="nt:unstructured"
jcr:title="Sample"
sling:resourceType="cq/gui/components/authoring/dialog"
mode="edit">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<columns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<col1
jcr:primaryType="nt:unstructured"
jcr:title="General"
sling:resourceType="granite/ui/components/foundation/section">
<items jcr:primaryType="nt:unstructured">
<filed1col1
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="sample filed1col1"
fieldLabel="filed 1 col 1"
name="./filed1col1"/>
</items>
</col1>
<col2
jcr:primaryType="nt:unstructured"
jcr:title="Phone Numbers"
sling:resourceType="granite/ui/components/foundation/section">
<items jcr:primaryType="nt:unstructured">
<filed1col2
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="sample filed1col2"
fieldLabel="filed 1 col 2"
name="./filed1col2"/>
</items>
</col2>
</items>
</columns>
</items>
</content>
</jcr:root>
Dialog in floating mode
dialog in fullscreen mode
As it is the case with any dialog related questions, you can write your own CSS to achive this functionality, however, you run the risk of dialog markup/classes changing in future which will render your CSS useless.

Programmatically change widget title in IBM Connections

I'am trying to programmatically change a widget title in Connections. I use the following REST end-point:
/communities/service/atom/community/widgets?communityUuid=xyz&widgetInstanceId=xyz
Using the following PUT:
<?xml version="1.0" encoding="UTF-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">Bestandjes</title>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="widget">
</category>
<snx:widgetDefId>Files</snx:widgetDefId>
<snx:widgetInstanceId>Wfa656aa9103e_41d2_a7fc_44e84d642aa4</snx:widgetInstanceId>
<snx:hidden>false</snx:hidden>
<snx:location>col2</snx:location>
</entry>
With the WidgetInstanceId and communityID as a parameter. After the PUT is being executed, no error did occur but the title stays the same. Any suggestions?
You should be able to get this working by adding the following:
<snx:customTitle>TestChangeBookmarks</snx:customTitle>
i.e.
<?xml version="1.0" encoding="UTF-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">Bookmarks</title>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="widget">
</category>
<snx:customTitle>TestChangeBookmarks</snx:customTitle>
<snx:widgetInstanceId>W127627423458_49a0_bba1_af9bbf24d395</snx:widgetInstanceId>
<snx:hidden>false</snx:hidden>
<snx:location>col2</snx:location>
</entry>
*Note the element should contain the current title of the widget before making changes.
*Note is ignored for PUT request, therefore it is not needed.
More information on the widget entry elements can be found here:
https://www-10.lotus.com/ldd/lcwiki.nsf/xpAPIViewer.xsp?lookupName=IBM+Connections+5.0+API+Documentation#action=openDocument&res_title=Working_with_community_widgets_ic50&content=apicontent
Updated Community Widget Title

How to create a radio button in aem 6 touch dialog

I am having a touch UI component for which I am creating a dialog in AEM 6. I have a requirement to create 2 radio buttons in the touch dialog and if either one of them are selected, the corresponding value of the selected radio button should be displayed. however, I am not understanding how to create the radio button options. I have implemented the same in classic dialog where the xtype=selection and type=radiogroup is used, but I do not understand how to create it in touch dialog
Here is a radio group example for CoralUI v1/v2. The radiogroup is optional, the radio widgets on their own will still work. The group is only needed if you want to have a label for the group.
<radioGroup jcr:primaryType="nt:unstructured"
name="./type"
text="Fruit"
required="{Boolean}true"
sling:resourceType="granite/ui/components/foundation/form/radiogroup"
renderReadOnly="{Boolean}true">
<items jcr:primaryType="nt:unstructured">
<radioApple jcr:primaryType="nt:unstructured"
name="./fruit"
text="Apple"
value="apple"
cq-msm-lockable="fruit"
sling:resourceType="granite/ui/components/foundation/form/radio"
renderReadOnly="{Boolean}true"/>
<radioPear jcr:primaryType="nt:unstructured"
name="./fruit"
text="Pear"
value="pear"
cq-msm-lockable="fruit"
sling:resourceType="granite/ui/components/foundation/form/radio"
renderReadOnly="{Boolean}true"/>
<radioDefaultValue jcr:primaryType="nt:unstructured"
name="./fruit#DefaultValue"
value="apple"
sling:resourceType="granite/ui/components/foundation/form/hidden"/>
<radioDefaultWhenMissing jcr:primaryType="nt:unstructured"
name="./fruit#UseDefaultWhenMissing"
value="true"
sling:resourceType="granite/ui/components/foundation/form/hidden"/>
</items>
</radioGroup>
NOTE: If you need a default value to be set before you even open the dialog, then you'll need to define it in the template (if it is a page dialog) or for the component.
For a component, to set the default value to apple you would add this in the .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="Fruit Component"
componentGroup="My App Group"
sling:resourceSuperType="foundation/components/parbase">
<cq:template jcr:primaryType="nt:unstructured" fruit="apple"/>
</jcr:root>
See also:
http://docs.adobe.com/docs/en/aem/6-0/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/radiogroup/index.html
http://docs.adobe.com/docs/en/aem/6-0/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/radio/index.html
NOTE:
If you are developing for AEM 6.3 then you will want the CoralUI3 flavour of all the components, i.e. instead of granite/ui/components/foundation/form/radio you should use granite/ui/components/coral/foundation/form/radio, etc.
For details on migrating to CoralUI 3 see https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/legacy/coral2/migration.html.
You can use Form Input - Radio . To create a radio button group give all radio buttons the same name. The resourceType of Radio input is /libs/granite/ui/components/foundation/form/radio.
Sample Json of the Nodes :
"hideinnav": {
"jcr:primaryType": "nt:unstructured",
"name": "./hideInNav",
"text": "Hide in Navigation",
"value": "true",
"cq-msm-lockable": "hideInNav",
"sling:resourceType": "/libs/granite/ui/components/foundation/form/radio",
"renderReadOnly": true
},
"showinNav": {
"jcr:primaryType": "nt:unstructured",
"name": "./hideInNav",
"text": "Show in Navigation",
"value": "false",
"cq-msm-lockable": "hideInNav",
"sling:resourceType": "/libs/granite/ui/components/foundation/form/radio",
"renderReadOnly": true
}
Unlike the Classic UI Selection widget where the buttons are set under options node , radio buttons are independent and can be directly used in containers.
Coral UI3 no longer supports individual form/radio. This is now replaced by form/radio group
https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/legacy/coral2/migration.html
In Coral UI3, to create two radio buttons, you can do something like below:
<radioGroup
jcr:primaryType="nt:unstructured"
name=“./state“
text=“Select an Option”
sling:resourceType="granite/ui/components/coral/foundation/form/radiogroup">
<items jcr:primaryType="nt:unstructured">
<radioExpanded jcr:primaryType="nt:unstructured"
text="Expanded"
value="expanded”/>
<radioCollapse
jcr:primaryType="nt:unstructured"
text=“Collapse”
value=“collapse”/>
</items>
</radioGroup>
Radio button group is not supported in AEM 6 Touch UI. Instead, you could use a dropdown?
sling:resourceType="granite/ui/components/foundation/form/dropdown"

Adding Custom Content Items in Orchard Site Recipe

I have added a content type in my custom orchard recipe but when I try to create an instance of that content type within the recipe nothing happens.
Declaration:
<Metadata>
<Types>
<Speedbump ContentTypeSettings.Creatable="True" ContentTypeSettings.Draftable="True" TypeIndexing.Indexes="Search">
<TitlePart />
<BodyPart />
<CommonPart />
</Speedbump>
</Types>
<Parts>
<BodyPart BodyPartSettings.FlavorDefault="html" />
</Parts>
</Metadata>
Creation:
<Command>
Speedbump create /Slug:"valid-url" /Title:"Valid URL" /Path:"valid-url" /Homepage:false /Publish:true /UseWelcomeText:false
</Command>
Any ideas as to why this isn't working? I can go into the site after it is created and my speedbump type is defined and creatable but the instance that should have been created by the recipe doesn't exist. Thank you.
This isn't how you create content items in recipes. You add xml in the <Data> tag like so:
<Data>
<Speedbump Id="" Status="Published">
<BodyPart Text="Hello this needs to be encoded" />
<CommonPart Owner="/User.UserName=admin" CreatedUtc="2014-09-05T16:09:13Z" PublishedUtc="2014-09-05T16:15:43Z" ModifiedUtc="2014-09-05T16:15:43Z" />
<TitlePart Title="My Page" />
</Speedbump>
</Data>
For any custom parts, you will need to implement Import and Export functions in your driver method. Check core modules for good examples

Resources