/// <summary> /// The init reply to topic. /// </summary> private void InitReplyToTopic() { DataRow topic = DB.topic_info(this.TopicID); var topicFlags = new TopicFlags(SqlDataLayerConverter.VerifyInt32(topic["Flags"])); // Ederon : 9/9/2007 - moderators can reply in locked topics if (topicFlags.IsLocked && !this.PageContext.ForumModeratorAccess) { this.Response.Redirect(this.Request.UrlReferrer.ToString()); } this.SubjectRow.Visible = false; this.Title.Text = this.GetText("reply"); // add topic link... this.PageLinks.AddLink( this.Server.HtmlDecode(topic["Topic"].ToString()), YafBuildLink.GetLink(ForumPages.posts, "t={0}", this.TopicID)); // add "reply" text... this.PageLinks.AddLink(this.GetText("reply")); // show attach file option if its a reply... if (this.PageContext.ForumUploadAccess) { this.PostOptions1.Visible = true; this.PostOptions1.AttachOptionVisible = true; } // show the last posts AJAX frame... this.LastPosts1.Visible = true; this.LastPosts1.TopicID = this.TopicID.Value; }
/// <summary> /// Initializes a new instance of the <see cref="TypedMessageList" /> class. /// </summary> /// <param name="messageid">The messageid.</param> /// <param name="userid">The userid.</param> /// <param name="username">The username.</param> /// <param name="message">The message.</param> /// <param name="topicid">The topicid.</param> /// <param name="forumid">The forumid.</param> /// <param name="topic">The topic.</param> /// <param name="priority">The priority.</param> /// <param name="flags">The flags.</param> /// <param name="topicownerid">The topicownerid.</param> /// <param name="edited">The edited.</param> /// <param name="topicflags">The topicflags.</param> /// <param name="forumflags">The forumflags.</param> /// <param name="editreason">The editreason.</param> /// <param name="position">The position.</param> /// <param name="ismoderatorchanged">The ismoderatorchanged.</param> /// <param name="deletereason">The deletereason.</param> /// <param name="blogpostid">The blogpostid.</param> /// <param name="pollid">The pollid.</param> /// <param name="ip">The ip.</param> /// <param name="replyTo">The reply to.</param> /// <param name="externalmessageid">The externalmessageid.</param> /// <param name="referencemessageid">The referencemessageid.</param> /// <param name="description">The description.</param> /// <param name="status">The status.</param> /// <param name="styles">The styles.</param> public TypedMessageList( int?messageid, int?userid, [CanBeNull] string username, [CanBeNull] string message, int?topicid, int?forumid, [CanBeNull] string topic, int?priority, [CanBeNull] MessageFlags flags, int?topicownerid, DateTime?edited, [CanBeNull] TopicFlags topicflags, [CanBeNull] ForumFlags forumflags, [CanBeNull] string editreason, int?position, bool?ismoderatorchanged, [CanBeNull] string deletereason, [CanBeNull] string blogpostid, int?pollid, [CanBeNull] string ip, int?replyTo, [CanBeNull] string externalmessageid, [CanBeNull] string referencemessageid, [CanBeNull] string description, [CanBeNull] string status, [CanBeNull] string styles) { this.MessageID = messageid; this.UserID = userid; this.UserName = username; this.Message = message; this.TopicID = topicid; this.ForumID = forumid; this.Topic = topic; this.Priority = priority; this.Flags = flags; this.TopicOwnerID = topicownerid; this.Edited = edited; this.TopicFlags = topicflags; this.ForumFlags = forumflags; this.EditReason = editreason; this.Position = position; this.IsModeratorChanged = ismoderatorchanged; this.DeleteReason = deletereason; this.BlogPostID = blogpostid; this.PollID = pollid; this.IP = ip; this.ReplyTo = replyTo; this.ExternalMessageId = externalmessageid; this.ReferenceMessageId = referencemessageid; this.Status = status; this.Styles = styles; this.Description = description; }
private void InitReplyToTopic() { DataRow topic = DB.topic_info(TopicID); TopicFlags topicFlags = new TopicFlags(SqlDataLayerConverter.VerifyInt32(topic["Flags"])); // Ederon : 9/9/2007 - moderators can reply in locked topics if (topicFlags.IsLocked && !PageContext.ForumModeratorAccess) { Response.Redirect(Request.UrlReferrer.ToString()); } SubjectRow.Visible = false; Title.Text = GetText("reply"); // add topic link... PageLinks.AddLink(Server.HtmlDecode(topic ["Topic"].ToString()), YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "t={0}", TopicID)); // add "reply" text... PageLinks.AddLink(GetText("reply")); // show attach file option if its a reply... if (PageContext.ForumUploadAccess) { NewTopicOptionsRow.Visible = true; TopicAttach.Visible = true; TopicAttachLabel.Visible = true; TopicWatch.Visible = false; TopicWatchLabel.Visible = false; TopicAttachBr.Visible = false; } if (YAF.Classes.Config.IsDotNetNuke || YAF.Classes.Config.IsRainbow || YAF.Classes.Config.IsPortal) { // can't use the last post iframe LastPosts.Visible = true; LastPosts.DataSource = DB.post_list_reverse10(TopicID); LastPosts.DataBind(); } else { LastPostsIFrame.Visible = true; LastPostsIFrame.Attributes.Add("src", string.Format("{0}framehelper.aspx?g=lastposts&t={1}", YafForumInfo.ForumRoot, TopicID)); } }
/// <summary> /// Gets the topic image. /// </summary> /// <param name="row">The row.</param> /// <param name="imgTitle">The image title.</param> /// <returns> /// Returns the Topic Image /// </returns> protected string GetTopicImage([NotNull] DataRowView row, [NotNull] ref string imgTitle) { CodeContracts.VerifyNotNull(row, "row"); CodeContracts.VerifyNotNull(imgTitle, "imgTitle"); var lastPosted = row["LastPosted"] != DBNull.Value ? (DateTime)row["LastPosted"] : DateTimeHelper.SqlDbMinTime(); var topicFlags = new TopicFlags(row["TopicFlags"]); var forumFlags = new ForumFlags(row["ForumFlags"]); var isHot = this.IsPopularTopic(lastPosted, row); var theme = this.Get <ITheme>(); if (row["TopicMovedID"].ToString().Length > 0) { imgTitle = this.GetText("MOVED"); return(theme.GetItem("ICONS", "TOPIC_MOVED")); } var lastRead = this.Get <IReadTrackCurrentUser>() .GetForumTopicRead( row["ForumID"].ToType <int>(), row["TopicID"].ToType <int>(), row["LastForumAccess"].IsNullOrEmptyDBField() ? DateTimeHelper.SqlDbMinTime() : row["LastForumAccess"].ToType <DateTime?>(), row["LastTopicAccess"].IsNullOrEmptyDBField() ? DateTimeHelper.SqlDbMinTime() : row["LastForumAccess"].ToType <DateTime?>()); if (lastPosted > lastRead) { this.Get <IYafSession>().UnreadTopics++; if (row["PollID"] != DBNull.Value) { imgTitle = this.GetText("POLL_NEW"); return(theme.GetItem("ICONS", "TOPIC_POLL_NEW")); } switch (row["Priority"].ToString()) { case "1": imgTitle = this.GetText("STICKY_NEW"); return(theme.GetItem("ICONS", "TOPIC_STICKY_NEW")); case "2": imgTitle = this.GetText("ANNOUNCEMENT"); return(theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT_NEW")); default: if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.GetText("NEW_POSTS_LOCKED"); return(theme.GetItem("ICONS", "TOPIC_NEW_LOCKED")); } if (isHot) { imgTitle = this.GetText("ICONLEGEND", "HOT_NEW_POSTS"); return(theme.GetItem("ICONS", "TOPIC_HOT_NEW", theme.GetItem("ICONS", "TOPIC_NEW"))); } imgTitle = this.GetText("ICONLEGEND", "NEW_POSTS"); return(theme.GetItem("ICONS", "TOPIC_NEW")); } } if (row["PollID"] != DBNull.Value) { imgTitle = this.GetText("POLL"); return(theme.GetItem("ICONS", "TOPIC_POLL")); } switch (row["Priority"].ToString()) { case "1": imgTitle = this.GetText("STICKY"); return(theme.GetItem("ICONS", "TOPIC_STICKY")); case "2": imgTitle = this.GetText("ANNOUNCEMENT"); return(theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT")); default: if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.GetText("NO_NEW_POSTS_LOCKED"); return(theme.GetItem("ICONS", "TOPIC_LOCKED")); } if (isHot) { imgTitle = this.GetText("HOT_NO_NEW_POSTS"); return(theme.GetItem("ICONS", "TOPIC_HOT", theme.GetItem("ICONS", "TOPIC"))); } imgTitle = this.GetText("NO_NEW_POSTS"); return(theme.GetItem("ICONS", "TOPIC")); } }
protected void Page_Load( object sender, System.EventArgs e ) { _messageRow = null; if ( Request.QueryString ["m"] != null ) { using ( DataTable dt = DB.message_list( Request.QueryString ["m"] ) ) { _messageRow = dt.Rows [0]; } if ( !PageContext.ForumModeratorAccess && PageContext.PageUserID != ( int )_messageRow ["UserID"] ) { YafBuildLink.AccessDenied(); } } _forumFlags = new ForumFlags( _messageRow ["ForumFlags"] ); _topicFlags = new TopicFlags( _messageRow ["TopicFlags"] ); _ownerUserId = ( int )_messageRow ["UserID"]; _isModeratorChanged = ( PageContext.PageUserID != _ownerUserId ); if ( PageContext.PageForumID == 0 ) YafBuildLink.AccessDenied(); if ( Request ["t"] == null && !PageContext.ForumPostAccess ) YafBuildLink.AccessDenied(); if ( Request ["t"] != null && !PageContext.ForumReplyAccess ) YafBuildLink.AccessDenied(); if ( !IsPostBack ) { // setup page links PageLinks.AddLink( PageContext.BoardSettings.Name, YafBuildLink.GetLink( ForumPages.forum ) ); PageLinks.AddLink( PageContext.PageCategoryName, YafBuildLink.GetLink( ForumPages.forum, "c={0}", PageContext.PageCategoryID ) ); PageLinks.AddForumLinks( PageContext.PageForumID ); EraseMessage.Checked = false; ViewState ["delAll"] = false; EraseRow.Visible = false; DeleteReasonRow.Visible = false; LinkedPosts.Visible = false; ReasonEditor.Attributes.Add( "style", "width:100%" ); Cancel.Text = GetText( "Cancel" ); if ( Request.QueryString ["m"] != null ) { // delete message... PreviewRow.Visible = true; DataTable tempdb = DB.message_getRepliesList( Request.QueryString ["m"] ); if ( tempdb.Rows.Count != 0 && (PageContext.ForumModeratorAccess || PageContext.IsAdmin) ) { LinkedPosts.Visible = true; LinkedPosts.DataSource = tempdb; LinkedPosts.DataBind(); } if ( Request.QueryString ["action"].ToLower() == "delete" ) { Title.Text = GetText( "EDIT" ); //GetText("EDIT"); Delete.Text = GetText( "DELETE" ); // "GetText("Save"); if ( PageContext.IsAdmin ) { EraseRow.Visible = true; } } else { Title.Text = GetText( "EDIT" ); Delete.Text = GetText( "UNDELETE" ); // "GetText("Save"); } Subject.Text = Convert.ToString( _messageRow ["Topic"] ); DeleteReasonRow.Visible = true; ReasonEditor.Text = Convert.ToString( _messageRow ["DeleteReason"] ); // populate the message preview with the message datarow... MessagePreview.Message = _messageRow["message"].ToString(); MessagePreview.MessageFlags.BitValue = Convert.ToInt32( _messageRow ["Flags"] ); } } }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.PageContext.IsGuest) { // Register Ajax Pro. Utility.RegisterTypeForAjax(typeof(YafFavoriteTopic)); // The html code for "Favorite Topic" theme buttons. string tagButtonHTML = "'<a class=\"yafcssbigbutton rightItem\" href=\"javascript:addFavoriteTopic(' + res.value + ');\" onclick=\"blur();\" title=\"{0}\"><span>{1}</span></a>'" .FormatWith( this.PageContext.Localization.GetText("BUTTON_TAGFAVORITE_TT"), this.PageContext.Localization.GetText("BUTTON_TAGFAVORITE")); string untagButtonHTML = "'<a class=\"yafcssbigbutton rightItem\" href=\"javascript:removeFavoriteTopic(' + res.value + ');\" onclick=\"blur();\" title=\"{0}\"><span>{1}</span></a>'" .FormatWith( this.PageContext.Localization.GetText("BUTTON_UNTAGFAVORITE_TT"), this.PageContext.Localization.GetText("BUTTON_UNTAGFAVORITE")); // Register the client side script for the "Favorite Topic". YafContext.Current.PageElements.RegisterJsBlockStartup( "addFavoriteTopicJs", JavaScriptBlocks.addFavoriteTopicJs(untagButtonHTML)); YafContext.Current.PageElements.RegisterJsBlockStartup( "removeFavoriteTopicJs", JavaScriptBlocks.removeFavoriteTopicJs(tagButtonHTML)); YafContext.Current.PageElements.RegisterJsBlockStartup( "asynchCallFailedJs", JavaScriptBlocks.asynchCallFailedJs); // Has the user already tagged this topic as favorite? if (this.Get <YafFavoriteTopic>().IsFavoriteTopic(this.PageContext.PageTopicID)) { // Generate the "Untag" theme button with appropriate JS calls for onclick event. this.TagFavorite1.NavigateUrl = "javascript:removeFavoriteTopic(" + this.PageContext.PageTopicID + ");"; this.TagFavorite2.NavigateUrl = "javascript:removeFavoriteTopic(" + this.PageContext.PageTopicID + ");"; this.TagFavorite1.TextLocalizedTag = "BUTTON_UNTAGFAVORITE"; this.TagFavorite1.TitleLocalizedTag = "BUTTON_UNTAGFAVORITE_TT"; this.TagFavorite2.TextLocalizedTag = "BUTTON_UNTAGFAVORITE"; this.TagFavorite2.TitleLocalizedTag = "BUTTON_UNTAGFAVORITE_TT"; } else { // Generate the "Tag" theme button with appropriate JS calls for onclick event. this.TagFavorite1.NavigateUrl = "javascript:addFavoriteTopic(" + this.PageContext.PageTopicID + ");"; this.TagFavorite2.NavigateUrl = "javascript:addFavoriteTopic(" + this.PageContext.PageTopicID + ");"; this.TagFavorite1.TextLocalizedTag = "BUTTON_TAGFAVORITE"; this.TagFavorite1.TitleLocalizedTag = "BUTTON_TAGFAVORITE_TT"; this.TagFavorite2.TextLocalizedTag = "BUTTON_TAGFAVORITE"; this.TagFavorite2.TitleLocalizedTag = "BUTTON_TAGFAVORITE_TT"; } } else { this.TagFavorite1.Visible = false; this.TagFavorite2.Visible = false; } this._quickReplyEditor.BaseDir = YafForumInfo.ForumClientFileRoot + "editors"; this._quickReplyEditor.StyleSheet = this.PageContext.Theme.BuildThemePath("theme.css"); this._topic = DB.topic_info(this.PageContext.PageTopicID); // in case topic is deleted or not existant if (this._topic == null) { YafBuildLink.RedirectInfoPage(InfoMessage.Invalid); } // get topic flags this._topicFlags = new TopicFlags(this._topic["Flags"]); using (DataTable dt = DB.forum_list(this.PageContext.PageBoardID, this.PageContext.PageForumID)) { this._forum = dt.Rows[0]; } this._forumFlags = new ForumFlags(this._forum["Flags"]); if (this.PageContext.IsGuest && !this.PageContext.ForumReadAccess) { // attempt to get permission by redirecting to login... this.Get <YafPermissions>().HandleRequest(ViewPermissions.RegisteredUsers); } else if (!this.PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { if (this.PageContext.Settings.LockedForum == 0) { this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); } this.QuickReply.Text = this.GetText("POSTMESSAGE", "SAVE"); this.DataPanel1.TitleText = this.GetText("QUICKREPLY"); this.DataPanel1.ExpandText = this.GetText("QUICKREPLY_SHOW"); this.DataPanel1.CollapseText = this.GetText("QUICKREPLY_HIDE"); this.PageLinks.AddForumLinks(this.PageContext.PageForumID); this.PageLinks.AddLink( this.Get <YafBadWordReplace>().Replace(this.Server.HtmlDecode(this.PageContext.PageTopicName)), string.Empty); this.TopicTitle.Text = this.Get <YafBadWordReplace>().Replace(this.HtmlEncode((string)this._topic["Topic"])); this.ViewOptions.Visible = this.PageContext.BoardSettings.AllowThreaded; this.ForumJumpHolder.Visible = this.PageContext.BoardSettings.ShowForumJump && this.PageContext.Settings.LockedForum == 0; this.RssTopic.NavigateUrl = YafBuildLink.GetLinkNotEscaped( ForumPages.rsstopic, "pg={0}&t={1}", this.Request.QueryString.GetFirstOrDefault("g"), this.PageContext.PageTopicID); this.RssTopic.Visible = this.PageContext.BoardSettings.ShowRSSLink; this.QuickReplyPlaceHolder.Visible = this.PageContext.BoardSettings.ShowQuickAnswer; if ((this.PageContext.IsGuest && this.PageContext.BoardSettings.EnableCaptchaForGuests) || (this.PageContext.BoardSettings.EnableCaptchaForPost && !this.PageContext.IsCaptchaExcluded)) { this.imgCaptcha.ImageUrl = "{0}resource.ashx?c=1".FormatWith(YafForumInfo.ForumClientFileRoot); this.CaptchaDiv.Visible = true; } if (!this.PageContext.ForumPostAccess || (this._forumFlags.IsLocked && !this.PageContext.ForumModeratorAccess)) { this.NewTopic1.Visible = false; this.NewTopic2.Visible = false; } // Ederon : 9/9/2007 - moderators can reply in locked topics if (!this.PageContext.ForumReplyAccess || ((this._topicFlags.IsLocked || this._forumFlags.IsLocked) && !this.PageContext.ForumModeratorAccess)) { this.PostReplyLink1.Visible = this.PostReplyLink2.Visible = false; this.QuickReplyPlaceHolder.Visible = false; } if (this.PageContext.ForumModeratorAccess) { this.MoveTopic1.Visible = true; this.MoveTopic2.Visible = true; } else { this.MoveTopic1.Visible = false; this.MoveTopic2.Visible = false; } if (!this.PageContext.ForumModeratorAccess) { this.LockTopic1.Visible = false; this.UnlockTopic1.Visible = false; this.DeleteTopic1.Visible = false; this.LockTopic2.Visible = false; this.UnlockTopic2.Visible = false; this.DeleteTopic2.Visible = false; } else { this.LockTopic1.Visible = !this._topicFlags.IsLocked; this.UnlockTopic1.Visible = !this.LockTopic1.Visible; this.LockTopic2.Visible = this.LockTopic1.Visible; this.UnlockTopic2.Visible = !this.LockTopic2.Visible; } } // Mark topic read YafContext.Current.Get <YafSession>().SetTopicRead(this.PageContext.PageTopicID, DateTime.UtcNow); this.BindData(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { this._messageRow = null; if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m") != null) { this._messageRow = LegacyDb.message_list( Security.StringToLongOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m"))) .GetFirstRowOrInvalid(); if (!this.PageContext.ForumModeratorAccess && this.PageContext.PageUserID != (int)this._messageRow["UserID"]) { YafBuildLink.AccessDenied(); } } this._forumFlags = new ForumFlags(this._messageRow["ForumFlags"]); this._topicFlags = new TopicFlags(this._messageRow["TopicFlags"]); this._ownerUserId = (int)this._messageRow["UserID"]; this._isModeratorChanged = this.PageContext.PageUserID != this._ownerUserId; if (this.PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("t") == null && !this.PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("t") != null && !this.PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } if (this.IsPostBack) { return; } // setup page links this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); this.PageLinks.AddForum(this.PageContext.PageForumID); this.EraseMessage.Checked = false; this.EraseRow.Visible = false; this.DeleteReasonRow.Visible = false; this.LinkedPosts.Visible = false; this.Cancel.Text = this.GetText("Cancel"); if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m") == null) { return; } // delete message... this.PreviewRow.Visible = true; DataTable tempdb = LegacyDb.message_getRepliesList(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m")); if (tempdb.HasRows() && (this.PageContext.ForumModeratorAccess || this.PageContext.IsAdmin)) { this.LinkedPosts.Visible = true; this.LinkedPosts.DataSource = tempdb; this.LinkedPosts.DataBind(); } if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("action").ToLower() == "delete") { this.Title.Text = this.GetText("EDIT"); this.Delete.Text = this.GetText("DELETE"); if (this.PageContext.IsAdmin) { this.EraseRow.Visible = true; } } else { this.Title.Text = this.GetText("EDIT"); this.Delete.Text = this.GetText("UNDELETE"); } this.Subject.Text = Convert.ToString(this._messageRow["Topic"]); this.DeleteReasonRow.Visible = true; this.ReasonEditor.Text = Convert.ToString(this._messageRow["DeleteReason"]); // populate the message preview with the message datarow... this.MessagePreview.Message = this._messageRow["message"].ToString(); this.MessagePreview.MessageFlags = new MessageFlags(this._messageRow["Flags"]); }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load(object sender, EventArgs e) { this._messageRow = null; if (this.Request.QueryString.GetFirstOrDefault("m") != null) { this._messageRow = DBHelper.GetFirstRowOrInvalid(DB.message_list(Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("m")))); if (!this.PageContext.ForumModeratorAccess && this.PageContext.PageUserID != (int)this._messageRow["UserID"]) { YafBuildLink.AccessDenied(); } } this._forumFlags = new ForumFlags(this._messageRow["ForumFlags"]); this._topicFlags = new TopicFlags(this._messageRow["TopicFlags"]); this._ownerUserId = (int)this._messageRow["UserID"]; this._isModeratorChanged = this.PageContext.PageUserID != this._ownerUserId; if (this.PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (this.Request["t"] == null && !this.PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (this.Request["t"] != null && !this.PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // setup page links this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); this.PageLinks.AddForumLinks(this.PageContext.PageForumID); this.EraseMessage.Checked = false; this.ViewState["delAll"] = false; this.EraseRow.Visible = false; this.DeleteReasonRow.Visible = false; this.LinkedPosts.Visible = false; this.ReasonEditor.Attributes.Add("style", "width:100%"); this.Cancel.Text = this.GetText("Cancel"); if (this.Request.QueryString.GetFirstOrDefault("m") != null) { // delete message... this.PreviewRow.Visible = true; DataTable tempdb = DB.message_getRepliesList(this.Request.QueryString.GetFirstOrDefault("m")); if (tempdb.Rows.Count != 0 && (this.PageContext.ForumModeratorAccess || this.PageContext.IsAdmin)) { this.LinkedPosts.Visible = true; this.LinkedPosts.DataSource = tempdb; this.LinkedPosts.DataBind(); } if (this.Request.QueryString.GetFirstOrDefault("action").ToLower() == "delete") { this.Title.Text = this.GetText("EDIT"); // GetText("EDIT"); this.Delete.Text = this.GetText("DELETE"); // "GetText("Save"); if (this.PageContext.IsAdmin) { this.EraseRow.Visible = true; } } else { this.Title.Text = this.GetText("EDIT"); this.Delete.Text = this.GetText("UNDELETE"); // "GetText("Save"); } this.Subject.Text = Convert.ToString(this._messageRow["Topic"]); this.DeleteReasonRow.Visible = true; this.ReasonEditor.Text = Convert.ToString(this._messageRow["DeleteReason"]); // populate the message preview with the message datarow... this.MessagePreview.Message = this._messageRow["message"].ToString(); this.MessagePreview.MessageFlags = new MessageFlags(this._messageRow["Flags"]); } } }
private void InitReplyToTopic() { DataRow topic = DB.topic_info( TopicID ); TopicFlags topicFlags = new TopicFlags(SqlDataLayerConverter.VerifyInt32(topic["Flags"])); // Ederon : 9/9/2007 - moderators can reply in locked topics if (topicFlags.IsLocked && !PageContext.ForumModeratorAccess) Response.Redirect( Request.UrlReferrer.ToString() ); SubjectRow.Visible = false; Title.Text = GetText( "reply" ); // add topic link... PageLinks.AddLink( Server.HtmlDecode( topic ["Topic"].ToString() ), YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.posts, "t={0}", TopicID ) ); // add "reply" text... PageLinks.AddLink( GetText( "reply" ) ); // show attach file option if its a reply... if ( PageContext.ForumUploadAccess ) { NewTopicOptionsRow.Visible = true; TopicAttach.Visible = true; TopicAttachLabel.Visible = true; TopicWatch.Visible = false; TopicWatchLabel.Visible = false; TopicAttachBr.Visible = false; } if ( YAF.Classes.Config.IsDotNetNuke || YAF.Classes.Config.IsRainbow || YAF.Classes.Config.IsPortal ) { // can't use the last post iframe LastPosts.Visible = true; LastPosts.DataSource = DB.post_list_reverse10( TopicID ); LastPosts.DataBind(); } else { LastPostsIFrame.Visible = true; LastPostsIFrame.Attributes.Add( "src", string.Format( "{0}framehelper.aspx?g=lastposts&t={1}", YafForumInfo.ForumRoot, TopicID ) ); } }
protected void Page_Load(object sender, System.EventArgs e) { _quickReplyEditor.BaseDir = YafForumInfo.ForumRoot + "editors"; _quickReplyEditor.StyleSheet = YafBuildLink.ThemeFile("theme.css"); _topic = YAF.Classes.Data.DB.topic_info(PageContext.PageTopicID); // in case topic is deleted or not existant if (_topic == null) { YafBuildLink.Redirect(ForumPages.info, "i=6"); // invalid argument message } // get topic flags _topicFlags = new TopicFlags(_topic["Flags"]); using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID)) _forum = dt.Rows [0]; _forumFlags = new ForumFlags(_forum["Flags"]); if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } #region Initial Setup if (!IsPostBack) { if (PageContext.Settings.LockedForum == 0) { PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum)); PageLinks.AddLink(PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID)); } QuickReply.Text = GetText("POSTMESSAGE", "SAVE"); DataPanel1.TitleText = GetText("QUICKREPLY"); DataPanel1.ExpandText = GetText("QUICKREPLY_SHOW"); DataPanel1.CollapseText = GetText("QUICKREPLY_HIDE"); PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(General.BadWordReplace(Server.HtmlDecode(PageContext.PageTopicName)), ""); TopicTitle.Text = General.BadWordReplace(( string )_topic ["Topic"]); ViewOptions.Visible = PageContext.BoardSettings.AllowThreaded; ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0; RssTopic.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg={0}&t={1}", Request.QueryString ["g"], PageContext.PageTopicID); RssTopic.Visible = PageContext.BoardSettings.ShowRSSLink; QuickReplyPlaceHolder.Visible = PageContext.BoardSettings.ShowQuickAnswer; if ((PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests) || (PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded)) { Session ["CaptchaImageText"] = General.GetCaptchaString(); imgCaptcha.ImageUrl = String.Format("{0}resource.ashx?c=1", YafForumInfo.ForumRoot); CaptchaDiv.Visible = true; } if (!PageContext.ForumPostAccess || (_forumFlags.IsLocked && !PageContext.ForumModeratorAccess)) { NewTopic1.Visible = false; NewTopic2.Visible = false; } // Ederon : 9/9/2007 - moderators can relpy in locked topics if (!PageContext.ForumReplyAccess || ((_topicFlags.IsLocked || _forumFlags.IsLocked) && !PageContext.ForumModeratorAccess)) { PostReplyLink1.Visible = PostReplyLink2.Visible = false; QuickReplyPlaceHolder.Visible = false; } if (PageContext.ForumModeratorAccess) { MoveTopic1.Visible = true; MoveTopic2.Visible = true; } else { MoveTopic1.Visible = false; MoveTopic2.Visible = false; } if (!PageContext.ForumModeratorAccess) { LockTopic1.Visible = false; UnlockTopic1.Visible = false; DeleteTopic1.Visible = false; LockTopic2.Visible = false; UnlockTopic2.Visible = false; DeleteTopic2.Visible = false; } else { LockTopic1.Visible = !_topicFlags.IsLocked; UnlockTopic1.Visible = !LockTopic1.Visible; LockTopic2.Visible = LockTopic1.Visible; UnlockTopic2.Visible = !LockTopic2.Visible; } // handle custom BBCode javascript or CSS... BBCode.RegisterCustomBBCodePageElements(Page, this.GetType()); } #endregion // Mark topic read Mession.SetTopicRead(PageContext.PageTopicID, DateTime.Now); BindData(); }
protected void Page_Load(object sender, System.EventArgs e) { _messageRow = null; if (Request.QueryString ["m"] != null) { using (DataTable dt = DB.message_list(Request.QueryString ["m"])) { _messageRow = dt.Rows [0]; } if (!PageContext.ForumModeratorAccess && PageContext.PageUserID != ( int )_messageRow ["UserID"]) { YafBuildLink.AccessDenied(); } } _forumFlags = new ForumFlags(_messageRow ["ForumFlags"]); _topicFlags = new TopicFlags(_messageRow ["TopicFlags"]); _ownerUserId = ( int )_messageRow ["UserID"]; _isModeratorChanged = (PageContext.PageUserID != _ownerUserId); if (PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (Request ["t"] == null && !PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (Request ["t"] != null && !PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { // setup page links PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", PageContext.PageCategoryID)); PageLinks.AddForumLinks(PageContext.PageForumID); EraseMessage.Checked = false; ViewState ["delAll"] = false; EraseRow.Visible = false; DeleteReasonRow.Visible = false; LinkedPosts.Visible = false; ReasonEditor.Attributes.Add("style", "width:100%"); Cancel.Text = GetText("Cancel"); if (Request.QueryString ["m"] != null) { // delete message... PreviewRow.Visible = true; DataTable tempdb = DB.message_getRepliesList(Request.QueryString ["m"]); if (tempdb.Rows.Count != 0 && (PageContext.ForumModeratorAccess || PageContext.IsAdmin)) { LinkedPosts.Visible = true; LinkedPosts.DataSource = tempdb; LinkedPosts.DataBind(); } if (Request.QueryString ["action"].ToLower() == "delete") { Title.Text = GetText("EDIT"); //GetText("EDIT"); Delete.Text = GetText("DELETE"); // "GetText("Save"); if (PageContext.IsAdmin) { EraseRow.Visible = true; } } else { Title.Text = GetText("EDIT"); Delete.Text = GetText("UNDELETE"); // "GetText("Save"); } Subject.Text = Convert.ToString(_messageRow ["Topic"]); DeleteReasonRow.Visible = true; ReasonEditor.Text = Convert.ToString(_messageRow ["DeleteReason"]); // populate the message preview with the message datarow... MessagePreview.Message = _messageRow["message"].ToString(); MessagePreview.MessageFlags.BitValue = Convert.ToInt32(_messageRow ["Flags"]); } } }
/// <summary> /// The get topic image. /// </summary> /// <param name="o"> /// The o. /// </param> /// <param name="imgTitle"> /// The img title. /// </param> /// <returns> /// The get topic image. /// </returns> protected string GetTopicImage([NotNull] object o, [NotNull] ref string imgTitle) { CodeContracts.ArgumentNotNull(o, "o"); CodeContracts.ArgumentNotNull(imgTitle, "imgTitle"); var row = (DataRowView)o; DateTime lastPosted = row["LastPosted"] != DBNull.Value ? (DateTime)row["LastPosted"] : new DateTime(2000, 1, 1); var topicFlags = new TopicFlags(row["TopicFlags"]); var forumFlags = new ForumFlags(row["ForumFlags"]); // Obsolette : Ederon // bool isLocked = General.BinaryAnd(row["TopicFlags"], TopicFlags.Locked); imgTitle = "???"; try { // Obsolette : Ederon // bool bIsLocked = isLocked || General.BinaryAnd( row ["ForumFlags"], ForumFlags.Locked ); if (row["TopicMovedID"].ToString().Length > 0) { imgTitle = this.PageContext.Localization.GetText("MOVED"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_MOVED")); } DateTime lastRead = YafContext.Current.Get <YafSession>().GetTopicRead((int)row["TopicID"]); DateTime lastReadForum = YafContext.Current.Get <YafSession>().GetForumRead((int)row["ForumID"]); if (lastReadForum > lastRead) { lastRead = lastReadForum; } if (lastPosted > lastRead) { YafContext.Current.Get <YafSession>().UnreadTopics++; if (row["PollID"] != DBNull.Value) { imgTitle = this.PageContext.Localization.GetText("POLL_NEW"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_POLL_NEW")); } else if (row["Priority"].ToString() == "1") { imgTitle = this.PageContext.Localization.GetText("STICKY"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_STICKY")); } else if (row["Priority"].ToString() == "2") { imgTitle = this.PageContext.Localization.GetText("ANNOUNCEMENT"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT_NEW")); } else if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.PageContext.Localization.GetText("NEW_POSTS_LOCKED"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_NEW_LOCKED")); } else { imgTitle = this.PageContext.Localization.GetText("NEW_POSTS"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_NEW")); } } else { if (row["PollID"] != DBNull.Value) { imgTitle = this.PageContext.Localization.GetText("POLL"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_POLL")); } else if (row["Priority"].ToString() == "1") { imgTitle = this.PageContext.Localization.GetText("STICKY"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_STICKY")); } else if (row["Priority"].ToString() == "2") { imgTitle = this.PageContext.Localization.GetText("ANNOUNCEMENT"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT")); } else if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.PageContext.Localization.GetText("NO_NEW_POSTS_LOCKED"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_LOCKED")); } else { imgTitle = this.PageContext.Localization.GetText("NO_NEW_POSTS"); return(this.PageContext.Theme.GetItem("ICONS", "TOPIC")); } } } catch (Exception) { return(this.PageContext.Theme.GetItem("ICONS", "TOPIC")); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { this._messageRow = null; if (this.Get <HttpRequestBase>().QueryString.Exists("m")) { this._messageRow = this.GetRepository <Message>().ListAsDataTable( Security.StringToIntOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m"))) .GetFirstRowOrInvalid(); if (!this.PageContext.ForumModeratorAccess && this.PageContext.PageUserID != (int)this._messageRow["UserID"]) { BuildLink.AccessDenied(); } } this._forumFlags = new ForumFlags(this._messageRow["ForumFlags"]); this._topicFlags = new TopicFlags(this._messageRow["TopicFlags"]); this._ownerUserId = (int)this._messageRow["UserID"]; this._isModeratorChanged = this.PageContext.PageUserID != this._ownerUserId; if (this.PageContext.PageForumID == 0) { BuildLink.AccessDenied(); } if (!this.Get <HttpRequestBase>().QueryString.Exists("t") && !this.PageContext.ForumPostAccess) { BuildLink.AccessDenied(); } if (this.Get <HttpRequestBase>().QueryString.Exists("t") && !this.PageContext.ForumReplyAccess) { BuildLink.AccessDenied(); } if (this.IsPostBack) { return; } this.EraseMessage.Checked = false; this.EraseMessage.Text = this.GetText("erasemessage"); this.EraseRow.Visible = false; this.DeleteReasonRow.Visible = false; this.LinkedPosts.Visible = false; if (!this.Get <HttpRequestBase>().QueryString.Exists("m")) { return; } // delete message... this.PreviewRow.Visible = true; var tempdb = this.GetRepository <Message>().RepliesListAsDataTable( this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m").ToType <int>()); if (tempdb.HasRows() && (this.PageContext.ForumModeratorAccess || this.PageContext.IsAdmin)) { this.LinkedPosts.Visible = true; this.LinkedPosts.DataSource = tempdb; this.LinkedPosts.DataBind(); } if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("action").ToLower() == "delete") { this.Title.Text = this.GetText("EDIT"); this.Delete.TextLocalizedTag = "DELETE"; if (this.PageContext.IsAdmin) { this.EraseRow.Visible = true; } } else { this.Title.Text = this.GetText("EDIT"); this.Delete.TextLocalizedTag = "UNDELETE"; this.Delete.Icon = "trash-restore"; } this.Subject.Text = Convert.ToString(this._messageRow["Topic"]); this.DeleteReasonRow.Visible = true; this.ReasonEditor.Text = Convert.ToString(this._messageRow["DeleteReason"]); // populate the message preview with the message data-row... this.MessagePreview.Message = this._messageRow["message"].ToString(); var messageFlags = new MessageFlags(this._messageRow["Flags"]) { IsDeleted = false }; this.MessagePreview.MessageFlags = messageFlags; }
protected void Page_Load( object sender, System.EventArgs e ) { _quickReplyEditor.BaseDir = YafForumInfo.ForumRoot + "editors"; _quickReplyEditor.StyleSheet = YafBuildLink.ThemeFile( "theme.css" ); _topic = YAF.Classes.Data.DB.topic_info( PageContext.PageTopicID ); // in case topic is deleted or not existant if (_topic == null) YafBuildLink.Redirect(ForumPages.info, "i=6"); // invalid argument message // get topic flags _topicFlags = new TopicFlags(_topic["Flags"]); using ( DataTable dt = YAF.Classes.Data.DB.forum_list( PageContext.PageBoardID, PageContext.PageForumID ) ) _forum = dt.Rows [0]; _forumFlags=new ForumFlags(_forum["Flags"]); if ( !PageContext.ForumReadAccess ) YafBuildLink.AccessDenied(); #region Initial Setup if ( !IsPostBack ) { if ( PageContext.Settings.LockedForum == 0 ) { PageLinks.AddLink( PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum ) ); PageLinks.AddLink( PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID ) ); } QuickReply.Text = GetText( "POSTMESSAGE", "SAVE" ); DataPanel1.TitleText = GetText( "QUICKREPLY" ); DataPanel1.ExpandText = GetText( "QUICKREPLY_SHOW" ); DataPanel1.CollapseText = GetText( "QUICKREPLY_HIDE" ); PageLinks.AddForumLinks( PageContext.PageForumID ); PageLinks.AddLink( General.BadWordReplace( Server.HtmlDecode( PageContext.PageTopicName ) ), "" ); TopicTitle.Text = General.BadWordReplace( ( string )_topic ["Topic"] ); ViewOptions.Visible = PageContext.BoardSettings.AllowThreaded; ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0; RssTopic.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped( YAF.Classes.Utils.ForumPages.rsstopic, "pg={0}&t={1}", Request.QueryString ["g"], PageContext.PageTopicID ); RssTopic.Visible = PageContext.BoardSettings.ShowRSSLink; QuickReplyPlaceHolder.Visible = PageContext.BoardSettings.ShowQuickAnswer; if ( ( PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests ) || ( PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded ) ) { Session ["CaptchaImageText"] = General.GetCaptchaString(); imgCaptcha.ImageUrl = String.Format( "{0}resource.ashx?c=1", YafForumInfo.ForumRoot ); CaptchaDiv.Visible = true; } if ( !PageContext.ForumPostAccess || ( _forumFlags.IsLocked && !PageContext.ForumModeratorAccess ) ) { NewTopic1.Visible = false; NewTopic2.Visible = false; } // Ederon : 9/9/2007 - moderators can relpy in locked topics if ( !PageContext.ForumReplyAccess || ( ( _topicFlags.IsLocked || _forumFlags.IsLocked ) && !PageContext.ForumModeratorAccess ) ) { PostReplyLink1.Visible = PostReplyLink2.Visible = false; QuickReplyPlaceHolder.Visible = false; } if ( PageContext.ForumModeratorAccess ) { MoveTopic1.Visible = true; MoveTopic2.Visible = true; } else { MoveTopic1.Visible = false; MoveTopic2.Visible = false; } if ( !PageContext.ForumModeratorAccess ) { LockTopic1.Visible = false; UnlockTopic1.Visible = false; DeleteTopic1.Visible = false; LockTopic2.Visible = false; UnlockTopic2.Visible = false; DeleteTopic2.Visible = false; } else { LockTopic1.Visible = !_topicFlags.IsLocked; UnlockTopic1.Visible = !LockTopic1.Visible; LockTopic2.Visible = LockTopic1.Visible; UnlockTopic2.Visible = !LockTopic2.Visible; } // handle custom BBCode javascript or CSS... BBCode.RegisterCustomBBCodePageElements( Page, this.GetType() ); } #endregion // Mark topic read Mession.SetTopicRead( PageContext.PageTopicID, DateTime.Now ); BindData(); }