private void LoadSelectableItems() { chkDescendants.DataSource = repository.FindDescendants(Selection.SelectedItem, ddlTypes.SelectedValue) .ToList() .Where(i => Engine.SecurityManager.IsAuthorized(User, i, Security.Permission.Publish)) .Select(i => new { Title = string.Format("<img src='{0}' /> {1} <a href='{2}'>»</a>", i.IconUrl, i.Title, i.Url), i.ID }); chkDescendants.DataBind(); }
public virtual IEnumerable <T> Find <T>(ContentItem root) where T : class { if (root is T) { yield return(root as T); } foreach (ItemDefinition definition in definitions.GetDefinitions()) { if (typeof(T).IsAssignableFrom(definition.ItemType)) { foreach (var item in repository.FindDescendants(root, definition.Discriminator)) { if (N2.Find.EnumerateParents(item).Any(i => i is ITrashCan)) { continue; } yield return(item as T); } } } }