Implements CoComment for Subtext.
Наследование: Subtext.Web.Controls.CoComment
Пример #1
0
        /// <summary>
        /// Handles the OnLoad event.  Attempts to prepopulate comment
        /// fields based on the user's cookie.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //TODO: Make this configurable.
            tbTitle.MaxLength   = 128;
            tbEmail.MaxLength   = 128;
            tbName.MaxLength    = 32;
            tbUrl.MaxLength     = 256;
            tbComment.MaxLength = 4000;
            SetValidationGroup();

            if (!IsPostBack)
            {
                if (Entry == null)
                {
                    //Somebody probably is messing with the url.
                    Response.Redirect("~/SystemMessages/FileNotFound.aspx", true);
                    return;
                }

                ResetCommentFields();

                if (Config.CurrentBlog.CoCommentsEnabled)
                {
                    if (coComment == null)
                    {
                        coComment = new SubtextCoComment();
                        var coCommentPlaceHolder = Page.FindControl("coCommentPlaceholder") as PlaceHolder;
                        if (coCommentPlaceHolder != null)
                        {
                            coCommentPlaceHolder.Controls.Add(coComment);
                        }
                    }
                    coComment.PostTitle = RealEntry.Title;
                    coComment.PostUrl   = Url.EntryUrl(RealEntry).ToFullyQualifiedUrl(Blog).ToString();
                }
            }

            DataBind();
        }
Пример #2
0
        /// <summary>
        /// Handles the OnLoad event.  Attempts to prepopulate comment 
        /// fields based on the user's cookie.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad (e);

            //TODO: Make this configurable.
            tbTitle.MaxLength = 128;
            tbEmail.MaxLength = 128;
            tbName.MaxLength = 32;
            tbUrl.MaxLength = 256;
            tbComment.MaxLength = 4000;
            SetValidationGroup();

            if(!IsPostBack)
            {
                if (this.Entry == null)
                {
                    //Somebody probably is messing with the url.
                    Response.Redirect("~/SystemMessages/FileNotFound.aspx", true);
                    return;
                }

                ResetCommentFields();

                if(Config.CurrentBlog.CoCommentsEnabled)
                {
                    if(coComment == null)
                    {
                        coComment = new SubtextCoComment();
                        PlaceHolder coCommentPlaceHolder = Page.FindControl("coCommentPlaceholder") as PlaceHolder;
                        if(coCommentPlaceHolder != null)
                        {
                            coCommentPlaceHolder.Controls.Add(coComment);
                        }
                    }
                    coComment.PostTitle = entry.Title;
                    coComment.PostUrl = entry.Url;
                    if(entry.Url.StartsWith("/"))
                    {
                        coComment.PostUrl = "http://" + Config.CurrentBlog.Host + coComment.PostUrl;
                    }
                }
            }

            this.DataBind();
        }
Пример #3
0
        /// <summary>
        /// Handles the OnLoad event.  Attempts to prepopulate comment 
        /// fields based on the user's cookie.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //TODO: Make this configurable.
            tbTitle.MaxLength = 128;
            tbEmail.MaxLength = 128;
            tbName.MaxLength = 32;
            tbUrl.MaxLength = 256;
            tbComment.MaxLength = 4000;
            SetValidationGroup();

            if(!IsPostBack)
            {
                if(Entry == null)
                {
                    //Somebody probably is messing with the url.
                    Response.Redirect("~/SystemMessages/FileNotFound.aspx", true);
                    return;
                }

                ResetCommentFields();

                if(Config.CurrentBlog.CoCommentsEnabled)
                {
                    if(coComment == null)
                    {
                        coComment = new SubtextCoComment();
                        var coCommentPlaceHolder = Page.FindControl("coCommentPlaceholder") as PlaceHolder;
                        if(coCommentPlaceHolder != null)
                        {
                            coCommentPlaceHolder.Controls.Add(coComment);
                        }
                    }
                    coComment.PostTitle = RealEntry.Title;
                    coComment.PostUrl = Url.EntryUrl(RealEntry).ToFullyQualifiedUrl(Blog).ToString();
                }
            }

            DataBind();
        }