/// <summary> /// Populates the velocity template context. Only the objects that were /// added in this method will be accessible in the mail template. /// </summary> /// <remarks>Override this to add your own data to the context</remarks> protected virtual void PopulateContext(WorkflowPipelineArgs args) { velocityContext.Put("args", args); velocityContext.Put("item", args.DataItem); velocityContext.Put("processor", args.ProcessorItem); velocityContext.Put("user", Sitecore.Context.User); velocityContext.Put("history", args.DataItem.State.GetWorkflow().GetHistory(args.DataItem)); velocityContext.Put("state", args.DataItem.State.GetWorkflowState()); velocityContext.Put("nextState", GetNextState(args)); velocityContext.Put("site", Sitecore.Context.Site); velocityContext.Put("time", DateTime.Now); Items.WeBlog.EntryItem entryItem = null; if (args.DataItem.TemplateIsOrBasedOn(Settings.EntryTemplateID)) { entryItem = new Items.WeBlog.EntryItem(args.DataItem); } else if (args.DataItem.TemplateIsOrBasedOn(Settings.CommentTemplateID)) { Items.WeBlog.CommentItem commentItem = new Items.WeBlog.CommentItem(args.DataItem); entryItem = ManagerFactory.EntryManagerInstance.GetBlogEntryByComment(commentItem); velocityContext.Put("comment", commentItem); } if (entryItem != null) { velocityContext.Put("entry", entryItem); if (!string.IsNullOrEmpty(entryItem.InnerItem.Statistics.CreatedBy)) { UserProfile createdBy = User.FromName(entryItem.InnerItem.Statistics.CreatedBy, false).Profile; velocityContext.Put("entryCreatedBy", createdBy); } if (!string.IsNullOrEmpty(entryItem.InnerItem.Statistics.UpdatedBy)) { UserProfile updatedBy = User.FromName(entryItem.InnerItem.Statistics.UpdatedBy, false).Profile; velocityContext.Put("entryUpdatedBy", updatedBy); } Items.WeBlog.BlogHomeItem blog = ManagerFactory.BlogManagerInstance.GetCurrentBlog(entryItem); velocityContext.Put("blog", blog); } }