Ejemplo n.º 1
0
        private static void CreatePap720Layout()
        {
            var xjfFileName = @"c:\Work\Tasks\XpressoGoodbye\base_job.xjf";
            var xjf         = XpressoRepository.GetFromFile(xjfFileName);
            var layout      = Pap720Generator.BuildPap720(720, xjf);

            LayoutRepository.Save(layout);
        }
Ejemplo n.º 2
0
        public IHttpActionResult Post([FromBody] IEnumerable <Models.LayoutModel> layout)
        {
            var layoutRepository = new LayoutRepository();

            layoutRepository.Save(layout);

            return(Ok());
        }
Ejemplo n.º 3
0
        // gets XJF files, downloaded by Xpresso, generates layouts
        // for each layout adds vendor logo element from XJF and creates new Pressview (measure color strip) element from hardcoded values
        private static void CreateLayoutsWithColorStripFromXjf()
        {
            var codes = new[] { 403, 404, 405, 408, 409, 410, 411, 412, 413, 414, 415, 417, 418, 420, 421, 422, 423, 424, 425, 426, 427, 428 };

            foreach (var code in codes)
            {
                var xjf    = XjfRepository.GetUntouched(code);
                var layout = CanvasGenerator.BuildFromXjf(code, xjf);
                LayoutRepository.Save(layout);
            }
        }
Ejemplo n.º 4
0
        public Site SetupTestSite()
        {
            var tbx = new ToolboxManager();

            var myLayout = new Layout
            {
                Name           = "Demo",
                MasterPagePath = "/Demo.Master",
            };

            myLayout.PageContent.Add(new CmsPageContent
            {
                Id             = Guid.NewGuid(),
                WidgetTypeCode = "Client-CustomNavigation",
                PlacementContentPlaceHolderId = "NavigationContentPlaceHolder"
            });
            var layoutRepository = new LayoutRepository();

            layoutRepository.Save(myLayout);

            var siteRepo = new SiteRepository();
            var newSite  = new Site
            {
                Name           = "WarpCore Demo",
                IsFrontendSite = true
            };

            siteRepo.Save(newSite);

            var homePage = new CmsPage
            {
                Name        = "Homepage",
                SiteId      = newSite.ContentId,
                LayoutId    = myLayout.ContentId,
                Keywords    = "WarpCore,CMS,Demo",
                Description = "WarpCore CMS Demo"
            };

            var lbId = Guid.NewGuid();
            var row  = new CmsPageContent
            {
                Id             = Guid.NewGuid(),
                WidgetTypeCode = RowLayout.ApiId,
                PlacementContentPlaceHolderId = "Body",
                Parameters = new Dictionary <string, string>
                {
                    //[nameof(RowLayout.LayoutBuilderId)] = lbId.ToString(),
                    [nameof(RowLayout.NumColumns)] = 3.ToString()
                }
            };

            var helloWorld0 = new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "0",
                PlacementLayoutBuilderId      = lbId,
                WidgetTypeCode = ContentBlock.ApiId,
                Parameters     = new Dictionary <string, string> {
                    ["AdHocHtml"] = "Hello World (0)"
                }
            };

            var helloWorld1 = new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "1",
                PlacementLayoutBuilderId      = lbId,
                WidgetTypeCode = ContentBlock.ApiId,
                Parameters     = new Dictionary <string, string> {
                    ["AdHocHtml"] = "Hello World (1)"
                }
            };

            row.AllContent.Add(helloWorld0);
            row.AllContent.Add(helloWorld1);

            homePage.PageContent.Add(row);



            var aboutUs = new CmsPage
            {
                Name     = "About Us",
                SiteId   = newSite.ContentId,
                LayoutId = myLayout.ContentId
            };
            var contactUs = new CmsPage
            {
                Name     = "Contact Us",
                SiteId   = newSite.ContentId,
                LayoutId = myLayout.ContentId
            };

            var pageRepository = new CmsPageRepository();

            pageRepository.Save(homePage, SitemapRelativePosition.Root);
            pageRepository.Save(aboutUs, SitemapRelativePosition.Root);
            pageRepository.Save(contactUs, SitemapRelativePosition.Root);
            newSite.HomepageId = homePage.ContentId;
            siteRepo.Save(newSite);

            var subPage1 = new CmsPage
            {
                Name   = "Subpage 1",
                SiteId = newSite.ContentId
            };

            pageRepository.Save(subPage1, new PageRelativePosition {
                ParentPageId = homePage.ContentId
            });

            var subPage0 = new CmsPage
            {
                Name   = "Subpage 0",
                SiteId = newSite.ContentId
            };

            pageRepository.Save(subPage0, new PageRelativePosition {
                ParentPageId = homePage.ContentId, BeforePageId = subPage1.ContentId
            });

            return(newSite);
        }
