From acb2e58a5cc46ecffd4f44e702c3ffa670d2b668 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 31 Oct 2013 18:28:02 +1100 Subject: [PATCH] Completes: U4-3067 Send to publish not implemented --- src/Umbraco.Core/Services/ContentService.cs | 6 ++++-- src/Umbraco.Core/Services/IContentService.cs | 2 ++ src/Umbraco.Web/Editors/ContentController.cs | 2 +- src/umbraco.cms/businesslogic/web/Document.cs | 14 ++++++++------ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 5be3681fd1..93bd9a6408 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -1228,18 +1228,20 @@ namespace Umbraco.Core.Services /// The to send to publication /// Optional Id of the User issueing the send to publication /// True if sending publication was succesfull otherwise false - internal bool SendToPublication(IContent content, int userId = 0) + public bool SendToPublication(IContent content, int userId = 0) { if (SendingToPublish.IsRaisedEventCancelled(new SendToPublishEventArgs(content), this)) return false; - //TODO: Do some stuff here.. RunActionHandlers + //TODO: Do some stuff here.. ... what is it supposed to do ? + // pretty sure all that legacy stuff did was raise an event? and we no longer have IActionHandlers so no worries there. SentToPublish.RaiseEvent(new SendToPublishEventArgs(content, false), this); Audit.Add(AuditTypes.SendToPublish, "Send to Publish performed by user", content.WriterId, content.Id); + //TODO: will this ever be false?? return true; } diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index 40be392eab..cdd71e7a80 100644 --- a/src/Umbraco.Core/Services/IContentService.cs +++ b/src/Umbraco.Core/Services/IContentService.cs @@ -12,6 +12,8 @@ namespace Umbraco.Core.Services public interface IContentService : IService { + bool SendToPublication(IContent content, int userId = 0); + IEnumerable GetByIds(IEnumerable ids); /// diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 06cf0ec417..d157a20818 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -243,7 +243,7 @@ namespace Umbraco.Web.Editors } else if (contentItem.Action == ContentSaveAction.SendPublish || contentItem.Action == ContentSaveAction.SendPublishNew) { - throw new NotSupportedException("Send to publish is currently not supported"); + Services.ContentService.SendToPublication(contentItem.PersistedContent, UmbracoUser.Id); } else { diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 547c338ca6..25482f2f7b 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -754,14 +754,16 @@ namespace umbraco.cms.businesslogic.web /// The User public bool SendToPublication(User u) { - SendToPublishEventArgs e = new SendToPublishEventArgs(); + var e = new SendToPublishEventArgs(); FireBeforeSendToPublish(e); - if (!e.Cancel) + if (e.Cancel == false) { - Log.Add(LogTypes.SendToPublish, u, this.Id, ""); - - FireAfterSendToPublish(e); - return true; + var sent = ApplicationContext.Current.Services.ContentService.SendToPublication(Content, u.Id); + if (sent) + { + FireAfterSendToPublish(e); + return true; + } } return false;