Пример #1
0
        public void GenericContentRoute_IsntPushedBackBy_ContentRoute()
        {
            RouteCollection rc = new RouteCollection();
            rc.MapContentRoute<Models.RegularPage>("area", MockRepository.GenerateStub<IEngine>());
            rc.MapContentRoute("content", MockRepository.GenerateStub<IEngine>());

            Assert.That(rc.Count, Is.EqualTo(2));
            Assert.That(rc.First(), Is.InstanceOf<ContentRoute<Models.RegularPage>>());
            Assert.That(rc.Skip(1).First(), Is.InstanceOf<ContentRoute>());
        }
Пример #2
0
        public void GenericContentRoute_IsntPushedBackBy_ContentRoute()
        {
            RouteCollection rc = new RouteCollection();

            rc.MapContentRoute <Models.RegularPage>("area", MockRepository.GenerateStub <IEngine>());
            rc.MapContentRoute("content", MockRepository.GenerateStub <IEngine>());

            Assert.That(rc.Count, Is.EqualTo(2));
            Assert.That(rc.First(), Is.InstanceOf <ContentRoute <Models.RegularPage> >());
            Assert.That(rc.Skip(1).First(), Is.InstanceOf <ContentRoute>());
        }
Пример #3
0
        public void ContentRoute_IsInsertedBetween_OtherContentRoutes_AndNonContentRoute()
        {
            RouteCollection rc = new RouteCollection();
            rc.MapRoute("mvc", "{controller}/{action}");
            rc.MapContentRoute<Models.RegularPage>("area", MockRepository.GenerateStub<IEngine>());
            rc.MapContentRoute("content", MockRepository.GenerateStub<IEngine>());

            Assert.That(rc.Count, Is.EqualTo(3));
            Assert.That(rc.First(), Is.InstanceOf<ContentRoute<Models.RegularPage>>());
            Assert.That(rc.Skip(1).First(), Is.InstanceOf<ContentRoute>());
        }
Пример #4
0
        public void ContentRoute_IsInsertedBetween_OtherContentRoutes_AndNonContentRoute()
        {
            RouteCollection rc = new RouteCollection();

            rc.MapRoute("mvc", "{controller}/{action}");
            rc.MapContentRoute <Models.RegularPage>("area", MockRepository.GenerateStub <IEngine>());
            rc.MapContentRoute("content", MockRepository.GenerateStub <IEngine>());

            Assert.That(rc.Count, Is.EqualTo(3));
            Assert.That(rc.First(), Is.InstanceOf <ContentRoute <Models.RegularPage> >());
            Assert.That(rc.Skip(1).First(), Is.InstanceOf <ContentRoute>());
        }
Пример #5
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            L24Manager.Init(routes, typeof(HomeController));
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapContentRoute(
                "BlogPost", "Blog/{Year}/{Month}/{Day}/{Name}",
                new { controller = "BlogPost", action = "Index" });

            routes.MapContentRoute(
                "Default", // Route name
                "{controller}/{action}", // URL with parameters
                new { controller = "Home", action = "Index" } // Parameter defaults
            );
        }
        private static IContentRoute MapCategoryRoute(this RouteCollection routes, string insertAfterRouteName, string name, string url, object defaults, Func<SiteDefinition, ContentReference> contentRootResolver)
        {
            var basePathResolver = ServiceLocator.Current.GetInstance<IBasePathResolver>();
            var urlSegmentRouter = ServiceLocator.Current.GetInstance<IUrlSegmentRouter>();
            var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
            urlSegmentRouter.RootResolver = contentRootResolver;
            Func<RequestContext, RouteValueDictionary, string> resolver = basePathResolver.Resolve;

            var contentRouteParameters = new MapContentRouteParameters
            {
                UrlSegmentRouter = urlSegmentRouter,
                BasePathResolver = resolver,
                Direction = SupportedDirection.Both,
                Constraints = new { node = new ContentTypeConstraint<CategoryData>(contentLoader) }
            };

            RouteBase mediaRoute = RouteTable.Routes[insertAfterRouteName];
            int insertIndex = mediaRoute != null
                ? RouteTable.Routes.IndexOf(mediaRoute) + 1
                : RouteTable.Routes.Count;

            var route = routes.MapContentRoute(name, url, defaults, contentRouteParameters) as DefaultContentRoute;
            routes.Remove(route);
            routes.Insert(insertIndex, route);
            return route;
        }
