diff --git a/.hgsubstate b/.hgsubstate index 7de3b3557..d89bfdaab 100644 --- a/.hgsubstate +++ b/.hgsubstate @@ -1,5 +1,5 @@ 81cb672c85fd980dd3db0515544b79a918e5eb69 src/Orchard.Web/Modules/Orchard.Alias -f142e9e8cebf92caf3ca091d6e54849e02a27a4c src/Orchard.Web/Modules/Orchard.Autoroute +38ee40302540edd0f4671b8110788b295573c345 src/Orchard.Web/Modules/Orchard.Autoroute c54cb640d6bc14c51b9fb9bd78231bb0facec067 src/Orchard.Web/Modules/Orchard.Forms c27801666ed3e8f9b9c7979a837e7d770763352a src/Orchard.Web/Modules/Orchard.Projections a1ef39ba4e2d0cd78b3c91d6150e841793acb34b src/Orchard.Web/Modules/Orchard.Routable diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Extensions/UrlHelperExtensions.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Extensions/UrlHelperExtensions.cs index 35874e6f1..420c4e1f5 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Extensions/UrlHelperExtensions.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Extensions/UrlHelperExtensions.cs @@ -1,5 +1,4 @@ using System.Web.Mvc; -using Orchard.Autoroute.Models; using Orchard.Blogs.Models; using Orchard.ContentManagement; using Orchard.ContentManagement.Aspects; @@ -27,19 +26,19 @@ namespace Orchard.Blogs.Extensions { } public static string BlogRsd(this UrlHelper urlHelper, BlogPart blogPart) { - return urlHelper.AbsoluteAction(() => urlHelper.Action("Rsd", "RemoteBlogPublishing", new { blogPath = blogPart.As().Path, area = "Orchard.Blogs" })); + return urlHelper.AbsoluteAction(() => urlHelper.Action("Rsd", "RemoteBlogPublishing", new { path = blogPart.As().Path + "/rsd", area = "Orchard.Blogs" })); } public static string BlogArchiveYear(this UrlHelper urlHelper, BlogPart blogPart, int year) { - return urlHelper.Action("ListByArchive", "BlogPost", new { blogPath = blogPart.As().DisplayAlias, archiveData = year.ToString(), area = "Orchard.Blogs" }); + return urlHelper.Action("ListByArchive", "BlogPost", new { path = blogPart.As().Path + "/archive/" + 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 = blogPart.As().DisplayAlias, archiveData = string.Format("{0}/{1}", year, month), area = "Orchard.Blogs" }); + return urlHelper.Action("ListByArchive", "BlogPost", new { path = blogPart.As().Path + "/archive/" + 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 = blogPart.As().DisplayAlias, archiveData = string.Format("{0}/{1}/{2}", year, month, day), area = "Orchard.Blogs" }); + return urlHelper.Action("ListByArchive", "BlogPost", new { path = blogPart.As().Path + "/archive/" + string.Format("{0}/{1}/{2}", year, month, day), area = "Orchard.Blogs" }); } public static string BlogForAdmin(this UrlHelper urlHelper, BlogPart blogPart) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartHandler.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartHandler.cs index 0a7583a50..1f19d71cb 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartHandler.cs @@ -1,9 +1,9 @@ using System.Web.Routing; using JetBrains.Annotations; -using Orchard.Autoroute.Models; using Orchard.Blogs.Models; using Orchard.Blogs.Routing; using Orchard.ContentManagement; +using Orchard.ContentManagement.Aspects; using Orchard.ContentManagement.Handlers; using Orchard.Data; @@ -21,8 +21,8 @@ namespace Orchard.Blogs.Handlers { context.Shape.PostCount = blog.PostCount; }); - OnPublished((context, blog) => _blogPathConstraint.AddPath(blog.As().DisplayAlias)); - OnUnpublished((context, blog) => _blogPathConstraint.RemovePath(blog.As().DisplayAlias)); + OnPublished((context, blog) => _blogPathConstraint.AddPath(blog.As().Path)); + OnUnpublished((context, blog) => _blogPathConstraint.RemovePath(blog.As().Path)); } protected override void GetItemMetadata(GetContentItemMetadataContext context) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt b/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt index 065f6d3e3..d85273145 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Module.txt @@ -12,5 +12,5 @@ Features: Orchard.Blogs.RemotePublishing: Name: Remote Blog Publishing Description: Blog easier using a dedicated MetaWeblogAPI-compatible publishing tool. - Dependencies: XmlRpc, Orchard.Blogs + Dependencies: XmlRpc, Orchard.Blogs, Orchard.Autoroute Category: Content Publishing diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index a17572f82..3a30b14fa 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -140,14 +140,6 @@ {9916839C-39FC-4CEB-A5AF-89CA7E87119F} Orchard.Core - - {475B6C45-B27C-438B-8966-908B9D6D1077} - Orchard.Alias - - - {66FCCD76-2761-47E3-8D11-B45D0001DDAA} - Orchard.Autoroute - diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraint.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraint.cs index 9a99df298..6fb86ae45 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraint.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraint.cs @@ -10,7 +10,7 @@ using Orchard.Logging; namespace Orchard.Blogs.Routing { [UsedImplicitly] public class BlogPathConstraint : IBlogPathConstraint { - private ConcurrentDictionary _paths = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); + private readonly ConcurrentDictionary _paths = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); public BlogPathConstraint() { Logger = NullLogger.Instance; diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraintUpdator.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraintUpdator.cs index 3f7f51bf1..5a35dac9c 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraintUpdator.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Routing/BlogPathConstraintUpdator.cs @@ -1,8 +1,8 @@ using System.Linq; using JetBrains.Annotations; -using Orchard.Autoroute.Models; using Orchard.Blogs.Services; using Orchard.ContentManagement; +using Orchard.ContentManagement.Aspects; using Orchard.Environment; using Orchard.Tasks; @@ -29,7 +29,7 @@ namespace Orchard.Blogs.Routing { } private void Refresh() { - _blogPathConstraint.SetPaths(_blogService.Get().Select(b => b.As().DisplayAlias).ToList()); + _blogPathConstraint.SetPaths(_blogService.Get().Select(b => b.As().Path).ToList()); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs index 8e2254c7b..c7f8f0e5a 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; -using Orchard.Autoroute.Models; using Orchard.Blogs.Models; using Orchard.Blogs.Routing; using Orchard.ContentManagement; @@ -20,9 +19,7 @@ namespace Orchard.Blogs.Services { } public BlogPart Get(string path) { - return _contentManager.Query() - .Join().Where(rr => rr.DisplayAlias == path) - .Slice(0, 1).FirstOrDefault(); + return _contentManager.Query().List().FirstOrDefault(rr => rr.As().Path == path); } public ContentItem Get(int id, VersionOptions versionOptions) { @@ -42,7 +39,7 @@ namespace Orchard.Blogs.Services { public void Delete(ContentItem blog) { _contentManager.Remove(blog); - _blogPathConstraint.RemovePath(blog.As().DisplayAlias); + _blogPathConstraint.RemovePath(blog.As().Path); } } } \ No newline at end of file diff --git a/src/Orchard/ContentManagement/Aspects/IAliasAspect.cs b/src/Orchard/ContentManagement/Aspects/IAliasAspect.cs new file mode 100644 index 000000000..3afd26833 --- /dev/null +++ b/src/Orchard/ContentManagement/Aspects/IAliasAspect.cs @@ -0,0 +1,5 @@ +namespace Orchard.ContentManagement.Aspects { + public interface IAliasAspect : IContent { + string Path { get; } + } +} diff --git a/src/Orchard/ContentManagement/Aspects/IRoutableAspect.cs b/src/Orchard/ContentManagement/Aspects/IRoutableAspect.cs index dad8b1633..396968243 100644 --- a/src/Orchard/ContentManagement/Aspects/IRoutableAspect.cs +++ b/src/Orchard/ContentManagement/Aspects/IRoutableAspect.cs @@ -1,6 +1,5 @@ namespace Orchard.ContentManagement.Aspects { - public interface IRoutableAspect : ITitleAspect { + public interface IRoutableAspect : ITitleAspect, IAliasAspect { string Slug { get; set; } - string Path { get; set; } } } diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index a65c59116..2a2fc4998 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -159,6 +159,7 @@ +