Exemplo n.º 1
0
        private void RenderPosts(HtmlTextWriter writer)
        {
            // Header row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Author
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(" Author ");
            writer.RenderEndTag();              // Td

            // Thread
            ForumPost firstForumPost = (ForumPost)_forumPostCollection[0];

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            ForumText subjectForumText = new ForumText(firstForumPost.Subject);

            writer.Write(string.Format(" Thread: {0}", subjectForumText.ProcessSingleLine(GetImages())));
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Work out when to display new images
            string   cookieName  = "Forum" + ForumID + "_LastVisited";
            DateTime lastVisited = Convert.ToDateTime(Page.Session[cookieName]);

            // Loop round rows in selected thread
            string document = GetDocument();
            string images   = GetImages();

            foreach (ForumPost forumPost in _forumPostCollection)
            {
                bool   selected = (_postID == forumPost.PostID);
                string avatar   = forumPost.User.Avatar;
                if (avatar != string.Empty)
                {
                    avatar = GetAvatar(avatar);
                }
                forumPost.Render(writer, true, _forumView, selected, lastVisited, Page, LoggedOnUserID, avatar, images, document);
            }
        }
Exemplo n.º 2
0
        public override void Render(HtmlTextWriter writer)
        {
            RenderTableBegin(writer, 1, 0);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Check to see whether a user is currently logged on.  If not, no need
            // to display logoff info message and logoff button.
            if (_loggedOff || LoggedOnUserID == 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write("Nobody is logged on.");
                writer.RenderEndTag();
            }
            else
            {
                // Display logged on user
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                ForumText aliasForumText = new ForumText(UserDB.GetUser(LoggedOnUserID).Alias);
                writer.Write(aliasForumText.ProcessSingleLine(GetImages()) + " is logged on.");
                writer.RenderEndTag();                  // P

                // Informative message
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write("Click the button below to logoff.");
                writer.RenderEndTag();

                // Logoff button
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                _logoffButton.RenderControl(writer);
                writer.RenderEndTag();
            }

            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr
            RenderTableEnd(writer);             // Table
        }
        public override void Render(HtmlTextWriter writer)
        {
            RenderTableBegin(writer, 1, 0);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Check to see whether a user is currently logged on.  If not, no need
            // to display logoff info message and logoff button.
            if (_loggedOff || LoggedOnUserID == 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write("Nobody is logged on.");
                writer.RenderEndTag();
            }
            else
            {
                // Display logged on user
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                ForumText aliasForumText = new ForumText(UserDB.GetUser(LoggedOnUserID).Alias);
                writer.Write(aliasForumText.ProcessSingleLine(GetImages()) + " is logged on.");
                writer.RenderEndTag();	// P

                // Informative message
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write("Click the button below to logoff.");
                writer.RenderEndTag();

                // Logoff button
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                _logoffButton.RenderControl(writer);
                writer.RenderEndTag();
            }

            writer.RenderEndTag();	// Td
            writer.RenderEndTag();	// Tr
            RenderTableEnd(writer);		// Table
        }
