Adobe CQ Components restricting child components - adobe

I am trying to create a component for a simple accordion, where blocks of content are held under headings and only one heading is visible at a time. My preferred implementation uses two components, one to represent the whole accordion and a second component for a single entry.
The idea is that a content author can pull the accordion in from the sidekick, then drop one or more accordion items into the accordion, but not allow any other components to be dropped here. The accordion items should only be able to be dropped into the accordion component and not within any other parsys.
My problem is that currently it is possible to add other content into the accordion and add accordion items outside of the accordion.
The first attempt to solve this was:
foobar/components/accordion
foobar/components/accordion/accordion.jsp
foobar/components/accordion/cq:editConfig
foobar/components/accordion/dialog
foobar/components/accordion/accordionitem
foobar/components/accordion/accordionitem/accordionitem.jsp
foobar/components/accordion/accordionitem/cq:editConfig
foobar/components/accordion/accordionitem/dialog
These are the config files from this are:
accordion/.content.xml
<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"
cq:isContainer="{Boolean}true"
jcr:primaryType="cq:Component"
jcr:title="Accordion"
sling:resourceSuperType="foundation/components/parbase"
allowedChildren="[*/accordion/accordionitem]"
allowedParents="[*/parsys]"
componentGroup="General"/>
accordion/_cq_editConfig.xml
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[-,edit,-,delete]"
cq:layout="editbar"
jcr:primaryType="cq:EditConfig">
<cq:listeners
jcr:primaryType="cq:EditListenersConfig"
aftercopy="REFRESH_PAGE"
afterdelete="REFRESH_PAGE"
afterinsert="REFRESH_PAGE"/>
</jcr:root>
The dialog is blank and exists only so that the component will appear in the sidekick.
accordion.jsp simply includes the foundation parsys.
accordion/accordionitem/.content.xml
<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="Accordion Item"
sling:resourceSuperType="foundation/components/parbase"
allowedParents="[*/accordion]"
componentGroup="General"/>
The accordion item dialog takes in the title. The editConfig simply adds the toolbar, but no listeners.
accordionitem.jsp outputs the title taken from the dialog and has a parsys.
My problem seems to be that the parsys aren't using the rules for the accordion and accordionitem components. Instead they seem to inherit from the next parsys up instead, unless overwritten.
I can set the components correctly by using edit mode on the page and selecting the appropriate components, but that sets the information against the template, meaning I need to perform the same configuration for every page template. What I want is to have it defined in the component definition instead so that it exists once.
After first writing the components I found this blog, which describes exactly the same scenerio: http://jenikya.com/blog/2012/03/cq5-accordion-component.html
Using that as I reference, I tried adding an extension of parsys to use within accordion.jsp instead. This made no difference to the code, so even my custom parsys allowed components other than accordion item to be added.
Any guidance on either what is wrong or other approaches to take will be greatly appreciated.

The solution here would be to use a parsys and build a composite component to restrict the accordion content to a set of components only (as described in the blog entry).
Have a look at http://localhost:4502/content/geometrixx/en/company/press/asseteditor.html which also uses this technique for the dam/components/asseteditor/thumbnail component.

This is a very generic problem statement in AEM. There are several ways to handle it, depends on your business need and how your design will map this. I can suggest two solution for this:
1. Apply Template level design restriction for your accordion component. Which means, you drop accordion component and then go to design mode of page and in accordion par select accordion item component. This is one time activity only.
Though i would recommend option #2:
2. In accordion component dialog, ask author to add accordion item using multilist.
- To add a new item, simply open accordion dialog and add item in multilist and enter accordion id in it.
- To remove item, open dialog and remove item from multilist
- To change position, rearrange items in multilist.
Based on no of multilist items entered by author in Accordion dialog, statically include accordion item component and give component id entered by author in multilist.
Using this approach, you will
- easily restrict component in accordion.
- Reduce one component (accordion item) in sidekick
- Reduce one parsys on page (so many parsys eat authoring performance)

Related

Sencha Touch 2 adding buttons to toolbar/titlebars

Can anyone tell me how I might add buttons, or other components, to a title/tool bar without using the items array? For months I've been struggling to find a way to make the bar on all my views contain the same user buttons and icons.
It's a struggle mostly on List item detail views where only a back button shows. I want the back button but also own buttons on the same bar. This is so my app has a uniform look and accessible functionality across the entire build.
Toolbar and TitleBar extend Ext.Container.
In Sencha Touch containers always store their components inside the items array.
If you want to have a toolbar that always look the same just create your own by extending Ext.Toolbar. Use the initialize method of such extended Toolbar to add the buttons/icons.
To use it with a list you can create a wrapping container, which contains the extended toolbar and the list.

Missing Dropdown in Component Styles Tab in CQ5

