How to edit querybuilder to include a cq:page - aem

I created a form and added it in geometrixx-gov folder under the dam (/content/dam/formsanddocuments/geometrixx-gov) as shown in the image below
However, this form isn't showing up when I go to http://localhost:4502/editor.html/content/geometrixx-gov/en/allforms.html
The allforms.html page is using a querybuilder to fetch all the forms in /content/dam/formsanddocuments/geometrixx-gov. Below is that query from the page
<querybuilder
jcr:created="{Date}2014-02-17T22:47:37.361+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2014-03-28T17:52:05.245+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="fd/fp/components/querybuilder"
customStylePath="/etc/designs/geometrixx-gov/form_portal_default.css"
customTemplate="/etc/designs/geometrixx-gov/fp/card/template.html/jcr:content"
disableSearch="true"
folderPaths="/content/dam/formsanddocuments/geometrixx-gov"
portalTitle="All Forms"
renderType="[PDF,HTML,GUIDE]"
singleView="Card"
style="Custom Style"
viewSwitch="true">
<view
jcr:primaryType="nt:unstructured"
sling:resourceType="fd/fp/components/lenses/view"/>
<textbar
jcr:primaryType="nt:unstructured"
sling:resourceType="fd/fp/components/predicates/textbar"/>
<left
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys">
<propertiespredicate
jcr:created="{Date}2014-03-28T17:45:35.478+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2014-03-28T17:50:01.642+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="fd/fp/components/predicates/propertiespredicate"
searchOptionsPredicates="\{"preducateType":"title","statusFilter":"active","captionText":"Title","defaultFilter":"","enabled":true}"
title="Properties"/>
</left>
<searchAssets
jcr:primaryType="nt:unstructured"
sling:resourceType="fd/fp/search"/>
</querybuilder>
Question
What can I do so that the form I added (DORUsingSchema) also shows up in the All Forms page?

How did you create DORUsingSchema Form?
If the form is being created using Forms Manager - http://localhost:4502/aem/forms.html/content/dam/formsanddocuments there are nodes created at two places.
/content/dam/formsanddocuments// - This node contains metadata of the form.
/content/forms/af// - This is actual form having the same relative hierarchy.
You have copied the node from /content/forms/af/[project-folder]/[formName] to /content/dam/formsanddocuments/[project-folder] which is incorrect, Form Manager take care of creating these nodes.
To show the form in your portal, you need to modify properties predicate applied on the form portal component in allforms.html page. This properties predicate shows all appliations starting with title "Application For", Either you can update your application title or update properties predicate to list down your form in the form portal.
To open properties dialog in authoring mode, click on Search icon located at the leftmost position of search box.

Related

Add attribute to anchor in AEM Rich text editor Link

I am working on making one of the AEM website of my client accessible. For the same, I want "aria-label" attribute should be added(value can be provided in authoring dialogue) to the anchor tag, when the target selected is "New tab".
Could not find much around it, following link describes we can customize the rtePlugin/linkPicker. But could not figure out my problem. Any help/guidance
http://experience-aem.blogspot.com/2017/06/aem-63-touch-ui-rte-rich-text-editor-color-picker-plugin-inplace-dialog-edit.html
Option 1) Reuse Alt Text/title from otb anchor link. No need to customize dialog. When Alt Text is authored otb will populate title like this <a title="Google" href="htttps://www.google.com">Google Link</a>
,
You will then need to Write a Link Transformer to copy title into aria-label. The rewriter will look for anchor tags; if title is present, copy into a new attribute aria-label and rewrite the anchor. If link rewriter is difficult, you can also rewrite the rte text from a sling model while saving the RTE text. Use a Jsoup parser to parse HTML, rewrite by copying title to aria-label and write back into JCR.
Option 2) Adding new text box for aria-label to dialog. You can refer to this blog post. But this option is needed only when Alt text is different from aria-label which I wonder why. Usually aria-label and titles are same and option 1 above will suffice.
So Finally was able to add aria-label attribute with some troubleshooting. Moreover the steps in the links mentioned above are same. Want to add additional details which I faced issue with
Adding new field
Follow the steps mentioned in the blog
After adding the field as mentioned in the blog the newly added attribute will get filtered by AEM. You will see the following error in error.log file
Error : "26.09.2017 12:40:42.804 INFO [0:0:0:0:0:0:0:1 [1506447642680] GET /content/we-retail/language-masters/en.html HTTP/1.1] org.apache.sling.xss.impl.HtmlToHtmlContentContext AntiSamy warning: The a tag contained an attribute that we could not process. The rel attribute had a value of "bookmark". This value could not be accepted for security reasons. We have chosen to remove this attribute from the tag and leave everything else in place so that we could process the input."
Solution: Declare the attribute in the AntiSamy configuration file in CRXDE Light.
Note : make the following changes in /apps/cq/xssprotection/config.xml (overlaying /libs/cq/xssprotection/config.xml), for Sightly/HTL its /libs/sling/xss/config.xml
Copy /libs/cq/xssprotection/config.xml to /apps/cq/xssprotection/config.xml.
Open /apps/cq/xssprotection/config.xml.
In the common-attributes section, add the following target attribute declaration.
<attribute name="aria-label>
<regexp-list>
<regexp value="[a-zA-Z0-9-_\$]+" />
</regexp-list>
</attribute>
Find the tag declaration by searching the term <tag name="a".
Add the line below in the list of attributes:
<attribute name="aria-label" />
Save the file. Now, the link will open in a new window if the option is selected.

