/// <summary> /// Gets the tree nodes. /// </summary> /// <param name="id">The identifier.</param> /// <param name="queryStrings">The query strings.</param> /// <returns>The content for approval tree collection.</returns> protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { var ctrl = new ApprovalApiController(); var nodes = new TreeNodeCollection(); IUser user = UmbracoContext.Security.CurrentUser; //check if we're rendering the root node's children if (id == Constants.System.Root.ToInvariantString()) { foreach (ApproveContent content in ctrl.GetAll(user)) { // Add the content nodes to the root of the tree TreeNode node = CreateTreeNode( content.Id.ToString(), "-1", queryStrings, content.Name, "icon-umb-content", true); nodes.Add(node); } } else { // We're rendering the node properties int level = id.Count(c => c == '-'); if (level == 0) { foreach (ApproveProperty prop in ctrl.GetAllForNode(user, id)) { TreeNode propNode = CreateTreeNode( prop.Alias, id, queryStrings, prop.Name, "icon-target", false, string.Format("approveIt/approvalTree/history/{0}", prop.Alias)); nodes.Add(propNode); } } } return(nodes); }