Exemplo n.º 4
0
        public void Render(HtmlTextWriter writer, int threadsPerPage, DateTime lastVisited, Page page, string images, string document, int postsPerPage, ForumUtils.ForumView forumView)
        {
            // Start row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Render thread image.  If the total number of posts in this thread is great than the
            // number of posts that can be displayed on one page, then we display a special image that
            // indicates this thread is "on fire".
            int totalPosts = (int)Replies + 1;

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "25");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if (totalPosts > threadsPerPage)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread_fire.gif");
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread.gif");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();              // Img
            writer.RenderEndTag();              // Td

            // Thread subject with link (and indicate whether or not this thread is pinned)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            if (PinnedDate > DateTime.Now)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.Write("Sticky: ");
                writer.RenderEndTag();                  // B
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", ThreadID), "forumaction=&searchpage=&threadspage=") + string.Format("#{0}", ThreadID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            ForumText subjectForumText = new ForumText(Subject);

            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // A

            // If thread spans several pages, then we need to indicate this in the thread list
            // by displaying text like (Page 1, 2, 3, ..., 5)
            if (totalPosts > threadsPerPage)
            {
                writer.Write(" (Page: ");
                int  pageCount       = ((totalPosts - 1) / threadsPerPage) + 1;
                int  pageCountCapped = Math.Min(pageCount, 4);
                bool showFinalPage   = (pageCountCapped < pageCount);
                for (int threadPage = 0; threadPage < pageCountCapped; threadPage++)
                {
                    int postID = ForumDB.GetPostFromThreadAndPage(ThreadID, threadPage, postsPerPage, forumView);
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", postID), "forumaction=&searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(string.Format("{0}", threadPage + 1));
                    writer.RenderEndTag();                      // A
                    if ((threadPage < pageCountCapped - 1) || showFinalPage)
                    {
                        writer.Write(", ");
                    }
                }
                if (showFinalPage)
                {
                    if (pageCount > 5)
                    {
                        writer.Write("..., ");
                    }
                    int postID = ForumDB.GetPostFromThreadAndPage(ThreadID, pageCount - 1, postsPerPage, forumView);
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", postID), "forumaction=&searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(pageCount.ToString());
                    writer.RenderEndTag();                      // A
                }
                writer.Write(")");
            }

            // Display new image if this thread is new since last time user visited
            if (lastVisited < _dateLastPost)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Started by
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            ForumText startedByAliasForumText = new ForumText(StartedByAlias);

            writer.Write(startedByAliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Replies
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(Replies);
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Views
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(Views);
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Last Post
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "140");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionSmallerFont");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(DateLastPost.ToString("dd MMM yy"));
            writer.Write("&nbsp;");
            writer.Write(DateLastPost.ToString("t"));
            writer.Write("<BR>");
            ForumText lastPostAliasForumText = new ForumText(LastPostAlias);

            writer.Write(lastPostAliasForumText.ProcessSingleLine(images));
            writer.Write("&nbsp;");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", LastPostID), "forumaction=&searchpage=&threadspage=") + string.Format("#{0}", LastPostID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "last_post.gif");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();              // Img
            writer.RenderEndTag();              // A
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // End row
            writer.RenderEndTag();              // Tr
        }
        public void Render(HtmlTextWriter writer, DateTime lastVisited, Page page, string images, string document)
        {
            // Start row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Render post image
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "25");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread.gif");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();	// Img
            writer.RenderEndTag();	// Td

            // Post subject with hyperlink
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&threadspage=&searchpage=&searchterms=") + string.Format("#{0}", PostID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            ForumText subjectForumText = new ForumText(Subject);
            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();	// A

            // Display new image if this post is new since last time user visited
            if (lastVisited < PostDate)
            {
                writer.Write(" ");
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // Posted by
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            ForumText aliasForumText = new ForumText(Alias);
            writer.Write(aliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // Date
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(string.Format("{0}", PostDate.ToString("dd MMM yy")));
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // End row
            writer.RenderEndTag();	// Tr
        }
        public void Render(HtmlTextWriter writer, bool displayActions, ForumUtils.ForumView forumView, bool selected, DateTime lastVisited, Page page, int loggedOnUserID, string avatar, string images, string document)
        {
            // New row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Left hand side contains user information (user alias, avatar, number of posts etc)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "160");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // We will put this user information in its own table in the first column
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "160");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // User alias and number of posts
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            ForumText userAliasForumText = new ForumText(User.Alias);

            writer.Write(userAliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // B
            writer.RenderBeginTag(HtmlTextWriterTag.Br);
            writer.Write(string.Format("Posts: {0}", User.PostCount));
            writer.RenderEndTag();              // Br
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Avatar
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_avatarrow");
                if (!selected)
                {
                    writer.AddStyleAttribute("display", "none");
                }
            }
            if ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (avatar != string.Empty)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, avatar);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();              // Img
                }
                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // End user information table
            writer.RenderEndTag();              // Table
            writer.RenderEndTag();              // Td

            // Start row which will display subject, body and actions (reply, edit, etc)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            if (forumView != ForumUtils.ForumView.FlatView && !selected)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            }
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_headercell");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Start a new table for this information
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            if (forumView != ForumUtils.ForumView.FlatView && !selected)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_messagetable");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // Highlighted row (subject and when posted information)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            if (forumView != ForumUtils.ForumView.FlatView)
            {
                RenderLevelIndentCell(writer);
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, PostID.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.RenderEndTag();

            // Provide link to select a different post
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&searchpage=&threadspage=") + "#" + PostID);
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "DynMessLink");
                writer.AddAttribute(HtmlTextWriterAttribute.Name, PostID.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.A);

            ForumText subjectForumText = new ForumText(Subject);

            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // A
            writer.RenderEndTag();              // B

            // Display new image if this post is new since last time user visited
            if (lastVisited < PostDate)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Br);
            writer.Write(string.Format("Posted: {0} {1}", PostDate.ToString("dd MMM yy"), PostDate.ToString("t")));
            writer.RenderEndTag();              // Br
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr

            // Message row
            if ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_messagerow");
                    if (!selected)
                    {
                        writer.AddStyleAttribute("display", "none");
                    }
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (forumView != ForumUtils.ForumView.FlatView)
                {
                    RenderLevelIndentCell(writer);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                ForumText bodyForumText = new ForumText(Body);
                writer.Write(bodyForumText.Process(images));

                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // Reply, Quote, Edit, Get Link row
            if (displayActions && ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView))
            {
                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_actionsrow");
                    if (!selected)
                    {
                        writer.AddStyleAttribute("display", "none");
                    }
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (forumView != ForumUtils.ForumView.FlatView)
                {
                    RenderLevelIndentCell(writer);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.AddAttribute(HtmlTextWriterAttribute.Align, "Left");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                // Reply link
                writer.Write("[");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=reply", PostID), "searchpage=&threadspage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Reply");
                writer.RenderEndTag();                  // A
                writer.Write("]");

                // Quote link
                writer.Write("[");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=quote", PostID), "searchpage=&threadspage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Quote");
                writer.RenderEndTag();                  // A
                writer.Write("]");

                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    // Get Link
                    writer.Write("[");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&searchpage=&threadspage=") + "#" + PostID);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write("Get Link");
                    writer.RenderEndTag();                       // A
                    writer.Write("]");
                }

                writer.RenderEndTag();                  // Td

                writer.AddAttribute(HtmlTextWriterAttribute.Align, "Right");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                // Edit link (only allowed if this post by currently logged on user or an administrator)
                if (User.UserID == loggedOnUserID || page.User.IsInRole("ForumAdmin"))
                {
                    writer.Write("[");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=edit", PostID), "searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write("Edit");
                    writer.RenderEndTag();                      // A
                    writer.Write("]");
                }

                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
                writer.RenderEndTag();                  // Table

                writer.RenderEndTag();                  // Td
                writer.RenderEndTag();                  // Tr
            }

            // Close out table and this row
            writer.RenderEndTag();              // Table
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr
        }
        private void PopulateUnits()
        {
            if (_action == "new" || _action == "reply" || _action == "quote")
            {
                ForumText aliasForumText = new ForumText(UserDB.GetUser(_userID).Alias);
                _nameLabel.Text = aliasForumText.ProcessSingleLine(GetImages());
            }

            if (_action == "edit" || _action == "reply" || _action == "quote")
            {
                _forumPost = ForumDB.GetPost(_postID);

                if (_action == "edit")
                {
                    if (LoggedOnUserID != _forumPost.User.UserID && !Page.User.IsInRole("ForumAdmin"))
                        RedirectUserHasNoAuthority();

                    ForumText postAliasForumText = new ForumText(_forumPost.User.Alias);
                    _nameLabel.Text = postAliasForumText.ProcessSingleLine(GetImages());
                    _subjectTextBox.Text = _forumPost.Subject;
                    _bodyTextBox.Text = _forumPost.Body;
                    _notifyCheckBox.Checked = _forumPost.Notify;
                }
                else
                {
                    // If action is quote or reply, make sure subject begins "Re:"
                    string subject = _forumPost.Subject;
                    string replySubject = subject;
                    if (replySubject.Length >= 3)
                    {
                        if (replySubject.Substring(0, 3) != "Re:")
                            replySubject = "Re: " + replySubject;
                    }
                    else
                    {
                        replySubject = "Re: " + replySubject;
                    }
                    _subjectTextBox.Text = replySubject;

                    // If action is quote, add message being replied to within QUOTE tags
                    if (_action == "quote")
                    {
                        ForumText forumText = new ForumText(_forumPost.Body);
                        _bodyTextBox.Text = forumText.ProcessQuoteBody(_forumPost.User.Alias);
                    }
                }
            }

            if (_pinnedDropDownList != null && !Page.IsPostBack)
            {
                _pinnedDropDownList.Items.Add(new ListItem("Not Sticky", "0"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Day", "1"));
                _pinnedDropDownList.Items.Add(new ListItem("3 Days", "3"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Week", "7"));
                _pinnedDropDownList.Items.Add(new ListItem("2 Weeks", "14"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Month", "30"));
                _pinnedDropDownList.Items.Add(new ListItem("3 Months", "90"));
                _pinnedDropDownList.Items.Add(new ListItem("6 Months", "180"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Year", "365"));
                _pinnedDropDownList.Items.Add(new ListItem("3 Years", "1095"));
            }
        }
        public void Render(HtmlTextWriter writer, bool displayActions, ForumUtils.ForumView forumView, bool selected, DateTime lastVisited, Page page, int loggedOnUserID, string avatar, string images, string document)
        {
            // New row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Left hand side contains user information (user alias, avatar, number of posts etc)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "160");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // We will put this user information in its own table in the first column
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "160");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // User alias and number of posts
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            ForumText userAliasForumText = new ForumText(User.Alias);
            writer.Write(userAliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();	// B
            writer.RenderBeginTag(HtmlTextWriterTag.Br);
            writer.Write(string.Format("Posts: {0}", User.PostCount));
            writer.RenderEndTag();	// Br
            writer.RenderEndTag();	// Td
            writer.RenderEndTag();	// Tr

            // Avatar
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_avatarrow");
                if (!selected)
                    writer.AddStyleAttribute("display", "none");
            }
            if ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (avatar != string.Empty)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, avatar);
                    writer.RenderBeginTag(HtmlTextWriterTag.Img);
                    writer.RenderEndTag();	// Img
                }
                writer.RenderEndTag();	// Td
                writer.RenderEndTag();	// Tr
            }

            // End user information table
            writer.RenderEndTag();	// Table
            writer.RenderEndTag();	// Td

            // Start row which will display subject, body and actions (reply, edit, etc)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            if (forumView != ForumUtils.ForumView.FlatView && !selected)
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_headercell");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Start a new table for this information
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "3");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            if (forumView != ForumUtils.ForumView.FlatView && !selected)
                writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_messagetable");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // Highlighted row (subject and when posted information)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            if (forumView != ForumUtils.ForumView.FlatView)
                RenderLevelIndentCell(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, PostID.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.RenderEndTag();

            // Provide link to select a different post
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&searchpage=&threadspage=") + "#" + PostID);
            if (forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "DynMessLink");
                writer.AddAttribute(HtmlTextWriterAttribute.Name, PostID.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.A);

            ForumText subjectForumText = new ForumText(Subject);
            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();	// A
            writer.RenderEndTag();	// B

            // Display new image if this post is new since last time user visited
            if (lastVisited < PostDate)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Br);
            writer.Write(string.Format("Posted: {0} {1}", PostDate.ToString("dd MMM yy"), PostDate.ToString("t")));
            writer.RenderEndTag();	// Br
            writer.RenderEndTag();	// Td
            writer.RenderEndTag();	// Tr

            // Message row
            if ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_messagerow");
                    if (!selected)
                        writer.AddStyleAttribute("display", "none");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (forumView != ForumUtils.ForumView.FlatView)
                    RenderLevelIndentCell(writer);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                ForumText bodyForumText = new ForumText(Body);
                writer.Write(bodyForumText.Process(images));

                writer.RenderEndTag();	// Td
                writer.RenderEndTag();	// Tr
            }

            // Reply, Quote, Edit, Get Link row
            if (displayActions && ((selected && forumView == ForumUtils.ForumView.TreeView) || forumView != ForumUtils.ForumView.TreeView))
            {
                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, PostID.ToString() + "_actionsrow");
                    if (!selected)
                        writer.AddStyleAttribute("display", "none");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                if (forumView != ForumUtils.ForumView.FlatView)
                    RenderLevelIndentCell(writer);
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.AddAttribute(HtmlTextWriterAttribute.Align, "Left");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                // Reply link
                writer.Write("[");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=reply", PostID), "searchpage=&threadspage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Reply");
                writer.RenderEndTag();	// A
                writer.Write("]");

                // Quote link
                writer.Write("[");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=quote", PostID), "searchpage=&threadspage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Quote");
                writer.RenderEndTag();	// A
                writer.Write("]");

                if (forumView == ForumUtils.ForumView.TreeViewDynamic)
                {
                    // Get Link
                    writer.Write("[");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&searchpage=&threadspage=") + "#" + PostID);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write("Get Link");
                    writer.RenderEndTag();	 // A
                    writer.Write("]");
                }

                writer.RenderEndTag();	// Td

                writer.AddAttribute(HtmlTextWriterAttribute.Align, "Right");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                // Edit link (only allowed if this post by currently logged on user or an administrator)
                if (User.UserID == loggedOnUserID || page.User.IsInRole("ForumAdmin"))
                {
                    writer.Write("[");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}&forumaction=edit", PostID), "searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write("Edit");
                    writer.RenderEndTag();	// A
                    writer.Write("]");
                }

                writer.RenderEndTag();	// Td
                writer.RenderEndTag();	// Tr
                writer.RenderEndTag();	// Table

                writer.RenderEndTag();	// Td
                writer.RenderEndTag();	// Tr
            }

            // Close out table and this row
            writer.RenderEndTag();	// Table
            writer.RenderEndTag();	// Td
            writer.RenderEndTag();	// Tr
        }
        public void Render(HtmlTextWriter writer, int threadsPerPage, DateTime lastVisited, Page page, string images, string document, int postsPerPage, ForumUtils.ForumView forumView)
        {
            // Start row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Render thread image.  If the total number of posts in this thread is great than the
            // number of posts that can be displayed on one page, then we display a special image that
            // indicates this thread is "on fire".
            int totalPosts = (int)Replies + 1;
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "25");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if (totalPosts > threadsPerPage)
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread_fire.gif");
            else
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread.gif");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();	// Img
            writer.RenderEndTag();	// Td

            // Thread subject with link (and indicate whether or not this thread is pinned)
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            if (PinnedDate > DateTime.Now)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.Write("Sticky: ");
                writer.RenderEndTag();	// B
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", ThreadID), "forumaction=&searchpage=&threadspage=") + string.Format("#{0}", ThreadID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            ForumText subjectForumText = new ForumText(Subject);
            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();	// A

            // If thread spans several pages, then we need to indicate this in the thread list
            // by displaying text like (Page 1, 2, 3, ..., 5)
            if (totalPosts > threadsPerPage)
            {
                writer.Write(" (Page: ");
                int pageCount = ((totalPosts - 1)/threadsPerPage) + 1;
                int pageCountCapped = Math.Min(pageCount, 4);
                bool showFinalPage = (pageCountCapped < pageCount);
                for (int threadPage = 0; threadPage < pageCountCapped; threadPage++)
                {
                    int postID = ForumDB.GetPostFromThreadAndPage(ThreadID, threadPage, postsPerPage, forumView);
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", postID), "forumaction=&searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(string.Format("{0}", threadPage + 1));
                    writer.RenderEndTag();	// A
                    if ((threadPage < pageCountCapped - 1) || showFinalPage)
                        writer.Write(", ");
                }
                if (showFinalPage)
                {
                    if (pageCount > 5)
                        writer.Write("..., ");
                    int postID = ForumDB.GetPostFromThreadAndPage(ThreadID, pageCount - 1, postsPerPage, forumView);
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", postID), "forumaction=&searchpage=&threadspage="));
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(pageCount.ToString());
                    writer.RenderEndTag();	// A
                }
                writer.Write(")");
            }

            // Display new image if this thread is new since last time user visited
            if (lastVisited < _dateLastPost)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // Started by
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            ForumText startedByAliasForumText = new ForumText(StartedByAlias);
            writer.Write(startedByAliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // Replies
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(Replies);
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // Views
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(Views);
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // Last Post
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "140");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionSmallerFont");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(DateLastPost.ToString("dd MMM yy"));
            writer.Write("&nbsp;");
            writer.Write(DateLastPost.ToString("t"));
            writer.Write("<BR>");
            ForumText lastPostAliasForumText = new ForumText(LastPostAlias);
            writer.Write(lastPostAliasForumText.ProcessSingleLine(images));
            writer.Write("&nbsp;");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", LastPostID), "forumaction=&searchpage=&threadspage=") + string.Format("#{0}", LastPostID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "last_post.gif");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();	// Img
            writer.RenderEndTag();	// A
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Span
            writer.RenderEndTag();	// Td

            // End row
            writer.RenderEndTag();	// Tr
        }
