Skip to main content

Posts

Showing posts from January, 2014

How to change the repository home directory

Per default, CRX will be installed in a folder named crx-quickstart located in the JVM's root folder. In order to change the default crx-quickstart installation folder, follow these steps. In this example the default installation folder will be prefixed with my_custom_path : extract the default crx-xxx-quickstart.jar with ' java -jar crx-xxx-quickstart.jar ' in a temporary location navigate to crx-quickstart/server/webapps unzip crx-explorer_crx.war to crx-explorer_crx edit crx-explorer_crx/WEB-INF/web.xml locate servlet with name Repository and adjust the value of the repository-home parameter to my_custom_path/crx-quickstart/repository locate servlet JCRExplorer and adjust value of parameter explorer-home to my_custom_path/crx-quickstart/repository locate servlet JCRWebdavServer and change value of parameter home to my_custom_path/crx-quickstart edit crx-explorer_crx/WEB-INF/log4j.xml adapt the path of t

Using currentNode with design dialog

I'm doing a simple CQ include which includes my component. <cq:include path="banner" resourceType="generic/components/content/banner" />    But instead of using a content dialog I am using a design dialog. I understand the design dialog properties are all stored under /etc/designs/default. So if I try to access the current node object I.E. use: <%= currentNode.getName() %>    I get a null pointer exception. The currentNode object contains the resolved JCR Node for the request. Since you are using design dialog, you will be able to access the The design of the addressed resource using the currentDesign object. And in order to access the properties stored in the design dialog you can use the currentStyle object. currentStyle.get("prop_name"); currentDesign.getId();    Refer to Style api and Design api for information on the methods available. Since we have the currentStyle object, we can get the path of the style

Identify CQ Mode

Identify CQ Mode Figuring out what is the current authoring mode in components in Adobe CQ can sometimes be a tricky prospect.  Determining the current authoring mode is important for component development when you may want to display different HTML or controls to authors than will be displayed to the end users.  As a best practice, the same interface should display in Author and Design mode, as hiding or showing components may affect design. The most obvious solution is to determining the authoring mode is to use the com . day . cq . wcm . api . WCMMode  Java class, which does a server-side check to see what mode is currently being used.   On new projects, I add a check for the WCMMode into the project's global.jsp and populate variables for testing if in design or author mode as such: <% boolean isEdit = WCMMode . fromRequest ( request ) == WCMMode . EDIT ; boolean isDesign = WCMMode . fromRequest ( request ) == WCMMode

Changing a CQ Component's Design Path

Changing a CQ Component's Design Path Usually, the default location used by the CQ Designs configuration works, however there are cases where you may want to set the designs to exist at a different location. For example, you may want multiple components to share a configuration or have all of the instances of a component on a site share the same configuration. CQ provides the  EditConfig  object which can be used to configure how the edit dialog is loaded in CQ. To configure your design path in Adobe CQ, first set the edit context path in the Edit Config object when in design mode: String myComponentDesignPath = currentDesign . getPath () + "/jcr:content/mycomponent" ; if ( WCMMode . fromRequest ( request ) == WCMMode . DESIGN ) { log . debug ( "Setting content path to {}" , myComponentDesignPath ); editContext . setContentPath ( myComponentDesignPath ); } Next, you will need to retrieve the resourc

Changing a CQ Component's Design Path

Changing a CQ Component's Design Path Usually, the default location used by the CQ Designs configuration works, however there are cases where you may want to set the designs to exist at a different location. For example, you may want multiple components to share a configuration or have all of the instances of a component on a site share the same configuration. CQ provides the  EditConfig  object which can be used to configure how the edit dialog is loaded in CQ. To configure your design path in Adobe CQ, first set the edit context path in the Edit Config object when in design mode: String myComponentDesignPath = currentDesign . getPath () + "/jcr:content/mycomponent" ; if ( WCMMode . fromRequest ( request ) == WCMMode . DESIGN ) { log . debug ( "Setting content path to {}" , myComponentDesignPath ); editContext . setContentPath ( myComponentDesignPath ); } Next, you will need to retrieve the resource you