protected virtual void SendToChildSites(Site site, ContentEventContext eventContext, bool keepStatus) { List <Repository> repositoryList = new List <Repository>(); GetAllRepositories(Kooboo.CMS.Sites.Services.ServiceFactory.SiteManager.ChildSites(site), repositoryList); foreach (var repository in repositoryList) { ServiceFactory.ReceiveSettingManager.ProcessMessage(repository, eventContext.Content, eventContext.Content.FolderName, keepStatus, eventContext.ContentAction); } }
private Task TriggerWorkflowEventAsync(string name, ContentItem contentItem) { var contentEvent = new ContentEventContext() { Name = name, ContentType = contentItem.ContentType, ContentItemId = contentItem.ContentItemId }; var input = new Dictionary <string, object> { { ContentEventConstants.ContentItemInputKey, contentItem }, { ContentEventConstants.ContentEventInputKey, contentEvent } }; return(_workflowManager.TriggerEventAsync(name, input, correlationId: contentItem.ContentItemId)); }
public override async Task <IDisplayResult> UpdateAsync(ContentItem model, IUpdateModel updater) { var httpContext = _httpContextAccessor.HttpContext; var action = (string)httpContext.Request.Form["submit.Save"] ?? httpContext.Request.Form["submit.Publish"]; if (action?.StartsWith("user-task.", StringComparison.Ordinal) == true) { action = action.Substring("user-task.".Length); var availableActions = await GetUserTaskActionsAsync(model.ContentItemId); if (!availableActions.Contains(action)) { await _notifier.ErrorAsync(H["Not authorized to trigger '{0}'.", action]); } else { var contentEvent = new ContentEventContext() { Name = nameof(UserTaskEvent), ContentType = model.ContentType, ContentItemId = model.ContentItemId }; var input = new Dictionary <string, object> { { ContentEventConstants.UserActionInputKey, action }, { ContentEventConstants.ContentItemInputKey, model }, { ContentEventConstants.ContentEventInputKey, contentEvent } }; await _workflowManager.TriggerEventAsync(nameof(UserTaskEvent), input, correlationId : model.ContentItemId); } } return(Edit(model)); }
protected virtual SendingSetting AllowSending(TextContent content, Repository repository, ContentEventContext eventContext) { if (!repository.EnableBroadcasting) { return(null); } var list = Providers.DefaultProviderFactory.GetProvider <ISendingSettingProvider>().All(repository).Select(o => Providers.DefaultProviderFactory.GetProvider <ISendingSettingProvider>().Get(o)); foreach (var item in list) { if (AllowSendingSetting(content, item, eventContext)) { return(item); } } return(null); }
protected virtual bool AllowSendingSetting(TextContent content, SendingSetting sendingSetting, ContentEventContext eventContext) { if (!string.IsNullOrEmpty(sendingSetting.FolderName) && !sendingSetting.FolderName.Equals(content.FolderName, StringComparison.CurrentCultureIgnoreCase)) { return(false); } if (!string.IsNullOrEmpty(content.OriginalUUID)) { if (content.IsLocalized == null || content.IsLocalized.Value == false) { if ((sendingSetting.SendReceived == null || sendingSetting.SendReceived.Value == false)) { return(false); } } } return(true); }