AEM: Responsive Grid does not show layout mode

I posted AEM related question in Adobe forums but I have still not able to resolve the configuration problems.
One is that I would like to show ruler and responsive emulator menu at the top of editor.html
Second is that I would like to components to have customizable with. For example, if you drop text component on a page at editor.html, you can adjust the width of the component with drugging blue dot on the side.
The original question in Adobe forum has my current configuration which is not quite working with screenshot and details.
Original question: https://forums.adobe.com/thread/2376694
Would anybody help me resolving the issue that I have?
There's several things you need to do to enable the ruler and layouting mode in AEM.
Ruler (Emulator)
make sure /libs/wcm/mobile/components/simulator/simulator.jsp is in the head of your page
register the page component with a MobileEmulatorProvider. For example:
com.day.cq.wcm.mobile.core.impl.MobileEmulatorProvider-alias.xml:
mobile.resourceTypes=[geometrixx-media/components/page]
add the cq:deviceGroup property to the root content node (i.e. /etc/mobile/groups/responsive)
Note: the ruler will not show up unless the page is treated as “responsive”. The “emulators” property must not be blank at http://localhost:4502/libs/wcm/core/content/pageinfo.json?path=<path to page>
Layouting Mode
add the cq:responsive node to the root content node (just grab it from geometrixx-media). For example:
<cq:responsive jcr:primaryType="nt:unstructured">
<breakpoints jcr:primaryType="nt:unstructured">
<phone jcr:primaryType="nt:unstructured" title="{String}Phone" width="{Decimal}768"/>
<tablet jcr:primaryType="nt:unstructured" title="{String}Tablet" width="{Decimal}1200"/>
</breakpoints>
</cq:responsive>
if not inheriting from the foundation page component, add /libs/foundation/components/page/cq:infoProviders/responsive node to page component
change the "par" parsys to be of type wcm/foundation/components/responsivegrid
include the responsive css client lib in the project (see below)
More info: https://docs.adobe.com/docs/en/aem/6-2/author/page-authoring/responsive-layout.html

AEM not deleting data inside of datepicker from JCR when input field is changed to empty

In Adobe AEM, I have a CQ dialog (using Granite UI) that has a datepicker inside of it. It looks like this when viewed in the CQ dialog:
The problem occurs whenever I set a date, and save the contents of the dialog:
When I do this, I can't set the date property back to blank again. If I open the dialog and remove the date inside of this field and click save, the property still stays there.
This is an except of my cq dialog's content.xml file which contains the datepicker:
<startdate
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/datepicker"
displayedFormat="YYYY-MM-DD"
emptyText="YYYY-MM-DD"
fieldDescription="If limited by a start date, add a start date value. (YYYY-MM-DD)"
fieldLabel="Start Date"
name="./startdate"
storedFormat="YYYY-MM-DD"/>
Why doesn't it save the property when I set it to blank and how do I fix it?
---------EDIT----------
I found that even if I don't put the delete suffixes as #nateyolles places in his answer, the dialog does delete the dates when it is in full-screen mode. It still does not work when the cq dialog is NOT in full screen mode. Either way, I'm sure that this is a bug in AEM.
Use the Sling Post Servlet's Delete Suffix. See the Apache Sling doc.
<startdate
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/datepicker"
displayedFormat="YYYY-MM-DD"
emptyText="YYYY-MM-DD"
fieldDescription="If limited by a start date, add a start date value. (YYYY-MM-DD)"
fieldLabel="Start Date"
name="./startdate"
storedFormat="YYYY-MM-DD"/>
<startdateType
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/hidden"
name="./startdate#Delete"
value="this text is ignored"/>
As #nateyolles answer. You should open browser console and network tab when you submit the dialog in order to see any form's value that the dialog is transferring to server.
You can also use the date picker from coral ui : granite/ui/components/coral/foundation/form/datepicker
I've seen the issue with the old foundation components and the new coral ui one fixes that issue.