Ejemplo n.º 5
0
        public void SetupBackendSite()
        {
            var listRepo       = new ContentListDefinitionRepository();
            var customPageList = new ConfiguratorCmsPageContentBuilder().GenerateDefaultContentListDefinition(typeof(CmsPage));

            customPageList.EntityUid = new Guid(CmsForm.ApiId);
            listRepo.Save(customPageList);
            listRepo.Publish(By.ContentId(customPageList.ContentId));



            var backendLayout = new Layout
            {
                Name           = "Backend Layout",
                MasterPagePath = "/App_Data/BackendPage.Master",
                PageContent    = new List <CmsPageContent> {
                    new CmsPageContent {
                        Id = Guid.NewGuid(), PlacementContentPlaceHolderId = "Body", WidgetTypeCode = "wc-navigation-bar"
                    }
                }
            };


            var layoutRepository = new LayoutRepository();

            layoutRepository.Save(backendLayout);


            var siteRepo    = new SiteRepository();
            var backendSite = new Site
            {
                Name        = "Admin",
                RoutePrefix = "Admin",
                ContentId   = new Guid("00000000-0000-0000-0000-000000000001"),
            };

            siteRepo.Save(backendSite);


            var formDesigner = new CmsPage
            {
                Name                = "Form Designer",
                ContentId           = KnownPageIds.FormDesigner,
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = false,
            };

            formDesigner.PageContent.Add(new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "Body",
                WidgetTypeCode = "wc-formdesigner"
            });


            var pageTree = new CmsPage
            {
                Name     = "Pages",
                SiteId   = backendSite.ContentId,
                LayoutId = backendLayout.ContentId
            };

            pageTree.PageContent.AddBlazorApp(new PageTreeApp());


            var redirectPageSettingsForm = SetupRedirectPageSettingsForm();
            var groupingPageSettingsForm = SetupGroupingPageSettingsForm();
            var pageSettingsForm         = SetupPageSettingsForm();


            var addPageWizard = new CmsPage
            {
                Name                = "Add Page Wizard",
                ContentId           = KnownPageIds.AddPageWizard,
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = false
            };

            addPageWizard.PageContent.Add(new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "Body",
                WidgetTypeCode = AddPageWizard.ApiId,
            });



            var contentPageSettings = new CmsPage
            {
                Name                = "Content Page Settings",
                ContentId           = KnownPageIds.ContentPageSettings,
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = false
            };

            contentPageSettings.PageContent.AddDynamicForm(pageSettingsForm);


            var groupingPageSettings = new CmsPage
            {
                Name                = "Group Page Settings",
                ContentId           = KnownPageIds.GroupingPageSettings,
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = false
            };

            groupingPageSettings.PageContent.AddDynamicForm(groupingPageSettingsForm);

            var redirectPageSettings = new CmsPage
            {
                Name                = "Redirect Page Settings",
                ContentId           = KnownPageIds.RedirectPageSettings,
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = false
            };

            redirectPageSettings.PageContent.AddDynamicForm(redirectPageSettingsForm);

            var dashboardPage = new CmsPage
            {
                Name     = "Dashboard",
                SiteId   = backendSite.ContentId,
                LayoutId = backendLayout.ContentId
            };


            var entityBuilderPage = new CmsPage
            {
                Name     = "Entity Builder",
                SiteId   = backendSite.ContentId,
                LayoutId = backendLayout.ContentId
            };

            entityBuilderPage.PageContent.Add(new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "Body",
                WidgetTypeCode = "wc-entitybuilder",
                Parameters     = new Dictionary <string, string> {
                }
            });

            var entityListPage = new CmsPage
            {
                Name     = "Entities",
                SiteId   = backendSite.ContentId,
                LayoutId = backendLayout.ContentId
            };

            entityListPage.PageContent.Add(new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "Body",
                WidgetTypeCode = "wc-entity-list",
                Parameters     = new Dictionary <string, string> {
                }
            });



            //////////////////
            var dynamicListTest = new CmsPage
            {
                Name                = "Dynamic List Test",
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = true
            };

            //var contentListControl = new ContentList()
            //{
            //    RepositoryId = new Guid(CmsPageRepository.ApiId),
            //    Config = new ContentListConfiguration
            //    {
            //        Fields = new List<ContentListField>
            //        {
            //            new ContentListField
            //            {
            //                Header = "Name",
            //                Template = "{" + nameof(CmsPage.Name) + "}"
            //            }

            //        }

            //    },

            //};
            //var parameters = (Dictionary<string, string>)contentListControl.GetPropertyValues(ToolboxPropertyFilter.SupportsDesigner);



            //var list= new ContentListDefinitionRepository().GetRandomList(new Guid(CmsForm.ApiId));
            //var bApp = new BlazorApp
            //{
            //    StartingRouteTemplate = "",
            //    StartingRouteParameters = new RouteDataDictionary()
            //    {
            //        ["RepositoryApiId"] = FormRepository.ApiId,
            //        ["ListId"] = list.ContentId.ToString()
            //    }
            //};
            //var listContent =new InstallationHelpers().BuildCmsPageContentFromToolboxItemTemplate();
            //listContent.PlacementContentPlaceHolderId = "Body";

            var contentBrowserConfig = new ContentBrowserConfiguration();

            contentBrowserConfig.RepositoryApiId = new Guid(CmsPageRepository.ApiId);
            contentBrowserConfig.ListId          = customPageList.ContentId;
            contentBrowserConfig.EditFormId      = KnownFormIds.ContentPageSettingsForm;
            contentBrowserConfig.AddFormId       = KnownFormIds.ContentPageSettingsForm;

            dynamicListTest.PageContent.AddBlazorApp(new ContentBrowserApp {
                Configuration = contentBrowserConfig
            });

            //dynamicListTest.PageContent.Add(new CmsPageContent
            //{
            //    Id = Guid.NewGuid(),
            //    PlacementContentPlaceHolderId = "Body",
            //    WidgetTypeCode = ContentList.ApiId,
            //    Parameters =
            //});


            ////////////////
            var formsList = new CmsPage
            {
                Name                = "FormsLegacy",
                SiteId              = backendSite.ContentId,
                LayoutId            = backendLayout.ContentId,
                DisplayInNavigation = true
            };



            var formList = new ContentList()
            {
                RepositoryId = new Guid(FormRepository.ApiId),
                Config       = new ContentListConfiguration
                {
                    Fields = new List <ContentListField>
                    {
                        new ContentListField
                        {
                            Header   = "Title",
                            Template = "{" + nameof(CmsForm.Title) + "}"
                        },
                        new ContentListField
                        {
                            Header   = "Actions",
                            Template = @"<a href='/Admin/form-designer?formId={" + nameof(CmsForm.DesignForContentId) + "}'><span class='glyphicon glyphicon-text-background'></span>Design</a>"
                        }
                    },
                    AddPage = KnownPageIds.FormDesigner
                }
            };
            var formListParameters = (Dictionary <string, string>)formList.GetPropertyValues(ToolboxPropertyFilter.SupportsDesigner);

            formsList.PageContent.Add(new CmsPageContent
            {
                Id = Guid.NewGuid(),
                PlacementContentPlaceHolderId = "Body",
                WidgetTypeCode = ContentList.ApiId,
                Parameters     = formListParameters
            });



            var pageRepo = new CmsPageRepository();

            pageRepo.Save(dashboardPage);
            pageRepo.Save(pageTree);
            pageRepo.Save(formDesigner);
            pageRepo.Save(contentPageSettings);
            pageRepo.Save(groupingPageSettings);
            pageRepo.Save(redirectPageSettings);
            pageRepo.Save(addPageWizard);
            pageRepo.Save(entityBuilderPage);
            pageRepo.Save(entityListPage);
            pageRepo.Save(dynamicListTest);
            pageRepo.Save(formsList);
            backendSite.HomepageId = dashboardPage.ContentId;
            siteRepo.Save(backendSite);

            var editBackendPageTreeLink = new CmsPage
            {
                Name        = "Edit Backend Pages",
                SiteId      = backendSite.ContentId,
                LayoutId    = backendLayout.ContentId,
                PageType    = PageType.RedirectPage,
                RedirectUri = new WarpCorePageUri(pageTree),
                InternalRedirectParameters = new Dictionary <string, string> {
                    ["SiteId"] = backendSite.ContentId.ToString()
                }
            };

            pageRepo.Save(editBackendPageTreeLink);
        }