/// <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> <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); }
/// <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} <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); }