Exemplo n.º 1
0
        /// <summary>
        /// Formats the Last Post for the Topic Line
        /// </summary>
        /// <returns>Formatted Last Post Text</returns>
        protected string FormatLastPost()
        {
            string      strReturn = ForumPage.GetText("no_posts");
            DataRowView row       = m_row;

            if (row["LastMessageID"].ToString().Length > 0)
            {
                string strMiniPost = ForumPage.GetThemeContents("ICONS", (DateTime.Parse(row["LastPosted"].ToString()) > Mession.LastVisit) ? "ICON_NEWEST" : "ICON_LATEST");

                string strBy =
                    String.Format(ForumPage.GetText("by"), String.Format("<a href=\"{0}\">{1}</a>&nbsp;<a title=\"{4}\" href=\"{3}\"><img border=0 src='{2}'></a>",
                                                                         OrionGlobals.resolveBase(string.Format("userinfo.aspx?id={0}", row["LastUserID"])),
                                                                         BBCode.EncodeHTML(row["LastUserName"].ToString()),
                                                                         strMiniPost,
                                                                         Forum.GetLink(Pages.posts, "m={0}#{0}", row["LastMessageID"]),
                                                                         ForumPage.GetText("GO_LAST_POST")
                                                                         ));

                strReturn =
                    String.Format("{0}<br />{1}",
                                  ForumPage.FormatDateTimeTopic(Convert.ToDateTime(row["LastPosted"])),
                                  strBy);
            }

            return(strReturn);
        }
