Displaying the newly created component in the sidekick of Adobe CQ

By default, the sidekick doesn’t display the newly created components. You need to enable them explicitly in a CQ author instance.

  1. Create the component.
  2. Using SiteAdmin, open the page that you want to edit in the Author instance.
  3. From the sidekick, click the Design tab.
  4. In the Design of Paragraph tab that appears, click Edit.


  5. Find the component based on the ComponentGroup property you defined and enable it.


Developing a Quiz component using Adobe CQ

In this blog entry, I will show you how to develop a CQ component. A CQ component, typically, has two parts. The first one is the CQ widget – the Graphical User  Interface (GUI) in which an author adds content. Second one is a script; in this example, a JSP page that defines the logic that you want to apply to the content.

You will see how to develop a widget and get the data included in the widget using the script. We can demonstrate the same using a “Hello World” example; there is no fun in developing such a component!! :)

Here, we are going to develop a Quiz component. An author can enter a question and multiple possible answers to check the mastery of the reader. When the reader selects an answer and submits, the appropriate message appears in the page. Following is the screenshot of the Quiz component in the Author instance.


Basic understanding of the following is a prerequisite:

  • CQ Author and Publisher instance (You should ideally have them running in your machine.)
  • CQ templates (You should have a template that you can modify for this example.)
  • JavaScript
  • Java Server Pages (JSP)

I will not provide details on how to create a template. Refer to the  “How to Create a Fully Featured Internet Website” document that has lots of good information on how to accomplish this task.

Create the component node

  1. Login to CRXDE Lite as an admin.
  2. Inside the app folder, go to your website directory and locate the Components folder.
  3. Right-click the folder and then select Create Component. Create a component, question, with the following details:
    allowedParents = */parsys
    resourceSuperType = foundation/components/page

Develop GUI of the component

In the Quiz component, we need six text fields. First one for the question, four text fields for various options, and the sixth one is for the author to enter the correct answer. The first step to develop GUI of the component is to add a Dialog node that can hold various elements such as text boxes.

  1. Right-click the question node and select Create Dialog.
  2. Right-click the dialog node, and add another node with the following properties:
    name: items
    Type: cq:WidgetCollection
  3. Right-click and create a Panel, Tab1, with the following properties. We need only one tab in the GUI.
    name: Tab1
    Type: cq:Panel
  4. Right-click and add another node of widget collection that can hold the text fields.
    Name: items
    Type: cq:WidgetCollection
  5. Now, let us add the text fields. Right-click and add a node.
    Name: question
    Type: cq:Widget
  6. Add the following properties manually.
    fieldLabel – String – Question
    name – String – ./question
    xtype – String – textfield
  7. Repeat step 5 and 6 for the following:

Ensure that you changed the name and fieldLabel based on the text field. After completing this operation, this is what your node hierarchy looks like:



Update the JSP file to include the logic to process the content

Update the content of the question.jsp page as shown below:

<%@include file=”/libs/foundation/global.jsp”%>
<%@page session=”false” %>
<!– section1 –>
String question=properties.get(“question”, “Type the question”);
String optionA=properties.get(“optionA”, “Type the option A”);
String optionB=properties.get(“optionB”, “Type the option B”);
String optionC=properties.get(“optionC”, “Type the option C”);
String optionD=properties.get(“optionD”, “Type the option D”);
String answer=properties.get(“answer”, “Type the answer”);
<!– section2 –>
out.write(“<INPUT TYPE=hidden name=\”answer\” VALUE=\””+answer+”\”>”);
out.write(“<INPUT TYPE=\”radio\” NAME=\”options\” VALUE=\””+optionA+”\”>”+optionA+”<br>”);
out.write(“<INPUT TYPE=\”radio\” NAME=\”options\” VALUE=\””+optionB+”\”>”+optionB+”<br>”);
out.write(“<INPUT TYPE=\”radio\” NAME=\”options\” VALUE=\””+optionC+”\”>”+optionC+”<br>”);
out.write(“<INPUT TYPE=\”radio\” NAME=\”options\” VALUE=\””+optionD+”\”>”+optionD+”<P> “);
out.write(“<INPUT TYPE=\”button\” NAME=\”Validate\” VALUE=\”Validate\” onClick=\”checkAnswer(this.form)\”>”);

If you know the basics of JSP, you have already figured out what we are doing.

String question=properties.get(“question”, “Type the question”);

In section 1, we assign the value provided in the question text box to a string variable.
properties.get(“question”, “Type the question”) method gets data in the question field and the second argument is the default value that an author sees while editing the component.

The second section in the code is nothing but a form in a JavaScript. We dynamically change the values and labels using the inputs from the author. When a reader, submits an answer, we call a method checkAnwser(). We have not yet defined this method in the JSP page. It is defined in the template page.

Include the script in your template

You can include JavaScript functions that you use in the header of your template. The following code checks the correct answer and provides the user appropriate error message.

