public override ID GetParentID(ItemDefinition itemDefinition, CallContext context) { if (itemDefinition.ID == FolderId) { return(ParentId); } if (ControllerType.GetControllerType(ParentId, itemDefinition.ID) != null) { return(FolderId); } ControllerAction action; if ((action = ControllerAction.GetControllerAction(ParentId, itemDefinition.ID)) != null) { return(ControllerType.GetControllerIds(ParentId.ToGuid()).Where(kv => kv.Value.Type == action.ControllerType.Type) .Select(kv => new ID(kv.Key)).FirstOrDefault()); } //if (itemDefinition.ID == TemplateFolderId) // return ItemIDs.TemplateRoot; //if (itemDefinition.ID == TemplateId) // return TemplateFolderId; return(base.GetParentID(itemDefinition, context)); }
public override ItemDefinition GetItemDefinition(ID itemId, CallContext context) { Assert.ArgumentNotNull(itemId, "itemId"); Assert.ArgumentNotNull(context, "context"); if (itemId == FolderId) { return(new ItemDefinition(itemId, FolderName, FolderTemplateId, this.MasterId)); } var type = ControllerType.GetControllerType(ParentId, itemId); if (type != null) { return(new ItemDefinition(itemId, ItemUtil.ProposeValidItemName(type.Description), FolderTemplateId, this.MasterId)); } var action = ControllerAction.GetControllerAction(ParentId, itemId); if (action != null) { return(new ItemDefinition(itemId, action.Description, BaseTemplateId, this.MasterId)); } return(base.GetItemDefinition(itemId, context)); }
public override FieldList GetItemFields(ItemDefinition item, VersionUri version, CallContext context) { Assert.ArgumentNotNull(item, "item"); Assert.ArgumentNotNull(version, "version"); Assert.ArgumentNotNull(context, "context"); var list = new FieldList(); if (item.ID == FolderId || (ControllerType.GetControllerType(ParentId, item.ID) != null)) { list.Add(FieldIDs.Icon, Themes.MapTheme("SoftwareV2/16x16/elements.png")); } else { var action = ControllerAction.GetControllerAction(ParentId, item.ID); if (action != null && HttpContext.Current != null) { //VirtualPathData vpd; //MvcActionHelper.GetRouteData(new HttpContextWrapper(HttpContext.Current), action.ActionName, action.ControllerType.ControllerName, null, false, out vpd); //list.Add(LayoutFieldIDs.Path, vpd.VirtualPath); list.Add(FieldIDs.Icon, Themes.MapTheme("SoftwareV2/16x16/element.png")); } } if (list.Count == 0) { return(base.GetItemFields(item, version, context)); } return(list); }
public override IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context) { ControllerType controllerType; var list = base.GetChildIDs(itemDefinition, context) ?? new IDList(); if (itemDefinition.ID == ParentId) { list.Add(FolderId); } else if (itemDefinition.ID == FolderId) { AddAllControllers(list); } else if ((controllerType = ControllerType.GetControllerType(ParentId, itemDefinition.ID)) != null) { AddAllActions(list, controllerType); } //else if ((itemDefinition.ID == ItemIDs.TemplateRoot) && (this.GetType() == typeof(MvcLayoutDataProvider))) // list.Add(TemplateFolderId); //else if (itemDefinition.ID == TemplateFolderId) // list.Add(this.TemplateId); return(list); }