Пример #1
0
        private IContentType CreateNew(string alias)
        {
            var ct = new ContentType(-1)
            {
                Alias         = alias,
                Name          = alias,
                AllowedAsRoot = true
            };

            ct.AddPropertyGroup("test1");
            ct.AddPropertyGroup("test2");
            ct.AddPropertyGroup("test3");
            ct.AddPropertyType(new PropertyType(_dataTypes[0])
            {
                Alias = "test1"
            }, "test1");
            ct.AddPropertyType(new PropertyType(_dataTypes[1])
            {
                Alias = "test2"
            }, "test2");
            ct.AddPropertyType(new PropertyType(_dataTypes[2])
            {
                Alias = "test3"
            }, "test3");
            ApplicationContext.Services.ContentTypeService.Save(ct);
            return(ct);
        }
Пример #2
0
        private void CreateUserTagDocumentType()
        {
            var contentTypeService  = ApplicationContext.Current.Services.ContentTypeService;
            var userTagDocumentType = contentTypeService.GetContentType(TaggingInstallationConstants.DocumentTypeAliases.UserTag);

            if (userTagDocumentType != null)
            {
                return;
            }

            var dataContentFolder = contentTypeService.GetContentTypeContainers(
                folderName: CoreInstallationConstants.DocumentTypesContainerNames.DataContent,
                level: 1)
                                    .First();

            userTagDocumentType = new ContentType(dataContentFolder.Id)
            {
                Name  = TaggingInstallationConstants.DocumentTypeNames.UserTag,
                Alias = TaggingInstallationConstants.DocumentTypeAliases.UserTag,
                Icon  = TaggingInstallationConstants.DocumentTypeIcons.UserTag
            };

            userTagDocumentType.AddPropertyGroup(TaggingInstallationConstants.DocumentTypeTabNames.Content);

            var textProperty = new PropertyType("Umbraco.Textbox", DataTypeDatabaseType.Nvarchar)
            {
                Alias     = "text",
                Name      = "Text",
                Mandatory = true
            };

            userTagDocumentType.AddPropertyType(textProperty, TaggingInstallationConstants.DocumentTypeTabNames.Content);

            contentTypeService.Save(userTagDocumentType);
        }
        private void CreateHomeNavigationComposition()
        {
            var contentService  = ApplicationContext.Current.Services.ContentTypeService;
            var dataTypeService = ApplicationContext.Current.Services.DataTypeService;

            var compositionFolder = contentService.GetContentTypeContainers(CoreInstallationConstants.DocumentTypesContainerNames.Compositions, 1).First();

            var systemLink = contentService.GetContentType(DocumentTypeAliases.HomeNavigationComposition);

            if (systemLink != null)
            {
                return;
            }

            systemLink = new ContentType(compositionFolder.Id)
            {
                Name  = DocumentTypeNames.HomeNavigationComposition,
                Alias = DocumentTypeAliases.HomeNavigationComposition
            };

            systemLink.AddPropertyGroup(DocumentTypeTabNames.Navigation);

            var showInHome         = dataTypeService.GetDataTypeDefinitionByName(DataTypeNames.IsShowInHomeNavigationTrueFalse);
            var showInHomeProperty = new PropertyType(showInHome)
            {
                Name  = DocumentTypePropertyNames.IsShowInHomeNavigation,
                Alias = DocumentTypePropertyAliases.IsShowInHomeNavigation
            };

            systemLink.AddPropertyType(showInHomeProperty, DocumentTypeTabNames.Navigation);

            contentService.Save(systemLink);
        }
        /// <summary>
        /// Gets the document type of the AngularJS master page.
        /// </summary>
        /// <returns>The document type definition.</returns>
        public static IContentType GetAngularJsMasterDocType()
        {
            // Main info
            ContentType res = new ContentType(-1)
            {
                Name          = "Sintra - AngularJs Master",
                Alias         = "sintraAngularJsMaster",
                AllowedAsRoot = true,
                Description   = "This should be the master template for all views.",
                CreateDate    = DateTime.Now
            };

            res.UpdateDate = res.CreateDate;

            // Angular JS related properties
            res.AddPropertyGroup("AngularJs");

            PropertyType enableJsPropType = new PropertyType(new DataTypeDefinition("Umbraco.TrueFalse"), "enableNg")
            {
                Name = "Enable AngularJS?"
            };

            res.AddPropertyType(enableJsPropType, "AngularJs");

            return(res);
        }
