<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adobe Day CQ - Tips and Tricks</title>
	<atom:link href="http://cq.shishank.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://cq.shishank.info</link>
	<description>World of cq</description>
	<lastBuildDate>Fri, 16 Mar 2012 17:27:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Quick way to find information of specific type</title>
		<link>http://cq.shishank.info/2012/03/16/quick-way-to-find-information-of-specific-type/</link>
		<comments>http://cq.shishank.info/2012/03/16/quick-way-to-find-information-of-specific-type/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 17:27:33 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#contentexplorer]]></category>
		<category><![CDATA[#crx]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=76</guid>
		<description><![CDATA[It is always not straight forward to search information of specific type from with CQ. For example: determining pages which uses specific templates. A quick and fast way is to perform search in CRX Content Explorer: - Login to Content Explorer - Click on search and select type as XPath - Specify query that match [...]]]></description>
			<content:encoded><![CDATA[<p>It is always not straight forward to search information of specific type from with CQ. For example: determining pages which uses specific templates.</p>
<p>A quick and fast way is to perform search in CRX Content Explorer:</p>
<p>- Login to Content Explorer<br />
- Click on search and select type as XPath<br />
- Specify query that match the required information. Example:</p>
<p>/jcr:root/content/mysite//*[@cq:template = &#8216;/apps/mysite/templates/mypage&#8217;</p>
<p>And you can retrieve all the information <img src='http://cq.shishank.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2012/03/16/quick-way-to-find-information-of-specific-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing parameters in cq:include</title>
		<link>http://cq.shishank.info/2012/01/04/passing-parameters-in-cqinclude/</link>
		<comments>http://cq.shishank.info/2012/01/04/passing-parameters-in-cqinclude/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 13:32:53 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#components]]></category>
		<category><![CDATA[#cq]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=71</guid>
		<description><![CDATA[When I started developing CQ components, I always use to have one jsp with the same name as the component and place all the logic there. And the reason, I not sure how we can pass on the parameters from one jsp file to other jsp file. But necessity is the mother of all search [...]]]></description>
			<content:encoded><![CDATA[<p>When I started developing CQ components, I always use to have one jsp with the same name as the component and place all the logic there. And the reason, I not sure how we can pass on the parameters from one jsp file to other jsp file. But necessity is the mother of all search <img src='http://cq.shishank.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . So, here is the way to pass parameters which will help to make your code cleaner and reusable:</p>
<blockquote><p>
In JSP 1</p>
<p>        <%<br />
        request.setAttribute("title", "column1title");<br />
        request.setAttribute("links", "column1links");<br />
        %><br />
        < cq:include script="columnlinks.jsp"/></p>
<p>In JSP 2</p>
<p><%<br />
String titleAttribute = (String) request.getAttribute("title");<br />
String linkAttribute = (String) request.getAttribute("links");<br />
%></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2012/01/04/passing-parameters-in-cqinclude/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Promotion Picker</title>
		<link>http://cq.shishank.info/2012/01/03/promotion-picker/</link>
		<comments>http://cq.shishank.info/2012/01/03/promotion-picker/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:11:41 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[WCM]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#components]]></category>
		<category><![CDATA[#cq]]></category>
		<category><![CDATA[#day]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=59</guid>
		<description><![CDATA[Promotions are integral part of each website, offering teased content from other sections, information about promotions, link to other sites etc. CQ provides the concept of iParsys (inherited paragraph system) which allows to inherit the created paragraphs from the parent to child pages. This provides a way to author the promotional sidebar on section home [...]]]></description>
			<content:encoded><![CDATA[<p>Promotions are integral part of each website, offering teased content from other sections, information about promotions, link to other sites etc.  </p>
<p>CQ provides the concept of iParsys (inherited paragraph system) which allows to inherit the created paragraphs from the parent to child pages. This provides a way to author the promotional sidebar on section home pages and all the child pages gets the components automatically inherited. Sounds a good start point, but more often then not, the requirements mostly revolve around managing different promotions on different pages or different sequence of promotions based on page description etc. This limits the usage of iparsys component. Managing such promotion area&#8217;s is one of the main challenge for each implementation. Here is one of the technique we adopted in a project to provide flexible promotion management:</p>
<ul>
<li> Define a promotional area within content</li>
<li> Define number of pages using same templates as used by actual pages where promotions need to be displayed</li>
<li> Add components and setup content within promotional area pages </li>
<li> Create promotion picker component to picks up promotional parsys from the promotional area page</li>
<li> Add promotion picker component on actual page with a browse button to browse to page from where the promotion parsys need to be picked up</li>
</ul>
<p>Good luck !</p>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2012/01/03/promotion-picker/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Happy New Year 2012 !</title>
		<link>http://cq.shishank.info/2012/01/02/happy-new-year-2012/</link>
		<comments>http://cq.shishank.info/2012/01/02/happy-new-year-2012/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 16:26:40 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[#2012]]></category>
		<category><![CDATA[#HNY]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=60</guid>
		<description><![CDATA[Cherishing the happy moments, learning from the difficult ones, and looking forward to a successful 2012, say Good Bye to 2011 ! May 2012 bring fun, happiness, prosperity and success to you and your family! Wish you and your family a very happy year 2012 !]]></description>
			<content:encoded><![CDATA[<div id="attachment_446" class="wp-caption alignleft" style="width: 547px"><a href="http://cq.shishank.info/?attachment_id=446" rel="attachment wp-att-446"><img src="http://shishank.info/pcm/wordpress/wp-content/uploads/2012/01/2012.png" alt="Happy New Year 2012" title="Happy New Year 2012" width="537" height="302" class="size-full wp-image-446" /></a><p class="wp-caption-text">Happy New Year 2012</p></div>
<blockquote><p><strong>Cherishing the happy moments, learning from the difficult ones, and looking forward to a successful 2012, say Good Bye to 2011 !</p>
<p>May 2012 bring fun, happiness, prosperity and success to you and your family! Wish you and your family a very happy year 2012 ! </strong>
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2012/01/02/happy-new-year-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Impressions in CQ 5.4</title>
		<link>http://cq.shishank.info/2011/12/20/impressions-in-cq-5-4/</link>
		<comments>http://cq.shishank.info/2011/12/20/impressions-in-cq-5-4/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 13:10:27 +0000</pubDate>
		<dc:creator>arun</dc:creator>
				<category><![CDATA[CQ Components]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=50</guid>
		<description><![CDATA[Impressions in CQ 5.4 In most of the websites today, we always find links to most viewed pages or top 5 most viewed pages. CQ stores every hit on any webpage as an impression which can be seen in siteadmin. There is no out of box component present in CQ5.4 which can be used or [...]]]></description>
			<content:encoded><![CDATA[<p>Impressions in CQ 5.4</p>
<p>In most of the websites today, we always find links to most viewed pages or top 5 most viewed pages.</p>
<p>CQ stores every hit on any webpage as an impression which can be seen in siteadmin.</p>
<p>There is no out of box component present in CQ5.4 which can be used or customized to get the impressions.</p>
<p>Below is the JSP code which can be used to find the most viewed/popular pages in your website.</p>
<blockquote><p>&lt;%@ page import=&#8221;java.util.Iterator,</p>
<p>java.util.ArrayList,</p>
<p>java.util.Collections,</p>
<p>com.day.text.Text,</p>
<p>com.day.cq.wcm.api.PageFilter,</p>
<p>com.day.cq.wcm.core.stats.PageViewStatistics,</p>
<p>com.day.cq.statistics.StatisticsService,</p>
<p>com.day.cq.wcm.core.stats.PageViewReport,</p>
<p>com.day.cq.wcm.api.WCMMode,</p>
<p>java.util.*,</p>
<p>com.day.cq.wcm.foundation.Download,</p>
<p>com.day.cq.wcm.commons.WCMUtils&#8221; %&gt;</p>
<p>&lt;%@ page import=&#8221;com.day.cq.statistics.StatisticsService, java.util.Map&#8221;</p>
<p>%&gt;&lt;%@page session=&#8221;false&#8221; %&gt;&lt;%</p>
<p>%&gt;&lt;%@taglib prefix=&#8221;sling&#8221; uri=&#8221;http://sling.apache.org/taglibs/sling/1.0&#8243; %&gt;&lt;%</p>
<p>%&gt;&lt;%@taglib prefix=&#8221;c&#8221; uri=&#8221;http://java.sun.com/jsp/jstl/core&#8221; %&gt;</p>
<p>&lt;%</p>
<p>%&gt;&lt;sling:defineObjects/&gt;</p>
<p>&lt;%</p>
<p>String p_searchPath =&#8221;";</p>
<p>%&gt;</p>
<p>&lt;%!</p>
<p>int intarray[];</p>
<p>Set limitToFive = new HashSet();</p>
<p>java.util.List&lt;Integer&gt; arrayList = new ArrayList&lt;Integer&gt;();</p>
<p>private int calcPageViews(JspWriter outWriter,</p>
<p>HttpServletRequest request,</p>
<p>StatisticsService statService,</p>
<p>Page mostpopularPage) throws</p>
<p>Exception {</p>
<p>final String PARAM_PERIOD = &#8220;Period&#8221;;</p>
<p>&nbsp;</p>
<p>int totalPageViews = 0;</p>
<p>PageManager pm = mostpopularPage.getPageManager();</p>
<p>&nbsp;</p>
<p>Page statsPage = pm.getPage(mostpopularPage.getPath());</p>
<p>&nbsp;</p>
<p>PageViewReport report = new PageViewReport(statService.getPath() + &#8220;/pages&#8221;, mostpopularPage, WCMMode.EDIT);</p>
<p>report.setPeriod(30);</p>
<p>Iterator stats;</p>
<p>&nbsp;</p>
<p>stats = statService.runReport(report);</p>
<p>while (stats.hasNext()) {</p>
<p>Object[] res = (Object[]) stats.next();</p>
<p>totalPageViews = totalPageViews + Integer.parseInt(res[1].toString());</p>
<p>}</p>
<p>Iterator&lt;Page&gt; children = mostpopularPage.listChildren(new PageFilter(request));</p>
<p>while (children.hasNext()) {</p>
<p>totalPageViews = totalPageViews + calcPageViews(outWriter, request, statService, children.next());</p>
<p>}</p>
<p>return totalPageViews;</p>
<p>}</p>
<p>private void outputPopularHowTos(JspWriter outWriter,</p>
<p>HttpServletRequest request,</p>
<p>StatisticsService statService,</p>
<p>Page mostpopularPage,</p>
<p>String strNrMostPopular) throws</p>
<p>Exception {</p>
<p>ArrayList mostPopular = new ArrayList();</p>
<p>int nrFound = 0;</p>
<p>int nrToList = 0;</p>
<p>outWriter.write(&#8220;&lt;ul&gt;&#8221;);</p>
<p>Iterator&lt;Page&gt; children = mostpopularPage.listChildren(new PageFilter(request));</p>
<p>while (children.hasNext()) {</p>
<p>nrFound++;</p>
<p>Page child = children.next();</p>
<p>mostPopular.add(calcPageViews(outWriter, request, statService, child) + &#8220;; &#8221; + child.getPath() + &#8220;; &#8221; + child.getTitle());</p>
<p>}</p>
<p>if  (strNrMostPopular == null || strNrMostPopular.equals(&#8220;&#8221;)) {</p>
<p>nrToList = nrFound;</p>
<p>} else {</p>
<p>nrToList = Integer.parseInt(strNrMostPopular);</p>
<p>}</p>
<p>Collections.reverseOrder();</p>
<p>//Collections.sort(mostPopular);</p>
<p>if (nrFound &lt; nrToList) nrToList = nrFound;</p>
<p>if (nrFound &lt;= 0) {</p>
<p>outWriter.write(&#8220;&lt;p&gt;&lt;i&gt;Page has Impressiosn&#8230;&lt;/i&gt;&lt;/p&gt;&#8221;);</p>
<p>} else {</p>
<p>int cnt = 0;</p>
<p>//  outWriter.write(&#8220;Impressions&#8221;);</p>
<p>List&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;();</p>
<p>for (int i = 0; i &lt; nrToList; i++) {</p>
<p>String[] entry = null;</p>
<p>entry = mostPopular.get(i).toString().split(&#8220;;&#8221;);</p>
<p>Integer numberOfImpressions = Integer.valueOf(entry[0]);</p>
<p>a.add(numberOfImpressions);</p>
<p>if(numberOfImpressions&gt;0){</p>
<p>if(cnt&lt;15){</p>
<p>outWriter.write(&#8220;&lt;li&gt;&#8221;);</p>
<p>outWriter.write(&#8220;&lt;a class=&#8217;view-more&#8217; href=\&#8221;" + entry[1]  + &#8220;.html\&#8221;&gt;&#8221; +&#8221;&lt;span&gt;»&lt;/span&gt;&#8221; + entry[2] + &#8220;&lt;/a&gt;&#8221;);</p>
<p>outWriter.write(&#8220;&lt;/li&gt;&#8221;);</p>
<p>cnt++;</p>
<p>}</p>
<p>}</p>
<p>outWriter.write(&#8220;&lt;/li&gt;&#8221;);</p>
<p>}</p>
<p>}</p>
<p>outWriter.write(&#8220;&lt;/ul&gt;&#8221;);</p>
<p>return;</p>
<p>}</p>
<p>%&gt;</p>
<p>&lt;%@include file=&#8221;/libs/foundation/global.jsp&#8221;%&gt;</p>
<p>&nbsp;</p>
<p>&lt;%</p>
<p>final StatisticsService statService = sling.getService(StatisticsService.class);</p>
<p>String queryDataPath = statService.getPath() + &#8220;/queries&#8221;;</p>
<p>String resultDataPath = statService.getPath() + &#8220;/results&#8221;;</p>
<p>&nbsp;</p>
<p>pageContext.setAttribute(&#8220;properties&#8221;, resource.adaptTo(Map.class));</p>
<p>%&gt;</p>
<p>&nbsp;</p>
<p>&lt;%</p>
<p>try {</p>
<p>p_searchPath = properties.get(&#8220;p_searchPath&#8221;, &#8220;&#8221;);</p>
<p>Page targetPage = pageManager.getPage(p_searchPath);</p>
<p>PageManager mostpopularPageManager = targetPage.getPageManager();</p>
<p>// get the parameters from the dialog</p>
<p>String rootMostPopular = properties.get(&#8220;rootmostpopular&#8221;, String.class);</p>
<p>Page mostpopularRootPage;</p>
<p>if (rootMostPopular == null) {</p>
<p>mostpopularRootPage = targetPage;</p>
<p>} else {</p>
<p>mostpopularRootPage = targetPage;</p>
<p>}</p>
<p>String strNrMostPopular = properties.get(&#8220;nrmostpopular&#8221;, String.class);</p>
<p>&nbsp;</p>
<p>// check that we have a valid page to start from</p>
<p>if (mostpopularRootPage != null) {</p>
<p>// get children of start page</p>
<p>outputPopularHowTos(out,</p>
<p>request,</p>
<p>statService,</p>
<p>mostpopularRootPage,</p>
<p>strNrMostPopular);</p>
<p>}</p>
<p>} catch(Throwable t) {</p>
<p>log.error(&#8220;Popular &#8216;Most Popular &#8211; Error &#8220;, t);</p>
<p>}</p>
<p>if(p_searchPath.equals(&#8220;&#8221;) || p_searchPath == &#8220;&#8221;) {</p>
<p>%&gt;</p>
<p>Click here to add the root page.</p>
<p>&lt;%}</p>
<p>%&gt;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2011/12/20/impressions-in-cq-5-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Limit to Multifiled</title>
		<link>http://cq.shishank.info/2011/12/20/adding-limit-to-multifiled/</link>
		<comments>http://cq.shishank.info/2011/12/20/adding-limit-to-multifiled/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 08:26:44 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[WCM]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#components]]></category>
		<category><![CDATA[#cq]]></category>
		<category><![CDATA[#day]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=47</guid>
		<description><![CDATA[Multifield is an important xtype which provides flexibility as we saw in the previous post around Multifield with custom xtype. It is good to have flexibility but becomes a bigger challenge in bigger editorial team environments where rules need to be defined to lock down flexibility. Adding validation is one way of locking down flexibility, [...]]]></description>
			<content:encoded><![CDATA[<p>Multifield is an important xtype which provides flexibility as we saw in the previous post around <a href="http://cq.shishank.info/2011/12/19/multifield-with-custom-xtype/">Multifield with custom xtype</a>. It is good to have flexibility but becomes a bigger challenge in bigger editorial team environments where rules need to be defined to lock down flexibility.</p>
<p>Adding validation is one way of locking down flexibility, providing cleaner content entry environment. To extend the previous example around <a href="http://cq.shishank.info/2011/12/19/multifield-with-custom-xtype/">defining custom type with multifield</a>,  we need to add &#8220;listeners&#8221; node under multifield. Then add an attribute called &#8220;<em>beforeadd</em>&#8221; and specify its value as a Javascript function. As an example, </p>
<blockquote><p>
            < linkspanel<br />
                jcr:primaryType="cq:Panel"<br />
                border="false"<br />
                height=""<br />
                title="Links"<br />
                width=""><br />
                < items jcr:primaryType="cq:WidgetCollection"><br />
                    < links<br />
                        jcr:primaryType="cq:Widget"<br />
                        fieldDescription="Press + to add more links"<br />
                        fieldLabel="Links"<br />
                        hideLabel="true"<br />
                        name="./links"<br />
                        width="1000"<br />
                        xtype="multifield"><br />
                        < fieldConfig<br />
                            jcr:primaryType="cq:Widget"<br />
                            xtype="rbspathfieldwithintent"/><br />
                        <strong>< listeners<br />
                            jcr:primaryType="nt:unstructured"<br />
                            beforeadd="function(list,component,index){if(index!=0){var link=list.items.item(index-1).getValue();var myObject=JSON.parse(link);if(link.text==''){CQ.Ext.Msg.show({title:'Validation Error',msg:'Link  Text can not be empty!',buttons:CQ.Ext.MessageBox.OK,icon:CQ.Ext.MessageBox.ERROR});return false;}if(link.url==''){CQ.Ext.Msg.show({title:'Validation Error',msg:'Link  Text can not be empty!',buttons:CQ.Ext.MessageBox.OK,icon:CQ.Ext.MessageBox.ERROR});return false;}}}"/></strong><br />
                    < /links><br />
                < /items><br />
            < /linkspanel>
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2011/12/20/adding-limit-to-multifiled/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multifield with custom xtype</title>
		<link>http://cq.shishank.info/2011/12/19/multifield-with-custom-xtype/</link>
		<comments>http://cq.shishank.info/2011/12/19/multifield-with-custom-xtype/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 21:28:25 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[WCM]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#components]]></category>
		<category><![CDATA[#cq]]></category>
		<category><![CDATA[#day]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=34</guid>
		<description><![CDATA[When started working with CQ, one of the cool feature was the list component which allow to add new paths with the plus &#8220;+&#8221; sign. Based on my experience, it is one of the mandatory requirement to provide such flexibility, then setting a fixed number of text fields. To achieve the same, please refer to [...]]]></description>
			<content:encoded><![CDATA[<p>When started working with CQ, one of the cool feature was the list component which allow to add new paths with the plus &#8220;+&#8221; sign. Based on my experience, it is one of the mandatory requirement to provide such flexibility, then setting a fixed number of text fields.</p>
<p>To achieve the same, please refer to the steps below:</p>
<ul> Within your app project, define a folder called &#8220;clientlib&#8221;. Create a text files called &#8220;js.txt&#8221; and specify the name of the js file which holds the custom xtype definition.
</ul>
<blockquote><p>Example:<br />
#base=js<br />
CustomPathField.js
</p></blockquote>
<ul> Define your js file which extends CQ.form.CompositeField and specify attributes required for the custom type. Here is an example for the same:
</ul>
<blockquote><p>
/**<br />
 * @class MyClientLib.CustomPathFieldWidget<br />
 * @extends CQ.form.CompositeField<br />
 * This is a custom path field with link text and target<br />
 * @param {Object} config the config object<br />
 */<br />
/**<br />
 * @class Ejst.CustomWidget<br />
 * @extends CQ.form.CompositeField<br />
 * This is a custom widget based on {@link CQ.form.CompositeField}.<br />
 * @constructor<br />
 * Creates a new CustomWidget.<br />
 * @param {Object} config The config object<br />
 */<br />
MyClientLib.CustomPathFieldWidget = CQ.Ext.extend(CQ.form.CompositeField, {</p>
<p>    /**<br />
     * @private<br />
     * @type CQ.Ext.form.TextField<br />
     */<br />
    hiddenField: null,</p>
<p>    /**<br />
     * @private<br />
     * @type CQ.Ext.form.TextField<br />
     */<br />
    linkText: null,</p>
<p>    /**<br />
     * @private<br />
     * @type CQ.Ext.form.TextField<br />
     */<br />
    linkURL: null,</p>
<p>    /**<br />
     * @private<br />
     * @type CQ.Ext.form.CheckBox<br />
     */<br />
    openInNewWindow: null,</p>
<p>    /**<br />
     * @private<br />
     * @type CQ.Ext.form.FormPanel<br />
     */<br />
    formPanel: null,</p>
<p>    constructor: function (config) {<br />
        config = config || {};<br />
        var defaults = {<br />
            &#8220;border&#8221;: true,<br />
            &#8220;labelWidth&#8221;: 75,<br />
            &#8220;layout&#8221;: &#8220;form&#8221;<br />
            //&#8221;columns&#8221;:6<br />
        };<br />
        config = CQ.Util.applyDefaults(config, defaults);<br />
        MyClientLib.CustomPathFieldWidget.superclass.constructor.call(this, config);<br />
    },</p>
<p>    //overriding CQ.Ext.Component#initComponent<br />
    initComponent: function () {<br />
        MyClientLib.CustomPathFieldWidget.superclass.initComponent.call(this);</p>
<p>        // Hidden field<br />
        this.hiddenField = new CQ.Ext.form.Hidden({<br />
            name: this.name<br />
        });<br />
        this.add(this.hiddenField);</p>
<p>        // Link text<br />
        this.add(new CQ.Ext.form.Label({<br />
            cls: &#8220;customwidget-label&#8221;,<br />
            text: &#8220;Link Text&#8221;<br />
        }));<br />
        this.linkText = new CQ.Ext.form.TextField({<br />
            cls: &#8220;customwidget-1&#8243;,<br />
            fieldLabel: &#8220;Link Text: &#8220;,<br />
            maxLength: 80,<br />
            maxLengthText: &#8220;A maximum of 80 characters is allowed for the Link Text.&#8221;,<br />
            allowBlank: true,<br />
            listeners: {<br />
                change: {<br />
                    scope: this,<br />
                    fn: this.updateHidden<br />
                }<br />
            }<br />
        });<br />
        this.add(this.linkText);</p>
<p>        // Link URL<br />
        this.add(new CQ.Ext.form.Label({<br />
            cls: &#8220;customwidget-label&#8221;,<br />
            text: &#8220;Link URL&#8221;<br />
        }));<br />
        this.linkURL = new CQ.form.PathField({<br />
            cls: &#8220;customwidget-2&#8243;,<br />
            fieldLabel: &#8220;Link URL: &#8220;,<br />
            allowBlank: false,<br />
            width: 225,<br />
            listeners: {<br />
                change: {<br />
                    scope: this,<br />
                    fn: this.updateHidden<br />
                },<br />
                dialogclose: {<br />
                    scope: this,<br />
                    fn: this.updateHidden<br />
                }<br />
            }<br />
        });<br />
        this.add(this.linkURL);</p>
<p>        // Link openInNewWindow<br />
        this.openInNewWindow = new CQ.Ext.form.Checkbox({<br />
            cls: &#8220;customwidget-3&#8243;,<br />
            boxLabel: &#8220;New window&#8221;,<br />
            listeners: {<br />
                change: {<br />
                    scope: this,<br />
                    fn: this.updateHidden<br />
                },<br />
                check: {<br />
                    scope: this,<br />
                    fn: this.updateHidden<br />
                }<br />
            }<br />
        });<br />
        this.add(this.openInNewWindow);</p>
<p>    },</p>
<p>    processInit: function (path, record) {<br />
        this.linkText.processInit(path, record);<br />
        this.linkURL.processInit(path, record);<br />
        this.openInNewWindow.processInit(path, record);<br />
    },</p>
<p>    setValue: function (value) {<br />
    	var link = JSON.parse(value);<br />
        this.linkText.setValue(link.text);<br />
        this.linkURL.setValue(link.url);<br />
        this.openInNewWindow.setValue(link.openInNewWindow);<br />
        this.hiddenField.setValue(value);<br />
    },</p>
<p>    getValue: function () {<br />
        return this.getRawValue();<br />
    },</p>
<p>    getRawValue: function () {<br />
        var link = {<br />
            &#8220;url&#8221;: this.linkURL.getValue(),<br />
            &#8220;text&#8221;: this.linkText.getValue(),<br />
            &#8220;openInNewWindow&#8221;: this.openInNewWindow.getValue()<br />
        };<br />
        return JSON.stringify(link);<br />
    },</p>
<p>    updateHidden: function () {<br />
        this.hiddenField.setValue(this.getValue());<br />
    }<br />
});</p>
<p>CQ.Ext.reg(&#8216;mypathfield&#8217;, MyClientLib.CustomPathFieldWidget);
</p></blockquote>
<p>So, once we have defined that, its time to use in your component Here is snippet from dialog.xml from component:</p>
<blockquote><p>
            < linkspanel<br />
                jcr:primaryType="cq:Panel"<br />
                border="false"<br />
                height=""<br />
                title="Links"<br />
                width=""><br />
                < items jcr:primaryType="cq:WidgetCollection"><br />
                    < links<br />
                        jcr:primaryType="cq:Widget"<br />
                        fieldDescription="Press + to add more links"<br />
                        fieldLabel="Links"<br />
                        hideLabel="true"<br />
                        name="./links"<br />
                        width="1000"<br />
                        xtype="multifield"><br />
                        < fieldConfig<br />
                            jcr:primaryType="cq:Widget"<br />
                            xtype="mypathfield"/><br />
                        < listeners<br />
                            jcr:primaryType="nt:unstructured" /><br />
                    < /links><br />
                < /items><br />
            < /linkspanel>
</p></blockquote>
<p>And this is how it appear !</p>
<div id="attachment_37" class="wp-caption aligncenter" style="width: 562px"><a href="http://cq.shishank.info/2011/12/19/multifield-with-custom-xtype/screenhunter_09-dec-19-21-18/" rel="attachment wp-att-37"><img src="http://cq.shishank.info/wp-content/uploads/2011/12/ScreenHunter_09-Dec.-19-21.18.gif" alt="Example of custom xtype" title="Example of custom xtype" width="552" height="269" class="size-full wp-image-37" /></a><p class="wp-caption-text">Example of custom xtype</p></div>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2011/12/19/multifield-with-custom-xtype/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Determine components on a Page</title>
		<link>http://cq.shishank.info/2011/12/18/determine-components-on-a-page/</link>
		<comments>http://cq.shishank.info/2011/12/18/determine-components-on-a-page/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 21:38:37 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[WCM]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#components]]></category>
		<category><![CDATA[#cq]]></category>
		<category><![CDATA[#day]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=29</guid>
		<description><![CDATA[One of the common thing with CQ Pages is how to determine which all CQ components form the page. Most common process is to login to CRX and go through each node to determine the structure. But there is a better way to determine that and that is suffix the url with ?debug=layout in Authoring [...]]]></description>
			<content:encoded><![CDATA[<p>One of the common thing with CQ Pages is how to determine which all CQ components form the page.  Most common process is to login to CRX and go through each node to determine the structure. But there is a better way to determine that and that is </p>
<blockquote><p>suffix the url with ?debug=layout in Authoring environment</p></blockquote>
<p>Example:</p>
<div id="attachment_30" class="wp-caption aligncenter" style="width: 1008px"><a href="http://cq.shishank.info/2011/12/18/determine-components-on-a-page/screenhunter_07-dec-18-21-36/" rel="attachment wp-att-30"><img src="http://cq.shishank.info/wp-content/uploads/2011/12/ScreenHunter_07-Dec.-18-21.36.gif" alt="Determine CQ Components" title="Determine CQ Components" width="998" height="664" class="size-full wp-image-30" /></a><p class="wp-caption-text">Determine CQ Components</p></div>
<p>Why not try it yourself !</p>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2011/12/18/determine-components-on-a-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Passing attribute to cq:include</title>
		<link>http://cq.shishank.info/2011/12/17/passing-attribute-to-cqinclude/</link>
		<comments>http://cq.shishank.info/2011/12/17/passing-attribute-to-cqinclude/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 22:56:34 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#components]]></category>
		<category><![CDATA[#cq]]></category>
		<category><![CDATA[#day]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=23</guid>
		<description><![CDATA[It is pretty common to divide components files in chunk of files which carry a common reusable functionality. A perfect example is the foundation list component where number of different jsp files are called and passed different values at run time. In order to pass dynamic parameter to calling jsp, here is what is required: [...]]]></description>
			<content:encoded><![CDATA[<p>It is pretty common to divide components files in chunk of files which carry a common reusable functionality. A perfect example is the foundation list component where number of different jsp files are called and passed different values at run time. In order to pass dynamic parameter to calling jsp, here is what is required:</p>
<blockquote><p><% request.setAttribute("attributeNAme", attributeValue); %><br />
< cq:include path="componentName" resourceType="app/components/content/componentName" />
</p></blockquote>
<p>OR</p>
<blockquote><p><% request.setAttribute("attributeNAme", attributeValue); %><br />
< cq:include script="callingJSPFile" /></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2011/12/17/passing-attribute-to-cqinclude/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Provide edit bar for a component</title>
		<link>http://cq.shishank.info/2011/12/17/provide-edit-bar-for-a-component/</link>
		<comments>http://cq.shishank.info/2011/12/17/provide-edit-bar-for-a-component/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 22:11:35 +0000</pubDate>
		<dc:creator>Shishank</dc:creator>
				<category><![CDATA[CQ Components]]></category>
		<category><![CDATA[WCM]]></category>
		<category><![CDATA[#adobe]]></category>
		<category><![CDATA[#cq]]></category>
		<category><![CDATA[#day]]></category>
		<category><![CDATA[#wcm]]></category>

		<guid isPermaLink="false">http://cq.shishank.info/?p=17</guid>
		<description><![CDATA[WCM is all about providing content authors the power to manage site content effectively with minimum effort. Within CQ terms, its all around CQ components and providing clear way to manage them on a page. Providing edit bar for a component is a clean way which could be achieved as: cq:Component _cq_editConfig (cq:EditConfig) cq:actions text:edit [...]]]></description>
			<content:encoded><![CDATA[<p>WCM is all about providing content authors the power to manage site content effectively with minimum effort. Within CQ terms, its all around CQ components and providing clear way to manage them on a page.</p>
<p>Providing edit bar for a component is a clean way which could be achieved as:</p>
<p>cq:Component</p>
<p>    _cq_editConfig (cq:EditConfig)</p>
<p>cq:actions text:edit bar name#-#edit#delete#insert</p>
<p>cq:layout editbar </p>
<div id="attachment_19" class="wp-caption aligncenter" style="width: 310px"><a href="http://cq.shishank.info/2011/12/17/provide-edit-bar-for-a-component/screenhunter_06-dec-17-22-37/" rel="attachment wp-att-19"><img src="http://cq.shishank.info/wp-content/uploads/2011/12/ScreenHunter_06-Dec.-17-22.37-300x51.gif" alt="CQ edit Config Setting" title="CQ edit Config Setting" width="300" height="51" class="size-medium wp-image-19" /></a><p class="wp-caption-text">CQ edit Config Setting</p></div>
<div id="attachment_20" class="wp-caption aligncenter" style="width: 737px"><a href="http://cq.shishank.info/2011/12/17/provide-edit-bar-for-a-component/screenhunter_04-dec-17-22-33/" rel="attachment wp-att-20"><img src="http://cq.shishank.info/wp-content/uploads/2011/12/ScreenHunter_04-Dec.-17-22.33.gif" alt="Edit Bar Example" title="Edit Bar Example" width="727" height="57" class="size-full wp-image-20" /></a><p class="wp-caption-text">Edit Bar Example</p></div>
]]></content:encoded>
			<wfw:commentRss>http://cq.shishank.info/2011/12/17/provide-edit-bar-for-a-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

