示例#1
0
        /// <summary>
        /// The init edited post.
        /// </summary>
        /// <param name="currentRow">
        /// The current row.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="messageFlags">
        /// The message flags.
        /// </param>
        private void InitEditedPost(DataRow currentRow, string message, MessageFlags messageFlags)
        {
            // If the message is in YafBBCode but the editor uses HTML, convert the message text to HTML
            if (messageFlags.IsBBCode && this._forumEditor.UsesHTML)
            {
                message = YafBBCode.ConvertBBCodeToHtmlForEdit(message);
            }

            this._forumEditor.Text = message;

            this.Title.Text = this.GetText("EDIT");

            // add topic link...
            this.PageLinks.AddLink(
                this.Server.HtmlDecode(currentRow["Topic"].ToString()),
                YafBuildLink.GetLink(ForumPages.posts, "m={0}", this.EditMessageID));

            // editing..
            this.PageLinks.AddLink(this.GetText("EDIT"));

            string blogPostID = currentRow["BlogPostID"].ToString();

            if (blogPostID != string.Empty)
            {
                // The user used this post to blog
                this.BlogPostID.Value   = blogPostID;
                this.PostToBlog.Checked = true;
                this.BlogRow.Visible    = true;
            }

            this.TopicSubjectTextBox.Text = this.Server.HtmlDecode(Convert.ToString(currentRow["Topic"]));

            if ((Convert.ToInt32(currentRow["TopicOwnerID"]) == Convert.ToInt32(currentRow["UserID"])) ||
                this.PageContext.ForumModeratorAccess)
            {
                // allow editing of the topic subject
                this.TopicSubjectTextBox.Enabled = true;
            }
            else
            {
                // disable the subject
                this.TopicSubjectTextBox.Enabled = false;
            }

            this.Priority.SelectedItem.Selected = false;
            this.Priority.Items.FindByValue(currentRow["Priority"].ToString()).Selected = true;
            this.EditReasonRow.Visible          = true;
            this.ReasonEditor.Text              = this.Server.HtmlDecode(Convert.ToString(currentRow["EditReason"]));
            this.PostOptions1.PersistantChecked = messageFlags.IsPersistent;
        }
示例#2
0
        /// <summary>
        /// The init quoted reply.
        /// </summary>
        /// <param name="currentRow">
        /// The current row.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="messageFlags">
        /// The message flags.
        /// </param>
        private void InitQuotedReply(DataRow currentRow, string message, MessageFlags messageFlags)
        {
            if (this.PageContext.BoardSettings.RemoveNestedQuotes)
            {
                message = YafFormatMessage.RemoveNestedQuotes(message);
            }

            // If the message being quoted in YafBBCode but the editor uses HTML, convert the message text to HTML
            if (messageFlags.IsBBCode && this._forumEditor.UsesHTML)
            {
                message = YafBBCode.ConvertBBCodeToHtmlForEdit(message);
            }

            // Ensure quoted replies have bad words removed from them
            message = this.Get <YafBadWordReplace>().Replace(message);

            // Quote the original message
            this._forumEditor.Text = "[quote={0};{1}]{2}[/quote]\n".FormatWith(this.PageContext.UserDisplayName.GetName(currentRow.Field <int>("UserID")), currentRow.Field <int>("MessageID"), message).TrimStart();
        }