Пример #5
0
        private void CreatePanelDocumentType()
        {
            var contentService    = ApplicationContext.Current.Services.ContentTypeService;
            var dataTypeService   = ApplicationContext.Current.Services.DataTypeService;
            var panelDocumentType = contentService.GetContentType(DocumentTypeNames.Panel);

            if (panelDocumentType != null)
            {
                return;
            }

            panelDocumentType = new ContentType(-1)
            {
                Name  = DocumentTypeNames.Panel,
                Alias = DocumentTypeAliases.Panel,
                Icon  = DocumentTypeIcons.Panel
            };

            panelDocumentType.AddPropertyGroup("Panel");
            var panelPickerDataType = dataTypeService.GetDataTypeDefinitionByName(DataTypeNames.PanelPicker);
            var panelPickerProperty = new PropertyType(panelPickerDataType)
            {
                Name  = DocumentTypePropertyNames.PanelConfig,
                Alias = DocumentTypePropertyAliases.PanelConfig,
            };

            panelDocumentType.AddPropertyType(panelPickerProperty, "Panel");

            contentService.Save(panelDocumentType);
            InstallationStepsHelper.AddAllowedChildNode(DocumentTypeAliases.GlobalPanelFolder, DocumentTypeAliases.Panel);
        }
        private void CreateNavigationComposition()
        {
            var contentService  = ApplicationContext.Current.Services.ContentTypeService;
            var dataTypeService = ApplicationContext.Current.Services.DataTypeService;

            var compositionFolder = contentService.GetContentTypeContainers(CoreInstallationConstants.DocumentTypesContainerNames.Compositions, 1).First();

            var navigationCompositionType = contentService.GetContentType(DocumentTypeAliases.NavigationComposition);

            if (navigationCompositionType != null)
            {
                return;
            }

            navigationCompositionType = new ContentType(compositionFolder.Id)
            {
                Name  = DocumentTypeNames.NavigationComposition,
                Alias = DocumentTypeAliases.NavigationComposition
            };

            navigationCompositionType.AddPropertyGroup(DocumentTypeTabNames.Navigation);

            var navigationNameProperty = new PropertyType("Umbraco.Textbox", DataTypeDatabaseType.Nvarchar)
            {
                Name      = DocumentTypePropertyNames.NavigationName,
                Alias     = DocumentTypePropertyAliases.NavigationName,
                Mandatory = true
            };

            var isHideFromLeftNav      = dataTypeService.GetDataTypeDefinitionByName(DataTypeNames.IsHideFromLeftNavigation);
            var isHideFromLeftProperty = new PropertyType(isHideFromLeftNav)
            {
                Name  = DocumentTypePropertyNames.HideFromLeftNavigation,
                Alias = DocumentTypePropertyAliases.IsHideFromLeftNavigation
            };

            var isHideFromSubNav      = dataTypeService.GetDataTypeDefinitionByName(DataTypeNames.IsHideFromSubNavigation);
            var isHideFromSubProperty = new PropertyType(isHideFromSubNav)
            {
                Name  = DocumentTypePropertyNames.HideFromSubNavigation,
                Alias = DocumentTypePropertyAliases.IsHideFromSubNavigation
            };

            navigationCompositionType.AddPropertyType(navigationNameProperty, DocumentTypeTabNames.Navigation);
            navigationCompositionType.AddPropertyType(isHideFromLeftProperty, DocumentTypeTabNames.Navigation);
            navigationCompositionType.AddPropertyType(isHideFromSubProperty, DocumentTypeTabNames.Navigation);

            contentService.Save(navigationCompositionType);
        }
