public void GetNotifications(GetPageEditorNotificationsArgs arguments) { if (arguments == null) { return; } var wfModel = new ItemWorkflowModel(arguments.ContextItem); if (wfModel.ShowNotification) { SetNotification(arguments, wfModel); } }
public void GetNotifications(GetContentEditorWarningsArgs arguments, Item contextItem) { if (arguments == null) { return; } var wfModel = new ItemWorkflowModel(contextItem); if (wfModel.ShowNotification) { SetNotification(arguments, wfModel); } }
private void SetNotification(GetContentEditorWarningsArgs arguments, ItemWorkflowModel wfModel) { var editorNotification = arguments.Add(); editorNotification.Title = "Datasource Item in Workflow"; editorNotification.Text = wfModel.GetEditorDescription(false); editorNotification.Icon = wfModel.WorkflowState.Icon; if (wfModel.HasWriteAccess()) { foreach (var command in wfModel.Commands) { editorNotification.AddOption(command.DisplayName, new WorkflowCommandBuilder(wfModel.ContextItem, wfModel.Workflow, command).ToString()); } } }
private void SetNotification(GetPageEditorNotificationsArgs arguments, ItemWorkflowModel wfModel) { var editorNotification = new PageEditorNotification(wfModel.GetEditorDescription(), PageEditorNotificationType.Warning) { Icon = wfModel.WorkflowState.Icon }; if (wfModel.HasWriteAccess()) { foreach (var notificationOption in wfModel.Commands.Select(command => new PageEditorNotificationOption(command.DisplayName, new WorkflowCommandBuilder(wfModel.ContextItem, wfModel.Workflow, command).ToString()))) { editorNotification.Options.Add(notificationOption); } } arguments.Notifications.Add(editorNotification); }
protected override ValidatorResult Evaluate() { var item = GetItem(); var result = ValidatorResult.Valid; var paths = new List <string>(); foreach (var ds in item.GetAllUniqueDataSourceItems()) { var wfModel = new ItemWorkflowModel(ds); if (wfModel.NoNulls && !wfModel.WorkflowState.FinalState) { paths.Add(ds.Paths.ContentPath); result = GetMaxValidatorResult(); } } this.Text = string.Empty; if (paths.Count > 0) { Text += GetText("The item{0} {1} should be in a final workflow state.", paths.Count > 1 ? "s" : string.Empty, GetPathsString(paths)); } return(result); }