10-03-2012 04:37 AM
10-19-2012 01:50 PM
10-19-2012 02:04 PM
var userid = "pelof";
var searchobj = {
query:'PATH:"/app:company_home/st:sites/cm:surf-config/cm:components/*" AND @cm\:name:"*'+userid+'*"',
language: 'fts-alfresco'
};
var nodes = search.query(searchobj);
for(i=0, ii=nodes.length;i<ii;i++){
//use only the dashboard ones
if(nodes[i].name.indexOf('dashboard')>-1){
print(nodes[i].name);
nodes[i].remove();
}
}
print('***')
searchobj.query = 'PATH:"/app:company_home/st:sites/cm:surf-config/cm:pages/cm:user/cm:'+userid+'/*"';
nodes = search.query(searchobj);
for(i=0, ii=nodes.length;i<ii;i++){
//use only the dashboard ones
if(nodes[i].name.indexOf('dashboard')>-1){
print(nodes[i].name);
nodes[i].remove();
}
}
I then went on to actually create the missing component file, and this helped. Note that you may have to refresh webscripts to reset cache for this to take effect.var users = search.luceneSearch("workspace://SpacesStore", "TYPE:\"cm:person\"");
for(i=0,ii=users.length;i<ii;i++){
var userid = users[i].properties["cm:userName"];
var dashboard = companyhome.childByNamePath('/Sites/surf-config/pages/user/' + userid + '/dashboard.xml');
if(dashboard){
var title =companyhome.childByNamePath('/Sites/surf-config/components/page.title.user~'+userid+'~dashboard.xml');
if(title){
print('Exists for ' +userid);
}else{
var componentfolder =companyhome.childByNamePath('/Sites/surf-config/components');
var newtitle = componentfolder.createFile('page.title.user~'+userid+'~dashboard.xml');
var content = '<?xml version="1.0" encoding="UTF-8"?>\n\n';
content += '<component>\n';
content += '<guid>page.title.user~' + userid + '~dashboard</guid>\n';
content += '<scope>page</scope>\n';
content += '<region-id>title</region-id>\n';
content += '<source-id>user/'+ userid +'/dashboard</source-id>\n';
content += '<url>/components/title/user-dashboard-title</url>\n';
content += '</component>\n';
newtitle.properties.content.content = content;
newtitle.properties.content.encoding = 'UTF-8';
newtitle.setOwner(userid);
newtitle.save();
print('Created new title component for ' +userid);
}
}else{
print("User has no dashboard " + userid);
}
}
This was seen with 4.0.e, we have since upgraded to 4.2.a. But the upgrade didn't resolve the issue for users that had the title component missing, so I had to run the above script. After 4.2.a upgrade, the issue hasn't re-appeared.
10-19-2012 02:19 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.