diff --git a/src/Orchard.Web/Packages/Orchard.Blogs/Models/BlogPostHandler.cs b/src/Orchard.Web/Packages/Orchard.Blogs/Models/BlogPostHandler.cs index abd6d1783..f18475689 100644 --- a/src/Orchard.Web/Packages/Orchard.Blogs/Models/BlogPostHandler.cs +++ b/src/Orchard.Web/Packages/Orchard.Blogs/Models/BlogPostHandler.cs @@ -1,7 +1,5 @@ using System; using System.Linq; -using System.Text.RegularExpressions; -using JetBrains.Annotations; using Orchard.Blogs.Controllers; using Orchard.Blogs.Services; using Orchard.ContentManagement; @@ -9,18 +7,16 @@ using Orchard.Core.Common.Models; using Orchard.ContentManagement.Handlers; using Orchard.Core.Common.Records; using Orchard.Core.Common.Services; -using Orchard.Data; using Orchard.Localization; using Orchard.UI.Notify; namespace Orchard.Blogs.Models { - [UsedImplicitly] public class BlogPostHandler : ContentHandler { private readonly IBlogPostService _blogPostService; private readonly IRoutableService _routableService; private readonly IOrchardServices _orchardServices; - public BlogPostHandler(IRepository commonRepository, IBlogPostService blogPostService, IRoutableService routableService, IOrchardServices orchardServices) { + public BlogPostHandler(IBlogPostService blogPostService, IRoutableService routableService, IOrchardServices orchardServices) { _blogPostService = blogPostService; _routableService = routableService; _orchardServices = orchardServices; @@ -31,7 +27,6 @@ namespace Orchard.Blogs.Models { Filters.Add(new ActivatingFilter>(BlogPostDriver.ContentType.Name)); Filters.Add(new ActivatingFilter(BlogPostDriver.ContentType.Name)); Filters.Add(new ActivatingFilter(BlogPostDriver.ContentType.Name)); - Filters.Add(StorageFilter.For(commonRepository)); Action updateBlogPostCount = (blog => { diff --git a/src/Orchard.Web/Packages/Orchard.Pages/Controllers/AdminController.cs b/src/Orchard.Web/Packages/Orchard.Pages/Controllers/AdminController.cs index 2130d37b0..551084222 100644 --- a/src/Orchard.Web/Packages/Orchard.Pages/Controllers/AdminController.cs +++ b/src/Orchard.Web/Packages/Orchard.Pages/Controllers/AdminController.cs @@ -132,7 +132,9 @@ namespace Orchard.Pages.Controllers { } } - model.Page = Services.ContentManager.UpdateEditorModel(Services.ContentManager.New("page"), this); + var page = Services.ContentManager.New("page"); + model.Page = Services.ContentManager.UpdateEditorModel(page, this); + if (!publishNow && publishDate != null) model.Page.Item.Published = publishDate.Value; diff --git a/src/Orchard.Web/Packages/Orchard.Pages/Models/PageHandler.cs b/src/Orchard.Web/Packages/Orchard.Pages/Models/PageHandler.cs index cbd8d0e4e..4999dab84 100644 --- a/src/Orchard.Web/Packages/Orchard.Pages/Models/PageHandler.cs +++ b/src/Orchard.Web/Packages/Orchard.Pages/Models/PageHandler.cs @@ -1,25 +1,22 @@ using System; using System.Linq; -using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.Core.Common.Records; using Orchard.Core.Common.Services; using Orchard.Localization; using Orchard.Pages.Controllers; using Orchard.Core.Common.Models; -using Orchard.Data; using Orchard.ContentManagement.Handlers; using Orchard.Pages.Services; using Orchard.UI.Notify; namespace Orchard.Pages.Models { - [UsedImplicitly] public class PageHandler : ContentHandler { private readonly IPageService _pageService; private readonly IRoutableService _routableService; private readonly IOrchardServices _orchardServices; - public PageHandler(IRepository commonRepository, IPageService pageService, IRoutableService routableService, IOrchardServices orchardServices) { + public PageHandler(IPageService pageService, IRoutableService routableService, IOrchardServices orchardServices) { _pageService = pageService; _routableService = routableService; _orchardServices = orchardServices; @@ -30,7 +27,6 @@ namespace Orchard.Pages.Models { Filters.Add(new ActivatingFilter>(PageDriver.ContentType.Name)); Filters.Add(new ActivatingFilter(PageDriver.ContentType.Name)); Filters.Add(new ActivatingFilter(PageDriver.ContentType.Name)); - Filters.Add(StorageFilter.For(commonRepository)); OnPublished((context, p) => ProcessSlug(p)); } diff --git a/src/Orchard/ContentManagement/Handlers/StorageFilter.cs b/src/Orchard/ContentManagement/Handlers/StorageFilter.cs index 65f7ab70b..2abdc5efe 100644 --- a/src/Orchard/ContentManagement/Handlers/StorageFilter.cs +++ b/src/Orchard/ContentManagement/Handlers/StorageFilter.cs @@ -19,7 +19,7 @@ namespace Orchard.ContentManagement.Handlers { public StorageFilter(IRepository repository) { if (this.GetType() == typeof(StorageFilter) && typeof(TRecord).IsSubclassOf(typeof(ContentPartVersionRecord))) { throw new ArgumentException( - string.Format("Use {0} (or {1}.For()) for versionable record types", typeof (StorageVersionFilter<>).Name, typeof(StorageFilter).Name), + string.Format("Use {0} (or {1}.For()) for versionable record types", typeof(StorageVersionFilter<>).Name, typeof(StorageFilter).Name), "repository"); } @@ -27,6 +27,11 @@ namespace Orchard.ContentManagement.Handlers { } protected override void Activated(ActivatedContentContext context, ContentPart instance) { + if (instance.Record != null) { + throw new InvalidOperationException(string.Format( + "Having more than one storage filter for a given part ({0}) is invalid.", + typeof(ContentPart).FullName)); + } instance.Record = new TRecord(); }