mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Removed HomePage, further references to Routable, and IBlogPathConstraint.
--HG-- branch : autoroute
This commit is contained in:
@@ -1 +1 @@
|
||||
setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,HomePage,Navigation,Reports,Routable,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine
|
||||
setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,Navigation,Reports,Scheduling,Settings,Shapes,Title,PackagingServices,Gallery,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.MediaPicker,Orchard.Modules,Orchard.Packaging,Orchard.Pages,Orchard.Recipes,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Orchard.Specs.Bindings {
|
||||
virtualDirectory,
|
||||
TableData(
|
||||
new { extension = "Module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Lists, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup" },
|
||||
new { extension = "Core", names = "Common, Containers, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc, Title" },
|
||||
new { extension = "Core", names = "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title" },
|
||||
new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
|
||||
|
||||
webApp.WhenIGoTo("Setup");
|
||||
|
||||
@@ -4,7 +4,7 @@ Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The common module introduces content parts that are going to be used by most content types (common, body and routable).
|
||||
Description: The common module introduces content parts that are going to be used by most content types (common, body, identity).
|
||||
FeatureDescription: Core content parts.
|
||||
Dependencies: Settings
|
||||
Category: Core
|
||||
|
||||
@@ -6,5 +6,5 @@ Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The containers module introduces container and containable behaviors for content items.
|
||||
FeatureDescription: Container and containable parts to enable parent-child relationships between content items.
|
||||
Dependencies: Contents, Routable
|
||||
Dependencies: Contents
|
||||
Category: Content
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "CommonPart.CreatedUtc", T("Date Created").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "TitlePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "RoutePart.Title", T("Routable Title").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.OrderByProperty, "CustomPropertiesPart.CustomThree", T("Custom 3").Text)
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.CreatedUtc", T("Date Created").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "TitlePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Title", T("Routable Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.Record.OrderByProperty, "CustomPropertiesPart.CustomThree", T("Custom 3").Text)
|
||||
@@ -41,8 +39,6 @@
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CommonPart.CreatedUtx", T("Date Created").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CommonPart.PublishedUtc", T("Date Published").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "TitlePart.Title", T("Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Title", T("Routable Title").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "RoutePart.Slug", T("Slug").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomOne", T("Custom 1").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomTwo", T("Custom 2").Text)
|
||||
@Html.SelectOption(Model.Part.Record.FilterByProperty, "CustomPropertiesPart.CustomThree", T("Custom 3").Text)
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Services;
|
||||
using Orchard.Themes;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.HomePage.Controllers {
|
||||
[HandleError]
|
||||
public class HomeController : Controller {
|
||||
|
||||
public HomeController() {
|
||||
Logger = NullLogger.Instance;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
[Themed]
|
||||
public ActionResult Index() {
|
||||
Logger.Error(T("No home page route exists").Text);
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
Name: HomePage
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The HomePage module provides a default home page if no home route is defined.
|
||||
FeatureDescription: A fallback home page if you have none defined.
|
||||
Category: Core
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Core.HomePage {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -100,
|
||||
Route = new Route(
|
||||
"",
|
||||
new RouteValueDictionary {
|
||||
{"area", "HomePage"},
|
||||
{"controller", "Home"},
|
||||
{"action", "Index"}
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"area", "HomePage"},
|
||||
{"controller", "Home"},
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"area", "HomePage"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<h1>Home Page</h1>
|
||||
<p>You are seeing this page because you have no home page. Please log in and configure one in admin.</p>
|
||||
@@ -171,8 +171,6 @@
|
||||
<Compile Include="Feeds\Models\FeedResponse.cs" />
|
||||
<Compile Include="Feeds\Rss\RssFeedBuilder.cs" />
|
||||
<Compile Include="Feeds\Rss\RssResult.cs" />
|
||||
<Compile Include="HomePage\Controllers\HomeController.cs" />
|
||||
<Compile Include="HomePage\Routes.cs" />
|
||||
<Compile Include="Navigation\AdminMenu.cs" />
|
||||
<Compile Include="Navigation\Controllers\AdminController.cs" />
|
||||
<Compile Include="Navigation\Models\MenuItemPart.cs" />
|
||||
@@ -333,7 +331,6 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Dashboard\Module.txt" />
|
||||
<Content Include="Dashboard\Views\Admin\Index.cshtml" />
|
||||
<Content Include="HomePage\Module.txt" />
|
||||
<Content Include="Navigation\Views\Admin\Index.cshtml" />
|
||||
<Content Include="Navigation\Views\EditorTemplates\Parts.Navigation.Menu.Edit.cshtml" />
|
||||
<Content Include="Navigation\Views\Web.config" />
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Orchard.Blogs.Controllers {
|
||||
private readonly IOrchardServices _services;
|
||||
private readonly IBlogService _blogService;
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
private readonly IBlogPathConstraint _blogPathConstraint;
|
||||
private readonly IFeedManager _feedManager;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly ISiteService _siteService;
|
||||
@@ -31,7 +30,6 @@ namespace Orchard.Blogs.Controllers {
|
||||
IOrchardServices services,
|
||||
IBlogService blogService,
|
||||
IBlogPostService blogPostService,
|
||||
IBlogPathConstraint blogPathConstraint,
|
||||
IFeedManager feedManager,
|
||||
IShapeFactory shapeFactory,
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
@@ -39,7 +37,6 @@ namespace Orchard.Blogs.Controllers {
|
||||
_services = services;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
_blogPathConstraint = blogPathConstraint;
|
||||
_feedManager = feedManager;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_siteService = siteService;
|
||||
|
||||
@@ -14,6 +14,11 @@ using Orchard.UI.Admin;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Blogs.Controllers {
|
||||
|
||||
/// <summary>
|
||||
/// TODO: (PH:Autoroute) This replicates a whole lot of Core.Contents functionality. All we actually need to do is take the BlogId from the query string in the BlogPostPartDriver, and remove
|
||||
/// helper extensions from UrlHelperExtensions.
|
||||
/// </summary>
|
||||
[ValidateInput(false), Admin]
|
||||
public class BlogPostAdminController : Controller, IUpdateModel {
|
||||
private readonly IBlogService _blogService;
|
||||
|
||||
@@ -6,6 +6,9 @@ using Orchard.Mvc.Extensions;
|
||||
using Orchard.Mvc.Html;
|
||||
|
||||
namespace Orchard.Blogs.Extensions {
|
||||
/// <summary>
|
||||
/// TODO: (PH:Autoroute) Most of these
|
||||
/// </summary>
|
||||
public static class UrlHelperExtensions {
|
||||
public static string Blogs(this UrlHelper urlHelper) {
|
||||
return urlHelper.Action("List", "Blog", new {area = "Orchard.Blogs"});
|
||||
@@ -24,19 +27,19 @@ namespace Orchard.Blogs.Extensions {
|
||||
}
|
||||
|
||||
public static string BlogRsd(this UrlHelper urlHelper, BlogPart blogPart) {
|
||||
return urlHelper.AbsoluteAction(() => urlHelper.Action("Rsd", "RemoteBlogPublishing", new { blogPath = urlHelper.ItemDisplayUrl(blogPart), area = "Orchard.Blogs" }));
|
||||
return urlHelper.AbsoluteAction(() => urlHelper.Action("Rsd", "RemoteBlogPublishing", new { blogId = blogPart.ContentItem.Id, area = "Orchard.Blogs" }));
|
||||
}
|
||||
|
||||
public static string BlogArchiveYear(this UrlHelper urlHelper, BlogPart blogPart, int year) {
|
||||
return urlHelper.Action("ListByArchive", "BlogPost", new { blogPath = urlHelper.ItemDisplayUrl(blogPart), archiveData = year.ToString(), area = "Orchard.Blogs" });
|
||||
return urlHelper.Action("ListByArchive", "BlogPost", new { blogId = blogPart.ContentItem.Id, archiveData = year.ToString(), area = "Orchard.Blogs" });
|
||||
}
|
||||
|
||||
public static string BlogArchiveMonth(this UrlHelper urlHelper, BlogPart blogPart, int year, int month) {
|
||||
return urlHelper.Action("ListByArchive", "BlogPost", new { blogPath = urlHelper.ItemDisplayUrl(blogPart), archiveData = string.Format("{0}/{1}", year, month), area = "Orchard.Blogs" });
|
||||
return urlHelper.Action("ListByArchive", "BlogPost", new { blogId = blogPart.ContentItem.Id, archiveData = string.Format("{0}/{1}", year, month), area = "Orchard.Blogs" });
|
||||
}
|
||||
|
||||
public static string BlogArchiveDay(this UrlHelper urlHelper, BlogPart blogPart, int year, int month, int day) {
|
||||
return urlHelper.Action("ListByArchive", "BlogPost", new { blogPath = urlHelper.ItemDisplayUrl(blogPart), archiveData = string.Format("{0}/{1}/{2}", year, month, day), area = "Orchard.Blogs" });
|
||||
return urlHelper.Action("ListByArchive", "BlogPost", new { blogId = blogPart.ContentItem.Id, archiveData = string.Format("{0}/{1}/{2}", year, month, day), area = "Orchard.Blogs" });
|
||||
}
|
||||
|
||||
public static string BlogForAdmin(this UrlHelper urlHelper, BlogPart blogPart) {
|
||||
@@ -58,11 +61,7 @@ namespace Orchard.Blogs.Extensions {
|
||||
public static string BlogPostCreate(this UrlHelper urlHelper, BlogPart blogPart) {
|
||||
return urlHelper.Action("Create", "BlogPostAdmin", new { blogId = blogPart.Id, area = "Orchard.Blogs" });
|
||||
}
|
||||
|
||||
public static string BlogPost(this UrlHelper urlHelper, BlogPostPart blogPostPart) {
|
||||
return urlHelper.Action("Item", "BlogPost", new { blogPath = urlHelper.ItemDisplayUrl(blogPostPart.As<ICommonPart>().Container), postSlug = blogPostPart.As<IRoutableAspect>(), area = "Orchard.Blogs" });
|
||||
}
|
||||
|
||||
|
||||
public static string BlogPostEdit(this UrlHelper urlHelper, BlogPostPart blogPostPart) {
|
||||
return urlHelper.Action("Edit", "BlogPostAdmin", new { blogId = blogPostPart.BlogPart.Id, postId = blogPostPart.Id, area = "Orchard.Blogs" });
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Orchard.Blogs.Handlers {
|
||||
public class BlogPartHandler : ContentHandler {
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public BlogPartHandler(IRepository<BlogPartRecord> repository, IWorkContextAccessor workContextAccessor, IBlogPathConstraint blogPathConstraint) {
|
||||
public BlogPartHandler(IRepository<BlogPartRecord> repository, IWorkContextAccessor workContextAccessor) {
|
||||
_workContextAccessor = workContextAccessor;
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Version: 1.3.0
|
||||
OrchardVersion: 1.3.0
|
||||
Description: The Orchard Blogs module is implementing basic blogging features.
|
||||
FeatureDescription: A simple web log.
|
||||
Dependencies: Shapes, Common, Routable, Feeds, Navigation, Orchard.Widgets, Orchard.jQuery, Orchard.PublishLater
|
||||
Dependencies: Shapes, Common, Feeds, Navigation, Orchard.Widgets, Orchard.jQuery, Orchard.PublishLater
|
||||
Category: Content
|
||||
Features:
|
||||
Orchard.Blogs.RemotePublishing:
|
||||
|
||||
@@ -79,10 +79,7 @@
|
||||
<Compile Include="Handlers\BlogPartArchiveHandler.cs" />
|
||||
<Compile Include="Models\BlogPartArchiveRecord.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Routing\IBlogPathConstraint.cs" />
|
||||
<Compile Include="Routing\IsArchiveConstraint.cs" />
|
||||
<Compile Include="Routing\BlogPathConstraint.cs" />
|
||||
<Compile Include="Routing\BlogPathConstraintUpdator.cs" />
|
||||
<Compile Include="Security\BlogAuthorizationEventHandler.cs" />
|
||||
<Compile Include="Services\BlogService.cs" />
|
||||
<Compile Include="Controllers\BlogController.cs" />
|
||||
|
||||
@@ -6,10 +6,7 @@ using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Blogs {
|
||||
public class Routes : IRouteProvider {
|
||||
private readonly IBlogPathConstraint _blogPathConstraint;
|
||||
|
||||
public Routes(IBlogPathConstraint blogPathConstraint) {
|
||||
_blogPathConstraint = blogPathConstraint;
|
||||
public Routes() {
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
@@ -189,7 +186,8 @@ namespace Orchard.Blogs {
|
||||
{"area", "Orchard.Blogs"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
}/*,
|
||||
TODO: (PH:Autoroute) Needs reimplementing
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"{blogPath}/Archive/{*archiveData}",
|
||||
@@ -223,7 +221,7 @@ namespace Orchard.Blogs {
|
||||
{"area", "Orchard.Blogs"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
}*/
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Blogs.Routing {
|
||||
[UsedImplicitly]
|
||||
public class BlogPathConstraint : IBlogPathConstraint {
|
||||
/// <summary>
|
||||
/// Singleton object, per Orchard Shell instance. We need to protect concurrent access to the dictionary.
|
||||
/// </summary>
|
||||
private readonly object _syncLock = new object();
|
||||
private IDictionary<string, string> _paths = new Dictionary<string, string>();
|
||||
|
||||
public BlogPathConstraint() {
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public void SetPaths(IEnumerable<string> paths) {
|
||||
// Make a copy to avoid performing potential lazy computation inside the lock
|
||||
var pathArray = paths.ToArray();
|
||||
|
||||
lock (_syncLock) {
|
||||
_paths = pathArray.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(value => value, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
Logger.Debug("Blog paths: {0}", string.Join(", ", pathArray));
|
||||
}
|
||||
|
||||
public string FindPath(string path) {
|
||||
lock (_syncLock) {
|
||||
string actual;
|
||||
// path can be null for homepage
|
||||
path = path ?? "";
|
||||
|
||||
return _paths.TryGetValue(path, out actual) ? actual : path;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPath(string path) {
|
||||
lock (_syncLock) {
|
||||
// path can be null for homepage
|
||||
path = path ?? "";
|
||||
|
||||
_paths[path] = path;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemovePath(string path) {
|
||||
lock (_syncLock) {
|
||||
// path can be null for homepage
|
||||
path = path ?? "";
|
||||
|
||||
_paths.Remove(path);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
|
||||
if (routeDirection == RouteDirection.UrlGeneration)
|
||||
return true;
|
||||
|
||||
object value;
|
||||
if (values.TryGetValue(parameterName, out value)) {
|
||||
var parameterValue = Convert.ToString(value);
|
||||
|
||||
lock (_syncLock) {
|
||||
return _paths.ContainsKey(parameterValue);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Tasks;
|
||||
|
||||
namespace Orchard.Blogs.Routing {
|
||||
[UsedImplicitly]
|
||||
public class BlogPathConstraintUpdator : IOrchardShellEvents, IBackgroundTask {
|
||||
private readonly IBlogPathConstraint _blogPathConstraint;
|
||||
private readonly IBlogService _blogService;
|
||||
|
||||
public BlogPathConstraintUpdator(IBlogPathConstraint blogPathConstraint, IBlogService blogService) {
|
||||
_blogPathConstraint = blogPathConstraint;
|
||||
_blogService = blogService;
|
||||
}
|
||||
|
||||
void IOrchardShellEvents.Activated() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void IOrchardShellEvents.Terminating() {
|
||||
}
|
||||
|
||||
void IBackgroundTask.Sweep() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void Refresh() {
|
||||
_blogPathConstraint.SetPaths(_blogService.Get().Select(b => b.As<IRoutableAspect>().Slug));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace Orchard.Blogs.Routing {
|
||||
public interface IBlogPathConstraint : IRouteConstraint, ISingletonDependency {
|
||||
void SetPaths(IEnumerable<string> paths);
|
||||
string FindPath(string path);
|
||||
void AddPath(string path);
|
||||
void RemovePath(string path);
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,9 @@ namespace Orchard.Blogs.Services {
|
||||
[UsedImplicitly]
|
||||
public class BlogService : IBlogService {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IBlogPathConstraint _blogPathConstraint;
|
||||
|
||||
public BlogService(IContentManager contentManager, IBlogPathConstraint blogPathConstraint) {
|
||||
public BlogService(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
_blogPathConstraint = blogPathConstraint;
|
||||
}
|
||||
public BlogPart Get(int id) {
|
||||
return _contentManager.Get<BlogPart>(id);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
-->
|
||||
<Match ContentType="List" DisplayType="Detail">
|
||||
<!-- don't show the List title or Common Metadata -->
|
||||
<Place Parts_RoutableTitle="-" />
|
||||
<Place Parts_Title="-" />
|
||||
<Place Parts_Common_Metadata="-" />
|
||||
</Match>
|
||||
<Match DisplayType="SummaryAdmin">
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Orchard.Setup.Services {
|
||||
// Framework
|
||||
"Orchard.Framework",
|
||||
// Core
|
||||
"Common", "Containers", "Contents", "Dashboard", "Feeds", "HomePage", "Navigation", "Reports", "Routable", "Scheduling", "Settings", "Shapes", "Title",
|
||||
"Common", "Containers", "Contents", "Dashboard", "Feeds", "Navigation", "Reports", "Scheduling", "Settings", "Shapes", "Title",
|
||||
// Modules
|
||||
"Orchard.Pages", "Orchard.Themes", "Orchard.Users", "Orchard.Roles", "Orchard.Modules",
|
||||
"PackagingServices", "Orchard.Packaging", "Gallery", "Orchard.Recipes",
|
||||
|
||||
@@ -12,7 +12,7 @@ Features:
|
||||
Orchard.Widgets.PageLayerHinting:
|
||||
Name: Page Layer Hinting
|
||||
Description: Adds a notification after creating a new Page with a direct link to create a Widget Layer for that specific page by URL.
|
||||
Dependencies: Orchard.Widgets, Routable
|
||||
Dependencies: Orchard.Widgets
|
||||
Category: Widget
|
||||
Orchard.Widgets.ControlWrapper:
|
||||
Name: Widget Control Wrapper
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Orchard.Environment {
|
||||
"~/Modules/Orchard.Setup/Views",
|
||||
"~/Themes/SafeMode/Views",
|
||||
|
||||
// Homepage
|
||||
"~/Core/Routable/Views",
|
||||
// Common
|
||||
"~/Core/Contents/Views",
|
||||
"~/Core/Common/Views",
|
||||
"~/Core/Settings/Views",
|
||||
|
||||
Reference in New Issue
Block a user