Пример #7
0
        private int?CreateDocumentType(Item item, int parentId, int userId = 0)
        {
            ContentType contentType = new ContentType(parentId);

            contentType.Name  = item.Name;
            contentType.Alias = item.Alias;
            contentType.Icon  = "icon-message";

            var textstringDef      = new DataTypeDefinition(-1, "Umbraco.Textbox");
            var richtextEditorDef  = new DataTypeDefinition(-1, "Umbraco.TinyMCEv3");
            var textboxMultipleDef = new DataTypeDefinition(-1, "Umbraco.TextboxMultiple");

            if (item.Tabs != null && item.Tabs.Any())
            {
                foreach (var tab in item.Tabs)
                {
                    if (!string.IsNullOrEmpty(tab.Name))
                    {
                        contentType.AddPropertyGroup(tab.Name);

                        foreach (var property in tab.Properties)
                        {
                            contentType.AddPropertyType(
                                new PropertyType(textstringDef)
                            {
                                Alias       = property.Alias,
                                Name        = property.Name,
                                Description = "",
                                Mandatory   = property.Mandatory,
                                SortOrder   = 1
                            },
                                tab.Name);
                        }
                    }
                }
            }

            _contentTypeService.Save(contentType);

            if (contentType != null)
            {
                return(contentType.Id);
            }
            else
            {
                return(parentId);
            }
        }
        private void CreateSystemLinkDocumentType()
        {
            var contentService  = ApplicationContext.Current.Services.ContentTypeService;
            var dataTypeService = ApplicationContext.Current.Services.DataTypeService;

            var compositionFolder = contentService.GetContentTypeContainers(CoreInstallationConstants.DocumentTypesContainerNames.DataContent, 1).First();

            var navigationCompositionType = contentService.GetContentType(DocumentTypeAliases.SystemLink);

            if (navigationCompositionType != null)
            {
                return;
            }

            navigationCompositionType = new ContentType(compositionFolder.Id)
            {
                Name  = DocumentTypeNames.SystemLink,
                Alias = DocumentTypeAliases.SystemLink
            };

            navigationCompositionType.AddPropertyGroup(DocumentTypeTabNames.Links);

            var linksGroupTitleProperty = new PropertyType("Umbraco.Textbox", DataTypeDatabaseType.Nvarchar)
            {
                Name  = DocumentTypePropertyNames.LinksGroupTitle,
                Alias = DocumentTypePropertyAliases.LinksGroupTitle
            };
            var sortProperty = new PropertyType("Umbraco.Integer", DataTypeDatabaseType.Integer)
            {
                Name  = DocumentTypePropertyNames.Sort,
                Alias = DocumentTypePropertyAliases.Sort
            };

            var linksPicker   = dataTypeService.GetDataTypeDefinitionByName(DataTypeNames.LinksPicker);
            var linksProperty = new PropertyType(linksPicker)
            {
                Name  = DocumentTypePropertyNames.Links,
                Alias = DocumentTypePropertyAliases.Links
            };

            navigationCompositionType.AddPropertyType(linksGroupTitleProperty, DocumentTypeTabNames.Links);
            navigationCompositionType.AddPropertyType(sortProperty, DocumentTypeTabNames.Navigation);
            navigationCompositionType.AddPropertyType(linksProperty, DocumentTypeTabNames.Navigation);

            contentService.Save(navigationCompositionType);
            InstallationStepsHelper.AddAllowedChildNode(DocumentTypeAliases.SystemLinkFolder, DocumentTypeAliases.SystemLink);
        }
        private void CreateBasePageWithContentGrid()
        {
            var contentService = ApplicationContext.Current.Services.ContentTypeService;

            var basePageDocumentType = contentService.GetContentType(DocumentTypeAliases.BasePageWithContentGrid);

            if (basePageDocumentType != null)
            {
                return;
            }

            var basePage = contentService.GetContentType(DocumentTypeAliases.BasePage);

            basePageDocumentType = new ContentType(basePage.Id)
            {
                Name  = DocumentTypeNames.BasePageWithContentGrid,
                Alias = DocumentTypeAliases.BasePageWithContentGrid
            };

            basePageDocumentType.AddPropertyGroup(DataTypePropertyGroupNames.Content);
            basePageDocumentType.AddPropertyType(InstallationStepsHelper.GetGridPropertyType(DataTypeNames.ContentGrid), DataTypePropertyGroupNames.Content);

            contentService.Save(basePageDocumentType);
        }
