示例#1
0
        private void RenderSearchPaging(HtmlTextWriter writer)
        {
            // Start the new column
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // First, previous, next, last thread hyperlinks
            int  pageCount = ((_postsCount - 1) / ForumUtils.GetPostsPerPage()) + 1;
            bool backwards = _searchPage != 0;
            bool forwards  = _searchPage != pageCount - 1;

            // << First and < Previous links
            if (backwards)
            {
                // << First
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, "", "postid=&threadspage=&searchpage="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("<<");
                writer.RenderEndTag();                  // A
                writer.Write("&nbsp;");

                // < Previous
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("searchpage={0}", _searchPage), "postid="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("< Previous");
                writer.RenderEndTag();                  // A
            }

            // Divider
            if (backwards && forwards)
            {
                writer.Write("&nbsp;|&nbsp;");
            }

            // Next > and Last >> links
            if (forwards)
            {
                // Next >
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("searchpage={0}", _searchPage + 2), "postid="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Next >");
                writer.RenderEndTag();                  // A
                writer.Write("&nbsp;");

                // Last >>
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("searchpage={0}", pageCount), "postid="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(">>");
                writer.RenderEndTag();                  // A
            }

            // Close column
            writer.RenderEndTag();              // Td
        }
示例#2
0
        private void RenderThreads(HtmlTextWriter writer)
        {
            // Render header row
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;Thread&nbsp;");
            writer.RenderEndTag();              // Td

            // Started by column
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;Started By&nbsp;");
            writer.RenderEndTag();              // Td

            // Replies column
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;Replies&nbsp;");
            writer.RenderEndTag();              // Td

            // Views column
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;Views&nbsp;");
            writer.RenderEndTag();              // Td

            // Last Post column
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "WebSolutionHeader");
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "center");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;Last Post&nbsp;");
            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 thread items, rendering information about individual threads
            string document = GetDocument();
            string images   = GetImages();

            foreach (ForumThreadInfo forumThreadInfo in _forumThreadInfoCollection)
            {
                forumThreadInfo.Render(writer, ForumUtils.GetPostsPerPage(), lastVisited, Page, images, document, ForumUtils.GetPostsPerPage(), ForumUtils.GetForumView(Page));
            }
        }
示例#3
0
        private void RenderFooter(HtmlTextWriter writer)
        {
            // Start the footer row
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "4");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Into which we will put a table that will contain
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // Start row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // On the left hand side: Page x of y
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            int pageCount = ((_postsCount - 1) / ForumUtils.GetPostsPerPage()) + 1;

            if (_postsCount == 0)
            {
                writer.Write("&nbsp;No Search Results");
            }
            else
            {
                writer.Write(string.Format("&nbsp;Page {0} of {1}", _searchPage + 1, pageCount));
            }
            writer.RenderEndTag();              // B
            writer.RenderEndTag();              // Td

            // And on the right hand side, render search navigation (<< < Previous | Next > >>)
            RenderSearchPaging(writer);

            // Close out this table and row
            writer.RenderEndTag();              // Tr
            writer.RenderEndTag();              // Table
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr
        }
示例#4
0
        private void RenderFooter(HtmlTextWriter writer)
        {
            // Start the footer row
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "25");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Into which we will put a table that will contain
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // On the left hand side: Page x of y
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "left");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // Page x of y text
            int pageCount = ((ForumDB.GetThreadRepliesCount(_threadID)) / ForumUtils.GetPostsPerPage()) + 1;

            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write(string.Format("&nbsp;Page {0} of {1}", _threadPage + 1, pageCount));
            writer.RenderEndTag();              // B
            writer.RenderEndTag();              // Td

            // And on the right hand side, render thread navigation (<< < Previous | Next > >>)
            RenderThreadPaging(writer, pageCount);

            // Close out this table and row
            writer.RenderEndTag();              // Tr
            writer.RenderEndTag();              // Table
            writer.RenderEndTag();              // Td
            writer.RenderEndTag();              // Tr
        }
