Quantcast
Channel: Experiencing Adobe Experience Manager (AEM, CQ)
Viewing all articles
Browse latest Browse all 525

AEM CQ 56 - Working with siteadmin tree nodes

$
0
0

Goal


Disable Geometrixx site nodes in the left tree of siteadmin Websites console. Package available for install



Solution


1) Using the overlay architecture of CQ, overlay /libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js by creating file /apps/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js and add the following code

CQ.Ext.ns("MyClientLib");

MyClientLib.SiteAdmin = {
SA_TREE: "cq-siteadmin-tree",

disableGeometrixx: function(tree){
if(!tree){
return;
}

var node = tree.getRootNode();

node.on('expand',function(){
CQ.Ext.each(this.childNodes, function(cNode){
var disable = cNode.attributes["name"].indexOf("geometrixx") == 0;

if(disable === true){
cNode.setCls("x-item-disabled");
var disableFn = function(){
return false;
};
cNode.on('beforeclick', disableFn);
cNode.on('beforedblclick', disableFn);
cNode.on('beforeexpand', disableFn);
cNode.on('beforecollapse', disableFn);
cNode.on('beforeinsert', disableFn);
cNode.on('beforemove', disableFn);
cNode.on('beforeremove', disableFn);
}
});
});

//collapse and expand to fire the expand event,
node.collapse();
node.expand();
}
};

$.getScript("/libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js", function(){
if(window.location.pathname == "/siteadmin"){
var INTERVAL = setInterval(function(){
var s = MyClientLib.SiteAdmin;
var tree = CQ.Ext.getCmp(s.SA_TREE);

if(tree){
clearInterval(INTERVAL);
s.disableGeometrixx(tree);
}
}, 250);
}
}).fail(function(jqxhr, settings, exception){
console.log("Error parsing /libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js");
console.log(exception);
});


Viewing all articles
Browse latest Browse all 525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>