1. Hide in the tree.
Basically share will make the call to alfresco get all the nodeRef so we need to change the corresponding javascript.
Script responsible for the tree population of Repository is treenode.get.js present in the location
D:\Alfresco3.3\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\slingshot\documentlibrary\treenode.get.js
/**
* Document List Component: treenode
*/
model.treenode = getTreeNode();
/* Create collection of folders in the given space */
function getTreeNode()
{
try
{
var items = new Array(),
hasSubfolders = true,
ignoredTypes =
{
"{http://www.alfresco.org/model/forum/1.0}forum": true,
"{http://www.alfresco.org/model/forum/1.0}topic": true,
"{http://www.alfresco.org/model/content/1.0}systemfolder": true
},
evalChildFolders = args["children"] !== "false",
resultsTrimmed = false,
argMax = parseInt(args["max"], 10),
maxItems = isNaN(argMax) ? -1 : argMax;
// Use helper function to get the arguments
var parsedArgs = ParseArgs.getParsedArgs();
if (parsedArgs === null)
{
return;
}
// Look for folders in the pathNode
for each (item in parsedArgs.pathNode.children)
{ //added by patil to check folders
if (item.isSubType("cm:folder") && !(item.type in ignoredTypes) && !( (item.properties.name =="Data Dictionary") || (item.properties.name =="Guest Home")|| (item.properties.name =="User Homes")|| (item.properties.name =="Imap Home")))
{
if (evalChildFolders)
{
hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0;
}
items.push(
{
node: item,
hasSubfolders: hasSubfolders
});
}
if (maxItems !== -1 && items.length > maxItems)
{
items.pop();
resultsTrimmed = true;
break;
}
}
items.sort(sortByName);
return (
{
parent: parsedArgs.pathNode,
resultsTrimmed: resultsTrimmed,
items: items
});
}
catch(e)
{
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString());
return;
}
}
/* Sort the results by case-insensitive name */
function sortByName(a, b)
{
return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1);
}
Similarly in the body part the listing will happen from the script doclist.get.js
/**
* Main entry point: Create collection of documents and folders in the given space
*
* @method getDoclist
*/
function getDoclist()
{
// Use helper function to get the arguments
var parsedArgs = ParseArgs.getParsedArgs();
if (parsedArgs === null)
{
return;
}
var filter = args.filter,
items = [];
// Try to find a filter query based on the passed-in arguments
var allNodes = [],
favourites = Common.getFavourites(),
filterParams = Filters.getFilterParams(filter, parsedArgs,
{
favourites: favourites
}),
query = filterParams.query;
// Query the nodes - passing in sort and result limit parameters
if (query !== "")
{
allNodes = search.query(
{
query: query,
language: filterParams.language,
page:
{
maxItems: (filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : 0)
},
sort: filterParams.sort,
templates: filterParams.templates,
namespace: (filterParams.namespace ? filterParams.namespace : null)
});
}
// Ensure folders and folderlinks appear at the top of the list
var folderNodes = [],
documentNodes = [];
for each (node in allNodes)
{
try
{
if (node.isContainer || node.typeShort == "app:folderlink")
{
//added by patil to filter
if(!( (node.properties.name =="Data Dictionary") || (node.properties.name =="Guest Home")|| (node.properties.name =="User Homes")|| (node.properties.name =="Imap Home"))){
folderNodes.push(node);
}
}
else
{
documentNodes.push(node);
}
}
catch (e)
{
// Possibly an old indexed node - ignore it
}
}
// Node type counts
var folderNodesCount = folderNodes.length,
documentNodesCount = documentNodes.length,
nodes, totalRecords;
if (parsedArgs.type === "documents")
{
nodes = documentNodes;
}
else
{
nodes = folderNodes.concat(documentNodes);
}
totalRecords = nodes.length;
// Pagination
var pageSize = args.size || nodes.length,
pagePos = args.pos || "1",
startIndex = (pagePos - 1) * pageSize;
// Trim the nodes array down to the page size
nodes = nodes.slice(startIndex, pagePos * pageSize);
// Common or variable parent container?
var parent = null;
if (!filterParams.variablePath)
{
// Parent node permissions (and Site role if applicable)
parent =
{
node: parsedArgs.pathNode,
userAccess: Evaluator.run(parsedArgs.pathNode, true).actionPermissions
};
}
var isThumbnailNameRegistered = thumbnailService.isThumbnailNameRegistered(THUMBNAIL_NAME),
thumbnail = null,
locationNode,
item;
// Loop through and evaluate each node in this result set
for each (node in nodes)
{
// Get evaluated properties.
item = Evaluator.run(node);
item.isFavourite = (favourites[item.node.nodeRef] === true);
// Does this collection of nodes have potentially differering paths?
if (filterParams.variablePath || item.isLink)
{
locationNode = (item.isLink && item.type == "document") ? item.linkNode : item.node;
location = Common.getLocation(locationNode);
}
else
{
location =
{
site: parsedArgs.location.site,
siteTitle: parsedArgs.location.siteTitle,
container: parsedArgs.location.container,
path: parsedArgs.location.path,
file: node.name
};
}
// Resolved location
item.location = location;
// Is our thumbnail type registered?
if (isThumbnailNameRegistered)
{
// Make sure we have a thumbnail.
thumbnail = item.node.getThumbnail(THUMBNAIL_NAME);
if (thumbnail === null)
{
// No thumbnail, so queue creation
item.node.createThumbnail(THUMBNAIL_NAME, true);
}
}
items.push(item);
}
return (
{
luceneQuery: query,
paging:
{
totalRecords: totalRecords,
startIndex: startIndex
},
parent: parent,
onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"),
itemCount:
{
folders: folderNodesCount,
documents: documentNodesCount
},
items: items
});
}
/**
* Document List Component: doclist
*/
model.doclist = getDoclist();
nice post, Mr Patil, what is guest home used for really? what is its purpose and what risk Associated with moving it?
ReplyDeletergs n
Hii Could please help me
ReplyDeleteI have document library in the navigation tree which is locted in the left side. Document library has different sub folders I want to hide all sub folders except one folder,could you please suggest me how to hide sub folders in document library