How to create a radio button in aem 6 touch dialog - 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"

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.

how to prevent cq:dialog inheritance

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 ...

Selected vs Selection in Xpages application layout control

This is SO confusing. I have an Xpage application built with the application layout control. I have 2 Title Bars which each have a navigation element in them with two views each.
I want the selected Title Bar and view to be highlighted. I understand that somehow this involves the Navigation Path and the use of the selected and/or selection properties,, but I do not understand how they work or interact.
Can these answers help you? How do you use the Selected property of the navigator?
You need to set the navigationPath property on each XPage and this must match the selection property (using regex) on the navigation control.
Updated with answer to the comment below
Here's an example XPage for the Home tab and the navigation control for Home:
<xc:layout navigationPath="/Home/XPage1">
<xp:this.facets>
<xc:layout_menu_home xp:key="facetLeft"></xc:layout_menu_home>
<xc:content_xpage1 xp:key="facetMiddle"></xc:content_xpage1>
</xp:this.facets>
</xc:layout>
The layout custom control uses the xe:applicationLayout to control the layout. In this case it has a custom property called navigationPath which is used in the example XPage above. The corresponding navigationPath property of the xe:applicationLayout must be set to this custom property:
<xe:applicationLayout id="applicationLayout">
...
<xe:this.configuration>
<xe:oneuiApplication
navigationPath="${javascript:compositeData.navigationPath}">
Here's part of xe:applicationLayout for handling the two tabs in your layout custom control:
<xe:this.titleBarTabs>
<xe:pageTreeNode page="/xpage1.xsp" label="Home" selection="/Home/.*"></xe:pageTreeNode>
<xe:pageTreeNode page="/xpage3.xsp" label="Tips" selection="/Tips/.*"></xe:pageTreeNode>
</xe:this.titleBarTabs>
Here's an example navigation control for Home:
<xe:navigator id="navigator1" >
<xe:this.treeNodes>
<xe:pageTreeNode page="/xpage1.xsp" label="XPage 1" selection="/Home/XPage1"></xe:pageTreeNode>
<xe:pageTreeNode page="/xpage2.xsp" label="XPage 2" selection="/Home/XPage2"></xe:pageTreeNode>
</xe:this.treeNodes>
</xe:navigator>

In SharePoint how to display custom ribbon button to particular lists only?

I am having four external list "List1", "List2", "List3", "List4". I have added a custom ribbon button Like:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="ATEAgWorkOrderButton"
RegistrationType="List"
RegistrationId="600"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListItem.Actions.Controls._children">
<Button
Id="Ribbon.ListItem.Actions.ATEAgWorkOrderButton"
Alt="Click on this button to Add"
Sequence="3"
Image32by32="/_layouts/Images/Project/image.png"
Command="ATEAg_WorkOrder"
LabelText="Add Detail"
TemplateAlias="o2"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ATEAg_WorkOrder"
CommandAction="javascript:alert("Hello Success");" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
The button is now visible in all the external lists. But I want to make it visible for only "List1" and "List2". How to do this?
You need to explore the Andrew Connell's Ribbon Customization Deep Dive.
http://www.andrewconnell.com/blog/archive/2011/04/16/sharepoint-2010-ribbon-customization-deep-dive.aspx
He goes into how to solve these problems. In short instead of binding a customization for all lists of a certain type, you can register a javascript function that gets called to determine if you button should be shown or hidden. In this function you can determine which list is currently active.
If all your lists are associated with a ContentType, you can set the registration id of the custom action to the ContentType id.
From MSDN:
RegistrationID: Optional Text. Specifies the identifier of the list or
item content type that this action is associated with, or the file
type or programmatic identifier (ProgID).

Resources