/// <summary> /// Gets the tags and coutns for the blog by the given blog ID /// </summary> /// <param name="blog">The blog to get the tags for</param> /// <returns>A sorted array of tags with counts</returns> public Dictionary <string, int> GetAllTags(Items.WeBlog.BlogHomeItem blog) { var tagList = new List <string>(); if (blog != null) { var entries = ManagerFactory.EntryManagerInstance.GetBlogEntries(blog.InnerItem); foreach (var entry in entries) { tagList.AddRange(entry.TagsSplit); } } return(SortByWeight(tagList)); }
/// <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); } }
/// <summary> /// Checks if emails should be displayed with comments /// </summary> /// /// <param name="blog">The blog to read the setting from</param> /// <returns>True if email should be shown, otherwise False</returns> public bool ShowEmailWithinComments(Items.WeBlog.BlogHomeItem blog) { return(blog.ShowEmailWithinComments.Checked); }
/// <summary> /// Checks if the current blog has RSS enabled /// </summary> /// <param name="blog">The blog to read the setting from</param> /// <returns>True if RSS is enabled, otherwise False</returns> public bool EnableRSS(Items.WeBlog.BlogHomeItem blog) { return(blog.EnableRSS.Checked); }