How to Start AEM/CQ5 Instance Without Sample Content


When you install a new instance of Adobe Experience Manager a bunch of content is provided as Sample content. 

You can remove sample content by 2 ways

1.     Run the CQ instance from the command line with the run mode nosamplecontent.

      For Author Instance

            java -server -XX:MaxPermSize=256m -Xmx1024M -jar aem-author-p7402.jar 
                  -r author, nosamplecontent

      For Publish Instance

            java -server -XX:MaxPermSize=256m -Xmx1024M -jar aem-publish-p7402.jar 

                  -r publish, nosamplecontent    

2.  You can  uninstall the cq-geometrixx-all-pkg-5.6.12.zip package, as described in

     Uninstalling Packages.




It is also a recommendation to Uninstall example content and users as part of the Adobe Experience Manager 5.6.1 Security Checklist specially in your Production environment.

How To Change Default Admin Password

1  . Open the welcome screen.(http://localhost:7402/projects.html).




2.  Click on the Tools. You will get below screen.



3. Click on the Users link.




4. Click on the Administrator link and find the account settings.


5.  Click on the change password.






 Fill the form and click OK button,

How Disable CRXDE and CRXDE Lite Support

To disable  CRXDE and CRXDE Lite, you need to disable the necessary bundles in  OSGI console

For the CRXDE Lite

CRXDE Lite Disable 

For the CRXDE


CRXDE Disable

Colorpicker RTE plugin for Richtext

1.  Create a clientlibs node (nodeTypecq:ClientLibraryFolder) under the root node of the project.
e.g. /apps/training
Assign the following properties to the newly created clientlibs node
the property that identifies the category these custom Widgets will be referenced by

Name = categories
Type = String []
Value = colorpicker.widgets
the property that defines JS library dependencies

Name = dependencies
Type = String[]
Value = cq.jquery#cq.foundaion-main

2.  Create a css folder under the newly created clientlibs node.
3.  Create a js folder under the newly created clientlibs node.
4.  Create a css.txt file under the newly created clientlibs node.
5.  Create a js.txt file under the newly created clientlibs node.
6.  Create colorpickerplugin.Js and colorpickerdialog.js in js folder under  clientlibs


colorpickerplugin.Js



 /**
* @class CQ.form.rte.plugins.HtmlColorPickerPlugin
* @extends CQ.form.rte.plugins.Plugin
* <p>This class builds a Colorpicker pop up as a plugin.</p>
* <p>The plugin ID is "<b>Colorpicker</b>".</p>
* <p><b>Features</b></p>
* <ul>
*   <li><b>colorpicker</b> - pops up Colorpicker dialog</li>
* </ul>
*/
CQ.form.rte.plugins.HtmlColorPickerPlugin = CQ.Ext.extend(CQ.form.rte.plugins.Plugin, {

/**
* @private
*/
htmlColorPickerDialog: null,
/**
* @private
*/
colorPickerText: null,
  /**
* @private
*/
envEditContext:null,

constructor: function(editorKernel) {
CQ.form.rte.plugins.HtmlColorPickerPlugin.superclass.constructor.call(this,
editorKernel);
},
callDialog: function(context) {

if (CQ.Ext.isIE) {
this.savedRange = context.doc.selection.createRange();
}
var editorKernel = this.editorKernel;

var configdialog = {
"editContext": context,
"title": CQ.I18n.getMessage("Color Picker"),
"colorPickerText": this.colorPickerText,
"insertContentIntoRTE": this.insertContentIntoRTE.createDelegate(this),
"cancelFn": this.execCancel.createDelegate(this),
"listeners": {
"show": function() {
editorKernel.fireUIEvent("dialogshow");
},
"hide": function() {
editorKernel.fireUIEvent("dialoghide");
}
}
};
this.htmlColorPickerDialog =
                                        new CQ.form.rte.plugins.HtmlColorPickerDialog(configdialog);
this.htmlColorPickerDialog.setPosition(
                                                   this.editorKernel.calculateWindowPosition("left"));

this.htmlColorPickerDialog.show();
window.setTimeout(function() {
this.htmlColorPickerDialog.toFront();
this.htmlColorPickerDialog.focus();
}.createDelegate(this), 10);
},

getYourData: function(){

 // You might want to do something here and populate a value that needs to go inside your dialog.
this.colorPickerText = "Color Picker RTE Plugin";
this.callDialog(this.envEditContext);
},

// This gets called when you click OK button from your dialog
insertContentIntoRTE: function(context, options, dialog) {
var selectionDef = this.editorKernel.analyzeSelection();
var nodelist = selectionDef["nodeList"];
var node = nodelist["nodes"][0];
var nodeDom = node["dom"];
var nodeText = nodeDom["nodeValue"];
var selectedText=nodeText.substring(node["startPos"], node["startPos"] +
                                                            node["charCnt"]);
var color;
for(var opt in options){
if(opt!=undefined && opt!="" && opt!='remove' && opt!='indexOf'){
                                              //for IE alone indexOf comes as a function
color = options[opt].value;
}
}
var style="style=color:#"+color;
var htmlCode = '<span '+style+'>' + selectedText + '</span>';

this.editorKernel.execCmd("inserthtml", htmlCode);
dialog.hide();
},

// This gets called when you click Cancel button from your dialog
execCancel: function() {

},

getFeatures: function() {
return [ "colorpicker" ];
},

initializeUI: function(tbGenerator) {
var plg = CQ.form.rte.plugins;
var ui = CQ.form.rte.ui;
if (this.isFeatureEnabled("colorpicker")) {
this.checkTextUI = new ui.TbElement("colorpicker", this,
                                                                                       true,this.getTooltip("colorpicker"));
tbGenerator.addElement("htmlColorPicker", plg.Plugin.SORT_LISTS,
                                                                               this.checkTextUI,10);
}

},

notifyPluginConfig: function(pluginConfig) {
pluginConfig = pluginConfig || { };
CQ.Util.applyDefaults(pluginConfig, {
"tooltips": {
"colorpicker": {
"title": CQ.I18n.getMessage("Color Picker"),
"text":  CQ.I18n.getMessage("Color Picker pop-up")
}
}
});
this.config = pluginConfig;
},

execute: function(id, value, env) {
switch (id) {
case "colorpicker":
this.envEditContext = env.editContext;
this.getYourData();              
break;
}

},

updateState: function(selDef) {

// todo implement
}

});


// register plugin
CQ.form.rte.plugins.PluginRegistry.register("htmlColorPicker",
CQ.form.rte.plugins.HtmlColorPickerPlugin);

     

colorpickerdialog.js



/**
* @class CQ.form.rte.plugins.HtmlColorPickerDialog
* @extends CQ.Ext.Window
* @private
* This class implements the Hello World dialog.
*/
CQ.form.rte.plugins.HtmlColorPickerDialog = CQ.Ext.extend(CQ.Ext.Window, {
editContext: null,
insertContentIntoRTE: null,
constructor: function(config) {
var dialogRef = this;
var dialogItems = [ ];
var buttonItems = [ ];
var defaults = {
"title": "Html Color Picker"
};
CQ.Util.applyDefaults(config, defaults);
CQ.Ext.apply(this, config);
dialogItems.push({
"itemId": "colorPickerField",
"name": "colorPickerField",
"xtype": "colorfield",          
"fieldLabel": "colorPickerField",
"colors":['000000', '993300', '333300', '003300', '003366', '000080', '333399',
                                                    '333333','800000', 'FF6600', '808000', '008000', '008080', '0000FF',
                                                   '666699', '808080','FF0000', 'FF9900', '99CC00', '339966', '33CCCC',
                                                   '3366FF', '800080', '969696','FF00FF', 'FFCC00', 'FFFF00', '00FF00',
                                                   '00FFFF', '00CCFF', '993366', 'C0C0C0','FF99CC', 'FFCC99',
                                                    'FFFF99', 'CCFFCC', 'CCFFFF', '99CCFF', 'CC99FF', 'FFFFFF' ]
 });
// Buttons
buttonItems.push({
"itemId": "ok",
"name": "ok",
"text": "OK",
"handler": function() {
this.applyDialog(this.insertContentIntoRTE, null);
},
"scope": this
});
buttonItems.push({
"text": "Cancel",
"handler": function() {
if (this.cancelFn) {
this.cancelFn();
}
this.hide();
},
"scope": this
});
CQ.form.rte.plugins.HtmlColorPickerDialog.superclass.constructor.call(this, {
"renderTo": CQ.Util.ROOT_ID,
"title": this.title,
"stateful": false,
"minWidth": 400,
"minHeight": 170,
"width": 400,
"height": 310,
"plain": true,
"layout": "fit",
"items": [ {
"xtype": "panel",
"layout": "fit",
"stateful": false,
"items": [ {
"border": false,
"xtype": "form",
"itemId": "ColorPickerForm",
"name": "ColorPickerForm",
"stateful": false,
"autoHeight": true,
"items": dialogItems,
"bodyStyle": "overflow: auto;",
"afterRender": function() {
CQ.Ext.Panel.prototype.afterRender.call(this);
dialogRef.findItems = this.items;
this.body.addClass("cq-rte-helloworlddialog");
}
}
]
}
],
"buttons": buttonItems,
"modal": true
});
},
applyDialog: function(fn, options) {
options = options || [];
if (fn) {
var colorPickerTextValue = this.findItems.get("colorPickerField").getValue();
options.push({value: colorPickerTextValue, name: 'colorPickerTextValue'});
fn(this.editContext, options, this);
}
},
cancelFn: function(){

//Implement here
}
});


7.  List colorpickerplugin.js and  colorpickerdialog.js in js.txt file.
8.  Create cloorpicker.css in css folder under  clientlibs.

cloorpicker.css 


@CHARSET "UTF-8";
#CQ .x-html-editor-tb .x-edit-colorpicker{
 background: url(/libs/cq/ui/widgets/themes/default/icons/16x16/colorpicker.jpg)
                           center no-repeat;
}