Exemplo n.º 2
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            DataTable dt     = (DataTable)ViewState["data"];
            bool      bTopic = ForumPage.PageTopicID > 0;

            try
            {
                if (dt == null)
                {
                    if (bTopic)
                    {
                        dt = DB.active_listtopic(ForumPage.PageTopicID);
                    }
                    else
                    {
                        dt = DB.active_listforum(ForumPage.PageForumID);
                    }
                    ViewState["data"] = dt;
                }

                if (bTopic)
                {
                    writer.WriteLine("<tr class=\"header2\">");
                    writer.WriteLine(String.Format("<td colspan=\"3\">{0}</td>", ForumPage.GetText("TOPICBROWSERS")));
                    writer.WriteLine("</tr>");
                    writer.WriteLine("<tr class=\"post\">");
                    writer.WriteLine("<td colspan=\"3\">");
                }
                else
                {
                    writer.WriteLine("<tr class=\"header2\">");
                    writer.WriteLine(String.Format("<td colspan=\"6\">{0}</td>", ForumPage.GetText("FORUMUSERS")));
                    writer.WriteLine("</tr>");
                    writer.WriteLine("<tr class=\"post\">");
                    writer.WriteLine("<td colspan=\"6\">");
                }

                bool bFirst = true;
                foreach (DataRow dr in dt.Rows)
                {
                    if (!bFirst)
                    {
                        writer.WriteLine(",");
                    }
                    else
                    {
                        bFirst = false;
                    }
                    writer.Write(String.Format("<a href=\"{0}\">{1}</a>", OrionGlobals.resolveBase(string.Format("userinfo.aspx?id={0}", dr["UserID"])), BBCode.EncodeHTML(dr["UserName"].ToString())));
                }
                writer.WriteLine("</td>");
                writer.WriteLine("</tr>");
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            System.Text.StringBuilder html = new System.Text.StringBuilder(2000);

            html.AppendFormat("<tr class=\"{0}\">", (IsAlt ? "post_alt" : "post"));

            // Icon
            string imgTitle = "", img = GetTopicImage(m_row, ref imgTitle);

            html.AppendFormat("<td><img title='{1}' src='{0}'></td>", img, imgTitle);
            // Topic
            html.AppendFormat("<td><span class='post_priority'>{0}</span>", GetPriorityMessage(m_row));
            if (FindUnread)
            {
                html.AppendFormat("<a href='{0}' class='post_link'>{1}</a>", Forum.GetLink(Pages.posts, "t={0}&find=unread", m_row["LinkTopicID"]), Utils.BadWordReplace(Convert.ToString(m_row["Subject"])));
            }
            else
            {
                html.AppendFormat("<a href='{0}' class='post_link'>{1}</a>", Forum.GetLink(Pages.posts, "t={0}", m_row["LinkTopicID"]), Utils.BadWordReplace(Convert.ToString(m_row["Subject"])));
            }

            string tPager = CreatePostPager(Convert.ToInt32(m_row["Replies"]) + 1, ForumPage.BoardSettings.PostsPerPage, Convert.ToInt32(m_row["LinkTopicID"]));

            if (tPager != String.Empty)
            {
                // more then one page to show
                html.AppendFormat("<br/><span class='smallfont'>{0}</span>", String.Format(ForumPage.GetText("GOTO_POST_PAGER"), tPager));
            }

            //html.AppendFormat("<br/><span class='smallfont'>{0}: {1}</span>",ForumPage.GetText("TOPICS","CREATED"),ForumPage.FormatDateShort(m_row["Posted"]));

            html.Append("</td>");
            // Topic Starter
            html.AppendFormat("<td><a href='{0}'>{1}</a></td>", OrionGlobals.resolveBase(string.Format("userinfo.aspx?id={0}", m_row["UserID"])), BBCode.EncodeHTML(m_row["Starter"].ToString()));
            // Replies
            html.AppendFormat("<td align=center>{0}</td>", FormatReplies());
            // Views
            html.AppendFormat("<td align=center>{0:N0}</td>", m_row["Views"]);
            // Last Post
            html.AppendFormat("<td align=center class=smallfont>{0}</td>", FormatLastPost());
            writer.Write(html.ToString());

            base.RenderChildren(writer);

            writer.Write("</tr>");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the text for the "Last Post" information on a forum listing.
        /// Detects user permissions and disables links if they have none.
        /// </summary>
        /// <param name="row">Current data row</param>
        /// <returns>Formatted "Last Post" text</returns>
        protected string FormatLastPost(System.Data.DataRow row)
        {
            if (row["RemoteURL"] != DBNull.Value)
            {
                return("-");
            }

            int ForumID = Convert.ToInt32(row["ForumID"]);
            // defaults to "no posts" text
            string strTemp = ForumPage.GetText("NO_POSTS");

            if (!row.IsNull("LastPosted"))
            {
                strTemp = ForumPage.GetThemeContents("ICONS", (DateTime.Parse(Convert.ToString(row["LastPosted"])) > Mession.LastVisit) ? "ICON_NEWEST" : "ICON_LATEST");

                if (int.Parse(row["ReadAccess"].ToString()) > 0)
                {
                    strTemp = String.Format("{0}<br/>{1}<br/>{2}&nbsp;<a title=\"{4}\" href=\"{5}\"><img src=\"{3}\"></a>",
                                            ForumPage.FormatDateTimeTopic((DateTime)row["LastPosted"]),
                                            String.Format(ForumPage.GetText("in"), String.Format("<a href=\"{0}\">{1}</a>", Forum.GetLink(Pages.posts, "t={0}", row["LastTopicID"]), Truncate(Utils.BadWordReplace(row["LastTopicName"].ToString()), 50))),
                                            String.Format(ForumPage.GetText("by"), String.Format("<a href=\"{0}\">{1}</a>", OrionGlobals.resolveBase(string.Format("userinfo.aspx?id={0}", row["LastUserID"])), BBCode.EncodeHTML(row["LastUser"].ToString()))),
                                            strTemp,
                                            ForumPage.GetText("GO_LAST_POST"),
                                            Forum.GetLink(Pages.posts, "m={0}#{0}", row["LastMessageID"])
                                            );
                }
                else
                {
                    // no access to this forum... disable links
                    strTemp = String.Format("{0}<br/>{1}<br/>{2}",
                                            ForumPage.FormatDateTimeTopic((DateTime)row["LastPosted"]),
                                            String.Format(ForumPage.GetText("in"), String.Format("{0}", Truncate(row["LastTopicName"].ToString(), 50))),
                                            String.Format(ForumPage.GetText("by"), String.Format("<a href=\"{0}\">{1}</a>", OrionGlobals.resolveBase(string.Format("userinfo.aspx?id={0}", row["LastUserID"])), row["LastUser"]))
                                            );
                }
            }

            return(strTemp);
        }