Exemplo n.º 10
0
        public void Render(HtmlTextWriter writer, DateTime lastVisited, Page page, string images, string document)
        {
            // Start row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Render post image
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "25");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "board_thread.gif");
            writer.RenderBeginTag(HtmlTextWriterTag.Img);
            writer.RenderEndTag();              // Img
            writer.RenderEndTag();              // Td

            // Post subject with hyperlink
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRow");
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "middle");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(document, page, string.Format("postid={0}", PostID), "forumaction=&threadspage=&searchpage=&searchterms=") + string.Format("#{0}", PostID));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            ForumText subjectForumText = new ForumText(Subject);

            writer.Write(subjectForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // A

            // Display new image if this post is new since last time user visited
            if (lastVisited < PostDate)
            {
                writer.Write(" ");
                writer.AddAttribute(HtmlTextWriterAttribute.Src, images + "new.gif");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Posted by
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            ForumText aliasForumText = new ForumText(Alias);

            writer.Write(aliasForumText.ProcessSingleLine(images));
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // Date
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionRowHighlight");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(string.Format("{0}", PostDate.ToString("dd MMM yy")));
            writer.RenderEndTag();              // Span
            writer.RenderEndTag();              // Td

            // End row
            writer.RenderEndTag();              // Tr
        }
Exemplo n.º 11
0
        private void PopulateUnits()
        {
            if (_action == "new" || _action == "reply" || _action == "quote")
            {
                ForumText aliasForumText = new ForumText(UserDB.GetUser(_userID).Alias);
                _nameLabel.Text = aliasForumText.ProcessSingleLine(GetImages());
            }

            if (_action == "edit" || _action == "reply" || _action == "quote")
            {
                _forumPost = ForumDB.GetPost(_postID);

                if (_action == "edit")
                {
                    if (LoggedOnUserID != _forumPost.User.UserID && !Page.User.IsInRole("ForumAdmin"))
                    {
                        RedirectUserHasNoAuthority();
                    }

                    ForumText postAliasForumText = new ForumText(_forumPost.User.Alias);
                    _nameLabel.Text         = postAliasForumText.ProcessSingleLine(GetImages());
                    _subjectTextBox.Text    = _forumPost.Subject;
                    _bodyTextBox.Text       = _forumPost.Body;
                    _notifyCheckBox.Checked = _forumPost.Notify;
                }
                else
                {
                    // If action is quote or reply, make sure subject begins "Re:"
                    string subject      = _forumPost.Subject;
                    string replySubject = subject;
                    if (replySubject.Length >= 3)
                    {
                        if (replySubject.Substring(0, 3) != "Re:")
                        {
                            replySubject = "Re: " + replySubject;
                        }
                    }
                    else
                    {
                        replySubject = "Re: " + replySubject;
                    }
                    _subjectTextBox.Text = replySubject;

                    // If action is quote, add message being replied to within QUOTE tags
                    if (_action == "quote")
                    {
                        ForumText forumText = new ForumText(_forumPost.Body);
                        _bodyTextBox.Text = forumText.ProcessQuoteBody(_forumPost.User.Alias);
                    }
                }
            }

            if (_pinnedDropDownList != null && !Page.IsPostBack)
            {
                _pinnedDropDownList.Items.Add(new ListItem("Not Sticky", "0"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Day", "1"));
                _pinnedDropDownList.Items.Add(new ListItem("3 Days", "3"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Week", "7"));
                _pinnedDropDownList.Items.Add(new ListItem("2 Weeks", "14"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Month", "30"));
                _pinnedDropDownList.Items.Add(new ListItem("3 Months", "90"));
                _pinnedDropDownList.Items.Add(new ListItem("6 Months", "180"));
                _pinnedDropDownList.Items.Add(new ListItem("1 Year", "365"));
                _pinnedDropDownList.Items.Add(new ListItem("3 Years", "1095"));
            }
        }
        private void RenderPosts(HtmlTextWriter writer)
        {
            // Header row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Author
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;Author&nbsp;");
            writer.RenderEndTag();	// Td

            // Thread
            ForumPost firstForumPost = (ForumPost) _forumPostCollection[0];
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            ForumText subjectForumText = new ForumText(firstForumPost.Subject);
            writer.Write(string.Format("&nbsp;Thread: {0}", subjectForumText.ProcessSingleLine(GetImages())));
            writer.RenderEndTag();	// Td
            writer.RenderEndTag();	// Tr

            // Work out when to display new images
            string cookieName = "Forum" + ForumID + "_LastVisited";
            DateTime lastVisited = Convert.ToDateTime(Page.Session[cookieName]);

            // Loop round rows in selected thread
            string document = GetDocument();
            string images = GetImages();
            foreach (ForumPost forumPost in _forumPostCollection)
            {
                bool selected = (_postID == forumPost.PostID);
                string avatar = forumPost.User.Avatar;
                if (avatar != string.Empty)
                    avatar = GetAvatar(avatar);
                forumPost.Render(writer, true, _forumView, selected, lastVisited, Page, LoggedOnUserID, avatar, images, document);
            }
        }