Пример #10
0
        private void CreatePagePromotionComposition()
        {
            var contentService  = ApplicationContext.Current.Services.ContentTypeService;
            var dataTypeService = ApplicationContext.Current.Services.DataTypeService;

            var compositionFolder = contentService.GetContentTypeContainers(CoreInstallationConstants.DocumentTypesContainerNames.Compositions, 1).Single();

            var pagePromotionCompositionType = contentService.GetContentType(PagePromotionInstallationConstants.DocumentTypeAliases.PagePromotionComposition);

            if (pagePromotionCompositionType != null)
            {
                return;
            }

            pagePromotionCompositionType = new ContentType(compositionFolder.Id)
            {
                Name  = PagePromotionInstallationConstants.DocumentTypeNames.PagePromotionComposition,
                Alias = PagePromotionInstallationConstants.DocumentTypeAliases.PagePromotionComposition
            };

            pagePromotionCompositionType.AddPropertyGroup(PagePromotionInstallationConstants.DocumentTypeTabNames.Promotion);

            var promotionPropertyGroup = pagePromotionCompositionType.PropertyGroups.Single(group => group.Name == PagePromotionInstallationConstants.DocumentTypeTabNames.Promotion);

            promotionPropertyGroup.SortOrder = PagePromotionInstallationConstants.DocumentTypeTabSortOrder.Promotion;

            var pagePromotionDataType       = dataTypeService.GetDataTypeDefinitionByName(PagePromotionInstallationConstants.DataTypeNames.PagePromotion);
            var pagePromotionConfigProperty = new PropertyType(pagePromotionDataType)
            {
                Name  = PagePromotionInstallationConstants.DocumentTypePropertyNames.PagePromotionConfig,
                Alias = PagePromotionInstallationConstants.DocumentTypePropertyAliases.PagePromotionConfig
            };

            pagePromotionCompositionType.AddPropertyType(pagePromotionConfigProperty, PagePromotionInstallationConstants.DocumentTypeTabNames.Promotion);
            contentService.Save(pagePromotionCompositionType);
        }
Пример #11
0
        private void CreateOpenGraphComposition()
        {
            var services        = ApplicationContext.Current.Services;
            var contentService  = services.ContentTypeService;
            var dataTypeService = services.DataTypeService;

            var compositionFolder = contentService.GetContentTypeContainers(
                CoreInstallationConstants.DocumentTypesContainerNames.Compositions, 1).First();

            var openGraphCompositionType = contentService.GetContentType(DocumentType.Alias);

            if (openGraphCompositionType != null)
            {
                return;
            }

            openGraphCompositionType = new ContentType(compositionFolder.Id)
            {
                Name  = DocumentType.Name,
                Alias = DocumentType.Alias
            };

            openGraphCompositionType.AddPropertyGroup(DocumentType.TabName);

            var titleProperty = new PropertyType("Umbraco.Textbox", DataTypeDatabaseType.Nvarchar)
            {
                Name  = Properties.TitleName,
                Alias = Properties.TitleAlias
            };

            var descriptionProperty = new PropertyType("Umbraco.TextboxMultiple", DataTypeDatabaseType.Nvarchar)
            {
                Name  = Properties.DescriptionName,
                Alias = Properties.DescriptionAlias
            };

            var mediaPickerDataType = dataTypeService.GetDataTypeDefinitionByName(MediaPickerDataTypeName);

            if (mediaPickerDataType == null)
            {
                mediaPickerDataType = new DataTypeDefinition("Umbraco.MediaPicker2")
                {
                    Name = MediaPickerDataTypeName
                };
                dataTypeService.Save(mediaPickerDataType);
                mediaPickerDataType = dataTypeService.GetDataTypeDefinitionByName(MediaPickerDataTypeName);
            }
            var imageProperty = new PropertyType(mediaPickerDataType)
            {
                Name  = Properties.ImageName,
                Alias = Properties.ImageAlias
            };

            openGraphCompositionType.AddPropertyType(titleProperty, DocumentType.TabName);
            openGraphCompositionType.AddPropertyType(descriptionProperty, DocumentType.TabName);
            openGraphCompositionType.AddPropertyType(imageProperty, DocumentType.TabName);


            var tab = openGraphCompositionType.PropertyGroups.First();

            tab.SortOrder = 20;

            contentService.Save(openGraphCompositionType);
        }
        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);
            }
        }