9.  List cloorpicker.css in css.txt file underclientlibs.

10. Create a htmlColorPicker node (nodeType nt:unstructured) under the Training Complex Component's Dialog tab 1 widget collection.

e.g./apps/<project>/components/content/Complex/dialog/items/items/tab1/items/text/rtePlugins
Assign the following properties to the newly created htmlColorPicker node:

the property that will define where the content is stored

Name = features
Type = String
Value = *



Customize column control in 5.6.1 (Adding backgroud color which is configured in dialog)

1.   Create the folder structure like apps/foundation/components.

2.   Copy the parsys component from the(/libs/foundation/components) to  /apps/foundation/components.

3.   In the column control dialog add following configurations
       (/apps/foundation/components/parsys/colctrl/dialog/items)

.           jcr:primaryType ="cq:Widget"
            fieldDescription ="eg : #f7f7f7"
            fieldLabel = "Background color"
            name = "./bgColor"
            xtype = "textfield"

            jcr:primaryType="cq:Widget"
            fieldLabel="Apply linear gradient"
            name="./linearGradient"
            type="checkbox"
            xtype="selection"

4.    Add the following snippet of code in parsys.jsp at line number 50.

                 //ading styles for  background color to column
                Node parNode = par.adaptTo(Node.class);
                String bgColorStyle = "";
                String bgColor = "";
                String linearGradient = "";
                if(parNode.hasProperty("bgColor")){
                bgColor = parNode.getProperty("bgColor").getString();
                bgColorStyle = "background: "+bgColor;
                }
                if(parNode.hasProperty("linearGradient") &&
                parNode.getProperty("linearGradient").getString().equalsIgnoreCase("true") ){
               
                bgColorStyle = "background-image: linear-gradient( "+bgColor + " 0%, #fff 45%,"+bgColor +
                                          " 75%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="
                                         +bgColor+", endColorstr="+bgColor+" GradientType=0)";
                }
         
                // open outer div
                %><div class="parsys_column <%= par.getBaseCssClass()%>" style="<%=bgColorStyle%>">






