private DocumentTypeProperty CreateSelectedTemplateId(DocumentTypeEditorModel docType) { return(new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _selectedTemplateDataType) { Name = "Selected template", Alias = SelectedTemplateAttributeDefinition.AliasValue, TabId = docType.DefinedTabs.Where(x => x.Alias == _generalGroup.Alias).Single().Id, SortOrder = 0 }); }
private void InitDocTypes() { Func <Tab[]> generateTabs = () => new[] { new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = "tab1", Name = "Some Content", SortOrder = 0 }, new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = "tab2", Name = "A second test tab", SortOrder = 1 }, new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = "tab3", Name = "Other info", SortOrder = 2 }, //add the general tab new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = _generalGroup.Alias, Name = _generalGroup.Name, SortOrder = _generalGroup.Ordinal } }; var providerGroupRoot = new Uri("content://"); var homePage = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(1045)) { Name = "Home Page", Description = "Represents a home page node", Icon = "/house.png", Thumbnail = "home.png", Alias = "homePage", AllowedTemplates = new List <SelectListItem>(new[] { _templates.First() }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), DefaultTemplateId = _templates.First().Id, DefinedTabs = new HashSet <Tab>(generateTabs.Invoke()), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, AllowedChildren = new[] { new SelectListItem { Selected = true, Value = HiveId.ConvertIntToGuid(providerGroupRoot, "nhibernate", 1046).ToString() }, new SelectListItem { Selected = true, Value = HiveId.ConvertIntToGuid(providerGroupRoot, "nhibernate", 2000).ToString() } } }; homePage.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(homePage), CreateSelectedTemplateId(homePage), new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]) { Name = "Body Text", Alias = "bodyText", TabId = homePage.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Site Name", Alias = "siteName", TabId = homePage.DefinedTabs.ElementAt(1).Id, SortOrder = 1 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Site Description", Alias = "siteDescription", TabId = homePage.DefinedTabs.ElementAt(1).Id, SortOrder = 2 }, }); var contentPage = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(1046)) { Name = "Content Page", Description = "A page for content", Icon = "tree-doc", Thumbnail = "doc.png", Alias = "contentPage", AllowedTemplates = new List <SelectListItem>(new[] { _templates.ElementAt(1) }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), DefaultTemplateId = _templates.ElementAt(1).Id, DefinedTabs = new HashSet <Tab>(generateTabs.Invoke()), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, AllowedChildren = new[] { new SelectListItem { Selected = true, Value = HiveId.ConvertIntToGuid(providerGroupRoot, "nhibernate", 1046).ToString() } } }; contentPage.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(contentPage), CreateSelectedTemplateId(contentPage), new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]) { Name = "Body Text", Alias = "bodyText", TabId = contentPage.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Rebel Hide in Nav", Alias = "rebelNaviHide", TabId = contentPage.DefinedTabs.ElementAt(1).Id, SortOrder = 4 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[2]) { Name = "Color Swatch Picker", Alias = "colorSwatchPicker", TabId = contentPage.DefinedTabs.ElementAt(0).Id, SortOrder = 5 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[3]) { Name = "Tags", Alias = "tags", TabId = contentPage.DefinedTabs.ElementAt(0).Id, SortOrder = 5 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[4]) { Name = "Textbox", Alias = "textBox", TabId = contentPage.DefinedTabs.ElementAt(0).Id, SortOrder = 5 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "New tree", Alias = "newTree", TabId = contentPage.DefinedTabs.ElementAt(0).Id, SortOrder = 5 } }); var faq = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(1055)) { Name = "Faq", Description = "A Faqs container", Icon = "tree-doc", Thumbnail = "doc.png", Alias = "Faq", AllowedTemplates = new List <SelectListItem>(new[] { _templates.ElementAt(2) }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), DefaultTemplateId = _templates.ElementAt(2).Id, DefinedTabs = new HashSet <Tab>(generateTabs.Invoke()), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, AllowedChildren = new[] { new SelectListItem { Selected = true, Value = HiveId.ConvertIntToGuid(providerGroupRoot, "nhibernate", 1056).ToString() } } }; faq.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(faq), CreateSelectedTemplateId(faq), new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]) { Name = "Body Text", Alias = "bodyText", TabId = faq.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Rebel Hide in Nav", Alias = "rebelNaviHide", TabId = faq.DefinedTabs.ElementAt(1).Id, SortOrder = 4 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Show Form", Alias = "ShowForm", TabId = faq.DefinedTabs.ElementAt(0).Id, SortOrder = 5 }, }); var faqCategory = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(1056)) { Name = "Faq Category", Description = "An Faq category", Icon = "tree-doc", Thumbnail = "doc.png", Alias = "FaqCategory", //AllowedTemplates = new List<SelectListItem>(new[] { _templates.ElementAt(3) }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), //DefaultTemplateId = _templates.ElementAt(3).Id, DefinedTabs = new HashSet <Tab>(generateTabs.Invoke()), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, AllowedChildren = new[] { new SelectListItem { Selected = true, Value = HiveId.ConvertIntToGuid(providerGroupRoot, "nhibernate", 1057).ToString() } } }; faqCategory.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(faqCategory), CreateSelectedTemplateId(faqCategory), new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]) { Name = "Body Text", Alias = "bodyText", TabId = faqCategory.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Rebel Hide in Nav", Alias = "rebelNaviHide", TabId = faqCategory.DefinedTabs.ElementAt(1).Id, SortOrder = 4 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Show Form", Alias = "ShowForm", TabId = faqCategory.DefinedTabs.ElementAt(0).Id, SortOrder = 5 }, }); var faqQuestion = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(1057)) { Name = "Faq Question", Description = "An Faq question", Icon = "tree-doc", Thumbnail = "doc.png", Alias = "FaqQuestion", //AllowedTemplates = new List<SelectListItem>(new[] { _templates.ElementAt(4) }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), //DefaultTemplateId = _templates.ElementAt(4).Id, DefinedTabs = new HashSet <Tab>(generateTabs.Invoke()), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, }; faqQuestion.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(faqQuestion), CreateSelectedTemplateId(faqQuestion), new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]) { Name = "Body Text", Alias = "bodyText", TabId = faqQuestion.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Question Text", Alias = "questionText", TabId = faqQuestion.DefinedTabs.ElementAt(1).Id, SortOrder = 1 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Rebel Hide in Nav", Alias = "rebelNaviHide", TabId = faqQuestion.DefinedTabs.ElementAt(1).Id, SortOrder = 4 }, }); var booksPage = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(2000)) { Name = "Books Page", Description = "List of usefull books", Icon = "tree-doc", Thumbnail = "doc.png", Alias = "BooksPage", AllowedTemplates = new List <SelectListItem>(new[] { _templates.ElementAt(5) }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), DefaultTemplateId = _templates.ElementAt(5).Id, DefinedTabs = new HashSet <Tab>(new[] { new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = "content", Name = "Content", SortOrder = 0 }, new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = _generalGroup.Alias, Name = _generalGroup.Name, SortOrder = _generalGroup.Ordinal } }), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, AllowedChildren = new[] { new SelectListItem { Selected = true, Value = HiveId.ConvertIntToGuid(providerGroupRoot, "nhibernate", 2001).ToString() } } }; booksPage.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(booksPage), CreateSelectedTemplateId(booksPage) }); var bookPage = new DocumentTypeEditorModel(HiveId.ConvertIntToGuid(2001)) { Name = "Book Page", Description = "An individual book", Icon = "tree-doc", Thumbnail = "doc.png", Alias = "BookPage", AllowedTemplates = new List <SelectListItem>(new[] { _templates.ElementAt(6) }.Select(x => new SelectListItem { Selected = true, Text = x.Name, Value = x.Id.ToString() })), DefaultTemplateId = _templates.ElementAt(6).Id, DefinedTabs = new HashSet <Tab>(new[] { new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = "content", Name = "Content", SortOrder = 0 }, new Tab { Id = HiveId.ConvertIntToGuid(++_tabIdCounter), Alias = _generalGroup.Alias, Name = _generalGroup.Name, SortOrder = _generalGroup.Ordinal } }), InheritFrom = new[] { new HierarchicalSelectListItem { Selected = true, Value = FixedHiveIds.ContentRootSchema.ToString() } }, }; bookPage.Properties = new HashSet <DocumentTypeProperty>(new[] { CreateNodeName(bookPage), CreateSelectedTemplateId(bookPage), new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]) { Name = "Description", Alias = "bodyText", TabId = bookPage.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]) { Name = "Publisher", Alias = "publisher", TabId = bookPage.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[6]) { Name = "Number of Pages", Alias = "numberOfPages", TabId = bookPage.DefinedTabs.ElementAt(0).Id, SortOrder = 0 }, new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[7]) { Name = "Image", Alias = "image", TabId = bookPage.DefinedTabs.ElementAt(0).Id, SortOrder = 0 } }); _docTypes = new List <DocumentTypeEditorModel> { homePage, contentPage, faq, faqCategory, faqQuestion, booksPage, bookPage }; }