Пример #13
0
        public static void CreateDocTypes()
        {
            var cts = ApplicationContext.Current.Services.ContentTypeService;

            // CampaignDetail
            var foundContentType = cts.GetContentType(DocTypeAliases.PhoneManagerCampaignDetail);

            if (foundContentType == null)
            {
                // create doctype
                ContentType ctModel = new ContentType(-1);
                ctModel.Name  = "Campaign Detail";
                ctModel.Alias = DocTypeAliases.PhoneManagerCampaignDetail;
                ctModel.Icon  = "icon-phone";
                var tabName = "Campaign Detail";
                ctModel.AddPropertyGroup(tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TextString)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.TelephoneNumber, Name = "Telephone number", Description = "The campaign phone number", Mandatory = true, SortOrder = 1
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TextString)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.CampaignCode, Name = "Campaign code", Description = "The campaign code sent as a querystring 'fsource=' with the request", Mandatory = false, SortOrder = 2
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TextString)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.Referrer, Name = "Referrer", Description = "With the following referrer domains. E.g. with could be search engine domains. Use 'none' for direct entry.", Mandatory = false, SortOrder = 3
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.ContentPicker2)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.EntryPage, Name = "Entry page", Description = "If user enters the site on this page", Mandatory = false, SortOrder = 4
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TrueFalse)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.DoNotPersistAcrossVisits, Name = "Do not persist across visits", Description = "Persist this number across user sessions. i.e. using cookies", Mandatory = false, SortOrder = 5
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.Numeric)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.PersistDurationOverride, Name = "Persist duration override", Description = "If persisting, for how many days?", Mandatory = true, SortOrder = 6
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TrueFalse)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.OverwritePersistingItem, Name = "Overwrite persisting item", Description = "This number will overwrite an exisiting persistent number", Mandatory = false, SortOrder = 7
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TextString)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.AltMarketingCode, Name = "Alt marketing code", Description = "Additional marketing code associated with this campaign", Mandatory = false, SortOrder = 8
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TextString)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.UseAltCampaignQueryStringKey, Name = "Override campaign querystring key", Description = "Use this as the QueryString key instead of the default one.", Mandatory = false, SortOrder = 9
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TrueFalse)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel_PhoneManagerCampaignDetail.IsDefault, Name = "Is Default", Description = "Use this if no other matching campaigns are found", Mandatory = false, SortOrder = 10
                }, tabName);

                cts.Save(ctModel);
            }

            // CampaignPhoneManagerModel
            foundContentType = cts.GetContentType(DocTypeAliases.PhoneManager);
            if (foundContentType == null)
            {
                // create doctype
                ContentType ctModel = new ContentType(-1);
                ctModel.Name  = "Phone Manager";
                ctModel.Alias = DocTypeAliases.PhoneManager;
                ctModel.Icon  = "icon-phone-ring color-orange";
                var tabName = "Settings";
                ctModel.AddPropertyGroup(tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TextString)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel.DefaultCampaignQueryStringKey, Name = "Campaign querystring key", Description = "The http request querystring key used by the marketing campaign", Mandatory = true, SortOrder = 1
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.Numeric)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel.DefaultPersistDurationInDays, Name = "Default persist duration in days", Description = "The default number of days to persist the campaign for a customer", Mandatory = true, SortOrder = 3
                }, tabName);

                ctModel.AddPropertyType(new PropertyType(UmbracoDataTypes.TrueFalse)
                {
                    Alias = AppConstants.UmbracoDocTypeAliases.PhoneManagerModel.GlobalDisableOverwritePersistingItems, Name = "Disable any campaign from overwriting persisting items. This is recommended if possible.", Mandatory = false, SortOrder = 4
                }, tabName);

                // Add the CampaignDetail content type as allowed under this
                var foundCampaignDetailType = cts.GetContentType(DocTypeAliases.PhoneManagerCampaignDetail);
                ctModel.AllowedContentTypes = new List <ContentTypeSort>(foundCampaignDetailType.Id);

                cts.Save(ctModel);
            }
        }
Пример #14
0
        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);
            }
        }