<head> <script type=”text/javascript”>
function checkAnswer(form) { for (var i = 0; i < form.options.length; i++) { if (form.options[i].checked)
if (form.options[i].value == form.answer.value)
{ alert(“You selected the correct answer!!”) } else { alert(“You selected an incorrect answer!!”) }
</script> </head>

Add the component in the Author instance

  1. Create a page with the template that you used.
  2. From the side-kick, drag-and-drop the Question component to the page.
  3. Right-click the component and click Edit.
  4. Enter the details and click OK.


The question and options appear in your page. Now publish the page to see it in the Author instance.

Creating PDF output in Adobe CQ

When you author in Adobe CQ, you may need to create a pdf version of the page. PDF pages would be helpful for users if they need to read the content when they are not connected to Internet.

Adobe CQ allows you to create the pdf version of the page using an OSGi bundle, PDF rewriter. After activating the content, call the page with the .pdf extension in the Author instance. The call will be automatically resolved to provide you with the pdf view of the content.

This blog entry explains how to create a pdf output using Adobe CQ 5.5 QuickStart.

It is assumed that:

  • Author instance is installed on port 4502 on the local machine.
  • Writer instance is installed on port 4503 on the local machine.

Check if PDF Writer bundle is installed and it’s Active in your instance.

  1. Login to Adobe CQ Web Console Configuration.  (http://localhost:4502/system/console/configMgr)
  2. Select OSGi > Bundles.
  3. Filter for Day Communique 5 Rewriter.
  4. Ensure that the bundle is installed and is Active.

Update the XSLT based on your component

While generating a pdf from html, you need to define the XSLT that transforms each element (component) to pdf format. Basically, you need to map all the components to a new style.
By default, Adobe CQ uses the XSLT defined in the following path: /libs/wcm/core/content/pdf/page2fo.xsl
Assume that you use the image component that inherits foundation/components/textimage. And, in the author instance, you have inserted an image using the component. To include the image in the pdf view, add the following in the XSLT.

<xsl:template match="*[contains(@sling:resourceType,'foundation/components/textimage')]">
 <xsl:if test="@jcr:title">
 <fo:block font-size="18pt" space-before.optimum="12pt" text-align="start"><xsl:value-of select="@jcr:title"/></fo:block>
 <xsl:if test="file">
 <fo:block><fo:external-graphic src="sling:/{$resource}/par/{local-name()}/file" content-width="100pt" content-height="100pt"/></fo:block>
 <xsl:if test="@FileRef">
 <fo:block><fo:external-graphic src="sling:/{@FileRef}" content-width="100pt" content-height="100pt"/></fo:block>
 <xsl:if test="image/@fileReference">
 <fo:block><fo:external-graphic src="sling:/{$resource}/par/{local-name()}/image.img.png" content-width="100pt" content-height="100pt"/></fo:block>
 <fo:block font-size="12pt" space-before.optimum="12pt" text-align="start"><xsl:apply-templates select="text"/></fo:block>

Ensure that every component you use in the page has a corresponding XSLT match.

Replicate the XSLT file to the publish instance

This is an important step, since the author instance still has the outdated version of XSLT. You need to activate the XSLT that you updated and make the most updated version available in your author instance.

  1. Login to SiteAdmin. (http://localhost:4502/siteadmin)
  2. Click Tools and in the left navigator select Replication > Activate Tree.
  3. Double-click Activate Tree.
  4. Provide the start path as /libs/wcm/core/content/pdf/page2fo.xsl
  5. Click Dry Run to see the file that is updated after the last Activation.
  6. Select the page2fo.xsl file and click Activate.

Three mistakes I made while creating a website using Adobe CQ

  1. While activating (publishing) pages in the new website, I didn’t activate the template, components, and style folders.And, I got a blank screen without any content. Content in the Live CQ pages checks for the corresponding JSP page to render the content. If these pages are not activated, the page won’t display anything. Activating a page can be done in the Website tab of the Siteadmin. However, to activate templates, components, and so on, go to the Tools tab. Then, select Replication in the left-side pane and double-click Activate Tree. Search for the node that you want to activate. For example, if you want to activate a component, go to the apps folder and then select the corresponding folder and activate all components in which you added the content.
  2. New components in the sidekick were not enabled explicitly. And, in the sidekick menu, I couldn’t see the components that I created when I was in the Edit mode.Create a page that uses the template that you created. Click the Design icon in the sidekick. The Design of Par tab appears. Select the Edit button. The Allowed Components list displays the components that you created. Select the components to display in the Edit mode.
  3. Sidekick is not enabled because of the script errors in newly created components.You can figure out if it’s an issue with the component by creating a new folder in the apps directory and then drag and drop the newly created components to it. Do it one-by-one while checking the authoring page to see the sidekick.

Flash Player 11.4 is available for download

The latest Flash Player version (11.4.402.265) is available. Please go to Adobe site to update Flash Player.

Flash Player 11.3 issues on Mozilla Firefox

A new version of Flash Player plug-in is available today (June 21st). The latest version is 11.3.300.262.
Go to http://get.adobe.com/flashplayer/ to get the latest version.

This version is for Mozilla Firefox and Safari.
If you have any issues with Flash Player 11.3 on Mozilla Firefox, see Issues | Flash Player 11.3 | Mozilla Firefox.

 If you have issues with installing Flash Player, please post the issue @ http://forums.adobe.com/community/flashplayer/installing_flashplayer.

Fireworks CS6 What’s New

Here is the link: http://helpx.adobe.com/fireworks/using/whats-new-cs6.html
Help & support page: http://helpx.adobe.com/fireworks.html
Archive of old docs: http://helpx.adobe.com/fireworks/archive.html

FrameMaker 10 ACE is live

Check your mastery by registering @ www.pearsonvue.com/adobe/exams/

ExtendScript to print the word count in an FM book file

Find the script here.
To test the script:

  1. Create a book file with many chapters. Chapters must be added as files.
  2. Open the book file.
  3. Ensure that chapters are not opened.
  4. Run the script.
  5. Wait for the script to open all the chapters and then print the word count.
    (Note that the script doesn’t include the words inserted in tables.)

Developing a document checklist using ExtendScript

I developed a script that can be used as a document checklist for a FrameMaker 10 book. You can add questions such as, “Have you updated variables?” Running the script captures the question and the answer to a .txt file. See the comments in the script to know more details.

Download the script here.