CQ5 preload a parsys with components

I'm curious if anyone knows how to have a parsys load w/ default components already in it.
What I'd like to accomplish is the following:
Form Component
- form-parsys
- input component
- input component
For the most part this was pretty straight forward. I created a "form" component that has a parsys in it. What I would like is for this form component to load with a few default input components already set. These input components would need to be a part of the form-parsys node, so that they can be reorganized amongst user added input components.
Not sure if there is any documentation out on this as I couldn't find any, but I'm sure it's not entirely impossible and wanted to see if anyone has done anything like this before, before I go ahead and start hacking away.
thank you
Brodie
I think what you are looking for are templates.
In CQ5, templates can be used to create pages with a predefined content, this can be a parsys (with components) or any other node you might want in your page when it is created.
In your case, you can define a template that includes a parsys component and whatever you want inside that parsys. You can also set rules for where a page can be created using that template.
After you have created (or edited, since you might already have one) the template, you can use the siteadmin to create a new page using your template. The page will be created and all the content below the jcr:content of the template will be copied into the new page. You can even have several templates for the same kind of page, if you need different types of 'initial contents'
An example of a template that includes a parsys with some content might look like this (I'm writing this mostly from memory, might have errors):
<?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:description="A form"
jcr:primaryType="cq:Template"
jcr:title="A form"
allowedChildren="/apps/app1/templates/home_page"
allowedParents="/apps/app1/templates/form_page"
allowedPaths="[/content(/.*)*]"
ranking="{Long}100">
<jcr:content
jcr:primaryType="cq:PageContent"
sling:resourceType="app1/pages/form_page">
<parsys
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/parsys" >
<component
jcr:primaryType="nt:unstructured"
sling:resourceType="foundation/components/text"
text="here is some text"/>
<!-- more components here-->
</parsys>
</jcr:content>
</jcr:root>

CQ5: Inheriting/Extended Dialogs

For reference, I'm on CQ5.5
I am curious if there is any way to extend upon an inherited dialog, without overwriting it's parent dialog.
For example, have a structure as follows:
base-page-template
- dialog
- title
- description
inerited-from-base-page
- dialog
- custom field
--------------- [inherited from parent]
- title
- description
What I'm trying to avoid is for example: I need to add a new property to base-page that should show up on all page templates that extend from base-page. My current solution is to add that property to all dialogs separately. So for example, in the above structure I would have to add the new "default property" to both the base-page and the inherited-from-base-page dialogs.
The only other option I could think of was creating a panel node that represents "base page" and then including that panel w/ an xtype:cqinclude node.
Before going with the latter route I'm curious if anyone has extended their dialogs in the fashion I'm describing above.
Any help is greatly appreciated, Thank you,
Brodie
No, there is no way to directly inherit dialogs. The best you can do is to include the dialog tabs using path property.
You should create your tab your tabs in a different location and you can include it in your dialog using path property like shown below:
<items jcr:primaryType="cq:WidgetCollection">
<tabs jcr:primaryType="cq:TabPanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Widget"
path="/apps/myproject/tab1.infinity.json"
xtype="cqinclude"/>
<tab2
jcr:primaryType="cq:Widget"
path="/apps/myproject/tab2.infinity.json"
xtype="cqinclude"/>
</items>
</tabs>
</items>
Where tab1 and tab2 are tab panels.
So, in your case it will be something like this :
base_page_dialog_tab
- dialog
- title
- description
inherited page-dialog-tab
- custom field
base-page-template
- include base page dialog tab here.
inerited-from-base-page
- include Tab 1 - inherited page-dialog tab using path property
- include Tab 2 - base page dialog tab using path property.
The above answer provided by Rajesh is correct w.r.t to dialog.xml written for classic UI interface in AEM.
The touch UI equivalent of cqinclude is sling:resourceType="granite/ui/components/foundation/include".
Example:
<basic
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/include"
path="foundation/components/page/cq:dialog/content/items/tabs/items/basic"/>
With touch UI in AEM, A different kind of dialog inheritance is possible using the sling:resourceSuperType property, however please note that this does not inherit dialog properties from its live copy parent. The dialog is inherited from its sling resource super-type.
I understand that this feature is not a solution to the problem described above, Just wanted to point out that dialog inheritance is possible with the new TOUCH-UI authoring.
Following is an example.
base_page_dialog_tab (sling:resourceType='A')
- dialog
- title
- description
page-dialog-tab (sling:resourceSuperType=sling:resourceSuperType='A')
- custom field
In the above example, the page-dialog-tab would have the following four properties in its dialog.
- dialog
- title
- description
- custom field
A few useful config options available like sling:hideProperties, sling:hideResource, sling:hideChildren and sling:orderBefore to hide and order properties in the dialog.