Пример #15
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var ct = applicationContext.Services.ContentTypeService
                     .GetAllContentTypes().FirstOrDefault(x => x.Alias == "UcommentatorSettings");

            if (ct == null)
            {
                var textstring = applicationContext.Services.DataTypeService.GetDataTypeDefinitionByPropertyEditorAlias("umbraco.Textbox")
                                 .FirstOrDefault(x => x.Name.ToLower() == "textstring");
                var trueFalse =
                    applicationContext.Services.DataTypeService.GetDataTypeDefinitionByPropertyEditorAlias(
                        "Umbraco.TrueFalse")
                    .FirstOrDefault(x => x.Name.ToLower() == "true/false");

                ContentType uCommentatorType = new ContentType(-1);
                uCommentatorType.Name          = "uCommentatorSettings";
                uCommentatorType.Alias         = "UcommentatorSettings";
                uCommentatorType.AllowedAsRoot = true;
                uCommentatorType.Icon          = "icon-wrench";

                var propGroup = new PropertyGroup()
                {
                    Name = "Settings"
                };

                uCommentatorType.AddPropertyGroup("Settings");

                var api_key = new PropertyType(textstring)
                {
                    Alias     = "api_key",
                    Name      = "API_KEY",
                    Mandatory = true
                };

                var api_secret = new PropertyType(textstring)
                {
                    Alias     = "api_secret",
                    Name      = "API_SECRET",
                    Mandatory = true
                };

                var access_token = new PropertyType(textstring)
                {
                    Alias     = "access_token",
                    Name      = "ACCESS_TOKEN",
                    Mandatory = true
                };

                var shortname = new PropertyType(textstring)
                {
                    Alias     = "shortname",
                    Name      = "Shortname",
                    Mandatory = true
                };

                var category = new PropertyType(textstring)
                {
                    Alias     = "category",
                    Name      = "Category",
                    Mandatory = true
                };

                var limit = new PropertyType(textstring)
                {
                    Alias     = "itemPerPage",
                    Name      = "Item per Page",
                    Mandatory = true
                };

                var enableSSO = new PropertyType(trueFalse)
                {
                    Alias     = "enableSSO",
                    Name      = "Enable SSO?",
                    Mandatory = false
                };

                var ssoName = new PropertyType(textstring)
                {
                    Alias       = "ssoName",
                    Name        = "SSO Name",
                    Description = "Fill this if you enable SSO.",
                    Mandatory   = false
                };

                var ssoButton = new PropertyType(textstring)
                {
                    Alias       = "ssoButton",
                    Name        = "SSO Button URL",
                    Description = "Fill this if you enable SSO.",
                    Mandatory   = false
                };

                var ssoIcon = new PropertyType(textstring)
                {
                    Alias       = "ssoIcon",
                    Name        = "SSO Icon URL",
                    Description = "Fill this if you enable SSO.",
                    Mandatory   = false
                };

                var ssoLogin = new PropertyType(textstring)
                {
                    Alias       = "ssoLogin",
                    Name        = "SSO Login URL",
                    Description = "Fill this if you enable SSO.",
                    Mandatory   = false
                };

                var ssoLogout = new PropertyType(textstring)
                {
                    Alias       = "ssoLogout",
                    Name        = "SSO Logout URL",
                    Description = "Fill this if you enable SSO.",
                    Mandatory   = false
                };

                uCommentatorType.AddPropertyType(api_key, "Settings");
                uCommentatorType.AddPropertyType(api_secret, "Settings");
                uCommentatorType.AddPropertyType(access_token, "Settings");
                uCommentatorType.AddPropertyType(shortname, "Settings");
                uCommentatorType.AddPropertyType(category, "Settings");
                uCommentatorType.AddPropertyType(limit, "Settings");
                uCommentatorType.AddPropertyType(enableSSO, "Settings");
                uCommentatorType.AddPropertyType(ssoName, "Settings");
                uCommentatorType.AddPropertyType(ssoButton, "Settings");
                uCommentatorType.AddPropertyType(ssoIcon, "Settings");
                uCommentatorType.AddPropertyType(ssoLogin, "Settings");
                uCommentatorType.AddPropertyType(ssoLogout, "Settings");

                ApplicationContext.Current.Services.ContentTypeService.Save(uCommentatorType);
            }

            var root     = new Node(-1);
            var settings = root.ChildrenAsList.FirstOrDefault(x => x.NodeTypeAlias == "UcommentatorSettings");

            if (settings == null)
            {
                IContent doc = ApplicationContext.Current.Services.ContentService.CreateContent("uCommentator Settings", -1,
                                                                                                "UcommentatorSettings");

                doc.SetValue("api_key", "your api_key");
                doc.SetValue("api_secret", "your api_secret");
                doc.SetValue("access_token", "your access_token");
                doc.SetValue("shortname", "your shortname");
                doc.SetValue("category", "your category");
                doc.SetValue("itemPerPage", 10);
                doc.SetValue("enableSSO", 0);
                doc.SetValue("ssoName", "Example SSO");
                doc.SetValue("ssoButton", "http://example.com/images/samplenews.gif");
                doc.SetValue("ssoIcon", "http://example.com/favicon.png");
                doc.SetValue("ssoLogout", "http://example.com/login/");
                doc.SetValue("ssoLogout", "http://example.com/logout/");

                applicationContext.Services.ContentService.SaveAndPublishWithStatus(doc);
            }

            installer = new LanguageInstaller();
            installer.CheckAndInstallLanguageActions();
            ServerVariablesParser.Parsing += ServerVariablesParser_Parsing;

            var us   = applicationContext.Services.UserService;
            var user = us.GetByProviderKey(0);

            if (!user.AllowedSections.Any(x => x == "uCommentator"))
            {
                user.AddAllowedSection("uCommentator");
                us.Save(user);
            }
        }
Пример #16
0
        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);
            }
        }
Пример #17
0
        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);
            }
        }
        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);
            }
        }