Пример #7
0
        public void ContentRoute_IsAdded()
        {
            RouteCollection rc = new RouteCollection();
            rc.MapContentRoute("content", MockRepository.GenerateStub<IEngine>());

            Assert.That(rc.Count, Is.EqualTo(1));
            Assert.That(rc.First(), Is.InstanceOf<ContentRoute>());
        }
Пример #8
0
        public void ContentRoute_IsAdded()
        {
            RouteCollection rc = new RouteCollection();

            rc.MapContentRoute("content", MockRepository.GenerateStub <IEngine>());

            Assert.That(rc.Count, Is.EqualTo(1));
            Assert.That(rc.First(), Is.InstanceOf <ContentRoute>());
        }
Пример #9
0
        public virtual void RegisterArea(RouteCollection routes, ViewEngineCollection viewEngines, IEngine engine)
        {
            var route = routes.MapContentRoute <IManagementHomePart>("Management", engine);
            var viewLocationFormats = new[] { Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/{1}/{0}.ascx"), Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/Shared/{0}.ascx") };

            viewEngines.Insert(0, new PrivateViewEngineDecorator(new WebFormViewEngine {
                AreaViewLocationFormats = viewLocationFormats, PartialViewLocationFormats = viewLocationFormats
            }, route));
        }
Пример #10
0
        public void ContentRoute_IsInsertedBefore_NonContentRoute()
        {
            RouteCollection rc = new RouteCollection();
            rc.MapRoute("mvc", "{controller}/{action}");
            rc.MapContentRoute("content", MockRepository.GenerateStub<IEngine>());

            Assert.That(rc.Count, Is.EqualTo(2));
            Assert.That(rc.First(), Is.InstanceOf<ContentRoute>());
        }
Пример #11
0
		public static void RegisterRoutes(RouteCollection routes, IEngine engine)
		{
			routes.MapContentRoute("Content", engine);

			routes.MapRoute(
				"Default", // Route name
				"{controller}/{action}/{*id}", // URL with parameters
                new { action = "Index", id = UrlParameter.Optional } // Parameter defaults
				);
		}
Пример #12
0
        public void ContentRoute_IsInsertedBefore_NonContentRoute()
        {
            RouteCollection rc = new RouteCollection();

            rc.MapRoute("mvc", "{controller}/{action}");
            rc.MapContentRoute("content", MockRepository.GenerateStub <IEngine>());

            Assert.That(rc.Count, Is.EqualTo(2));
            Assert.That(rc.First(), Is.InstanceOf <ContentRoute>());
        }
        public static void RegisterRoutes(RouteCollection routes, IEngine engine)
        {
            routes.MapContentRoute("Content", engine);

            routes.MapRoute(
                "Default",                     // Route name
                "{controller}/{action}/{*id}", // URL with parameters
                new { action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
        }
Пример #14
0
 public static void RegisterRoutes(RouteCollection routes, IEngine engine)
 {
     routes.MapContentRoute("Content", engine);
     routes.MapRoute("DefaultCss",
                     "DefaultCss",
                     new
     {
         controller = "StartPage",
         action     = "DefaultCss"
     });
 }
Пример #15
0
 public static void RegisterRoutes(RouteCollection routes, IEngine engine)
 {
     routes.MapContentRoute("Content", engine);
     routes.MapRoute("DefaultCss",
                     "DefaultCss",
                     new
                     {
                         controller = "StartPage",
                         action = "DefaultCss"
                     });
 }
Пример #16
0
        public static void RegisterRoutes(RouteCollection routes, IEngine engine)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapContentRoute("Content", engine);

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
Пример #17
0
        public static void RegisterRoutes(RouteCollection routes, IEngine engine)
        {
            AreaRegistration.RegisterAllAreas(new AreaRegistrationState(engine));

            routes.MapContentRoute("Content", engine);
            routes.MapRoute("Forum", "Forum",
                new { controller = "RedirectToUrl", action = "RedirectToUrl", url = "http://forum.tigersnetball.co.uk" });

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { action = "Index", id = "" }); // Parameter defaults
        }
Пример #18
0
        public static void RegisterRoutes(RouteCollection routes, IEngine engine)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // This route detects content item paths and executes their controller
            routes.MapContentRoute("Content", engine);

            // This controller fallbacks to a controller unrelated to N2
            routes.MapRoute(
                "Default",                                             // Route name
                "{controller}/{action}/{id}",                          // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
        }
Пример #19
0
        public static void RegisterRoutes(RouteCollection routes, IEngine engine)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // This route detects content item paths and executes their controller
            routes.MapContentRoute("Content", engine);

            // This controller fallbacks to a controller unrelated to N2
            routes.MapRoute(
               "Default",                                              // Route name
               "{controller}/{action}/{id}",                           // URL with parameters
               new { controller = "Home", action = "Index", id = UrlParameter.Optional }  // Parameter defaults
            );
        }
