//+ //- #OnPreRender -// protected override void OnPreRender(EventArgs e) { String link = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.CustomLink); //+ if (!String.IsNullOrEmpty(link)) { Minima.Service.BlogEntry blogEntry = BlogAgent.GetSingleBlogEntryByLink(this.BlogGuid, link, this.IgnoreBlogEntryFooter); if (blogEntry != null) { String labelSeries = SeriesHelper.GetBlogEntryLabelSeries(blogEntry); Template template = DataTemplateTemplateFactory.CreatePostTemplate(false, this.HidePostDateTime, this.ShowAuthorSeries, this.ShowLabelSeries, labelSeries, true, false, Minima.Service.AllowCommentStatus.Disabled, false, String.Empty); String output = template.Interpolate(new Map( new MapEntry("$Title$", blogEntry.Title), new MapEntry("$DateTimeString$", String.Format("{0}, {1} {2}, {3}", blogEntry.PostDateTime.DayOfWeek, blogEntry.PostDateTime.ToString("MMMM"), blogEntry.PostDateTime.Day, blogEntry.PostDateTime.Year)), new MapEntry("$Content$", blogEntry.Content), new MapEntry("$AuthorSeries$", SeriesHelper.GetBlogEntryAuthorSeries(blogEntry)), new MapEntry("$DateTimeDisplay$", String.Format("{0}/{1}/{2} {3}", blogEntry.PostDateTime.Month, blogEntry.PostDateTime.Day, blogEntry.PostDateTime.Year, blogEntry.PostDateTime.ToShortTimeString())), new MapEntry("$LabelSeries$", labelSeries) ) ); output = this.CodeParserSeries.ParseCode(output); //+ this.Controls.Add(new System.Web.UI.WebControls.Literal { Text = output }); } } //+ base.OnPreRender(e); }
//- #OnLoad -// protected override void OnLoad(EventArgs e) { List <BlogEntry> blogEntryList = this.DataSource; if (this.AccessType != AccessType.Index) { //+ were there any entries at all? if (blogEntryList == null || blogEntryList.Count < 1) { rptPosts.Visible = false; phNoEntries.Visible = true; litNoEntriesMessage.Text = BlogSection.GetConfigSection().Display.BlankMessage; } else { rptPosts.DataSource = blogEntryList.Select(p => new { Url = Themelia.Web.WebDomain.GetUrl() + Themelia.Web.UrlCleaner.FixWebPathHead(p.MappingNameList.First()), // BlogEntryHelper.BuildBlogEntryLink(p.PostDateTime, p.MappingNameList.First(), Themelia.Web.WebDomain.Current), Content = this.CodeParserSeries.ParseCode(p.Content), Title = p.Title, AuthorList = p.AuthorList, AllowCommentStatus = p.AllowCommentStatus, CommentList = p.CommentList, Guid = p.Guid, LabelList = p.LabelList, AuthorSeries = SeriesHelper.GetBlogEntryAuthorSeries(p), LabelSeries = SeriesHelper.GetBlogEntryLabelSeries(p), ViewableCommentCount = p.CommentList != null ? p.CommentList.Count : 0, DateTimeString = String.Format("{0}, {1} {2}, {3}", p.PostDateTime.DayOfWeek, p.PostDateTime.ToString("MMMM"), p.PostDateTime.Day, p.PostDateTime.Year), DateTimeDisplay = String.Format("{0}/{1}/{2} {3}", p.PostDateTime.Month, p.PostDateTime.Day, p.PostDateTime.Year, p.PostDateTime.ToShortTimeString()) }); rptPosts.DataBind(); //+ if (this.AccessType == AccessType.Link && this.SupportCommenting) { BlogEntry blogEntry = blogEntryList[0]; if (blogEntry.AllowCommentStatus == AllowCommentStatus.Disabled) { mvCommentContent.SetActiveView(vCommentsDisabled); } else { mvCommentContent.SetActiveView(vShowComments); List <Comment> commentList = CommentAgent.GetCommentList(this.BlogEntryGuid, false); if (commentList.Count > 0) { htmlCommentListHeader.Visible = true; litCommentCount.Text = commentList.Count.ToString(); } rptComments.DataSource = commentList; rptComments.DataBind(); //+ CommentInputBase commentInput = vCommentForm.FindControl("CommentInput") as CommentInputBase; if (commentInput != null) { HiddenField hfBlogEntryGuid = commentInput.FindControl("hfBlogEntryGuid") as HiddenField; if (hfBlogEntryGuid != null) { hfBlogEntryGuid.Value = this.BlogEntryGuid; } } //+ if (blogEntry.AllowCommentStatus == AllowCommentStatus.Closed) { mvCommentInput.SetActiveView(vCommentClosed); } else { mvCommentInput.SetActiveView(vCommentForm); } } } } } //+ SetPageTitle(); //+ base.OnLoad(e); }