From 746a2d2169a8db55c2670406b38e4b2f8356c584 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 14 Jul 2010 10:24:40 -0700 Subject: [PATCH 1/7] Fix unit tests --HG-- branch : dev --- .../Settings/Metadata/ContentDefinitionManagerTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Core.Tests/Settings/Metadata/ContentDefinitionManagerTests.cs b/src/Orchard.Core.Tests/Settings/Metadata/ContentDefinitionManagerTests.cs index 440c38864..29a9ea3d7 100644 --- a/src/Orchard.Core.Tests/Settings/Metadata/ContentDefinitionManagerTests.cs +++ b/src/Orchard.Core.Tests/Settings/Metadata/ContentDefinitionManagerTests.cs @@ -45,8 +45,8 @@ namespace Orchard.Core.Tests.Settings.Metadata { builder.RegisterType().As(); builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>)); builder.RegisterType(typeof(SettingsFormatter)) - .As(typeof(IMapper>)) - .As(typeof(IMapper, XElement>)); + .As(typeof(IMapper)) + .As(typeof(IMapper)); _container = builder.Build(); _container.Mock() From 511327f68ee51c86f4730358e0df568b79f382e2 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 14 Jul 2010 10:29:43 -0700 Subject: [PATCH 2/7] Fix unit tests --HG-- branch : dev --- .../Common/Providers/CommonAspectProviderTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs b/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs index 88f774c5f..a6d0e3705 100644 --- a/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs +++ b/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs @@ -13,8 +13,11 @@ using Orchard.Core.Common.Models; using Orchard.ContentManagement; using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.Records; +using Orchard.Core.Common.Services; +using Orchard.Core.Scheduling.Services; using Orchard.Localization; using Orchard.Security; +using Orchard.Tasks.Scheduling; using Orchard.Tests.Modules; using Orchard.Core.Common.ViewModels; using System.Web.Mvc; @@ -32,6 +35,9 @@ namespace Orchard.Core.Tests.Common.Providers { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); + builder.RegisterType().As(); + builder.RegisterType().As(); _authn = new Mock(); _authz = new Mock(); From 1a58dee719f5ec6e61dbd8b2d39f5120a755d471 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 14 Jul 2010 12:33:00 -0700 Subject: [PATCH 3/7] Fix Unit Tests --HG-- branch : dev --- .../Common/Providers/CommonAspectProviderTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs b/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs index a6d0e3705..057b4ae90 100644 --- a/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs +++ b/src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs @@ -14,6 +14,7 @@ using Orchard.ContentManagement; using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.Records; using Orchard.Core.Common.Services; +using Orchard.Core.Scheduling.Models; using Orchard.Core.Scheduling.Services; using Orchard.Localization; using Orchard.Security; @@ -58,6 +59,7 @@ namespace Orchard.Core.Tests.Common.Providers { typeof(ContentItemVersionRecord), typeof(CommonRecord), typeof(CommonVersionRecord), + typeof(ScheduledTaskRecord), }; } } From 379fca0a4374b779952bc9d3353985d76c82b5f0 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 14 Jul 2010 12:43:14 -0700 Subject: [PATCH 4/7] Fix Unit Tests --HG-- branch : dev --- .../Common/Services/RoutableServiceTests.cs | 2 ++ src/Orchard.Web/Core/Routable/Handlers/RoutableHandler.cs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Core.Tests/Common/Services/RoutableServiceTests.cs b/src/Orchard.Core.Tests/Common/Services/RoutableServiceTests.cs index c33b53dda..8e1676a86 100644 --- a/src/Orchard.Core.Tests/Common/Services/RoutableServiceTests.cs +++ b/src/Orchard.Core.Tests/Common/Services/RoutableServiceTests.cs @@ -10,6 +10,7 @@ using Orchard.ContentManagement.Handlers; using Orchard.ContentManagement.MetaData; using Orchard.ContentManagement.Records; using Orchard.Core.Common.Models; +using Orchard.Core.Routable; using Orchard.Core.Routable.Handlers; using Orchard.Core.Routable.Models; using Orchard.Core.Routable.Services; @@ -35,6 +36,7 @@ namespace Orchard.Core.Tests.Common.Services { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterInstance(new UrlHelper(new RequestContext(new StubHttpContext("~/"), new RouteData()))).As(); diff --git a/src/Orchard.Web/Core/Routable/Handlers/RoutableHandler.cs b/src/Orchard.Web/Core/Routable/Handlers/RoutableHandler.cs index 3c475aa04..7ea971dd4 100644 --- a/src/Orchard.Web/Core/Routable/Handlers/RoutableHandler.cs +++ b/src/Orchard.Web/Core/Routable/Handlers/RoutableHandler.cs @@ -12,7 +12,10 @@ namespace Orchard.Core.Routable.Handlers { _routablePathConstraint = routablePathConstraint; Filters.Add(StorageFilter.For(repository)); - OnPublished((context, routable) => _routablePathConstraint.AddPath(routable.Path)); + OnPublished((context, routable) => { + if (!string.IsNullOrEmpty(routable.Path)) + _routablePathConstraint.AddPath(routable.Path); + }); } } public class IsRoutableHandler : ContentHandlerBase { From f65fd9d7e8b8b67ca4c35b74c734eb5727126775 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 14 Jul 2010 13:02:17 -0700 Subject: [PATCH 5/7] Fix Unit Tests --HG-- branch : dev --- .../Users/Controllers/AdminControllerTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Orchard.Tests.Modules/Users/Controllers/AdminControllerTests.cs b/src/Orchard.Tests.Modules/Users/Controllers/AdminControllerTests.cs index 990ca9d89..19e6d65a5 100644 --- a/src/Orchard.Tests.Modules/Users/Controllers/AdminControllerTests.cs +++ b/src/Orchard.Tests.Modules/Users/Controllers/AdminControllerTests.cs @@ -3,9 +3,14 @@ using System.Collections.Generic; using System.Web; using System.Web.Mvc; using System.Web.Routing; +using System.Xml.Linq; using Autofac; using Moq; using NUnit.Framework; +using Orchard.ContentManagement.MetaData; +using Orchard.ContentManagement.MetaData.Models; +using Orchard.ContentManagement.MetaData.Services; +using Orchard.Core.Settings.Metadata; using Orchard.Data; using Orchard.Environment; using Orchard.ContentManagement; @@ -30,6 +35,10 @@ namespace Orchard.Tests.Modules.Users.Controllers { public override void Register(ContainerBuilder builder) { builder.RegisterType().SingleInstance(); builder.RegisterType().As(); + builder.RegisterType(typeof(SettingsFormatter)) + .As(typeof(IMapper)) + .As(typeof(IMapper)); + builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As().InstancePerDependency(); builder.RegisterType().As(); From ba9743d0e60bba688e0fb5af82f3ac7cd769c87b Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Wed, 14 Jul 2010 14:33:31 -0700 Subject: [PATCH 6/7] Fix Unit Tests --HG-- branch : dev --- .../Users/Services/MembershipServiceTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Orchard.Tests.Modules/Users/Services/MembershipServiceTests.cs b/src/Orchard.Tests.Modules/Users/Services/MembershipServiceTests.cs index ea7ee2f3d..6573949e2 100644 --- a/src/Orchard.Tests.Modules/Users/Services/MembershipServiceTests.cs +++ b/src/Orchard.Tests.Modules/Users/Services/MembershipServiceTests.cs @@ -1,8 +1,13 @@ using System; using System.Web.Security; +using System.Xml.Linq; using Autofac; using NHibernate; using NUnit.Framework; +using Orchard.ContentManagement.MetaData; +using Orchard.ContentManagement.MetaData.Models; +using Orchard.ContentManagement.MetaData.Services; +using Orchard.Core.Settings.Metadata; using Orchard.Data; using Orchard.ContentManagement; using Orchard.ContentManagement.Handlers; @@ -55,6 +60,10 @@ namespace Orchard.Tests.Modules.Users.Services { //builder.RegisterModule(new ImplicitCollectionSupportModule()); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType(typeof(SettingsFormatter)) + .As(typeof(IMapper)) + .As(typeof(IMapper)); + builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>)); From 881b71db4b7629cad31cdd4ddad657f8d8e7884f Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Wed, 14 Jul 2010 15:31:43 -0700 Subject: [PATCH 7/7] Moved the content item publishing option functionality (save draft, publish and schedule) out into it's own Orchard.Core module (PublishLater) --HG-- branch : dev --- .../DataMigrations/CommonDataMigration.cs | 1 - .../Core/Common/Drivers/CommonDriver.cs | 42 +---------- .../Common/Handlers/CommonAspectHandler.cs | 14 +--- .../Core/Common/Models/CommonAspect.cs | 3 - src/Orchard.Web/Core/Common/Routes.cs | 37 --------- .../Core/Common/Services/CommonService.cs | 18 +---- .../Core/Common/Services/ICommonService.cs | 7 +- .../ViewModels/CommonMetadataViewModel.cs | 2 - .../Common.ItemReferenceContentField.ascx | 3 - .../Parts/Common.Metadata.SummaryAdmin.ascx | 27 +------ .../Parts/Common.Publish.ascx | 2 +- .../Common.ItemReferenceContentField.ascx | 3 - .../Contents/Controllers/AdminController.cs | 8 +- .../Items/Contents.Item.SummaryAdmin.ascx | 4 +- src/Orchard.Web/Core/Orchard.Core.csproj | 60 +++++++++------ .../Drivers/PublishLaterPartDriver.cs | 71 ++++++++++++++++++ .../Handlers/PublishLaterPartHandler.cs | 16 ++++ .../PublishLater/Models/PublishLaterPart.cs | 11 +++ src/Orchard.Web/Core/PublishLater/Module.txt | 12 +++ .../Scripts/jquery.ui.core.js | 0 .../Scripts/jquery.ui.datepicker.js | 0 .../Scripts/jquery.ui.widget.js | 0 .../Scripts/jquery.utils.js | 0 .../Scripts/ui.timepickr.js | 0 .../Services/IPublishLaterService.cs | 10 +++ .../Services/PublishLaterService.cs | 23 ++++++ .../Styles/datetime.css | 4 +- .../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin .../images/ui-bg_flat_75_ffffff_40x100.png | Bin .../images/ui-bg_glass_55_fbf9ee_1x400.png | Bin .../images/ui-bg_glass_65_ffffff_1x400.png | Bin .../images/ui-bg_glass_75_dadada_1x400.png | Bin .../images/ui-bg_glass_75_e6e6e6_1x400.png | Bin .../images/ui-bg_glass_95_fef1ec_1x400.png | Bin .../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin .../Styles/images/ui-icons_222222_256x240.png | Bin .../Styles/images/ui-icons_2e83ff_256x240.png | Bin .../Styles/images/ui-icons_454545_256x240.png | Bin .../Styles/images/ui-icons_888888_256x240.png | Bin .../Styles/images/ui-icons_cd0a0a_256x240.png | Bin .../Styles/jquery-ui-1.7.2.custom.css | 0 .../Styles/ui.datepicker.css | 0 .../Styles/ui.timepickr.css | 0 .../ItemReferenceContentFieldDisplayModel.cs | 0 ...temReferenceContentFieldEditorViewModel.cs | 0 .../ViewModels/PublishLaterViewModel.cs} | 15 ++-- .../PublishLater.Metadata.SummaryAdmin.ascx | 31 ++++++++ .../Parts/PublishLater.Metadata.ascx | 1 + .../Parts/PublishLater.SummaryAdmin.ascx | 12 +++ .../DisplayTemplates/Parts/PublishLater.ascx | 1 + .../EditorTemplates/Parts/PublishLater.ascx} | 2 +- .../Core/PublishLater/Views/Web.config | 34 +++++++++ src/Orchard.Web/Core/Routable/Routes.cs | 50 +++++++----- .../Orchard.Blogs/Handlers/BlogPostHandler.cs | 2 + .../Orchard.Setup/Services/SetupService.cs | 1 + .../Themes/TheAdmin/Styles/site.css | 3 + .../Aspects/IPublishingControlAspect.cs | 8 ++ src/Orchard/Orchard.Framework.csproj | 1 + 58 files changed, 334 insertions(+), 205 deletions(-) delete mode 100644 src/Orchard.Web/Core/Common/Routes.cs delete mode 100644 src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.ItemReferenceContentField.ascx delete mode 100644 src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.ItemReferenceContentField.ascx create mode 100644 src/Orchard.Web/Core/PublishLater/Drivers/PublishLaterPartDriver.cs create mode 100644 src/Orchard.Web/Core/PublishLater/Handlers/PublishLaterPartHandler.cs create mode 100644 src/Orchard.Web/Core/PublishLater/Models/PublishLaterPart.cs create mode 100644 src/Orchard.Web/Core/PublishLater/Module.txt rename src/Orchard.Web/Core/{Common => PublishLater}/Scripts/jquery.ui.core.js (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Scripts/jquery.ui.datepicker.js (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Scripts/jquery.ui.widget.js (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Scripts/jquery.utils.js (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Scripts/ui.timepickr.js (100%) create mode 100644 src/Orchard.Web/Core/PublishLater/Services/IPublishLaterService.cs create mode 100644 src/Orchard.Web/Core/PublishLater/Services/PublishLaterService.cs rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/datetime.css (65%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_flat_0_aaaaaa_40x100.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_flat_75_ffffff_40x100.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_glass_55_fbf9ee_1x400.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_glass_65_ffffff_1x400.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_glass_75_dadada_1x400.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_glass_75_e6e6e6_1x400.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_glass_95_fef1ec_1x400.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-bg_highlight-soft_75_cccccc_1x100.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-icons_222222_256x240.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-icons_2e83ff_256x240.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-icons_454545_256x240.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-icons_888888_256x240.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/images/ui-icons_cd0a0a_256x240.png (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/jquery-ui-1.7.2.custom.css (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/ui.datepicker.css (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/Styles/ui.timepickr.css (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/ViewModels/ItemReferenceContentFieldDisplayModel.cs (100%) rename src/Orchard.Web/Core/{Common => PublishLater}/ViewModels/ItemReferenceContentFieldEditorViewModel.cs (100%) rename src/Orchard.Web/Core/{Common/ViewModels/PublishEditorViewModel.cs => PublishLater/ViewModels/PublishLaterViewModel.cs} (75%) create mode 100644 src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.Metadata.SummaryAdmin.ascx create mode 100644 src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.Metadata.ascx create mode 100644 src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.SummaryAdmin.ascx create mode 100644 src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.ascx rename src/Orchard.Web/Core/{Common/Views/EditorTemplates/Parts/Common.Publish.ascx => PublishLater/Views/EditorTemplates/Parts/PublishLater.ascx} (96%) create mode 100644 src/Orchard.Web/Core/PublishLater/Views/Web.config create mode 100644 src/Orchard/ContentManagement/Aspects/IPublishingControlAspect.cs diff --git a/src/Orchard.Web/Core/Common/DataMigrations/CommonDataMigration.cs b/src/Orchard.Web/Core/Common/DataMigrations/CommonDataMigration.cs index 52ff185df..259d7f5aa 100644 --- a/src/Orchard.Web/Core/Common/DataMigrations/CommonDataMigration.cs +++ b/src/Orchard.Web/Core/Common/DataMigrations/CommonDataMigration.cs @@ -3,7 +3,6 @@ using Orchard.Data.Migration; namespace Orchard.Core.Common.DataMigrations { public class CommonDataMigration : DataMigrationImpl { - public int Create() { //CREATE TABLE Common_BodyRecord (Id INTEGER not null, Text TEXT, Format TEXT, ContentItemRecord_id INTEGER, primary key (Id)); SchemaBuilder.CreateTable("BodyRecord", table => table diff --git a/src/Orchard.Web/Core/Common/Drivers/CommonDriver.cs b/src/Orchard.Web/Core/Common/Drivers/CommonDriver.cs index 187593af5..0500f6c74 100644 --- a/src/Orchard.Web/Core/Common/Drivers/CommonDriver.cs +++ b/src/Orchard.Web/Core/Common/Drivers/CommonDriver.cs @@ -1,13 +1,10 @@ -using System; -using Orchard.ContentManagement; +using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Models; -using Orchard.Core.Common.Services; using Orchard.Core.Common.ViewModels; using Orchard.Localization; using Orchard.Security; using Orchard.Services; -using Orchard.UI.Notify; namespace Orchard.Core.Common.Drivers { public class CommonDriver : ContentPartDriver { @@ -16,7 +13,6 @@ namespace Orchard.Core.Common.Drivers { private readonly IAuthenticationService _authenticationService; private readonly IAuthorizationService _authorizationService; private readonly IMembershipService _membershipService; - private readonly ICommonService _commonService; private readonly IClock _clock; public CommonDriver( @@ -25,13 +21,11 @@ namespace Orchard.Core.Common.Drivers { IAuthenticationService authenticationService, IAuthorizationService authorizationService, IMembershipService membershipService, - ICommonService commonService, IClock clock) { _contentManager = contentManager; _authenticationService = authenticationService; _authorizationService = authorizationService; _membershipService = membershipService; - _commonService = commonService; _clock = clock; T = NullLocalizer.Instance; Services = services; @@ -43,15 +37,14 @@ namespace Orchard.Core.Common.Drivers { protected override DriverResult Display(CommonAspect part, string displayType) { var model = new CommonMetadataViewModel(part); return Combined( - ContentPartTemplate(model, "Parts/Common.Metadata").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("metadata"), + ContentPartTemplate(model, "Parts/Common.Metadata").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("metadata", "5"), ContentPartTemplate(model, "Parts/Common.Publish").LongestMatch(displayType, "Summary", "SummaryAdmin").Location("secondary")); } protected override DriverResult Editor(CommonAspect part) { return Combined( OwnerEditor(part, null), - ContainerEditor(part, null), - PublishEditor(part, null)); + ContainerEditor(part, null)); } protected override DriverResult Editor(CommonAspect instance, ContentManagement.IUpdateModel updater) { @@ -61,34 +54,7 @@ namespace Orchard.Core.Common.Drivers { return Combined( OwnerEditor(instance, updater), - ContainerEditor(instance, updater), - PublishEditor(instance, updater)); - } - - DriverResult PublishEditor(CommonAspect part, IUpdateModel updater) { - var model = new PublishEditorViewModel(part); - - if (updater != null) { - updater.TryUpdateModel(model, TemplatePrefix, null, null); - switch (model.Command) { - case "PublishNow": - _commonService.Publish(model.ContentItem); - Services.Notifier.Information(T("{0} has been published!", model.ContentItem.TypeDefinition.DisplayName)); - break; - case "PublishLater": - DateTime scheduled; - if (DateTime.TryParse(string.Format("{0} {1}", model.ScheduledPublishUtcDate, model.ScheduledPublishUtcTime), out scheduled)) - model.ScheduledPublishUtc = scheduled; - _commonService.Publish(model.ContentItem, model.ScheduledPublishUtc.HasValue ? model.ScheduledPublishUtc.Value : DateTime.MaxValue); - Services.Notifier.Information(T("{0} has been scheduled for publishing!", model.ContentItem.TypeDefinition.DisplayName)); - break; - case "SaveDraft": - Services.Notifier.Information(T("{0} draft has been saved!", model.ContentItem.TypeDefinition.DisplayName)); - break; - } - } - - return ContentPartTemplate(model, "Parts/Common.Publish", TemplatePrefix).Location("secondary", "1"); + ContainerEditor(instance, updater)); } DriverResult OwnerEditor(CommonAspect part, IUpdateModel updater) { diff --git a/src/Orchard.Web/Core/Common/Handlers/CommonAspectHandler.cs b/src/Orchard.Web/Core/Common/Handlers/CommonAspectHandler.cs index 6229a9bf5..83fcb41a8 100644 --- a/src/Orchard.Web/Core/Common/Handlers/CommonAspectHandler.cs +++ b/src/Orchard.Web/Core/Common/Handlers/CommonAspectHandler.cs @@ -1,6 +1,5 @@ using JetBrains.Annotations; using Orchard.Core.Common.Models; -using Orchard.Core.Common.Services; using Orchard.Data; using Orchard.Localization; using Orchard.ContentManagement; @@ -13,27 +12,18 @@ namespace Orchard.Core.Common.Handlers { public class CommonAspectHandler : ContentHandler { private readonly IClock _clock; private readonly IAuthenticationService _authenticationService; - private readonly IAuthorizationService _authorizationService; - private readonly IMembershipService _membershipService; private readonly IContentManager _contentManager; - private readonly ICommonService _commonService; public CommonAspectHandler( IRepository commonRepository, IRepository commonVersionRepository, IClock clock, IAuthenticationService authenticationService, - IAuthorizationService authorizationService, - IMembershipService membershipService, - IContentManager contentManager, - ICommonService commonService) { + IContentManager contentManager) { _clock = clock; _authenticationService = authenticationService; - _authorizationService = authorizationService; - _membershipService = membershipService; _contentManager = contentManager; - _commonService = commonService; T = NullLocalizer.Instance; Filters.Add(StorageFilter.For(commonRepository)); @@ -45,7 +35,6 @@ namespace Orchard.Core.Common.Handlers { OnInitializing>(AssignCreatingDates); OnLoaded(LazyLoadHandlers); - OnLoaded((context, commonAspect) => commonAspect.ScheduledPublishUtc.Value = _commonService.GetScheduledPublishUtc(commonAspect)); OnVersioning(CopyOwnerAndContainer); @@ -125,7 +114,6 @@ namespace Orchard.Core.Common.Handlers { // add handlers that will load content for id's just-in-time aspect.OwnerField.Loader(() => _contentManager.Get(aspect.Record.OwnerId)); aspect.ContainerField.Loader(() => aspect.Record.Container == null ? null : _contentManager.Get(aspect.Record.Container.Id)); - aspect.ScheduledPublishUtc.Loader(() => _commonService.GetScheduledPublishUtc(context.ContentItem)); } static void PropertySetHandlers(InitializingContentContext context, CommonAspect aspect) { diff --git a/src/Orchard.Web/Core/Common/Models/CommonAspect.cs b/src/Orchard.Web/Core/Common/Models/CommonAspect.cs index aa6ac8ad7..d8468c348 100644 --- a/src/Orchard.Web/Core/Common/Models/CommonAspect.cs +++ b/src/Orchard.Web/Core/Common/Models/CommonAspect.cs @@ -8,14 +8,11 @@ namespace Orchard.Core.Common.Models { public class CommonAspect : ContentPart, ICommonAspect { private readonly LazyField _owner = new LazyField(); private readonly LazyField _container = new LazyField(); - private readonly LazyField _scheduledPublishUtc = new LazyField(); public LazyField OwnerField { get { return _owner; } } public LazyField ContainerField { get { return _container; } } - public LazyField ScheduledPublishUtc { get { return _scheduledPublishUtc; } } - public IUser Owner { get { return _owner.Value; } set { _owner.Value = value; } diff --git a/src/Orchard.Web/Core/Common/Routes.cs b/src/Orchard.Web/Core/Common/Routes.cs deleted file mode 100644 index cd3454294..000000000 --- a/src/Orchard.Web/Core/Common/Routes.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections.Generic; -using System.Web.Mvc; -using System.Web.Routing; -using Orchard.Mvc.Routes; - -namespace Orchard.Core.Common { - public class Routes : IRouteProvider { - #region IRouteProvider Members - - public IEnumerable GetRoutes() { - return new[] { - new RouteDescriptor { - Route = new Route( - "Admin/Common/Routable/Slugify", - new RouteValueDictionary { - {"area", "Common"}, - {"controller", "Routable"}, - {"action", "Slugify"} - }, - new RouteValueDictionary(), - new RouteValueDictionary { - {"area", "Common"} - }, - new MvcRouteHandler()) - } - }; - } - - public void GetRoutes(ICollection routes) { - foreach (RouteDescriptor routeDescriptor in GetRoutes()) { - routes.Add(routeDescriptor); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Services/CommonService.cs b/src/Orchard.Web/Core/Common/Services/CommonService.cs index 206428047..72202a7b4 100644 --- a/src/Orchard.Web/Core/Common/Services/CommonService.cs +++ b/src/Orchard.Web/Core/Common/Services/CommonService.cs @@ -1,6 +1,4 @@ -using System; -using Orchard.ContentManagement; -using Orchard.Core.Common.Models; +using Orchard.ContentManagement; using Orchard.Tasks.Scheduling; namespace Orchard.Core.Common.Services { @@ -13,23 +11,9 @@ namespace Orchard.Core.Common.Services { _contentManager = contentManager; } - DateTime? ICommonService.GetScheduledPublishUtc(ContentItem contentItem) { - var task = _publishingTaskManager.GetPublishTask(contentItem); - return (task == null ? null : task.ScheduledUtc); - } - void ICommonService.Publish(ContentItem contentItem) { _publishingTaskManager.DeleteTasks(contentItem); _contentManager.Publish(contentItem); } - - void ICommonService.Publish(ContentItem contentItem, DateTime scheduledPublishUtc) { - _publishingTaskManager.Publish(contentItem, scheduledPublishUtc); - } - - DateTime? ICommonService.GetScheduledPublishUtc(CommonAspect commonAspect) { - var task = _publishingTaskManager.GetPublishTask(commonAspect.ContentItem); - return (task == null ? null : task.ScheduledUtc); - } } } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Services/ICommonService.cs b/src/Orchard.Web/Core/Common/Services/ICommonService.cs index a0d3de7cc..6b719df4b 100644 --- a/src/Orchard.Web/Core/Common/Services/ICommonService.cs +++ b/src/Orchard.Web/Core/Common/Services/ICommonService.cs @@ -1,12 +1,7 @@ -using System; -using Orchard.ContentManagement; -using Orchard.Core.Common.Models; +using Orchard.ContentManagement; namespace Orchard.Core.Common.Services { public interface ICommonService : IDependency { - DateTime? GetScheduledPublishUtc(ContentItem contentItem); void Publish(ContentItem contentItem); - void Publish(ContentItem contentItem, DateTime scheduledPublishUtc); - DateTime? GetScheduledPublishUtc(CommonAspect commonAspect); } } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs b/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs index fad17600b..b95148969 100644 --- a/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs +++ b/src/Orchard.Web/Core/Common/ViewModels/CommonMetadataViewModel.cs @@ -22,8 +22,6 @@ namespace Orchard.Core.Common.ViewModels { public DateTime? VersionPublishedUtc { get { return _commonAspect.VersionPublishedUtc; } } public DateTime? VersionModifiedUtc { get { return _commonAspect.VersionModifiedUtc; } } - public DateTime? ScheduledPublishUtc { get { return _commonAspect.ScheduledPublishUtc.Value; } } - public bool IsPublished { get { return ContentItem.VersionRecord != null && ContentItem.VersionRecord.Published; } } diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.ItemReferenceContentField.ascx b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.ItemReferenceContentField.ascx deleted file mode 100644 index ef1af1f37..000000000 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Fields/Common.ItemReferenceContentField.ascx +++ /dev/null @@ -1,3 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Core.Common.ViewModels"%> -<%= Html.ItemDisplayLink(Model.Item) %> \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Metadata.SummaryAdmin.ascx b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Metadata.SummaryAdmin.ascx index 3a35a768f..401dec37d 100644 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Metadata.SummaryAdmin.ascx +++ b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Metadata.SummaryAdmin.ascx @@ -1,32 +1,7 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %>
  • <% - // Published or not - if (Model.HasPublished) { %> - " alt="<%:T("Online") %>" title="<%:T("The page is currently online") %>" /> <%:T("Published") %> | <% - } - else { %> - " alt="<%:T("Offline") %>" title="<%:T("The page is currently offline") %>" /> <%:T("Not Published") %> | <% - } %> -
  • -
  • <% - // Does the page have a draft - if (Model.HasDraft) { %> - " alt="<%:T("Draft") %>" title="<%:T("The page has a draft") %>" /><%:T("Draft") %> | <% - } - else { %> - <%:T("No Draft") %> | <% - } %> -
  • -
  • <% - if (Model.ScheduledPublishUtc.HasValue && Model.ScheduledPublishUtc.Value > DateTime.UtcNow) { %> - " alt="<%:T("Scheduled") %>" title="<%:T("The page is scheduled for publishing") %>" /><%:T("Scheduled") %> - <%:Html.DateTime(Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt")) %><% - } - else if (Model.IsPublished && Model.VersionPublishedUtc.HasValue) { %> - <%:T("Published: {0}", Html.DateTimeRelative(Model.VersionPublishedUtc.Value, T)) %><% - } - else if (Model.ModifiedUtc.HasValue) { %> + if (Model.ModifiedUtc.HasValue) { %> <%:T("Last modified: {0}", Html.DateTimeRelative(Model.ModifiedUtc.Value, T)) %><% } %> | 
  • diff --git a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Publish.ascx b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Publish.ascx index 72146480f..a7b05d462 100644 --- a/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Publish.ascx +++ b/src/Orchard.Web/Core/Common/Views/DisplayTemplates/Parts/Common.Publish.ascx @@ -1 +1 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.ItemReferenceContentField.ascx b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.ItemReferenceContentField.ascx deleted file mode 100644 index ab522e34e..000000000 --- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields/Common.ItemReferenceContentField.ascx +++ /dev/null @@ -1,3 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Core.Common.ViewModels"%> -<%= Html.ItemEditLink(Model.Item) %> \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index ec3b6cdb6..1554e30c4 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -3,9 +3,11 @@ using System.Linq; using System.Web.Mvc; using System.Web.Routing; using Orchard.ContentManagement; +using Orchard.ContentManagement.Aspects; using Orchard.ContentManagement.MetaData; using Orchard.Core.Common.Models; using Orchard.Core.Contents.ViewModels; +using Orchard.Core.PublishLater.Models; using Orchard.Data; using Orchard.Localization; using Orchard.Logging; @@ -124,7 +126,7 @@ namespace Orchard.Core.Contents.Controllers { } //need to go about this differently - to know when to publish (IPlublishableAspect ?) - if (!contentItem.Has()) + if (!contentItem.Has()) _contentManager.Publish(contentItem); _notifier.Information(T("Created content item")); @@ -161,6 +163,10 @@ namespace Orchard.Core.Contents.Controllers { return View("Edit", model); } + //need to go about this differently - to know when to publish (IPlublishableAspect ?) + if (!contentItem.Has()) + _contentManager.Publish(contentItem); + return RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } }); } diff --git a/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Items/Contents.Item.SummaryAdmin.ascx b/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Items/Contents.Item.SummaryAdmin.ascx index 687919f09..4c449a99e 100644 --- a/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Items/Contents.Item.SummaryAdmin.ascx +++ b/src/Orchard.Web/Core/Contents/Views/DisplayTemplates/Items/Contents.Item.SummaryAdmin.ascx @@ -4,8 +4,8 @@ <%@ Import Namespace="Orchard.ContentManagement" %>
    -

    <%:Html.ActionLink(Model.Item.Is() ? Model.Item.As().Title : string.Format("[title for this {0}]", Model.Item.TypeDefinition.DisplayName), "Edit", new { id = Model.Item.Id }) %>

    <% - Html.Zone("metadata"); %> +

    <%:Html.ActionLink(Model.Item.Is() ? Model.Item.As().Title : string.Format("[title for this {0}]", Model.Item.TypeDefinition.DisplayName), "Edit", new { id = Model.Item.Id }) %>

    +