In the TextImage component, the Style tab has lost the css selection dropdown that used to show up when editing the component. It now just shows a blank area. It should have a dropdown for image alignment (left or right are your choices). This doesn't appear anymore.
This tab is xtype componentstyles (String), so I don't know where it references the source for the dropdown values. My local instance of CQ5 works just fine.
I cannot just add an xtype selection and feed it values because the css that gets added to the JSP code is outside the component's .jsp-specific page
It looks like the componentstyles xtype is driven by the CQ design that is associated to the page. Designs are stored underneath /etc/designs and are assigned through a page's Page properties dialog (cq:designPath property)
Let's look at an example in the Geometrixx website. If you navigate to the English homepage # /content/geometrixx/en.html and add an instance of the TextImage component to the page, you will notice that the Styles tab is empty in the component dialog. Now navigate to the 'Discover Geometrixx' page # /geometrixx/en/company/discover_geometrixx.html and examine one of the two pre-existing instances of the TextImage component. The Styles tab has the image dropdown you mentioned!
So what is the difference between the instances on the 'Discover Page' and the 'Home' page? The answer is in the design definition. If you open up CRXDE Lite and navigate to the Geometrixx design page for the Content Page template (which the 'Discover Geometrixx' page adopts), you will see the following nodes:
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles/imagealign
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles/imagealign/image_left
/etc/designs/geometrixx/jcr:content/contentpage/par/textimage/cq:styles/imagealign/image_right
The design for the Homepage template (which the 'Home' page adopts) is missing this definition.
If you want to continue to use the out of box TextImage component, it seems you will need to have this design configuration set up on all the paragraph systems and templates where the component can go. So for example, if you want these styles to be available to the TextImage component when it is added to the par paragraph system of the Homepage template, you would add similar style nodes to:
/etc/designs/geometrixx/jcr:content/homepage/par/textimage/cq:styles
Alternatively you could just overlay the component and/or create your own. Then for this custom component you could create your own Styles dialog that is independent of the design. You can simulate the out of box behavior by examining the saved JCR property and setting the appropriate CSS class name in your render script.
The problem is that a design path variable went missing. We don't know why or how, but the solution is as follows.
Open up Content Repository
Go to /content/-sitefolder-/ and expand
Click on jcr:content and view properties
Check for attribute cq:designPath and its value
/etc/designs/-sitefolder-; add to properties if it doesn't exist

Flex 4: Checkbox in Accordion header

I wanted to know if it is possible to add a checkbox in the accordion control.
The main idea is to have a list of selectable items (like selecting various items for checkout) and each of them should have an option to display additional information (the accordion panel).
So basically, 3 questions:
Can I have a checkbox in the accordion header?
Can I have all the panels closed from the start? So the user chooses which panel to open, and not start with one panel displayed.
Can I have multiple panels opened at the same time?
Some notes:
- I tried a header renderer option, but the checkbox was the same for all accordion headers, so it was useless.
- It would be great to avoid the use of libraries or external controls. I am aware of some of the limitations of Flex controls though.
Thanks for any help or information you can provide ! :)
If you're not dead set on using mx controls, I'd give the 4.6 list/item renderer skinning method a try.
I'd use the sparks list control and create a custom item render that's comprised of checkbox control, several nested group/border-container wrappers depending on your design/creative requirements and whatever as3 logic would be necessary to expand and contract the item renderer keyed off of the checkbox's click event or change events-- that's some of the beauty of skinning item renderers in flex 4, you can encapsulate all that dope-ass logic within renderer itself.
In any case, here's some links you might find helpful:
http://www.adobe.com/devnet/flex/articles/flex4_skinning.html
http://blog.flexexamples.com/2009/06/21/creating-a-custom-halo-accordion-header-skin-in-flex-4/
http://saturnboy.com/2009/09/flex4-component-states-skin-states/
hope this helps!

Flex custom component first item not read by JAWS

Flex application is being made accessibility compliant. When a custom component is made visible based on some condition, the first item (either text or formitem or textarea) inside the component is skipped by Jaws. It reads from the second item. On pressing UP arrow, the first item is then read.
Is there a way to make the first item accessible without need for pressing UP arrow?
This is likely going to be related to focus management.
You're likely going to want to assign componentId.setFocus() to the first component in the current view when the view state changes.
You need to re-assess the focus when the state of your display changes. If you post how you are managing display state I can suggest exactly how to trigger that via an event or in your custom state method.
Also, if that doesn't work, try this once your screen is ready / state changed :
focusManager.moveFocus(mx.events.FocusRequestDirection.TOP);

How to add custom component in context menu of datagrid

How to add custom component in context menu of datagrid.Here custom component like one text box with formatting details.
You cannot put components into the context menu. You can only have menuitems that dispatch a menuclick event. Unfortunately the context menu in the flashplayer is lacking a lot of functionality like that.
You might be able to highjack the context menu all together and display some sort of title window on a right click, but I am not sure if this is possible or how you would go about trying to achieve it.

Resources