mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 02:44:52 +08:00

Work Item: 17261 --HG-- branch : dev extra : transplant_source : Y%BC%1F%0E%A2%C5%10%BE%3B%82P%21%FC%FA%ED%FE%A7%26%9B%92
265 lines
21 KiB
C#
265 lines
21 KiB
C#
using System.Collections.Generic;
|
|
using System.Web.Mvc;
|
|
using System.Web.Routing;
|
|
using Orchard.Blogs.Routing;
|
|
using Orchard.Mvc.Routes;
|
|
|
|
namespace Orchard.Blogs {
|
|
public class Routes : IRouteProvider {
|
|
private readonly IBlogPathConstraint _blogPathConstraint;
|
|
|
|
public Routes(IBlogPathConstraint blogPathConstraint) {
|
|
_blogPathConstraint = blogPathConstraint;
|
|
}
|
|
|
|
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
|
foreach (var routeDescriptor in GetRoutes())
|
|
routes.Add(routeDescriptor);
|
|
}
|
|
|
|
public IEnumerable<RouteDescriptor> GetRoutes() {
|
|
return new[] {
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/Create",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogAdmin"},
|
|
{"action", "Create"}
|
|
},
|
|
new RouteValueDictionary(),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Edit",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogAdmin"},
|
|
{"action", "Edit"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Remove",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogAdmin"},
|
|
{"action", "Remove"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogAdmin"},
|
|
{"action", "Item"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Posts/Create",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPostAdmin"},
|
|
{"action", "Create"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Posts/{postId}/Edit",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPostAdmin"},
|
|
{"action", "Edit"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Posts/{postId}/Delete",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPostAdmin"},
|
|
{"action", "Delete"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Posts/{postId}/Publish",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPostAdmin"},
|
|
{"action", "Publish"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs/{blogId}/Posts/{postId}/Unpublish",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPostAdmin"},
|
|
{"action", "Unpublish"}
|
|
},
|
|
new RouteValueDictionary (),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Admin/Blogs",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogAdmin"},
|
|
{"action", "List"}
|
|
},
|
|
new RouteValueDictionary(),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Blogs",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "Blog"},
|
|
{"action", "List"}
|
|
},
|
|
new RouteValueDictionary(),
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"Archive/{*archiveData}",
|
|
new RouteValueDictionary {
|
|
{"blogPath", ""},
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPost"},
|
|
{"action", "ListByArchive"}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"archiveData", new IsArchiveConstraint()}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Route = new Route(
|
|
"{blogPath}/Archive/{*archiveData}",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPost"},
|
|
{"action", "ListByArchive"}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"blogPath", _blogPathConstraint},
|
|
{"archiveData", new IsArchiveConstraint()}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Priority = 11,
|
|
Route = new Route(
|
|
"{blogPath}/rsd",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "RemoteBlogPublishing"},
|
|
{"action", "Rsd"}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"blogPath", _blogPathConstraint}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Priority = 11,
|
|
Route = new Route(
|
|
"{blogPath}/{postSlug}",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "BlogPost"},
|
|
{"action", "Item"}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"blogPath", _blogPathConstraint}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
},
|
|
new RouteDescriptor {
|
|
Priority = 11,
|
|
Route = new Route(
|
|
"{blogPath}",
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"},
|
|
{"controller", "Blog"},
|
|
{"action", "Item"},
|
|
{"blogPath", ""}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"blogPath", _blogPathConstraint}
|
|
},
|
|
new RouteValueDictionary {
|
|
{"area", "Orchard.Blogs"}
|
|
},
|
|
new MvcRouteHandler())
|
|
}
|
|
};
|
|
}
|
|
}
|
|
} |