Skip to content

Instantly share code, notes, and snippets.

@AFaust
Last active November 29, 2016 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AFaust/4533d831934c26d3d02381bef6f1ffb9 to your computer and use it in GitHub Desktop.
Save AFaust/4533d831934c26d3d02381bef6f1ffb9 to your computer and use it in GitHub Desktop.
Alfresco JavaScript Console script to remove various specific dashlets from user and site dashboards
var siteDashboardComponents, userDashboardComponents, idx;
siteDashboardComponents = companyhome.childrenByXPath('st:sites/cm:*/cm:surf-config/cm:components/*');
userDashboardComponents = companyhome.childrenByXPath('st:sites/cm:surf-config/cm:components/*');
function checkAndRemoveComponent (component)
{
var componentXml;
// we don't expect anything else but just to be sure
if (/dashboard.xml$/.test(component.name))
{
componentXml = component.content;
if (/dashlets\/(addonsfeed|rssfeed|my-meeting-workspaces|my-workspaces)<\/url>/.test(componentXml))
{
print('Removing unsupported dashlet ' + component.name);
component.remove();
}
}
}
for (idx = 0; idx < siteDashboardComponents.length; idx++)
{
checkAndRemoveComponent(siteDashboardComponents[idx]);
}
for (idx = 0; idx < userDashboardComponents.length; idx++)
{
checkAndRemoveComponent(userDashboardComponents[idx]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment