Exemplo n.º 1
0
        private static bool ValidateCreationModel(BasePageWithDefaultGridCreateModel model)
        {
            var context           = new ValidationContext(model);
            var validationResults = new List <ValidationResult>();

            return(Validator.TryValidateObject(model, context, validationResults, true));
        }
Exemplo n.º 2
0
        private static IContentType CreatePageDocTypeWithGrid(BasePageWithDefaultGridCreateModel model, string basePageTypeAlias)
        {
            if (!ValidateCreationModel(model))
            {
                return(null);
            }

            var contentService = ApplicationContext.Current.Services.ContentTypeService;

            var page = contentService.GetContentType(model.Alias);

            if (page != null)
            {
                return(page);
            }

            page = GetBasePageWithGridBase(basePageTypeAlias);

            page.Name  = model.Name;
            page.Alias = model.Alias;
            page.Icon  = model.Icon;

            contentService.Save(page);
            if (model.ParentAlias.HasValue())
            {
                AddAllowedChildNode(model.ParentAlias, model.Alias);
            }

            return(page);
        }
        private void CreateSearchResultPage()
        {
            var createModel = new BasePageWithDefaultGridCreateModel
            {
                Name        = DocumentTypeNames.SearchResultPage,
                Alias       = DocumentTypeAliases.SearchResultPage,
                Icon        = DocumentTypeIcons.SearchResultPage,
                ParentAlias = CoreInstallationConstants.DocumentTypeAliases.HomePage
            };

            InstallationStepsHelper.CreatePageDocTypeWithBaseGrid(createModel);
        }
Exemplo n.º 4
0
        private void CreateBulletinsDetailsPage()
        {
            var createModel = new BasePageWithDefaultGridCreateModel
            {
                Name        = DocumentTypeNames.BulletinsDetailsPage,
                Alias       = DocumentTypeAliases.BulletinsDetailsPage,
                Icon        = DocumentTypeIcons.BulletinsDetailsPage,
                ParentAlias = DocumentTypeAliases.BulletinsOverviewPage
            };

            InstallationStepsHelper.CreatePageDocTypeWithBaseGrid(createModel);
        }
Exemplo n.º 5
0
        private void CreateGroupsDocumentsPageDocType()
        {
            var createModel = new BasePageWithDefaultGridCreateModel
            {
                Name        = DocumentTypeNames.GroupsDocumentsPage,
                Alias       = DocumentTypeAliases.GroupsDocumentsPage,
                Icon        = DocumentTypeIcons.GroupsDocumentsPage,
                ParentAlias = DocumentTypeAliases.GroupsRoomPage
            };

            InstallationStepsHelper.CreatePageDocTypeWithBaseGrid(createModel);
        }
        private void CreateContentPage()
        {
            var createModel = new BasePageWithDefaultGridCreateModel
            {
                Name        = DocumentTypeNames.ContentPage,
                Alias       = DocumentTypeAliases.ContentPage,
                Icon        = DocumentTypeIcons.ContentPage,
                ParentAlias = DocumentTypeAliases.HomePage
            };

            InstallationStepsHelper.CreatePageDocTypeWithContentGrid(createModel);
            InstallationStepsHelper.AddAllowedChildNode(DocumentTypeAliases.ContentPage, DocumentTypeAliases.ContentPage);
        }
        private void CreateHomePage()
        {
            var createModel = new BasePageWithDefaultGridCreateModel
            {
                Name  = DocumentTypeNames.HomePage,
                Alias = DocumentTypeAliases.HomePage,
                Icon  = DocumentTypeIcons.HomePage
            };

            var homePage = InstallationStepsHelper.CreatePageDocTypeWithBaseGrid(createModel);

            homePage.AllowedAsRoot = true;

            var contentService = ApplicationContext.Current.Services.ContentTypeService;

            contentService.Save(homePage);
        }
        private void CreateNotificationPage()
        {
            var createModel = new BasePageWithDefaultGridCreateModel
            {
                Name        = DocumentTypeNames.NotificationPage,
                Alias       = DocumentTypeAliases.NotificationPage,
                Icon        = DocumentTypeIcons.NotificationPage,
                ParentAlias = CoreInstallationConstants.DocumentTypeAliases.HomePage
            };

            var notificationPage = InstallationStepsHelper.CreatePageDocTypeWithBaseGrid(createModel);

            var itemCountForPopupProperty = new PropertyType("Umbraco.Integer", DataTypeDatabaseType.Integer)
            {
                Name  = DocumentTypePropertyNames.ItemCountForPopup,
                Alias = DocumentTypePropertyAliases.ItemCountForPopup
            };

            notificationPage.AddPropertyType(itemCountForPopupProperty, "Content");

            var contentService = ApplicationContext.Current.Services.ContentTypeService;

            contentService.Save(notificationPage);
        }
Exemplo n.º 9
0
 public static IContentType CreatePageDocTypeWithContentGrid(BasePageWithDefaultGridCreateModel model)
 {
     return(CreatePageDocTypeWithGrid(model, CoreInstallationConstants.DocumentTypeAliases.BasePageWithContentGrid));
 }