public PublishLaterPartHandler( IPublishLaterService publishLaterService, IPublishingTaskManager publishingTaskManager) { _publishLaterService = publishLaterService; OnLoading<PublishLaterPart>((context, part) => LazyLoadHandlers(part)); OnVersioning<PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart)); OnRemoved<PublishLaterPart>((context, part) => publishingTaskManager.DeleteTasks(part.ContentItem)); }
public PublishLaterPartHandler( IPublishLaterService publishLaterService, IPublishingTaskManager publishingTaskManager) { _publishLaterService = publishLaterService; OnLoading <PublishLaterPart>((context, part) => LazyLoadHandlers(part)); OnVersioning <PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart)); OnRemoved <PublishLaterPart>((context, part) => publishingTaskManager.DeleteTasks(part.ContentItem)); }
public PublishLaterPartHandler( IPublishLaterService publishLaterService, IPublishingTaskManager publishingTaskManager) { _publishLaterService = publishLaterService; OnLoading <PublishLaterPart>((context, part) => LazyLoadHandlers(part)); OnVersioning <PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart)); OnRemoved <PublishLaterPart>((context, part) => publishingTaskManager.DeleteTasks(part.ContentItem)); OnPublishing <PublishLaterPart>((context, part) => { var existingPublishTask = publishingTaskManager.GetPublishTask(context.ContentItem); //Check if there is already and existing publish task for old version. if (existingPublishTask != null) { //If exists remove it in order no to override the latest published version. publishingTaskManager.DeleteTasks(context.ContentItem); } }); }
protected override DriverResult Editor(PublishLaterPart part, IUpdateModel updater, dynamic shapeHelper) { var model = BuildViewModelFromPart(part); updater.TryUpdateModel(model, Prefix, null, null); var httpContext = _httpContextAccessor.Current(); if (httpContext.Request.Form["submit.Save"] == "submit.PublishLater") { if (!String.IsNullOrWhiteSpace(model.Editor.Date) && !String.IsNullOrWhiteSpace(model.Editor.Time)) { try { var utcDateTime = _dateLocalizationServices.ConvertFromLocalizedString(model.Editor.Date, model.Editor.Time); if (utcDateTime.HasValue) { if (utcDateTime.Value < _clock.UtcNow) { updater.AddModelError("ScheduledPublishUtcDate", T("You cannot schedule a publishing date in the past.")); } else { _publishLaterService.Publish(model.ContentItem, utcDateTime.Value); } } } catch (FormatException) { updater.AddModelError(Prefix, T("'{0} {1}' could not be parsed as a valid date and time.", model.Editor.Date, model.Editor.Time)); } } else { updater.AddModelError(Prefix, T("Both the date and time need to be specified for when this is to be published. If you don't want to schedule publishing then click Save Draft or Publish.")); } } if (httpContext.Request.Form["submit.Save"] == "submit.CancelPublishLaterTasks") { _publishingTaskManager.DeleteTasks(model.ContentItem); } return(ContentShape("Parts_PublishLater_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix))); }
public void Delete(BlogPostPart blogPostPart) { _publishingTaskManager.DeleteTasks(blogPostPart.ContentItem); _contentManager.Remove(blogPostPart.ContentItem); }
public void Delete(CasePostPart cAsePostPart) { _publishingTaskManager.DeleteTasks(cAsePostPart.ContentItem); _contentManager.Remove(cAsePostPart.ContentItem); }
void ICommonService.Publish(ContentItem contentItem) { _publishingTaskManager.DeleteTasks(contentItem); _contentManager.Publish(contentItem); }