/// <summary>
        /// Registers a routes.
        /// </summary>
        /// <param name="context">The area registration context.</param>
        /// <param name="containerBuilder">The container builder.</param>
        public override void RegisterCustomRoutes(ModuleRegistrationContext context, ContainerBuilder containerBuilder)
        {
            context.MapRoute(
                "bcms_" + AreaName + "_MainJs",
                string.Format(RootModuleConstants.AutoGeneratedJsFilePathPattern, "bcms.main.js").TrimStart('/'),
                new
            {
                area       = AreaName,
                controller = "Rendering",
                action     = "RenderMainJsFile"
            },
                new[] { typeof(RenderingController).Namespace });

            context.MapRoute(
                "bcms_" + AreaName + "_ProcessorJs",
                string.Format(RootModuleConstants.AutoGeneratedJsFilePathPattern, "bcms.processor.js").TrimStart('/'),
                new
            {
                area       = AreaName,
                controller = "Rendering",
                action     = "RenderProcessorJsFile"
            },
                new[] { typeof(RenderingController).Namespace });

            context.MapRoute(
                "bcms_" + AreaName + "_PreviewPage",
                "bcms/preview/{pageId}/{pageContentId}",
                new
            {
                area       = AreaName,
                controller = "Preview",
                action     = "Index"
            },
                new[] { typeof(PreviewController).Namespace });


            CreateEmbeddedResourcesRoutes(context);

            // All CMS Pages:
            context.MapRoute("bcms_" + AreaName + "_AllPages",
                             "{*data}",
                             new
            {
                area       = AreaName,
                controller = "Cms",
                action     = "Index"
            },
                             new[] { typeof(CmsController).Namespace });
        }
        /// <summary>
        /// Creates the resource routes for 6 levels folder structure.
        /// </summary>
        /// <param name="context">The context.</param>
        private void CreateEmbeddedResourcesRoutes(ModuleRegistrationContext context)
        {
            string[] urls = new[]
            {
                "file/{area}/{file}.{resourceType}/{*all}",
                "file/{area}/{folder1}/{file}.{resourceType}/{*all}",
                "file/{area}/{folder1}/{folder2}/{file}.{resourceType}/{*all}",
                "file/{area}/{folder1}/{folder2}/{folder3}/{file}.{resourceType}/{*all}",
                "file/{area}/{folder1}/{folder2}/{folder3}/{folder4}/{file}.{resourceType}/{*all}",
                "file/{area}/{folder1}/{folder2}/{folder3}/{folder4}/{folder5}/{file}.{resourceType}/{*all}",
                "file/{area}/{folder1}/{folder2}/{folder3}/{folder4}/{folder5}/{folder6}/{file}.{resourceType}/{*all}"
            };

            int i = 0;

            foreach (var url in urls)
            {
                context.MapRoute(
                    AreaName + "-level" + i++,
                    url,
                    new
                {
                    controller = "EmbeddedResources",
                    action     = "Index"
                },
                    new
                {
                    resourceType = new MimeTypeRouteConstraint()
                },
                    new[] { typeof(EmbeddedResourcesController).Namespace });
            }
        }
Beispiel #3
0
 /// <summary>
 /// Register a routes for the google analytics module.
 /// </summary>
 /// <param name="context">The module context.</param>
 /// <param name="containerBuilder">The container builder.</param>
 public override void RegisterCustomRoutes(ModuleRegistrationContext context, ContainerBuilder containerBuilder)
 {
     context.MapRoute(
         "bcms-google-sitemap",
         GoogleAnalyticsModuleHelper.GetSitemapUrl(cmsConfiguration),
         new { area = AreaName, controller = "GoogleSitemap", action = "Index" });
 }
Beispiel #4
0
        public override void RegisterCustomRoutes(ModuleRegistrationContext context, ContainerBuilder containerBuilder)
        {
            if (Configuration.Users != null)
            {
                if (Configuration.Users.CreateDefaultUserOnStart)
                {
                    context.MapRoute(
                        "bcms-users-register-first-user",
                        AreaName + "/register",
                        new
                    {
                        area       = AreaName,
                        controller = "Registration",
                        action     = "CreateFirstUser"
                    });
                }

                if (Configuration.Users.EnableCmsFormsAuthentication)
                {
                    context.MapRoute(
                        "bcms-users-login",
                        "login",
                        new
                    {
                        area       = AreaName,
                        controller = "Authentication",
                        action     = "Login"
                    });

                    context.MapRoute(
                        "bcms-users-logout",
                        "logout",
                        new
                    {
                        area       = AreaName,
                        controller = "Authentication",
                        action     = "Logout"
                    });
                }
            }
        }
        public override void RegisterCustomRoutes(ModuleRegistrationContext context, ContainerBuilder containerBuilder)
        {
            context.MapRoute(
                "bcms-setup-database-first-time",
                SetupDatabaseRoute,
                new
            {
                area       = AreaName,
                controller = "Install",
                action     = "SetupDatabase"
            });

            context.MapRoute(
                "bcms-setup-database-test-connection",
                TestConnectionRoute,
                new
            {
                area       = AreaName,
                controller = "Install",
                action     = "TestConnection"
            });
        }