Completes: U4-3067 Send to publish not implemented

This commit is contained in:
Shannon
2013-10-31 18:28:02 +11:00
parent 523c48d4fd
commit acb2e58a5c
4 changed files with 15 additions and 9 deletions

View File

@@ -1228,18 +1228,20 @@ namespace Umbraco.Core.Services
/// <param name="content">The <see cref="IContent"/> to send to publication</param>
/// <param name="userId">Optional Id of the User issueing the send to publication</param>
/// <returns>True if sending publication was succesfull otherwise false</returns>
internal bool SendToPublication(IContent content, int userId = 0)
public bool SendToPublication(IContent content, int userId = 0)
{
if (SendingToPublish.IsRaisedEventCancelled(new SendToPublishEventArgs<IContent>(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<IContent>(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;
}

View File

@@ -12,6 +12,8 @@ namespace Umbraco.Core.Services
public interface IContentService : IService
{
bool SendToPublication(IContent content, int userId = 0);
IEnumerable<IContent> GetByIds(IEnumerable<int> ids);
/// <summary>

View File

@@ -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
{

View File

@@ -754,14 +754,16 @@ namespace umbraco.cms.businesslogic.web
/// <param name="u">The User</param>
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;