示例#1
0
        private void DisplayPost_PreRender(object sender, EventArgs e)
        {
            Attach.Visible               = CanAttach;
            Attach.Text                  = ForumPage.GetThemeContents("BUTTONS", "ATTACHMENTS");
            Attach.ToolTip               = "Attachments";
            Attach.NavigateUrl           = Forum.GetLink(Pages.attachments, "m={0}", DataRow["MessageID"]);
            Edit.Visible                 = CanEditPost;
            Edit.Text                    = ForumPage.GetThemeContents("BUTTONS", "EDITPOST");
            Edit.ToolTip                 = "Edit this post";
            Edit.NavigateUrl             = Forum.GetLink(Pages.postmessage, "m={0}", DataRow["MessageID"]);
            Delete.Visible               = CanDeletePost;
            Delete.Text                  = ForumPage.GetThemeContents("BUTTONS", "DELETEPOST");
            Delete.ToolTip               = "Delete this post";
            Delete.Attributes["onclick"] = string.Format("return confirm('{0}')", ForumPage.GetText("confirm_deletemessage"));
            Quote.Visible                = CanReply;
            Quote.Text                   = ForumPage.GetThemeContents("BUTTONS", "QUOTEPOST");
            Quote.ToolTip                = "Reply with quote";
            Quote.NavigateUrl            = Forum.GetLink(Pages.postmessage, "t={0}&f={1}&q={2}", ForumPage.PageTopicID, ForumPage.PageForumID, DataRow["MessageID"]);

            // private messages
            Pm.Visible     = ForumPage.User.IsAuthenticated && ForumPage.BoardSettings.AllowPrivateMessages;
            Pm.Text        = ForumPage.GetThemeContents("BUTTONS", "PM");
            Pm.NavigateUrl = Forum.GetLink(Pages.pmessage, "u={0}", DataRow["UserID"]);
            // emailing
            Email.Visible     = ForumPage.User.IsAuthenticated && ForumPage.BoardSettings.AllowEmailSending;
            Email.NavigateUrl = Forum.GetLink(Pages.im_email, "u={0}", DataRow["UserID"]);
            Email.Text        = ForumPage.GetThemeContents("BUTTONS", "EMAIL");

            Home.Visible     = DataRow["HomePage"] != DBNull.Value && DataRow["HomePage"].ToString() != string.Empty;
            Home.NavigateUrl = DataRow["HomePage"].ToString();
            Home.Text        = ForumPage.GetThemeContents("BUTTONS", "WWW");

            Msn.Visible     = ForumPage.User.IsAuthenticated && DataRow["MSN"] != DBNull.Value;
            Msn.Text        = ForumPage.GetThemeContents("BUTTONS", "MSN");
            Msn.NavigateUrl = Forum.GetLink(Pages.im_email, "u={0}", DataRow["UserID"]);

            Aim.Visible     = ForumPage.User.IsAuthenticated && DataRow["AIM"] != DBNull.Value;
            Aim.Text        = ForumPage.GetThemeContents("BUTTONS", "AIM");
            Aim.NavigateUrl = Forum.GetLink(Pages.im_aim, "u={0}", DataRow["UserID"]);

            Icq.Visible     = ForumPage.User.IsAuthenticated && DataRow["ICQ"] != DBNull.Value;
            Icq.Text        = ForumPage.GetThemeContents("BUTTONS", "ICQ");
            Icq.NavigateUrl = Forum.GetLink(Pages.im_icq, "u={0}", DataRow["UserID"]);

            // display admin only info
            if (ForumPage.IsAdmin)
            {
                AdminInfo.InnerHtml = "<span class='smallfont'>";
                if (Convert.ToDateTime(DataRow["Edited"]) != Convert.ToDateTime(DataRow["Posted"]))
                {
                    // message has been edited
                    AdminInfo.InnerHtml += String.Format("<b>Edited:</b> {0}", ForumPage.FormatDateTimeShort(Convert.ToDateTime(DataRow["Edited"])));
                }
                AdminInfo.InnerHtml += String.Format(" <b>IP:</b> {0}", DataRow["IP"].ToString());
                AdminInfo.InnerHtml += "</span>";
            }
        }