private AuthorInfo GetLastPostAuthor(int authorId) { var member = new Member().GetById(authorId); AuthorInfo author = new AuthorInfo(member); return author; }
public static AuthorInfo GetAuthor(int memberid) { var member = GetMember(memberid); AuthorInfo author = new AuthorInfo(member); return author; }
private void SetUpButtons() { if (Post == null) return; string modtext = ""; TopicApprove.Visible = false; //TopicHold.Visible = false; hReplyQuote.Visible = false; hEdit.Visible = false; ViewIP.Visible = false; TopicDelete.Visible = false; SplitTopic.Visible = false; PageBase page = (PageBase)Page; bool _isadmin = page.IsAdministrator; bool newerreplies = false; _topicid = page.TopicId != null ? page.TopicId.Value : Convert.ToInt32(Session["TOPIC"]); _topic = Topics.GetTopic(_topicid); _isTopicLocked = _topic.Status == (int)Enumerators.PostStatus.Closed; _forum = Forums.GetForum(_topic.ForumId); _topicid = _topic.Id; bool _isForumModerator = Moderators.IsUserForumModerator(HttpContext.Current.User.Identity.Name, _forum.Id); if (_post is TopicInfo) { if (Cache["M" + _topic.AuthorId] == null) { _author = Members.GetAuthor(_topic.AuthorId); Cache.Insert("M" + _topic.AuthorId, _author, null, DateTime.Now.AddMinutes(10d), System.Web.Caching.Cache.NoSlidingExpiration); } else { _author = (AuthorInfo)Cache["M" + _topic.AuthorId]; } ThisId = _topic.Id; if (_topic.ReplyCount > 0) newerreplies = true; _posttype = "TOPICS"; _postdate = _topic.Date; _ip = _topic.PosterIp; if (_isadmin || _isForumModerator) { TopicApprove.Visible = (_topic.Status == (int)Enumerators.PostStatus.UnModerated || _topic.Status == (int)Enumerators.PostStatus.OnHold); TopicApprove.OnClientClick = string.Format( "mainScreen.LoadServerControlHtml('Moderation',{{'pageID':7,'data':'{0},{1}'}}, 'methodHandlers.BeginRecieve');return false;", false,_topic.Id); //TopicHold.Visible = _topic.Status == Enumerators.PostStatus.UnModerated; } if (_topic.Status == (int)Enumerators.PostStatus.UnModerated || _topic.Status == (int)Enumerators.PostStatus.OnHold) { _unmoderated = true; modtext = String.Format("<span class=\"moderation\">{0}</span>", webResources.lblRequireModeration); if (_topic.Status == (int)Enumerators.PostStatus.OnHold) modtext = String.Format("<span class=\"moderation\">!!{0}!!</span>", webResources.OnHold); } SplitTopic.Visible = false; hEdit.Text = webResources.lblEditTopic; hEdit.ToolTip = webResources.lblEditTopic; TopicDelete.AlternateText = webResources.lblDelTopic; TopicDelete.OnClientClick = "confirmPostBack('Do you want to delete the Topic?','DeleteTopic'," + ThisId + ");return false;"; imgPosticon.OnClientClick = "confirmBookMark('Do you want to bookmark the Topic?'," + ThisId + ",-1); return false;"; } else if (_post is ReplyInfo) { ReplyInfo reply = (ReplyInfo)_post; _author = Members.GetAuthor(reply.AuthorId); ThisId = reply.Id; if (_topic.LastReplyId != reply.Id) newerreplies = true; _posttype = "REPLY"; _postdate = reply.Date; _ip = reply.PosterIp; if (_isadmin || _isForumModerator) { TopicApprove.Visible = (reply.Status == (int)Enumerators.PostStatus.UnModerated || reply.Status == (int)Enumerators.PostStatus.OnHold); TopicApprove.OnClientClick = string.Format( "mainScreen.LoadServerControlHtml('Moderation',{{'pageID':7,'data':'{0},{1},{2}'}}, 'methodHandlers.BeginRecieve');return false;", false,"",reply.Id); //TopicHold.Visible = reply.Status == Enumerators.PostStatus.UnModerated; } if (reply.Status == (int)Enumerators.PostStatus.UnModerated || reply.Status == (int)Enumerators.PostStatus.OnHold) { _unmoderated = true; modtext = String.Format("<span class=\"moderation\">{0}</span>", webResources.lblRequireModeration); if (reply.Status == (int)Enumerators.PostStatus.OnHold) modtext = String.Format("<span class=\"moderation\">!!{0}!!</span>", webResources.OnHold); } TopicDelete.AlternateText = webResources.lblDelReply; SplitTopic.CommandArgument = ThisId.ToString(); hEdit.ToolTip = webResources.lblEditReply; hEdit.Text = webResources.lblEditReply; TopicDelete.OnClientClick = "confirmPostBack('Do you want to delete the Reply?','DeleteReply'," + ThisId + ");return false;"; imgPosticon.OnClientClick = "confirmBookMark('Do you want to bookmark the Reply?'," + ThisId + "," + page.CurrentPage + ");return false;"; SplitTopic.Visible = _isForumModerator || _isadmin; SplitTopic.OnClientClick = String.Format( "mainScreen.LoadServerControlHtml('Split Topic',{{'pageID':6,'data':'{0},asc'}}, 'methodHandlers.BeginRecieve');return false;", reply.Id); } TopicDelete.Visible = (currentUser.ToLower() == _author.Username.ToLower() && !newerreplies); TopicDelete.Visible = TopicDelete.Visible || (_isForumModerator || _isadmin); imgPosticon.AlternateText = String.Format("#{0}", ThisId); date.Text = _unmoderated ? modtext : SnitzTime.TimeAgoTag(_postdate, page.IsAuthenticated, page.Member); ViewIP.Visible = _isadmin && Config.LogIP; ViewIP.OnClientClick = string.Format( "mainScreen.LoadServerControlHtml('IP Lookup',{{'pageID':4,'data':'{0}'}}, 'methodHandlers.BeginRecieve');return false;", _ip); hEdit.NavigateUrl = string.Format("~/Content/Forums/post.aspx?method=edit&type={0}&id={1}&TOPIC={2}", _posttype, ThisId, _topicid); hEdit.Visible = (currentUser.ToLower() == _author.Username.ToLower() && !newerreplies); hEdit.Visible = hEdit.Visible && !(_isTopicLocked || _forum.Status == (int)Enumerators.PostStatus.Closed); // but not if it is locked hEdit.Visible = hEdit.Visible || _isForumModerator || _isadmin; //override for admins/moderator hReplyQuote.Visible = page.IsAuthenticated && !(_isTopicLocked || _forum.Status == (int)Enumerators.PostStatus.Closed); hReplyQuote.Visible = hReplyQuote.Visible || (_isForumModerator || _isadmin); hReplyQuote.NavigateUrl = String.Format("~/Content/Forums/post.aspx?method=quote&type={0}&id={1}&TOPIC={2}", _posttype, ThisId, _topicid); }
public static string LinkTarget(AuthorInfo author) { ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username); if (String.IsNullOrEmpty(prof.LinkTarget)) return "_blank"; return prof.LinkTarget; }