示例#1
0
        /// <summary>
        /// Installs the pages.
        /// </summary>
        /// <param name="initializer">The initializer.</param>
        protected override void InstallPages(SiteInitializer initializer)
        {
            // code to install admin page nodes and pages
            // get page manager
            var pageManager = initializer.PageManager;
            var modulesPageNode = pageManager.GetPageNode(SiteInitializer.ModulesNodeId);

            // Create PageNode if doesn't exist
            var ProjectsModulePageGroupNode = pageManager.GetPageNodes().Where(t => t.Id == ProjectsPageGroupID).SingleOrDefault();
            if (ProjectsModulePageGroupNode == null)
            {
                // create page node under Modules node
                ProjectsModulePageGroupNode = initializer.CreatePageNode(ProjectsPageGroupID, modulesPageNode, Telerik.Sitefinity.Pages.Model.NodeType.Group);
                ProjectsModulePageGroupNode.Name = ProjectsModule.ModuleName;
                ProjectsModulePageGroupNode.ShowInNavigation = true;
                ProjectsModulePageGroupNode.Attributes["ModuleName"] = ProjectsModule.ModuleName;

                // hard-code names for now, will eventually be localized
                ProjectsModulePageGroupNode.Title = "Projects";
                ProjectsModulePageGroupNode.UrlName = "Projects";
                ProjectsModulePageGroupNode.Description = "Module for managing a list of Projects";
            }

            // create Landing Page if doesn't exist
            var landingPage = pageManager.GetPageNodes().SingleOrDefault(p => p.Id == LandingPageId);
            if (landingPage == null)
            {
                // create page
                var pageInfo = new PageDataElement()
                {
                    PageId = LandingPageId,
                    IncludeScriptManager = true,
                    ShowInNavigation = false,
                    EnableViewState = false,
                    TemplateName = SiteInitializer.BackendTemplateName,

                    // hard-code names for now, will eventually be localized
                    Name = ProjectsModule.ModuleName,
                    MenuName = "Projects Module",
                    UrlName = "Projects",
                    Description = "Landing page for the Projects Module",
                    HtmlTitle = "Projects Module"
                };

                pageInfo.Parameters["ModuleName"] = ProjectsModule.ModuleName;

                // create control panel
                var backendView = new BackendContentView()
                {
                    ModuleName = ProjectsModule.ModuleName,
                    ControlDefinitionName = ProjectsDefinitions.BackendDefinitionName
                };

                // add page
                initializer.CreatePageFromConfiguration(pageInfo, ProjectsModulePageGroupNode, backendView);
            }
        }
        protected void InstallPages(SiteInitializer initializer)
        {
            var pageManager = initializer.PageManager;
            var moduleNode = pageManager.GetPageNode(SiteInitializer.DesignNodeId);

            PageNode TemplateImporterNode = pageManager.GetPageNodes().Where(p => p.Id == TemplateImporterModule.TemplateImporterPageGroupID).SingleOrDefault();
            if (TemplateImporterNode == null)
            {
                TemplateImporterNode = initializer.CreatePageNode(TemplateImporterModule.TemplateImporterPageGroupID, moduleNode, NodeType.Group);

                TemplateImporterNode.Name = TemplateImporterModule.ModuleName;
                TemplateImporterNode.ShowInNavigation = true;
                TemplateImporterNode.Attributes["ModuleName"] = TemplateImporterModule.ModuleName;
                TemplateImporterNode.Title = TemplateImporterModule.ModuleName;
                TemplateImporterNode.UrlName = TemplateImporterModule.ModuleName;
                TemplateImporterNode.Description = "Module for importing Template packages";
            }

            var landingPage = pageManager.GetPageNodes().SingleOrDefault(p => p.Id == this.LandingPageId);

            if (landingPage == null)
            {
                var pageInfo = new PageDataElement()
                {
                    PageId = this.LandingPageId,
                    Name = "TemplateImporter",
                    MenuName = "TemplateImporter Module",
                    UrlName = "TemplateImporter",
                    Description = "TemplateImporterLandingPageDescription",
                    HtmlTitle = "Template Importer",
                    //ResourceClassId = typeof(TemplateImporterResources).Name,
                    IncludeScriptManager = true,
                    ShowInNavigation = false,
                    EnableViewState = false,
                    TemplateName = SiteInitializer.BackendTemplateName,
                };

                pageInfo.Parameters["ModuleName"] = TemplateImporterModule.ModuleName;
              
                TemplateImporterServerControl control = new TemplateImporterServerControl();
                              
                Control[] pageControls = new Control[] { 
                   control
                };
                
                initializer.CreatePageFromConfiguration(pageInfo, TemplateImporterNode, pageControls);
            }
        }
        /// <summary>
        /// Installs the pages.
        /// </summary>
        /// <param name="initializer">The initializer.</param>
        protected override void InstallPages(SiteInitializer initializer)
        {
            var moduleNode = initializer.PageManager.GetPageNode(SiteInitializer.ModulesNodeId);
            var pageManager = initializer.PageManager;

            var fundingRequestNode = pageManager.GetPageNodes().Where(p => p.Id == FundingModule.HomePageId).SingleOrDefault();
            if (fundingRequestNode == null)
            {
                fundingRequestNode = initializer.CreatePageNode(FundingModule.HomePageId, moduleNode);

                fundingRequestNode.Name = FundingModule.ModuleName;
                fundingRequestNode.ShowInNavigation = true;
                fundingRequestNode.Attributes["ModuleName"] = FundingModule.ModuleName;
                fundingRequestNode.Title = FundingModule.ModuleName;
                fundingRequestNode.UrlName = FundingModule.ModuleName;
            }

            // create the subpage
            var subPage = pageManager.GetPageNodes().Where(p => p.Id == FundingModule.ChildPageId).SingleOrDefault();
            if (subPage == null)
            {
                var pageInfo = new PageDataElement()
                {
                    PageId = FundingModule.ChildPageId,
                    Name = "FundingRequestList",
                    MenuName = "FundingRequestList",
                    UrlName = "FundingRequestList",
                    Description = "Funding Requests List",
                    ShowInNavigation = false,
                    TemplateName = SiteInitializer.BackendTemplateName,
                };
                pageInfo.Parameters["ModuleName"] = FundingModule.ModuleName;
                var control = new FundingRequestList();
                var node = initializer.CreatePageFromConfiguration(pageInfo, fundingRequestNode, control);
            }
        }