Customising CQ5’s SiteAdmin actions

You could have the need to customise the actions available via the siteadmin interface in CQ

For better understaing the one highlighted in the below screenshot

Screen shot 2013-02-28 at 16.04.10

to do so you simply have to copy the

/libs/wcm/core/content/siteadmin/actions

as

/apps/wcm/core/content/siteadmin/actions

having care of recreating the correct folder structure and node types.

here a json extract

{

    "jcr:createdBy": "admin",
    "jcr:created": "Thu Oct 18 2012 16:55:43 GMT+0100",
    "jcr:primaryType": "nt:folder",
    "core": {
        "jcr:createdBy": "admin",
        "jcr:created": "Thu Oct 18 2012 16:55:43 GMT+0100",
        "jcr:primaryType": "nt:folder",
        "content": {
            "jcr:mixinTypes": [
                  "rep:AccessControllable"
             ],
             "jcr:createdBy": "admin",
             "jcr:created": "Thu Oct 18 2012 16:55:43 GMT+0100",
             "jcr:primaryType": "sling:Folder",
             "siteadmin": {
                "xtype": "siteadmin",
                "sling:redirect": false,
                "sling:resourceType": "cq/ui/components/widget",
                "jcr:mixinTypes": [
                   "cq:Console"
                ],
                "jcr:title": "CQ5 WCM",
                "consoleDescription": "Create and manage multiple websites.",
                "iconClass": "siteadmin",
                "jsLibs": [
                   "cq.wcm.admin"
                ],
                "sling:vanityPath": "/siteadmin",
                "consoleTitle": "Websites",
                "jcr:primaryType": "cq:Widget",
                "sling:vanityOrder": 300,
                "actions": {
                   "jcr:primaryType": "nt:unstructured"
                   //........
                   // here all the actions as subnodes
                   //........
                }
            }
        }
    }
}

Then you can simply customise the action you want: for example you could change the target, the conditions, the text or even the handler if you implement your own one.

Following an extract of the “Activate” menu (the OOTB one). I find each attribute self-explainatory.

"activate": {
    "iconCls": "cq-siteadmin-activate-icon",
    "cls": "cq-siteadmin-activate",
    "context": [
      "toolbar"
    ],
    "jcr:primaryType": "nt:unstructured",
    "split": true,
    "text": "Activate",
    "menu": {
      "jcr:primaryType": "nt:unstructured",
      "activateNow": {
        "isDefaultAction": true,
        "handler": "CQ.wcm.SiteAdmin.activatePage",
        "cls": "cq-siteadmin-activate-now",
        "conditions": [
          "CQ.wcm.SiteAdmin.hasAnySelection",
          "CQ.wcm.SiteAdmin.notLocked"
        ],
        "context": [
          "toolbar",
          "contextmenu"
        ],
        "target": "CQ.wcm.SiteAdmin.getAnyTarget",
        "jcr:primaryType": "nt:unstructured",
        "text": "Activate"
      },
      "activateLater": {
        "privileges": [
          "replicate"
        ],
        "handler": "CQ.wcm.SiteAdmin.scheduleForActivation",
        "cls": "cq-siteadmin-activate-later",
        "context": [
          "toolbar"
        ],
        "conditions": [
          "CQ.wcm.SiteAdmin.hasAnySelection",
          "CQ.wcm.SiteAdmin.notLocked"
        ],
        "target": "CQ.wcm.SiteAdmin.getTargetFromList",
        "jcr:primaryType": "nt:unstructured",
        "text": "Activate Later..."
      }
    }
}

if you instead just need to hide/show some commands on certain groups of users, you won’t need to custimise anything, just play with ACL! (See reference).

Once you overlayed you could realise that your changes are not reflected by the UI. This is done by the sling:vanityOrder. As
/siteadmin is a vanity path pointing to wcm/core/content/siteadmin. The /libs one are picked up. The default value (as of 5.5) is 300. Just update the one under /apps to a greater value. 301 is enough. As practice I like to have my vanitypath order as 400+ though.

Reference

weekly links 2010-48

It’s been a long time I’m not posting but just changed job and relocated abroad, so no time for the blog.

SocialAuth – Java Library for seamless authentication for oAuth and OpenID providers

Eclipse Makes Available New Release of Eclipse Virgo

Using «Federated Login for Google Account Users» in your application

Introducing CQ 5.4, an early sneak-peek.

The way we write software these days

Why Java is being used for high-performance computing

Goodbye SOAP – Welcome JSON REST

Being bad to your customers is bad for business

Oracle’s Reply to Google’s Answer with Counterclaims

A Closer Look at JUnit Categories

Weekly links 2010-29

The Passage of Time by ToniVCCommons Configuration

Commons Configuration provides a generic configuration interface which enables a Java application to read configuration data from a variety of sources.

Lambdas in Java Preview – Part 1: The Basics | Javalobby

…closures (or better lambda expressions) will (probably) be added to JDK7..

Lambdas in Java Preview – Part 2: Functional Java | Javalobby

…giving some practical examples of lambdas, how functional programming in Java could look like and how lambdas could affect some of the well known libraries in Java land…

Lambdas in Java Preview – Part 3: Collections API

In this part I’ll focus on how the addition of lambdas could affect one of the most used standard APIs – the Collections API.

First Symbian^4 Screenshots Surface

for those interested in, there are some previews of the 4th version of Symbian OS

Life is Too Short to Parse Command Line Parameters

Recently, DZone MVB Cedric Beust unveiled JCommander, a tool he developed that takes away the manual labor of command line parsing.  Just six days after posting his announcement for JCommander 1.0, he’s already got an expanded 1.1 version out.  New features include simple internationalization, type converters, and password parameters.

OutOfMemoryError in Eclipse with JDK 1.6.0_21, on Windows

This past weekend I spent a good amount of time trying to solve an OutOfMemoryError that made Eclipse crash every 5 minutes.

Sun Java 6 on Ubuntu 10.04 10.10 and later

Apparently the Ubuntu folks have started putting some weight behind their recommendations for switching to the “OpenJDK.” Fortunately, the official, “proprietary” Java is still available through another Ubuntu repository.

Effective JSON with Google Web Toolkit

Hopefully every developer knows JSON protocol or has at least heard about it. In Google Web Toolkit technology, JSON is a very common protocol