Пример #1
0
        //- $__BuildCommentFormViewControl -//
        private View __BuildCommentFormViewControl()
        {
            View v = new View();
            //+ comment input
            CommentInputBase commentInput = GetCommentInputControl();

            commentInput.ID = "CommentInput";
            v.Controls.Add(commentInput);
            return(v);
        }
Пример #2
0
        //- #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);
        }