public IEnumerable <TemplateDefinition> GetTemplates(ItemDefinition definition) { return(Definitions.GetTemplates(definition.ItemType) .AllowedBelow(Definitions.GetDefinition(Selection.SelectedItem), Selection.SelectedItem, Engine.Definitions) .Where(t => t.Definition.IsAllowedInZone(ZoneName)) .Where(t => Engine.SecurityManager.IsAuthorized(t.Definition, User, Selection.SelectedItem)) .OrderBy(t => (t.Definition.TemplateKey ?? "Index") == "Index" ? 0 : 1) .ThenBy(t => t.Definition.SortOrder)); }
private void LoadAdd() { lblLocationTitle.DataBind(); txtTitle.Text = Selection.SelectedItem.Title; ddlTypes.DataSource = Definitions.GetAllowedChildren(Selection.SelectedItem, "", User) .SelectMany(d => { return(new [] { new { Value = d.Discriminator, Title = d.Title } }.Union(Definitions.GetTemplates(d.ItemType).Select(t => new { Value = d.Discriminator + ":" + t.Name, Title = "* " + t.Title }))); }); ddlTypes.DataBind(); }
public IEnumerable <TemplateDefinition> GetTemplates(ItemDefinition definition) { return(Definitions.GetTemplates(definition.ItemType).OrderBy(t => t.Definition.Template == null ? 0 : 1)); }