private void AddTabs(Models.SimpleContentType docType, IContentType contentType) { if (docType.Tabs == null) { return; } foreach (var tab in docType.Tabs) { contentType.AddPropertyGroup(tab.Name); AddProperties(tab, contentType); } }
private void CreateContentType(Models.SimpleContentType docType) { var contentType = GetContentType(docType); if (docType is ComposedContentType) { AddCompositions((ComposedContentType)docType, contentType); } AddTabs(docType, contentType); AddAllowedContentTypes(docType, contentType); AddTemplate(docType, contentType); _ContentTypeService.Save(contentType); }
private IContentType GetContentType(Models.SimpleContentType docType) { var contentType = GetContentType(docType.Alias); if (contentType != null) { return(contentType); } return(new ContentType(GetContainerId(docType.ContainerName)) { Name = docType.Name, Alias = docType.Alias, Description = docType.Description, Icon = docType.Icon, AllowedAsRoot = docType.AllowAtRoot }); }
private void AddAllowedContentTypes(Models.SimpleContentType docType, IContentType contentType) { if (docType.AllowedContentTypes == null) { return; } var sortOrder = 0; var allowedContentTypes = new List <ContentTypeSort>(); foreach (var alias in docType.AllowedContentTypes) { var allowedContentType = GetContentType(alias); allowedContentTypes.Add(new ContentTypeSort(allowedContentType.Id, sortOrder++)); } contentType.AllowedContentTypes = allowedContentTypes; }
private void AddTemplate(Models.SimpleContentType docType, IContentType contentType) { if (docType.Template == null) { return; } var template = _FileService.GetTemplate(docType.Template.Alias); if (template == null) { template = new Template(docType.Template.Name, docType.Template.Alias) { Content = docType.Template.Html }; _FileService.SaveTemplate(template); } contentType.AllowedTemplates = new List <ITemplate> { template }; contentType.SetDefaultTemplate(template); }