protected bool IsShowCheckBox(BasicThread thread) { if (ForumID == thread.ForumID && (//Forum.IsModerator(MyUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsRecycled, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.DeleteAnyThreads, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.MoveThreads, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsLock, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.SetThreadsSubjectStyle) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsStick, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsGlobalStick, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.SetThreadsUp) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadNotUpdateSortOrder, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsValued, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.UpdateThreadCatalog, thread.PostUserID) || ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.JudgementThreads, thread.PostUserID)) ) { return(true); } else { return(false); } }
protected bool AlwaysViewShieldContents(int posterUserID) { if (ForumManagePermission.Can(My, ManageForumPermissionSetNode.ActionWithTarget.AlwaysViewContents, posterUserID)) { return(true); } else { return(false); } }
protected void Page_Load(object sender, System.EventArgs e) { //点击了快速发帖按钮 if (_Request.IsClick("postButton")) { ProcessThread(); } ForumBO.Instance.SetForumsLastThread(Forum.SubForumsForList); int totalThreads = 0; int pageSize = AllSettings.Current.BbsSettings.ThreadsPageSize; if (_Request.IsSpider) { if (ThreadCatalogID != -1) { m_ThreadCatalogID = -1; } if (Action != "list") { m_Action = "list"; } } //如果要显示某个主题分类的主题 if (ThreadCatalogID != -1) { AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetForumUrl(CodeName)); Action = ""; if (ThreadCatalogID != 0) { ThreadCatalog threadCatalog = ForumBO.Instance.GetThreadCatalog(ThreadCatalogID); if (threadCatalog == null) { Response.End(); } AddNavigationItem(string.Concat("[", threadCatalog.ThreadCatalogName, "]")); //navigation += " [" + threadCatalog.ThreadCatalogName + "]"; } else { AddNavigationItem("[其他]"); } //navigation += " [其他]"; threads = PostBOV5.Instance.GetThreads(ForumID, ThreadCatalogID, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, out totalThreads); //设置分页控件的显示 SetPager("ThreadListPager", BbsUrlHelper.GetThreadCatalogUrlForPager(CodeName, ThreadCatalogID) + (parms == null ? "" : "?" + parms), PageNumber, pageSize, totalThreads); //url = BbsUrlHelper.GetForumEmoticonUrlForPager(CodeName, ThreadCatalogID, PageNumber, IsGetAllDefaultEmoticon, EmoticonGroupID); } else { string navigation = null; switch (Action) { //精华帖 case "valued": navigation = "[精华帖]"; threads = PostBOV5.Instance.GetValuedThreads(ForumID, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads); break; //投票帖 case "poll": navigation = "[投票帖]"; threads = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Poll, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads); break; //问题帖 case "question": navigation = "[提问帖]"; threads = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Question, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads); break; //辩论帖 case "polemize": navigation = "[辩论帖]"; threads = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Polemize, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads); break; //回收 case "recycled": IsNormalThreads = false; IsRecycleBin = true; navigation = "[回收站]"; if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsRecycled) == false) { ShowError("您没有权限进入回收站"); } threads = PostBOV5.Instance.GetThreadsByStatus(ThreadStatus.Recycled, ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, out totalThreads); break; //未审核主题 case "unapproved": IsNormalThreads = false; IsUnapprovedThreads = true; navigation = "[未审核主题]"; if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.ApproveThreads) == false) { ShowError("您没有权限查看未审核的主题"); } threads = PostBOV5.Instance.GetThreadsByStatus(ThreadStatus.UnApproved, ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, out totalThreads); break; //未审核回复 case "unapprovedpost": IsNormalThreads = false; IsUnapprovedPostsThreads = true; navigation = "[未审核回复]"; if (ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.ApprovePosts) == false) { ShowError("您没有权限查看未审核的回复"); } threads = PostBOV5.Instance.GetUnapprovedPostThreads(ForumID, PageNumber, pageSize); totalThreads = threads.TotalRecords; break; //正常帖子 default: IsDefaultList = true; Action = "list"; threads = PostBOV5.Instance.GetThreads(ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, _Request.IsSpider, out totalThreads); break; } if (navigation == null) { AddNavigationItem(Forum.ForumName); } else { AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetForumUrl(CodeName)); AddNavigationItem(navigation); } //设置分页控件的显示 SetPager("ThreadListPager", BbsUrlHelper.GetForumUrlForPager(CodeName, Action) + (parms == null ? "" : "?" + parms), PageNumber, pageSize, totalThreads); //url = BbsUrlHelper.GetForumEmoticonUrlForPager(CodeName, Action, PageNumber, IsGetAllDefaultEmoticon, EmoticonGroupID); } if (PageNumber > 1 && threads.Count == 0) { Response.Redirect(AttachQueryString("page=1")); } //更新用户在在线列表中的状态 UpdateOnlineStatus(OnlineAction.ViewThreadList, 0, ""); //OnlineManager.UpdateOnlineUser(MyUserID, ForumID, 0, My.OnlineStatus, OnlineAction.ViewThreadList, Request, Response); if (IsNormalThreads) { PostBOV5.Instance.ProcessKeyword(threads, ProcessKeywordMode.TryUpdateKeyword); } else { PostBOV5.Instance.ProcessKeyword(threads, ProcessKeywordMode.FillOriginalText); } if (CanManageThread) { List <int> userIDs = new List <int>(); foreach (BasicThread thread in threads) { if (userIDs.Contains(thread.PostUserID) == false) { userIDs.Add(thread.PostUserID); } } UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll); } WaitForFillSimpleUsers <Moderator>(Forum.Moderators); foreach (Forum subForum in Forum.SubForumsForList) { WaitForFillSimpleUsers <Moderator>(subForum.Moderators); } SubmitFillUsers(); }
protected bool CanManage(ManageForumPermissionSetNode.ActionWithTarget action, int targetUserID) { return(ForumManagePermission.Can(My, action, targetUserID)); }
protected bool CanManage(ManageForumPermissionSetNode.Action action) { return(ForumManagePermission.Can(My, action)); }
protected virtual string GetModeratorActionLinks(string outputFormat, string separator) { if (string.IsNullOrEmpty(outputFormat)) { outputFormat = @"<a href=""javascript:postToDialog({{url:'{1}',callback:refresh}})"">{0}</a> "; } StringBuilder sb = new StringBuilder(); if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsRecycled)) { appendModeratorActionLink(sb, outputFormat, separator, "回收主题", ThreadManageAction.RecycleThread, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.DeleteAnyThreads)) { appendModeratorActionLink(sb, outputFormat, separator, "删除主题", ThreadManageAction.DeleteThread, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.MoveThreads)) { appendModeratorActionLink(sb, outputFormat, separator, "移动主题", ThreadManageAction.MoveThread, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsLock)) { appendModeratorActionLink(sb, outputFormat, separator, "设置锁定", ThreadManageAction.LockThread, CodeName); } if (ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.SetThreadsSubjectStyle)) { appendModeratorActionLink(sb, outputFormat, separator, "高亮显示", ThreadManageAction.SetThreadSubjectStyle, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsStick) || ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsGlobalStick)) { appendModeratorActionLink(sb, outputFormat, separator, "设置置顶", ThreadManageAction.SetThreadIsTop, CodeName); } if (ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.SetThreadsUp)) { appendModeratorActionLink(sb, outputFormat, separator, "提升主题", ThreadManageAction.UpThread, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadNotUpdateSortOrder)) { appendModeratorActionLink(sb, outputFormat, separator, "自动沉帖", ThreadManageAction.SetThreadNotUpdateSortOrder, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsValued)) { appendModeratorActionLink(sb, outputFormat, separator, "设置精华", ThreadManageAction.SetThreadElite, CodeName); } if (Forum.ThreadCatalogStatus != ThreadCatalogStatus.DisEnable && ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.UpdateThreadCatalog)) { appendModeratorActionLink(sb, outputFormat, separator, "设置分类", ThreadManageAction.UpdateThreadCatalog, CodeName); } if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.JudgementThreads)) { appendModeratorActionLink(sb, outputFormat, separator, "鉴定主题", ThreadManageAction.JudgementThread, CodeName); } if (sb.Length > separator.Length) { return(sb.ToString(0, sb.Length - separator.Length)); } return(sb.ToString()); }