示例#5
0
        public override void OnPreRender()
        {
            // Determine whether we are in flat view or tree view mode.  This setting is
            // stored in a cookie, but should probably be moved in to the user's profile
            // which is stored in the database.
            if (!_viewDropDownSelected)
            {
                _forumView = ForumUtils.GetForumView(Page);
            }
            ListItem listItem = _viewDropDownList.Items.FindByValue(_forumView.ToString());

            if (listItem != null)
            {
                listItem.Selected = true;
            }

            // _threadID identifies the thread we are currently viewing.  _postID identifies
            // the post within the thread that is currently being shown. (i.e. in tree view,
            // only one post can be viewed at a time).  _threadID can be obtained from the value
            // of _postID.  We will also determine what page we are looking at.
            _threadID   = ForumDB.GetThreadFromPost(_postID);
            _threadPage = ForumDB.GetSortOrderFromPost(_postID, _forumView) / ForumUtils.GetPostsPerPage();

            // If looking at the first post in a thread, then increment the thread view count
            if (_threadID == _postID)
            {
                ForumDB.IncrementThreadViews(_threadID);
            }

            // Get page of posts that will be rendered
            _forumPostCollection = ForumDB.GetThread(_threadID, _threadPage, ForumUtils.GetPostsPerPage(), _forumView);

            // Register javascript for dynamically showing threads in tree view
            if (_forumView == ForumUtils.ForumView.TreeViewDynamic)
            {
                RegisterJavascript();
            }
        }
示例#6
0
 public override void OnPreRender()
 {
     // Get search results that will be rendered and the total number of search results
     _forumSearchInfoCollection = ForumDB.GetForumSearchResults(_searchTerms, ForumID, ForumUtils.GetPostsPerPage(), _searchPage);
     if (_forumSearchInfoCollection.Count > 0)
     {
         _postsCount = ((ForumSearchInfo)_forumSearchInfoCollection[0]).RecordCount;
     }
 }
示例#7
0
        private void RenderThreadPaging(HtmlTextWriter writer, int pageCount)
        {
            // Start the new column
            writer.AddAttribute(HtmlTextWriterAttribute.Align, "right");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "50%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            // First, previous, next, last thread hyperlinks
            bool backwards = _threadPage != 0;
            bool forwards  = _threadPage != pageCount - 1;

            // << First and < Previous links
            if (backwards)
            {
                int postID = 0;

                // << First
                postID = _threadID;
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("postid={0}", postID), "forumaction="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("&lt;&lt;");
                writer.RenderEndTag();                  // A
                writer.Write("&nbsp;");

                // < Previous
                postID = ForumDB.GetPostFromThreadAndPage(_threadID, _threadPage - 1, ForumUtils.GetPostsPerPage(), _forumView);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("postid={0}", postID), "forumaction="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("&lt;&nbsp;Previous");
                writer.RenderEndTag();                  // A
            }

            // Divider
            if (backwards && forwards)
            {
                writer.Write("&nbsp;|&nbsp;");
            }

            // Next > and Last >> links
            if (forwards)
            {
                int postID = 0;

                // Next >
                postID = ForumDB.GetPostFromThreadAndPage(_threadID, _threadPage + 1, ForumUtils.GetPostsPerPage(), _forumView);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("postid={0}", postID), "forumaction="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("Next&nbsp;&gt;");
                writer.RenderEndTag();
                writer.Write("&nbsp;");

                // Last >>
                postID = ForumDB.GetPostFromThreadAndPage(_threadID, pageCount - 1, ForumUtils.GetPostsPerPage(), _forumView);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, WebSolutionUtils.GetURL(GetDocument(), Page, string.Format("postid={0}", postID), "forumaction="));
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write("&gt;&gt;");
                writer.RenderEndTag();
            }

            // Close column
            writer.Write("&nbsp;");
            writer.RenderEndTag();              // Td
        }