private void CreateConfirmEmailDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = container.Id; var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); var parentDocType = contentTypeService.Get(PARENT_DOCUMENT_TYPE_ALIAS); if (contentType == null) { ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = false, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture, ParentId = parentDocType.Id }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); fileService.SaveTemplate(newTemplate); } // Set templates for document type var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); contentTypeService.Save(docType); // set as allowed content type in home ContentHelper.AddAllowedDocumentType(contentTypeService, Phase2MergedHomeDocumentType.DOCUMENT_TYPE_ALIAS, DOCUMENT_TYPE_ALIAS); ConfigureMasterTemplate(); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new Milestone7EmbeddedResources()); } } catch (System.Exception ex) { logger.Error(typeof(_07_ResetPasswordViaEmailDocumentType), ex.Message); logger.Error(typeof(_07_ResetPasswordViaEmailDocumentType), ex.StackTrace); } }
public override ContentType Create(int parentId = -1) { var parentContainer = _contentTypeService.CreateContainer(parentId, _name); if (parentContainer.Success) { var parentNode = _contentTypeService.GetContainers(_name, 1).FirstOrDefault(); foreach (var component in _components) { _contentTypeService.Save(component.Create(parentNode.Id)); } } return(null); }
protected override SyncAttempt <XElement> SerializeCore(IContentType item) { var node = SerializeBase(item); var info = SerializeInfo(item); var parent = item.ContentTypeComposition.FirstOrDefault(x => x.Id == item.ParentId); if (parent != null) { info.Add(new XElement("Parent", parent.Alias, new XAttribute("Key", parent.Key))); } else if (item.Level != 1) { var folderNode = this.GetFolderNode(contentTypeService.GetContainers(item)); if (folderNode != null) { info.Add(folderNode); } } // compositions ? info.Add(SerializeCompostions((ContentTypeCompositionBase)item)); // templates var templateAlias = (item.DefaultTemplate != null && item.DefaultTemplate.Id != 0) ? item.DefaultTemplate.Alias : ""; info.Add(new XElement("DefaultTemplate", templateAlias)); var templates = SerailizeTemplates(item); if (templates != null) { info.Add(templates); } node.Add(info); node.Add(SerializeStructure(item)); node.Add(SerializeProperties(item)); node.Add(SerializeTabs(item)); return(SyncAttempt <XElement> .Succeed(item.Name, node, typeof(IContentType), ChangeType.Export)); }
private int GetContainerId(string containerName) { var container = _ContentTypeService.GetContainers(containerName, 1).FirstOrDefault(); if (container != null) { return(container.Id); } var attempt = _ContentTypeService.CreateContainer(-1, containerName); if (attempt.Success) { return(attempt.Result.Entity.Id); } throw new InvalidOperationException($"Unable to create container: {containerName}"); }
public XElement Serialize(IContentType contentType) { var info = new XElement( "Info", new XElement("Name", contentType.Name), new XElement("Alias", contentType.Alias), new XElement("Key", contentType.Key), new XElement("Icon", contentType.Icon), new XElement("Thumbnail", contentType.Thumbnail), new XElement("Description", contentType.Description), new XElement("AllowAtRoot", contentType.AllowedAsRoot.ToString()), new XElement("IsListView", contentType.IsContainer.ToString()), new XElement("IsElement", contentType.IsElement.ToString()), new XElement("Variations", contentType.Variations.ToString())); IContentTypeComposition?masterContentType = contentType.ContentTypeComposition.FirstOrDefault(x => x.Id == contentType.ParentId); if (masterContentType != null) { info.Add(new XElement("Master", masterContentType.Alias)); } var compositionsElement = new XElement("Compositions"); IEnumerable <IContentTypeComposition> compositions = contentType.ContentTypeComposition; foreach (IContentTypeComposition composition in compositions) { compositionsElement.Add(new XElement("Composition", composition.Alias)); } info.Add(compositionsElement); var allowedTemplates = new XElement("AllowedTemplates"); if (contentType.AllowedTemplates is not null) { foreach (ITemplate template in contentType.AllowedTemplates) { allowedTemplates.Add(new XElement("Template", template.Alias)); } } info.Add(allowedTemplates); if (contentType.DefaultTemplate != null && contentType.DefaultTemplate.Id != 0) { info.Add(new XElement("DefaultTemplate", contentType.DefaultTemplate.Alias)); } else { info.Add(new XElement("DefaultTemplate", string.Empty)); } var structure = new XElement("Structure"); if (contentType.AllowedContentTypes is not null) { foreach (ContentTypeSort allowedType in contentType.AllowedContentTypes) { structure.Add(new XElement("DocumentType", allowedType.Alias)); } } var genericProperties = new XElement( "GenericProperties", SerializePropertyTypes(contentType.PropertyTypes, contentType.PropertyGroups)); // actually, all of them var tabs = new XElement( "Tabs", SerializePropertyGroups(contentType.PropertyGroups)); // TODO Rename to PropertyGroups var xml = new XElement( "DocumentType", info, structure, genericProperties, tabs); if (contentType is IContentTypeWithHistoryCleanup withCleanup && withCleanup.HistoryCleanup is not null) { xml.Add(SerializeCleanupPolicy(withCleanup.HistoryCleanup)); } var folderNames = string.Empty; var folderKeys = string.Empty; // don't add folders if this is a child doc type if (contentType.Level != 1 && masterContentType == null) { // get URL encoded folder names IOrderedEnumerable <EntityContainer> folders = _contentTypeService.GetContainers(contentType) .OrderBy(x => x.Level); folderNames = string.Join("/", folders.Select(x => WebUtility.UrlEncode(x.Name)).ToArray()); folderKeys = string.Join("/", folders.Select(x => x.Key).ToArray()); } if (string.IsNullOrWhiteSpace(folderNames) == false) { xml.Add(new XAttribute("Folders", folderNames)); xml.Add(new XAttribute("FolderKeys", folderKeys)); } return(xml); }
private void UpdateDocumentType() { const string propertyAlias = "meta", propertyName = "Meta Tag"; try { #region Home Document Type var container = contentTypeService.GetContainers(DOCUMENT_TYPE_CONTAINER, 1).FirstOrDefault(); int containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { var changed = false; #region Meta Tags Property Type if (!contentType.PropertyTypeExists($"{propertyAlias}Author")) { PropertyType metaAuthorPropType = new PropertyType(dataTypeService.GetDataType(-88), $"{propertyAlias}Author") { Name = $"Author {propertyName}", Variations = ContentVariation.Culture }; contentType.AddPropertyType(metaAuthorPropType, META_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}Copyright")) { PropertyType metaCopyrightPropType = new PropertyType(dataTypeService.GetDataType(-88), $"{propertyAlias}Copyright") { Name = $"Copyright {propertyName}", Variations = ContentVariation.Culture }; contentType.AddPropertyType(metaCopyrightPropType, META_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}Description")) { PropertyType metaDescriptionPropType = new PropertyType(dataTypeService.GetDataType(-88), $"{propertyAlias}Description") { Name = $"Description {propertyName}", Variations = ContentVariation.Culture }; contentType.AddPropertyType(metaDescriptionPropType, META_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}Keywords")) { PropertyType metaKeywordsPropType = new PropertyType(dataTypeService.GetDataType(-88), $"{propertyAlias}Keywords") { Name = $"Keywords {propertyName}", Variations = ContentVariation.Culture }; contentType.AddPropertyType(metaKeywordsPropType, META_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}Robots")) { PropertyType metaRobotsPropType = new PropertyType(dataTypeService.GetDataType(-88), $"{propertyAlias}Robots") { Name = $"Robots {propertyName}", Variations = ContentVariation.Culture }; contentType.AddPropertyType(metaRobotsPropType, META_TAB); changed = true; } #endregion if (changed) { contentTypeService.Save(contentType); } ConnectorContext.AuditService.Add(AuditType.New, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } #endregion } catch (System.Exception ex) { logger.Error(typeof(_31_MetaTags), ex.Message); logger.Error(typeof(_31_MetaTags), ex.StackTrace); } }
private void CreateHomeDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); int containerId = 0; if (container == null) { var newcontainer = contentTypeService.CreateContainer(-1, CONTAINER); if (newcontainer.Success) { containerId = newcontainer.Result.Entity.Id; } } else { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType == null) { //http://refreshwebsites.co.uk/blog/umbraco-document-types-explained-in-60-seconds/ //https://our.umbraco.org/forum/developers/api-questions/43278-programmatically-creating-a-document-type ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = true, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); fileService.SaveTemplate(newTemplate); } // Set templates for document type var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); docType.AddPropertyGroup(CONTENT_TAB); docType.AddPropertyGroup(TENANT_TAB); // Set Document Type Properties #region Tenant Home Page Content PropertyType brandLogoPropType = new PropertyType(dataTypeService.GetDataType(1043), "brandLogo") { Name = "Brand Logo", Variations = ContentVariation.Nothing }; docType.AddPropertyType(brandLogoPropType, CONTENT_TAB); PropertyType homeContentProType = new PropertyType(dataTypeService.GetDataType(-87), "homeContent") { Name = "Content", Variations = ContentVariation.Culture }; docType.AddPropertyType(homeContentProType, CONTENT_TAB); #endregion #region Tenant Info Tab PropertyType tenantUidPropType = new PropertyType(dataTypeService.GetDataType(-92), "tenantUid") { Name = "Tenant Uid", Description = "Tenant Unique Id", Variations = ContentVariation.Nothing }; docType.AddPropertyType(tenantUidPropType, TENANT_TAB); PropertyType brandNamePropType = new PropertyType(dataTypeService.GetDataType(-92), "brandName") { Name = "Brand Name", Variations = ContentVariation.Nothing }; docType.AddPropertyType(brandNamePropType, TENANT_TAB); PropertyType domainPropType = new PropertyType(dataTypeService.GetDataType(-92), "domain") { Name = "Domain", Variations = ContentVariation.Nothing }; docType.AddPropertyType(domainPropType, TENANT_TAB); PropertyType subDomainPropType = new PropertyType(dataTypeService.GetDataType(-92), "subDomain") { Name = "Sub Domain", Variations = ContentVariation.Nothing }; docType.AddPropertyType(subDomainPropType, TENANT_TAB); PropertyType appIdPropType = new PropertyType(dataTypeService.GetDataType(-92), "appId") { Name = "App Id", Variations = ContentVariation.Nothing }; docType.AddPropertyType(appIdPropType, TENANT_TAB); PropertyType apiKeyPropType = new PropertyType(dataTypeService.GetDataType(-92), "apiKey") { Name = "Api Key", Variations = ContentVariation.Nothing }; docType.AddPropertyType(apiKeyPropType, TENANT_TAB); PropertyType defaultLanguagePropType = new PropertyType(dataTypeService.GetDataType(-92), "defaultLanguage") { Name = "Default Language", Description = "System Default Language", Variations = ContentVariation.Nothing }; docType.AddPropertyType(defaultLanguagePropType, TENANT_TAB); PropertyType languagestPropType = new PropertyType(dataTypeService.GetDataType(-92), "languages") { Name = "Alternate Languages", Variations = ContentVariation.Nothing }; docType.AddPropertyType(languagestPropType, TENANT_TAB); PropertyType tenantStatusPropType = new PropertyType(dataTypeService.GetDataType(-92), "tenantStatus") { Name = "Tenant Status", Description = "Total Code Tenant Status", Variations = ContentVariation.Nothing }; docType.AddPropertyType(tenantStatusPropType, TENANT_TAB); #endregion contentTypeService.Save(docType); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new EmbeddedResources()); } } catch (System.Exception ex) { logger.Error(typeof(HomeDocumentType), ex.Message); logger.Error(typeof(HomeDocumentType), ex.StackTrace); } }
public XElement Serialize(IContentType contentType) { var info = new XElement("Info", new XElement("Name", contentType.Name), new XElement("Alias", contentType.Alias), new XElement("Icon", contentType.Icon), new XElement("Thumbnail", contentType.Thumbnail), new XElement("Description", contentType.Description), new XElement("AllowAtRoot", contentType.AllowedAsRoot.ToString()), new XElement("IsListView", contentType.IsContainer.ToString()), new XElement("IsElement", contentType.IsElement.ToString())); var masterContentType = contentType.ContentTypeComposition.FirstOrDefault(x => x.Id == contentType.ParentId); if (masterContentType != null) { info.Add(new XElement("Master", masterContentType.Alias)); } var compositionsElement = new XElement("Compositions"); var compositions = contentType.ContentTypeComposition; foreach (var composition in compositions) { compositionsElement.Add(new XElement("Composition", composition.Alias)); } info.Add(compositionsElement); var allowedTemplates = new XElement("AllowedTemplates"); foreach (var template in contentType.AllowedTemplates) { allowedTemplates.Add(new XElement("Template", template.Alias)); } info.Add(allowedTemplates); if (contentType.DefaultTemplate != null && contentType.DefaultTemplate.Id != 0) { info.Add(new XElement("DefaultTemplate", contentType.DefaultTemplate.Alias)); } else { info.Add(new XElement("DefaultTemplate", "")); } var structure = new XElement("Structure"); foreach (var allowedType in contentType.AllowedContentTypes) { structure.Add(new XElement("DocumentType", allowedType.Alias)); } var genericProperties = new XElement("GenericProperties"); // actually, all of them foreach (var propertyType in contentType.PropertyTypes) { var definition = _dataTypeService.GetDataType(propertyType.DataTypeId); var propertyGroup = propertyType.PropertyGroupId == null // true generic property ? null : contentType.PropertyGroups.FirstOrDefault(x => x.Id == propertyType.PropertyGroupId.Value); var genericProperty = new XElement("GenericProperty", new XElement("Name", propertyType.Name), new XElement("Alias", propertyType.Alias), new XElement("Type", propertyType.PropertyEditorAlias), new XElement("Definition", definition.Key), new XElement("Tab", propertyGroup == null ? "" : propertyGroup.Name), new XElement("SortOrder", propertyType.SortOrder), new XElement("Mandatory", propertyType.Mandatory.ToString()), propertyType.ValidationRegExp != null ? new XElement("Validation", propertyType.ValidationRegExp) : null, propertyType.Description != null ? new XElement("Description", new XCData(propertyType.Description)) : null); genericProperties.Add(genericProperty); } var tabs = new XElement("Tabs"); foreach (var propertyGroup in contentType.PropertyGroups) { var tab = new XElement("Tab", new XElement("Id", propertyGroup.Id.ToString(CultureInfo.InvariantCulture)), new XElement("Caption", propertyGroup.Name), new XElement("SortOrder", propertyGroup.SortOrder)); tabs.Add(tab); } var xml = new XElement("DocumentType", info, structure, genericProperties, tabs); var folderNames = string.Empty; //don't add folders if this is a child doc type if (contentType.Level != 1 && masterContentType == null) { //get url encoded folder names var folders = _contentTypeService.GetContainers(contentType) .OrderBy(x => x.Level) .Select(x => HttpUtility.UrlEncode(x.Name)); folderNames = string.Join("/", folders.ToArray()); } if (string.IsNullOrWhiteSpace(folderNames) == false) { xml.Add(new XAttribute("Folders", folderNames)); } return(xml); }
private void UpdateHomeDocumentType() { try { var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); if (contentType != null) { if (contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "termsAndConditionsMessage") == null) { // Add Document Type Properties #region Tenant Home Page Content PropertyType termsAndConditionsMessagePropType = new PropertyType(dataTypeService.GetDataType(-88), "termsAndConditionsMessage") { Name = "Terms and Conditions", Description = "Message to display for required accepting Terms and Conditions", Variations = ContentVariation.Culture }; contentType.AddPropertyType(termsAndConditionsMessagePropType, CONTENT_TAB); #endregion contentTypeService.Save(contentType); ConnectorContext.AuditService.Add(AuditType.New, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); ContentHelper.CopyPhysicalAssets(new RegisterUpdateHomeEmbeddedResources()); //CreateMasterTemplate(); } var telegramUsername = contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "telegramUsername"); if (telegramUsername != null) { if (telegramUsername.Name != "Telegram URL") { telegramUsername.Name = "Telegram URL"; telegramUsername.Description = ""; telegramUsername.ValidationRegExp = ""; contentType.AddPropertyType(telegramUsername); contentTypeService.Save(contentType); } else if (!string.IsNullOrEmpty(telegramUsername.ValidationRegExp)) { telegramUsername.ValidationRegExp = ""; contentType.AddPropertyType(telegramUsername); contentTypeService.Save(contentType); } } var helpdeskTelegramAccount = contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "helpdeskTelegramAccount"); if (helpdeskTelegramAccount != null) { if (helpdeskTelegramAccount.Name != "HelpDesk Telegram Bot") { helpdeskTelegramAccount.Name = "HelpDesk Telegram Bot"; helpdeskTelegramAccount.Description = ""; helpdeskTelegramAccount.ValidationRegExp = ""; contentType.AddPropertyType(helpdeskTelegramAccount); contentTypeService.Save(contentType); } else if (!string.IsNullOrEmpty(helpdeskTelegramAccount.ValidationRegExp)) { helpdeskTelegramAccount.ValidationRegExp = ""; contentType.AddPropertyType(helpdeskTelegramAccount); contentTypeService.Save(contentType); } } var whatsAppNumber = contentType.PropertyTypes.ToList().SingleOrDefault(x => x.Alias == "whatsAppNumber"); if (whatsAppNumber != null) { if (whatsAppNumber.Name != "Whatsapp URL") { whatsAppNumber.Name = "Whatsapp URL"; whatsAppNumber.Description = ""; whatsAppNumber.ValidationRegExp = ""; contentType.AddPropertyType(whatsAppNumber); contentTypeService.Save(contentType); } else if (!string.IsNullOrEmpty(whatsAppNumber.ValidationRegExp)) { whatsAppNumber.ValidationRegExp = ""; contentType.AddPropertyType(whatsAppNumber); contentTypeService.Save(contentType); } } //var //var } if (createDictionaryItems) { var language = new LanguageDictionaryService(ConnectorContext.LocalizationService, ConnectorContext.DomainService, ConnectorContext.Logger); // Check if parent Key exists, and skip if true if (!language.CheckExists(typeof(Home_ParentKey))) { // Add Dictionary Items var dictionaryItems = new List <Type> { typeof(Home_ParentKey), typeof(Home_Register), typeof(Site_ParentKey), typeof(Site_AlreadyHaveAccount), typeof(Register_ParentKey), typeof(Register_RegisterTitle), typeof(Register_RegisterStep), typeof(Register_RegisterOf), typeof(Register_PhoneNumber), typeof(Register_PhoneNumberPlaceholder), typeof(Register_IsMandatory), typeof(Register_Continue), typeof(Register_PhoneNumberInstructions), typeof(Register_VerificationCode), typeof(Register_VerificationCodePlaceholder), typeof(Register_EnterCode), typeof(Register_Enter6DigitVerificationCode), typeof(Register_EnterVerificationCode), typeof(Register_ResendCode), typeof(Register_Wait), typeof(Register_VerificationCodeInvalidOrExpired), typeof(Register_Email), typeof(Register_EmailPlaceholder), typeof(Register_Password), typeof(Register_PasswordPlaceholder), typeof(Register_ConfirmPassword), typeof(Register_FirstName), typeof(Register_FirstNamePlaceholder), typeof(Register_LastName), typeof(Register_LastNamePlaceholder), typeof(Register_Username), typeof(Register_UsernamePlaceholder), typeof(Register_Gender), typeof(Register_DateOfBirth), typeof(Register_DateOfBirthDay), typeof(Register_DateOfBirthMonth), typeof(Register_DateOfBirthMonthJanuary), typeof(Register_DateOfBirthMonthFebruary), typeof(Register_DateOfBirthMonthMarch), typeof(Register_DateOfBirthMonthApril), typeof(Register_DateOfBirthMonthMay), typeof(Register_DateOfBirthMonthJune), typeof(Register_DateOfBirthMonthJuly), typeof(Register_DateOfBirthMonthAugust), typeof(Register_DateOfBirthMonthSeptember), typeof(Register_DateOfBirthMonthOctober), typeof(Register_DateOfBirthMonthNovember), typeof(Register_DateOfBirthMonthDecember), typeof(Register_DateOfBirthYear), typeof(Register_IAgreeWithThe), typeof(Register_TermsAndConditions), typeof(Register_Finish), typeof(Register_IncorrectOrInvalid), typeof(Register_VerifyEmailSentToTitle), typeof(Register_VerifyEmailSentTo), typeof(Register_VerifyEmailSentToPleaseClick), typeof(Register_ResendVerificationEmail), typeof(Register_ResendVerificationEmailSent), typeof(Register_ChangeEmail), typeof(Register_IsInvalid), typeof(Register_Title), typeof(Register_Address1), typeof(Register_Address1Placeholder), typeof(Register_Address2), typeof(Register_Address2Placeholder), typeof(Register_Address3), typeof(Register_Address3Placeholder), typeof(Register_CityOrTown), typeof(Register_CityOrTownPlaceholder), typeof(Register_PostalCode), typeof(Register_PostalCodePlaceholder), typeof(Register_Country), typeof(Register_Preferences), typeof(Register_Language), typeof(Register_Currency), typeof(Register_OddsDisplay), typeof(Register_TimeZone), typeof(Register_BonusCode), typeof(Register_BonusCodePlaceholder), typeof(Register_Referrer), typeof(Register_ReferrerPlaceholder), typeof(Register_ReceiveNotifications), typeof(Register_ReceiveNotificationsViaInPlatformMessages), typeof(Register_ReceiveNotificationsViaEmail), typeof(Register_ReceiveNotificationsViaSMS), typeof(Register_CookiesPolicy), typeof(Register_PrivacyPolicy), typeof(Register_MinimunAge), typeof(Register_Age), typeof(Register_AgeYearsOld), typeof(Register_NewEmail), typeof(Register_CurrentEmail) }; language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items ConnectorContext.AuditService.Add(AuditType.Save, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated, and Dictionaries Created"); } } var oldHome = contentTypeService.Get(HomeDocumentType.DOCUMENT_TYPE_ALIAS); if (oldHome != null) { // remove old home document type contentTypeService.Delete(contentTypeService.Get(HomeDocumentType.DOCUMENT_TYPE_ALIAS)); // remove old home template fileService.DeleteTemplate(HomeDocumentType.TEMPLATE_ALIAS); } } catch (Exception ex) { logger.Error(typeof(_02_HomeDocumentTypePhase2Milestone6), ex.Message); logger.Error(typeof(_02_HomeDocumentTypePhase2Milestone6), ex.StackTrace); } }
public void Initialize() { try { var container = contentTypeService.GetContainers(DOCUMENT_TYPE_CONTAINER, 1).FirstOrDefault(); int containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { return; } const string CONTENT_TAB = "CONTENT"; ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = true, Description = "", Icon = NESTED_DOCUMENT_TYPE_ICON, ParentId = contentTypeService.Get(NESTED_DOCUMENT_TYPE_PARENT_ALIAS).Id, SortOrder = 0, Variations = ContentVariation.Culture, }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); ITemplate masterTemplate = fileService.GetTemplate(PARENT_TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); } var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); docType.AddPropertyGroup(CONTENT_TAB); #region Content PropertyType CotentPageTitlePropType = new PropertyType(dataTypeService.GetDataType(-88), "genericInfoPageTitle") { Name = "Page Title", Variations = ContentVariation.Culture }; docType.AddPropertyType(CotentPageTitlePropType, CONTENT_TAB); PropertyType CotentPageContentPropType = new PropertyType(dataTypeService.GetDataType(-87), "genericInfoPageContent") { Name = "Page Content", Variations = ContentVariation.Culture }; docType.AddPropertyType(CotentPageContentPropType, CONTENT_TAB); #endregion contentTypeService.Save(docType); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new GenericInfoPageEmbeddedResources()); } catch (Exception ex) { logger.Error(typeof(_40_GenericInfoPageDocumentType), ex.Message); logger.Error(typeof(_40_GenericInfoPageDocumentType), ex.StackTrace); } }
private void CreateDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = container.Id; var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); var parentDocType = contentTypeService.Get(PARENT_NODE_DOCUMENT_TYPE_ALIAS); if (contentType == null) { ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = false, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture, ParentId = parentDocType.Id }; // Create the Template if it doesn't exist if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { var layoutAlias = "totalCodeLayout"; ITemplate masterTemplate = fileService.GetTemplate(layoutAlias); //then create the template Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); } // Set templates for document type var template = fileService.GetTemplate(TEMPLATE_ALIAS); docType.AllowedTemplates = new List <ITemplate> { template }; docType.SetDefaultTemplate(template); contentTypeService.Save(docType); // set as allowed content type in account home ContentHelper.AddAllowedDocumentType(contentTypeService, PARENT_NODE_DOCUMENT_TYPE_ALIAS, DOCUMENT_TYPE_ALIAS); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new EditAccountDetailsEmbeddedResources()); if (createDictionaryItems) { // Check if parent Key exists, and skip if true var language = new LanguageDictionaryService(localizationService, domainService, logger); if (!language.CheckExists(typeof(Account_ParentKey))) { // Add Dictionary Items var dictionaryItems = new List <Type> { typeof(Account_ParentKey), typeof(Others_Save), typeof(Account_AccountPageTitle), typeof(Account_AccountEditPageTitle) }; language.CreateDictionaryItems(dictionaryItems); // Create Dictionary Items ConnectorContext.AuditService.Add(AuditType.Save, -1, -1, "Dictionary Items", $"Dictionaries Created"); } } } } catch (Exception ex) { logger.Error(typeof(_09_EditAccountDocumentType), ex.Message); logger.Error(typeof(_09_EditAccountDocumentType), ex.StackTrace); } }
private void UpdateDocumentType() { const string propertyAlias = "bannerSlider", propertyName = "Banner Slider", propertyDescription = "Slider with banner images"; try { #region Nested Document Type var container = contentTypeService.GetContainers(DOCUMENT_TYPE_CONTAINER, 1).FirstOrDefault(); int containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(NESTED_DOCUMENT_TYPE_ALIAS); if (contentType == null) { ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = NESTED_DOCUMENT_TYPE_NAME, Alias = NESTED_DOCUMENT_TYPE_ALIAS, AllowedAsRoot = false, Description = NESTED_DOCUMENT_TYPE_DESCRIPTION, Icon = NESTED_DOCUMENT_TYPE_ICON, IsElement = true, SortOrder = 0, ParentId = contentTypeService.Get(NESTED_DOCUMENT_TYPE_PARENT_ALIAS).Id, Variations = ContentVariation.Culture }; docType.AddPropertyGroup(SLIDERS_TAB); #region Nested Document Type Properties PropertyType ImagePropType = new PropertyType(dataTypeService.GetDataType(-88), "sliderItemImage") { Name = "Image", Description = "Image used in the Slider", Variations = ContentVariation.Nothing }; docType.AddPropertyType(ImagePropType, SLIDERS_TAB); PropertyType ButtonLabelPropType = new PropertyType(dataTypeService.GetDataType(-88), "sliderItemButtonLabel") { Name = " Button Label", Description = "Label for the Button", Variations = ContentVariation.Nothing }; docType.AddPropertyType(ButtonLabelPropType, SLIDERS_TAB); PropertyType TitlePropType = new PropertyType(dataTypeService.GetDataType(-88), "sliderItemTitle") { Name = "Title", Description = "Title for the banner item", Variations = ContentVariation.Nothing }; docType.AddPropertyType(TitlePropType, SLIDERS_TAB); PropertyType SubtitlePropType = new PropertyType(dataTypeService.GetDataType(-88), "sliderItemSubtitle") { Name = "Subtitle", Description = "Subtitle for the banner item", Variations = ContentVariation.Nothing }; docType.AddPropertyType(SubtitlePropType, SLIDERS_TAB); PropertyType UrlPropType = new PropertyType(dataTypeService.GetDataType(-88), "sliderItemUrl") { Name = "Url", Description = "The Link to the item", Variations = ContentVariation.Nothing }; docType.AddPropertyType(UrlPropType, SLIDERS_TAB); #endregion contentTypeService.Save(docType); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{NESTED_DOCUMENT_TYPE_ALIAS}' has been created"); } else { if (contentType.PropertyTypeExists("sliderItemImage") && contentType.PropertyTypes.Single(x => x.Alias == "sliderItemImage").DataTypeId == -88) { var mediaPickerContainer = dataTypeService.GetContainers(DATA_TYPE_CONTAINER, 1).FirstOrDefault(); var mediaPickerContainerId = -1; if (mediaPickerContainer != null) { mediaPickerContainerId = mediaPickerContainer.Id; } var dataTypeExists = dataTypeService.GetDataType("sliderItemImageMediaPicker") != null; if (!dataTypeExists) { var created = Web.Composing.Current.PropertyEditors.TryGet("Umbraco.MediaPicker", out IDataEditor editor); if (created) { DataType mediaPickerSliderImage = new DataType(editor, mediaPickerContainerId) { Name = "sliderItemImageMediaPicker", ParentId = mediaPickerContainerId, Configuration = new MediaPickerConfiguration { DisableFolderSelect = true, Multiple = false, OnlyImages = true } }; dataTypeService.Save(mediaPickerSliderImage); contentType.PropertyTypes.Single(x => x.Alias == "sliderItemImage").DataTypeId = mediaPickerSliderImage.Id; contentTypeService.Save(contentType); } } } } #endregion #region Update Home Document Type var homeDocumentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); var dataTypeContainer = dataTypeService.GetContainers(DATA_TYPE_CONTAINER, 1).FirstOrDefault(); var dataTypeContainerId = -1; if (dataTypeContainer != null) { dataTypeContainerId = dataTypeContainer.Id; } var exists = dataTypeService.GetDataType(propertyName) != null; if (!exists) { var created = Web.Composing.Current.PropertyEditors.TryGet("Umbraco.NestedContent", out IDataEditor editor); if (!created) { DataType bannerSliderNestedDataType = new DataType(editor, dataTypeContainerId) { Name = propertyName, ParentId = dataTypeContainerId, Configuration = new NestedContentConfiguration { MinItems = 0, MaxItems = 999, ConfirmDeletes = true, HideLabel = false, ShowIcons = true, ContentTypes = new[] { new NestedContentConfiguration.ContentType { Alias = NESTED_DOCUMENT_TYPE_ALIAS, TabAlias = SLIDERS_TAB } } } }; dataTypeService.Save(bannerSliderNestedDataType); } } if (!homeDocumentType.PropertyTypeExists("bannerSlider")) { var bannerSliderNestedDataType = dataTypeService.GetDataType(propertyName); PropertyType BannerSlider = new PropertyType(bannerSliderNestedDataType, propertyAlias) { Name = propertyName, Description = propertyDescription, Variations = ContentVariation.Culture }; var propertyGroup = homeDocumentType.PropertyGroups.SingleOrDefault(x => x.Name == SLIDERS_TAB); if (propertyGroup == null) { homeDocumentType.AddPropertyGroup(SLIDERS_TAB); } homeDocumentType.AddPropertyType(BannerSlider, SLIDERS_TAB); contentTypeService.Save(homeDocumentType); ConnectorContext.AuditService.Add(AuditType.Save, -1, homeDocumentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } #endregion } catch (System.Exception ex) { logger.Error(typeof(_17_HomeDocumentTypeSlider), ex.Message); logger.Error(typeof(_17_HomeDocumentTypeSlider), ex.StackTrace); } }
private void Reconfigure() { try { var oldControlAlias = "links"; var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType == null) { return; } if (!contentType.PropertyTypeExists(oldControlAlias)) { return; } var MNTPpropertyName = "Total Code MNTP Menu - Single Site"; var NestedContentPropertyName = "Nested Content Footer Link Group"; var dataTypeContainer = dataTypeService.GetContainers(DATA_TYPE_CONTAINER, 1).FirstOrDefault(); var dataTypeContainerId = -1; if (dataTypeContainer != null) { dataTypeContainerId = dataTypeContainer.Id; } var exists = dataTypeService.GetDataType(MNTPpropertyName) != null; if (!exists) { var created = Web.Composing.Current.PropertyEditors.TryGet("Umbraco.MultiNodeTreePicker", out IDataEditor editor); if (editor != null) { DataType MNTPMenu_SingleSite = new DataType(editor, dataTypeContainerId) { Name = MNTPpropertyName, ParentId = dataTypeContainerId, Configuration = new MultiNodePickerConfiguration() { MaxNumber = 1, MinNumber = 1, ShowOpen = false, TreeSource = new MultiNodePickerConfigurationTreeSource() { StartNodeQuery = "$site", ObjectType = "content" }, } }; dataTypeService.Save(MNTPMenu_SingleSite); } } var container = contentTypeService.GetContainers(DOCUMENT_TYPE_CONTAINER, 1).FirstOrDefault(); int containerId = -1; if (container != null) { containerId = container.Id; } contentType = contentTypeService.Get(NESTED_FOOTERLINKSSETTING_DOCUMENT_TYPE_ALIAS); if (contentType == null) { ContentType docType = (ContentType)contentType ?? new ContentType(containerId) { Name = NESTED_FOOTERLINKSSETTING_DOCUMENT_TYPE_NAME, Alias = NESTED_FOOTERLINKSSETTING_DOCUMENT_TYPE_ALIAS, AllowedAsRoot = false, Description = "", Icon = NESTED_DOCUMENT_TYPE_ICON, IsElement = true, SortOrder = 0, ParentId = 1087, Variations = ContentVariation.Culture }; docType.AddPropertyGroup(NESTED_TAB_NAME); #region Nested Document Type Properties var FooterContent_MNTPpropertyName = dataTypeService.GetDataType(MNTPpropertyName); PropertyType internalLinkPropType = new PropertyType(FooterContent_MNTPpropertyName, "internalLink") { Name = "Internal Link", Description = "", Variations = ContentVariation.Culture }; docType.AddPropertyType(internalLinkPropType, NESTED_TAB_NAME); PropertyType ExternalLinkTextPropType = new PropertyType(dataTypeService.GetDataType(-88), "externalLinkText") { Name = "External Link Text", Description = "", Variations = ContentVariation.Culture, }; docType.AddPropertyType(ExternalLinkTextPropType, NESTED_TAB_NAME); PropertyType LinkUrlPropType = new PropertyType(dataTypeService.GetDataType(-88), "externalLinkUrl") { Name = "External Link URL", Description = "", Variations = ContentVariation.Culture, ValidationRegExp = "https?://[a-zA-Z0-9-.]+.[a-zA-Z]{2,}" }; docType.AddPropertyType(LinkUrlPropType, NESTED_TAB_NAME); #endregion contentTypeService.Save(docType); ConnectorContext.AuditService.Add(AuditType.New, -1, docType.Id, "Document Type", $"Document Type '{NESTED_FOOTERLINKSSETTING_DOCUMENT_TYPE_ALIAS}' has been created"); } exists = dataTypeService.GetDataType(NestedContentPropertyName) != null; if (!exists) { var created = Web.Composing.Current.PropertyEditors.TryGet("Umbraco.NestedContent", out IDataEditor editor); if (editor != null) { DataType bannerSliderNestedDataType = new DataType(editor, dataTypeContainerId) { Name = NestedContentPropertyName, ParentId = dataTypeContainerId, Configuration = new NestedContentConfiguration { MinItems = 0, MaxItems = 999, ConfirmDeletes = true, HideLabel = false, ShowIcons = true, ContentTypes = new[] { new NestedContentConfiguration.ContentType { Alias = NESTED_FOOTERLINKSSETTING_DOCUMENT_TYPE_ALIAS, TabAlias = NESTED_TAB_NAME } } } }; dataTypeService.Save(bannerSliderNestedDataType); } } contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); contentType.RemovePropertyType(oldControlAlias); var FooterContent_NestedContentPropertyName = dataTypeService.GetDataType(NestedContentPropertyName); PropertyType linksPropType = new PropertyType(FooterContent_NestedContentPropertyName, "footerLinks") { Name = "Links", Description = "", Variations = ContentVariation.Culture }; contentType.AddPropertyType(linksPropType, NESTED_TAB_NAME); contentTypeService.Save(contentType); ConnectorContext.AuditService.Add(AuditType.New, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been created"); } catch (Exception ex) { logger.Error(typeof(_35_FooterLinkGroupChangesDocumentType), ex.Message); logger.Error(typeof(_35_FooterLinkGroupChangesDocumentType), ex.StackTrace); } }
private void CreateDocumentType() { try { var richTextContainer = dataTypeService.GetContainers(DATA_TYPE_CONTAINER, 1).FirstOrDefault(); var richTextContainerId = -1; if (richTextContainer != null) { richTextContainerId = richTextContainer.Id; } var dataTypeExists = dataTypeService.GetDataType("Full Rich Text Editor") != null; if (!dataTypeExists) { var created = Web.Composing.Current.PropertyEditors.TryGet("Umbraco.TinyMCE", out IDataEditor editor); if (created) { DataType richTextEditor = new DataType(editor, richTextContainerId) { Name = "Full Rich Text Editor", ParentId = richTextContainerId, Configuration = new RichTextConfiguration { Editor = JObject.Parse("{\"toolbar\":[\"ace\",\"removeformat\",\"undo\",\"redo\",\"cut\",\"copy\",\"paste\",\"styleselect\",\"bold\",\"italic\",\"underline\",\"strikethrough\",\"alignleft\",\"aligncenter\",\"alignright\",\"alignjustify\",\"bullist\",\"numlist\",\"outdent\",\"indent\",\"link\",\"unlink\",\"anchor\",\"umbmediapicker\",\"umbmacro\",\"table\",\"umbembeddialog\",\"hr\",\"subscript\",\"superscript\",\"charmap\",\"rtl\",\"ltr\"],\"stylesheets\":[],\"maxImageSize\":500,\"mode\":\"classic\"}"), HideLabel = true } }; dataTypeService.Save(richTextEditor); var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); var containerId = container.Id; string propertyName = "Page Content", propertyDescription = "Text to be displayed on the Page"; // categories page var contentCategoriesType = contentTypeService.Get(CATEGORIES_DOCUMENT_TYPE_ALIAS); if (contentCategoriesType != null) { PropertyType richTextPropType = new PropertyType(dataTypeService.GetDataType(richTextEditor.Id), "pageContent") { Name = propertyName, Description = propertyDescription, Variations = ContentVariation.Culture }; contentCategoriesType.AddPropertyType(richTextPropType, TAB); contentTypeService.Save(contentCategoriesType); ConnectorContext.AuditService.Add(AuditType.Save, -1, contentCategoriesType.Id, "Document Type", $"Document Type '{CATEGORIES_DOCUMENT_TYPE_ALIAS}' has been updated"); } // category page var contentCategoryType = contentTypeService.Get(CATEGORY_DOCUMENT_TYPE_ALIAS); if (contentCategoryType != null) { PropertyType richTextPropType = new PropertyType(dataTypeService.GetDataType(richTextEditor.Id), "pageContent") { Name = propertyName, Description = propertyDescription, Variations = ContentVariation.Culture }; contentCategoryType.AddPropertyType(richTextPropType, TAB); contentTypeService.Save(contentCategoryType); ConnectorContext.AuditService.Add(AuditType.Save, -1, contentCategoryType.Id, "Document Type", $"Document Type '{CATEGORY_DOCUMENT_TYPE_ALIAS}' has been updated"); } } } } catch (Exception ex) { logger.Error(typeof(_20_ContentPagesReconfiguration), ex.Message); logger.Error(typeof(_20_ContentPagesReconfiguration), ex.StackTrace); } }
private void UpdateDocumentType() { const string propertyAlias = "externalUrls", propertyName = "External Urls", propertyDescription = "Custom Links for"; try { #region Home Document Type var container = contentTypeService.GetContainers(DOCUMENT_TYPE_CONTAINER, 1).FirstOrDefault(); int containerId = -1; if (container != null) { containerId = container.Id; } var contentType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (contentType != null) { var changed = false; #region External Links Property Type if (!contentType.PropertyTypeExists($"{propertyAlias}TopMenu")) { PropertyType topMenuPropType = new PropertyType(dataTypeService.GetDataType(1050), $"{propertyAlias}TopMenu") { Name = $"Top Menu {propertyName}", Description = $"{propertyDescription} Top Menu", Variations = ContentVariation.Culture }; contentType.AddPropertyType(topMenuPropType, CONTENT_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}MainMenu")) { PropertyType mainMenuPropType = new PropertyType(dataTypeService.GetDataType(1050), $"{propertyAlias}MainMenu") { Name = $"Main Menu {propertyName}", Description = $"{propertyDescription} Main Menu", Variations = ContentVariation.Culture }; contentType.AddPropertyType(mainMenuPropType, CONTENT_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}Footer")) { PropertyType mainMenuPropType = new PropertyType(dataTypeService.GetDataType(1050), $"{propertyAlias}Footer") { Name = $"Footer {propertyName}", Description = $"{propertyDescription} Footer", Variations = ContentVariation.Culture }; contentType.AddPropertyType(mainMenuPropType, CONTENT_TAB); changed = true; } if (!contentType.PropertyTypeExists($"{propertyAlias}AccountMenu")) { PropertyType accountMenuPropType = new PropertyType(dataTypeService.GetDataType(1050), $"{propertyAlias}AccountMenu") { Name = $"Account Menu {propertyName}", Description = $"{propertyDescription} Account Menu", Variations = ContentVariation.Culture }; contentType.AddPropertyType(accountMenuPropType, CONTENT_TAB); changed = true; } #endregion if (changed) { contentTypeService.Save(contentType); } ConnectorContext.AuditService.Add(AuditType.New, -1, contentType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_ALIAS}' has been updated"); } #endregion } catch (System.Exception ex) { logger.Error(typeof(_30_ExternalUrlsToMenus), ex.Message); logger.Error(typeof(_30_ExternalUrlsToMenus), ex.StackTrace); } }
private void CreateErrorPageDocumentType() { try { var container = contentTypeService.GetContainers(CONTAINER, 1).FirstOrDefault(); int containerId = container.Id; var errorDocType = contentTypeService.Get(DOCUMENT_TYPE_ALIAS); if (errorDocType == null) { errorDocType = new ContentType(containerId) { Name = DOCUMENT_TYPE_NAME, Alias = DOCUMENT_TYPE_ALIAS, AllowedAsRoot = true, ParentId = contentTypeService.Get("totalCodeBasePage").Id, Description = DOCUMENT_TYPE_DESCRIPTION, Icon = ICON, SortOrder = 0, Variations = ContentVariation.Culture }; errorDocType.AddPropertyGroup(CONTENT_TAB); PropertyType errorTitlePropertyType = new PropertyType(dataTypeService.GetDataType(-88), "errorTitle") { Name = "Page Title", Description = "Title to display to users when reaching this page", Variations = ContentVariation.Culture }; errorDocType.AddPropertyType(errorTitlePropertyType, CONTENT_TAB); var richTextEditor = dataTypeService.GetDataType("Full Rich Text Editor"); string propertyName = "Page Content", propertyDescription = "Text to be displayed on the Page"; PropertyType richTextPropType = new PropertyType(dataTypeService.GetDataType(richTextEditor.Id), "pageContent") { Name = propertyName, Description = propertyDescription, Variations = ContentVariation.Culture }; errorDocType.AddPropertyType(richTextPropType, CONTENT_TAB); if (fileService.GetTemplate(TEMPLATE_ALIAS) == null) { ITemplate masterTemplate = fileService.GetTemplate(TEMPLATE_PARENT_ALIAS); Template newTemplate = new Template(TEMPLATE_NAME, TEMPLATE_ALIAS); newTemplate.SetMasterTemplate(masterTemplate); fileService.SaveTemplate(newTemplate); errorDocType.AllowedTemplates = new List <ITemplate> { newTemplate }; errorDocType.SetDefaultTemplate(newTemplate); } contentTypeService.Save(errorDocType); ConnectorContext.AuditService.Add(AuditType.New, -1, errorDocType.Id, "Document Type", $"Document Type '{DOCUMENT_TYPE_NAME}' has been created"); ContentHelper.CopyPhysicalAssets(new ErrorPageEmbeddedResources()); NodeHelper helper = new NodeHelper(); helper.CreateErrorNode(DOCUMENT_TYPE_ALIAS, "Page Not Found (404)", domainService); } } catch (System.Exception ex) { logger.Error(typeof(_23_ErrorPageDocumentType), ex.Message); logger.Error(typeof(_23_ErrorPageDocumentType), ex.StackTrace); } }