Last active
November 29, 2016 14:40
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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