0
votes

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 ?

2

2 Answers

0
votes

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.

0
votes

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