Пример #20
0
		public static void RegisterRoutes(RouteCollection routes, IEngine engine)
		{
			routes.MapContentRoute("Content", engine);
		}
Пример #21
0
 public static void RegisterRoutes(RouteCollection routes, IEngine engine)
 {
     // The content route routes firndly urls based onthe content structure
     routes.MapContentRoute("Content", engine);
 }
Пример #22
0
 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.MapContentRoute("Content", N2.Context.Current);
 }
Пример #23
0
 public static void RegisterRoutes(RouteCollection routes, IEngine engine)
 {
     routes.MapContentRoute("Content", engine);
 }
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("Content/{*pathInfo}");
            routes.IgnoreRoute("Scripts/{*pathInfo}");
            routes.IgnoreRoute("Styles/{*pathInfo}");

            routes.IgnoreRoute("{*sosa}", new { font = @"(.*/)?sosa.(/.*)?" });
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.([iI][cC][oO]|[gG][iI][fF])(/.*)?" });

            routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.map/{*pathInfo}");


            routes.MapRoute(
                "N2Diagnostics",
                "Diagnostic/{action}/{id}",
                new { controller = "Diagnostic", action = "Index", id = UrlParameter.Optional });

            routes.MapRoute(
                "RestrictedAdmin",
                "Restricted/Admin/{action}/{id}",
                new { controller = "Admin", action = "Index", id = UrlParameter.Optional });

            routes.MapRoute(
                "Sitemap1",
                "sitemap.xml",
                new { controller = "Sitemap", action = "Index" }
                );

            routes.MapRoute(
                "Sitemap2",
                "{siteId}/sitemap.xml",
                new { controller = "Sitemap", action = "Index" }
                );

            routes.MapRoute(
                "Sitemap3",
                "{siteId}/{cultureCode}/sitemap.xml",
                new { controller = "Sitemap", action = "Index" }
                );

            // n2cms content route
            routes.MapContentRoute("CMS", N2.Context.Current, true);


            // Image Picker Controller: GetFiles method
            routes.MapRoute(
                "ImagePickerUploadFiles",
                "ImagePicker/UploadFile",
                new { controller = "ImagePicker", action = "UploadFile" } // Parameter defaults
                );

            // Image Picker Controller: GetFiles method

            routes.MapRoute(
                "ImagePickerGetFiles",
                "ImagePicker/GetFiles",
                new { controller = "ImagePicker", action = "GetFiles" } // Parameter defaults
                );

            // Image Picker Controller: Search method
            routes.MapRoute(
                "ImagePickerImageSearch",
                "ImagePicker/Search",
                new { controller = "ImagePicker", action = "Search" } // Parameter defaults
                );

            // Image Picker controller: Index method
            routes.MapRoute(
                "ImagePickerIndex",
                "ImagePicker/{id}",
                new { controller = "ImagePicker", action = "Index" }
                );

            routes.MapRoute(
                "CategoryPicker",                   // Route name
                "CategoryPicker/{id}/{categoryId}", // URL with parameters
                new { controller = "CategoryPicker", action = "Index", categoryId = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "ProductPickerProductSearch",                                // Route name
                "ProductPicker/SearchProducts/{keywords}/{page}/{pageSize}", // URL with parameters
                new { controller = "ProductPicker", action = "SearchProducts", page = UrlParameter.Optional, pageSize = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "ProductPicker",                             // Route name
                "ProductPicker/{id}/{mode}/{selectedItems}", // URL with parameters
                new { controller = "ProductPicker", action = "Index", selectedItems = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "ContentPicker",                    // Route name
                "ContentPicker/{id}/{startPageId}", // URL with parameters
                new { controller = "ContentPicker", action = "Index" } // Parameter defaults
                );

            //routes.MapRoute(
            //    "SiteServices", // Route name
            //    "Services/{siteId}/{cultureCode}/{controller}/{action}/{id}", // URL with parameters
            //    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            //    );

            routes.MapRoute(
                "Account",               // Route name
                "Account/{action}/{id}", // URL with parameters
                new { controller = "Account", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "SiteServices",                                      // Route name
                "{siteId}/{cultureCode}/{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "Default",                    // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
        }
Пример #25
0
        public static void RegisterRoutes(RouteCollection routes)
        {

            routes.IgnoreRoute("Content/{*pathInfo}");
            routes.IgnoreRoute("Scripts/{*pathInfo}");
            routes.IgnoreRoute("Styles/{*pathInfo}");

            routes.IgnoreRoute("{*sosa}", new { font = @"(.*/)?sosa.(/.*)?" });
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.([iI][cC][oO]|[gG][iI][fF])(/.*)?" });

            routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.map/{*pathInfo}");


            routes.MapRoute(
                "N2Diagnostics",
                "Diagnostic/{action}/{id}",
                new { controller = "Diagnostic", action = "Index", id = UrlParameter.Optional });

            routes.MapRoute(
                "RestrictedAdmin",
                "Restricted/Admin/{action}/{id}",
                new { controller = "Admin", action = "Index", id = UrlParameter.Optional });

            routes.MapRoute(
                "Sitemap1",
                "sitemap.xml",
                new { controller = "Sitemap", action = "Index" }
            );

            routes.MapRoute(
                "Sitemap2",
                "{siteId}/sitemap.xml",
                new { controller = "Sitemap", action = "Index" }
            );

            routes.MapRoute(
                "Sitemap3",
                "{siteId}/{cultureCode}/sitemap.xml",
                new { controller = "Sitemap", action = "Index" }
            );

            // n2cms content route
            routes.MapContentRoute("CMS", N2.Context.Current, true);


            // Image Picker Controller: GetFiles method
            routes.MapRoute(
                "ImagePickerUploadFiles",
                "ImagePicker/UploadFile",
                new { controller = "ImagePicker", action = "UploadFile" } // Parameter defaults
            );

            // Image Picker Controller: GetFiles method

            routes.MapRoute(
                "ImagePickerGetFiles",
                "ImagePicker/GetFiles",
                new { controller = "ImagePicker", action = "GetFiles" } // Parameter defaults
            );

            // Image Picker Controller: Search method
            routes.MapRoute(
                "ImagePickerImageSearch",
                "ImagePicker/Search",
                new { controller = "ImagePicker", action = "Search" } // Parameter defaults
            );

            // Image Picker controller: Index method
            routes.MapRoute(
                "ImagePickerIndex",
                "ImagePicker/{id}",
                new { controller = "ImagePicker", action = "Index" }
                );

            routes.MapRoute(
                "CategoryPicker", // Route name
                "CategoryPicker/{id}/{categoryId}", // URL with parameters
                new { controller = "CategoryPicker", action = "Index", categoryId = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "ProductPickerProductSearch", // Route name
                "ProductPicker/SearchProducts/{keywords}/{page}/{pageSize}", // URL with parameters
                new { controller = "ProductPicker", action = "SearchProducts", page = UrlParameter.Optional, pageSize = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "ProductPicker", // Route name
                "ProductPicker/{id}/{mode}/{selectedItems}", // URL with parameters
                new { controller = "ProductPicker", action = "Index", selectedItems = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "ContentPicker", // Route name
                "ContentPicker/{id}/{startPageId}", // URL with parameters
                new { controller = "ContentPicker", action = "Index" } // Parameter defaults
                );

            //routes.MapRoute(
            //    "SiteServices", // Route name
            //    "Services/{siteId}/{cultureCode}/{controller}/{action}/{id}", // URL with parameters
            //    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            //    );

            routes.MapRoute(
                "Account", // Route name
                "Account/{action}/{id}", // URL with parameters
                new { controller = "Account", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "SiteServices", // Route name
                "{siteId}/{cultureCode}/{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
        }
Пример #26
0
 public static void RegisterRoutes(RouteCollection routes, IEngine engine)
 {
     // The content route routes firndly urls based onthe content structure
     routes.MapContentRoute("Content", engine);
 }
Пример #27
0
 private static ContentRoute MapContentRoute <T>(this RouteCollection routes, string name, IEngine engine, string url, object defaults)
     where T : ContentItem
 {
     return(routes.MapContentRoute <T>(name, engine, url, defaults, null, null));
 }
 public virtual void RegisterArea(RouteCollection routes, ViewEngineCollection viewEngines, IEngine engine)
 {
     var route = routes.MapContentRoute<IManagementHomePart>("Management", engine);
     var viewLocationFormats = new[] { Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/{1}/{0}.ascx"), Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/Shared/{0}.ascx") };
     viewEngines.Insert(0, new PrivateViewEngineDecorator(new WebFormViewEngine { AreaViewLocationFormats = viewLocationFormats, PartialViewLocationFormats = viewLocationFormats }, route));
 }