Customization of parsys to restrict number of compnents in CQ 5.6.1

  1. Copy the parsys component from(/libs/foundation/components/parsys) to your poroject(/apps/<project nmae>/components/).
     2.  In the design dialog add number filed configuration to enter the number of components.

           Crate node noofcomp of type cq:widget under /apps/<project nmae>/components/parsys
              /design_dialog/items.
           Add the following properties

           xtype : numberfield
           name : noOfComp
           maxValue : 20
           fieldLabel : No of components


     3.   Create ajax.jsp and write the below logic.
           <%@page import="com.day.cq.wcm.foundation.ParagraphSystem"%>
           <%@include file="/libs/foundation/global.jsp"%>
           <%
                 ParagraphSystem parSys = ParagraphSystem.create(resource, slingRequest);
                 int totalComponents=parSys.paragraphs().size();
                 int restrictCompoNo=Integer.parseInt(currentStyle.get("noOfComp","20"));

                if(totalComponents >= restrictCompoNo){
                      out.println("true");
                  }else{
                            out.println("false");
                    }
               %>

    4.  You need to overlay the EditBase.js and Sidekick.js

          Create the following structure   /apps/cq/ui/widgets/source/widgets/wcm

         then copy the EditBase.js and Sidekick.js form libs . Place under /wcm /
   
         In Sidekic.js at line 4098 in set timeout method add this snippet.

            var parentPath=editComponent.path;
            var ajaxUrl=parentPath.substr(0,parentPath.lastIndexOf("/"))+".ajax";
            var notAllowToCreate = CQ.HTTP.eval(ajaxUrl);
           
            if(!notAllowToCreate){
                editComponent.createParagraph(definition);

            }else{
                CQ.Ext.Msg.show({
                                   msg: 'You reached  the maximun limit. You can set the limit in disign mode.',
                                   buttons: CQ.Ext.Msg.OK,
                                   icon: CQ.Ext.MessageBox.WARNING
                                });

               }
                dropTarget.editComponent.hideTarget();


         In EditBase.js at line 1181  in set timeout method add this snippet.
       
           var parentPath=e.path;
            var ajaxUrl=parentPath.substr(0,parentPath.lastIndexOf("/"))+".ajax";
            var notAllowToCreate = CQ.HTTP.eval(ajaxUrl);    
            if(!notAllowToCreate){
                e.createParagraph(definition);

            }else{
                CQ.Ext.Msg.show({
                    msg: 'You reached  the maximun limit. You can set the limit in disign mode.',
                    buttons: CQ.Ext.Msg.OK,
                    icon: CQ.Ext.MessageBox.WARNING
                });
               
            }
            e.dialogs[CQ.wcm.EditBase.INSERT].hide();
            e.insertDialogMask.hide();