public ActionResult UserThreads(string spaceKey, bool isPosted = false, int pageIndex = 1) { IUser currentUser = UserContext.CurrentUser; long sectionId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); //若当前用户是在浏览自己的帖子列表,或者是管理员,则忽略审核; bool ignoreAudit = currentUser != null && UserContext.CurrentUser.UserId == currentUser.UserId || authorizer.IsAdministrator(BarConfig.Instance().ApplicationId); PagingDataSet <BarThread> pds = barThreadService.GetUserThreads(TenantTypeIds.Instance().Topic(), currentUser.UserId, ignoreAudit, isPosted, pageIndex, sectionId); if (Request.IsAjaxRequest()) { return(PartialView("~/Applications/Bar/Views/Bar/_ListInTopic.cshtml", pds)); } var topic = topicService.Get(spaceKey); pageResourceManager.InsertTitlePart(topic.TopicName); string title = isPosted ? "我的回帖" : "我的帖子"; if (UserContext.CurrentUser != null && UserContext.CurrentUser.UserId != currentUser.UserId) { title = isPosted ? currentUser.DisplayName + "的回帖" : currentUser.DisplayName + "的帖子"; ViewData["isOwner"] = false; } pageResourceManager.InsertTitlePart(title); ViewData["userId"] = currentUser != null ? currentUser.UserId : 0; return(View(pds)); }
public JsonResult GetNewerTopicActivityCount(string spaceKey, long lastActivityId, int?applicationId) { if (UserContext.CurrentUser == null) { return(Json(new { })); } long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); string name; int count = activityService.GetNewerCount(groupId, lastActivityId, applicationId, out name, ActivityOwnerTypes.Instance().Topic(), UserContext.CurrentUser.UserId); if (count == 0) { return(Json(new { lastActivityId = lastActivityId, hasNew = false })); } else { string showName; if (count == 1) { showName = name + "更新了动态,点击查看"; } else { showName = name + "等多位群友更新了动态,点击查看"; } return(Json(new { hasNew = true, showName = showName })); } }
public ActionResult DeleteMemberApply(string spaceKey, long id) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); groupService.DeleteTopicMemberApply(id); return(Json(new StatusMessageData(StatusMessageType.Success, "操作成功"))); }
public ActionResult _PapersOfTopic(string spaceKey) { long topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IEnumerable <PaperEntity> papers = paperService.GetPapersByTopicId(topicId); return(View(papers)); }
/// <summary> /// 我关注的专题成员 /// </summary> /// <param name="spaceKey"></param> /// <param name="pageIndex"></param> /// <returns></returns> public ActionResult MyFollowedUsers(string spaceKey, int pageIndex = 1) { TopicEntity group = groupService.Get(spaceKey); if (group == null) { return(HttpNotFound()); } var currentUser = UserContext.CurrentUser; if (currentUser == null) { return(Redirect(SiteUrls.Instance().Login(true))); } pageResourceManager.InsertTitlePart(group.TopicName); pageResourceManager.InsertTitlePart("管理成员列表页"); long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IEnumerable <TopicMember> groupMember = groupService.GetTopicMembersAlsoIsMyFollowedUser(groupId, currentUser.UserId); PagingDataSet <TopicMember> groupMembers = new PagingDataSet <TopicMember>(groupMember); if (currentUser.IsFollowed(group.User.UserId)) { ViewData["groupOwner"] = group.User; } return(View(groupMembers)); }
public ActionResult ManagePosts(string spaceKey, ManagePostsEditModel model, int pageIndex = 1) { long sectionId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); BarSection section = barSectionService.Get(sectionId); if (!authorizer.BarSection_Manage(section)) { return(Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Title = "没有权限", Body = "您可能没有权限编辑此帖吧" }))); } var topic = topicService.Get(spaceKey); pageResourceManager.InsertTitlePart(topic.TopicName); pageResourceManager.InsertTitlePart("回帖管理"); BarPostQuery query = model.AsBarPostQuery(); query.SectionId = section.SectionId; model.SectionId = section.SectionId; ViewData["BarPosts"] = barPostService.Gets(TenantTypeIds.Instance().Topic(), query, model.PageSize ?? 20, pageIndex); return(View(model)); }
public ActionResult _Menu_Manage(string spaceKey) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); TopicEntity group = groupService.Get(groupId); if (group == null) { return(Content(string.Empty)); } int currentNavigationId = RouteData.Values.Get <int>("CurrentNavigationId", 0); NavigationService navigationService = new NavigationService(); Navigation navigation = navigationService.GetNavigation(PresentAreaKeysOfBuiltIn.GroupSpace, currentNavigationId, group.TopicId); IEnumerable <Navigation> navigations = new List <Navigation>(); if (navigation != null) { if (navigation.Depth >= 1 && navigation.Parent != null) { navigations = navigation.Parent.Children; } else if (navigation.Depth == 0) { navigations = navigation.Children; } } ViewData["MemberApplyCount"] = groupService.GetMemberApplyCount(group.TopicId); return(View(navigations)); }
public ActionResult ApproveMemberApply(string spaceKey, IList <long> applyIds, bool isApproved) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); groupService.ApproveTopicMemberApply(applyIds, isApproved); return(Json(new StatusMessageData(StatusMessageType.Success, "操作成功"))); }
/// <summary> /// 标签显示帖子列表 /// </summary> /// <returns></returns> public ActionResult ListByTag(string spaceKey, string tagName, SortBy_BarThread?sortBy, bool?isEssential, int pageIndex = 1) { tagName = WebUtility.UrlDecode(tagName); PagingDataSet <BarThread> pds = barThreadService.Gets(TenantTypeIds.Instance().Topic(), tagName, isEssential, sortBy ?? SortBy_BarThread.StageHitTimes, pageIndex); if (Request.IsAjaxRequest()) { return(PartialView("~/Applications/Bar/Views/Bar/_ListInTopic.cshtml", pds)); } var topic = topicService.Get(spaceKey); if (topic == null) { return(HttpNotFound()); } pageResourceManager.InsertTitlePart(topic.TopicName); pageResourceManager.InsertTitlePart(tagName); ViewData["sortBy"] = sortBy; var tag = new TagService(TenantTypeIds.Instance().BarThread()).Get(tagName); if (tag == null) { return(HttpNotFound()); } ViewData["tag"] = tag; ViewData["SectionId"] = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); ViewData["topic"] = topic; return(View(pds)); }
public ActionResult _TopicMemberAlsoJoinedTopics(string spaceKey, int topNumber = 10) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IEnumerable <TopicEntity> groups = groupService.TopicMemberAlsoJoinedTopics(groupId, topNumber); return(View(groups)); }
public ActionResult _TopicMenu(string spaceKey) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); TopicEntity group = groupService.Get(groupId); if (group == null) { return(Content(string.Empty)); } int currentNavigationId = RouteData.Values.Get <int>("CurrentNavigationId", 0); IEnumerable <Navigation> navigations = new List <Navigation>(); NavigationService navigationService = new NavigationService(); Navigation navigation = navigationService.GetNavigation(PresentAreaKeysOfBuiltIn.GroupSpace, currentNavigationId, group.TopicId); if (navigation != null && navigation.Children.Count() > 0) { navigations = navigation.Children; } else { navigations = navigationService.GetRootNavigations(PresentAreaKeysOfBuiltIn.GroupSpace, group.TopicId); } return(View(navigations)); }
public ActionResult _TagCloud(string spaceKey, int topNum = 20) { long sectionId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); TagService tagService = new TagService(TenantTypeIds.Instance().BarThread()); Dictionary <TagInOwner, int> ownerTags = tagService.GetOwnerTopTags(topNum, sectionId); return(View(ownerTags)); }
/// <summary> /// 最近访客控件 /// </summary> public ActionResult _LastTopicVisitors(string spaceKey, int topNumber = 12) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IEnumerable <Visit> visits = visitService.GetTopVisits(groupId, topNumber); ViewData["groupId"] = groupId; return(View(visits)); }
/// <summary> /// 管理分类 /// </summary> /// <param name="sectionId">贴吧id</param> /// <returns>管理分类</returns> public string ManageCategories(long sectionId) { string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(sectionId); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicManageThreadCategories(spaceKey)); }
/// <summary> /// 贴吧详细显示页面 /// </summary> /// <param name="sectionId"></param> /// <returns></returns> public string SectionDetail(long sectionId, SortBy_BarThread?sortBy = null, bool?isEssential = null, long?categoryId = null) { string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(sectionId); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicSectionDetail(spaceKey, categoryId, isEssential, sortBy)); }
/// <summary> /// 编辑页面 /// </summary> /// <param name="sectionId"></param> /// <param name="threadId"></param> /// <returns></returns> public string Edit(long sectionId, long?threadId = null) { string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(sectionId); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicThreadEdit(spaceKey, threadId)); }
public ActionResult SectionDetail(string spaceKey, long?categoryId = null, bool?isEssential = null, SortBy_BarThread?sortBy = null, bool?isPosted = null, int pageIndex = 1) { IUser currentUser = UserContext.CurrentUser; long sectionId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); BarSection barSection = barSectionService.Get(sectionId); if (barSection == null) { return(HttpNotFound()); } if (barSection.AuditStatus != AuditStatus.Success && !authorizer.BarSection_Manage(barSection)) { return(Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Title = "没有权限", Body = "此群组还未通过审核,不能查看", StatusMessageType = StatusMessageType.Hint }))); } PagingDataSet <BarThread> pds = barThreadService.Gets(sectionId, categoryId, isEssential, sortBy ?? SortBy_BarThread.LastModified_Desc, pageIndex); if (Request.IsAjaxRequest()) { return(PartialView("~/Applications/Bar/Views/Bar/_ListInTopic.cshtml", pds)); } pageResourceManager.InsertTitlePart(barSection.Name); Category currentThreadCategory = null; if (categoryId.HasValue && categoryId.Value > 0) { currentThreadCategory = categoryService.Get(categoryId.Value); } if (currentThreadCategory != null) { ViewData["currentThreadCategory"] = currentThreadCategory; } //若当前用户是在浏览自己的帖子列表,或者是管理员,则忽略审核; bool ignoreAudit = currentUser != null && UserContext.CurrentUser.UserId == currentUser.UserId || authorizer.IsAdministrator(BarConfig.Instance().ApplicationId); if (isPosted.HasValue) { pds = barThreadService.GetUserThreads(TenantTypeIds.Instance().Topic(), currentUser.UserId, ignoreAudit, isPosted.Value, pageIndex, sectionId); } ViewData["section"] = barSection; ViewData["threadCategories"] = categoryService.GetOwnerCategories(sectionId, TenantTypeIds.Instance().BarThread()); ViewData["sortBy"] = sortBy; return(View(pds)); }
/// <summary> /// 用户回帖页面 /// </summary> /// <param name="userId">用户id</param> /// <param name="sectionId">贴吧id</param> /// <returns>用户回帖页面</returns> public string UserPosts(long userId, long?sectionId = null) { if (sectionId == null) { return(string.Empty); } string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(sectionId.Value); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicUserThreads(spaceKey, true)); }
/// <summary> /// 最新加入 /// </summary> /// <param name="spaceKey">专题标识</param> /// <param name="topNumber">前几条数据</param> /// <returns></returns> public ActionResult _ListMembers(string spaceKey, int topNumber) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IUser currentUser = UserContext.CurrentUser; if (currentUser == null) { return(new EmptyResult()); } PagingDataSet <TopicMember> groupMembers = groupService.GetTopicMembers(groupId, false, SortBy_TopicMember.DateCreated_Desc); IEnumerable <TopicMember> members = groupMembers.Take(topNumber); return(View(members)); }
/// <summary> /// 专题信息 /// </summary> /// <param name="spaceKey">专题标识</param> /// <param name="showtopicLogo">显示专题Logo</param> /// <returns></returns> //[HttpGet] public ActionResult _TopicInfo(string spaceKey, bool?showTopicLogo) { long topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); TopicEntity topic = topicService.Get(topicId); if (topic == null) { return(Content(string.Empty)); } ViewData["showTopicLogo"] = showTopicLogo; return(View(topic)); }
/// <summary> /// 获取以后进入用户时间线的动态 /// </summary> public ActionResult _GetNewerActivities(string spaceKey, int?applicationId, long?lastActivityId = 0) { if (UserContext.CurrentUser == null) { return(new EmptyResult()); } long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IEnumerable <Activity> newActivities = activityService.GetNewerActivities(groupId, lastActivityId.Value, applicationId, ActivityOwnerTypes.Instance().Topic(), UserContext.CurrentUser.UserId); if (newActivities != null && newActivities.Count() > 0) { ViewData["lastActivityId"] = newActivities.FirstOrDefault().ActivityId; } return(View(newActivities)); }
/// <summary> /// 编辑回帖页面 /// </summary> /// <param name="threadId">帖子id</param> /// <param name="postId">回帖id</param> /// <returns>编辑回帖页面</returns> public string EditPost(long threadId, long?postId = null) { BarThread thread = new BarThreadService().Get(threadId); if (thread == null) { return(string.Empty); } string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(thread.SectionId); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicEditPost(spaceKey, threadId, postId)); }
/// <summary> /// 标签下的帖子 /// </summary> /// <param name="tagName">标签名</param> /// <param name="sectionId">帖子id</param> /// <returns>标签下的帖子</returns> public string ListByTag(string tagName, long?sectionId = null, SortBy_BarThread?sortBy = null, bool?isEssential = null) { if (sectionId == null) { return(string.Empty); } string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(sectionId.Value); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicThreadListByTag(spaceKey, tagName, sortBy, isEssential)); }
public string ThreadDetail(long threadId, bool onlyLandlord = false, SortBy_BarPost sortBy = SortBy_BarPost.DateCreated, int pageIndex = 1, long?anchorPostId = null, bool isAnchorPostList = false, long?childPostIndex = null) { BarThread thread = new BarThreadService().Get(threadId); if (thread == null) { return(string.Empty); } string spaceKey = TopicIdToTopicKeyDictionary.GetTopicKey(thread.SectionId); if (string.IsNullOrEmpty(spaceKey)) { return(string.Empty); } return(SiteUrls.Instance().TopicThreadDetail(spaceKey, threadId, onlyLandlord, sortBy, pageIndex, anchorPostId, isAnchorPostList, childPostIndex)); }
public ActionResult _ListActivities(string spaceKey, int?pageIndex, int?applicationId, MediaType?mediaType, bool?isOriginal, long?userId) { long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); PagingDataSet <Activity> activities = activityService.GetOwnerActivities(ActivityOwnerTypes.Instance().Topic(), groupId, applicationId, mediaType, isOriginal, null, pageIndex ?? 1, userId); if (activities.FirstOrDefault() != null) { ViewData["lastActivityId"] = activities.FirstOrDefault().ActivityId; } ViewData["pageIndex"] = pageIndex; ViewData["applicationId"] = applicationId; ViewData["mediaType"] = mediaType; ViewData["isOriginal"] = isOriginal; ViewData["userId"] = userId; return(View(activities)); }
/// <summary> /// 成员列表 /// </summary> /// <returns></returns> public ActionResult Members(string spaceKey, int pageIndex = 1) { TopicEntity topic = topicService.Get(spaceKey); if (topic == null) { return(HttpNotFound()); } pageResourceManager.InsertTitlePart(topic.TopicName); pageResourceManager.InsertTitlePart("管理成员列表页"); long topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); PagingDataSet <TopicMember> topicMembers = topicService.GetTopicMembers(topicId, false, pageSize: 60, pageIndex: pageIndex); ViewData["Topic"] = topic; return(View(topicMembers)); }
public ActionResult _OnlineTopicMembers(string spaceKey, int topNumber = 12) { TopicEntity group = groupService.Get(spaceKey); ViewData["User"] = group.User; long groupId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); IEnumerable <TopicMember> groupMembers = groupService.GetOnlineTopicMembers(groupId); if (group.User.IsOnline) { return(View(groupMembers.Take(topNumber - 1))); } else { return(View(groupMembers.Take(topNumber))); } }
public ActionResult ManageThreads(string spaceKey, ManageThreadEditModel model, int pageIndex = 1) { long topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); BarSection section = barSectionService.Get(topicId); if (!authorizer.BarSection_Manage(section)) { return(Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Body = string.Format("您没有权限管理 {0} !", section == null ? "" : section.Name), Title = "没有权限", StatusMessageType = StatusMessageType.Hint }))); } var topic = topicService.Get(spaceKey); pageResourceManager.InsertTitlePart(topic.TopicName); pageResourceManager.InsertTitlePart("帖吧管理"); List <SelectListItem> SelectListItem_TrueAndFlase = new List <SelectListItem> { new SelectListItem { Text = "是", Value = true.ToString() }, new SelectListItem { Text = "否", Value = false.ToString() } }; ViewData["IsEssential"] = new SelectList(SelectListItem_TrueAndFlase, "Value", "Text", model.IsEssential); ViewData["IsSticky"] = new SelectList(SelectListItem_TrueAndFlase, "Value", "Text", model.IsSticky); IEnumerable <Category> categories = categoryService.GetOwnerCategories(section.SectionId, TenantTypeIds.Instance().BarThread()); ViewData["CategoryId"] = new SelectList(categories.Select(n => new { text = StringUtility.Trim(n.CategoryName, 20), value = n.CategoryId }), "value", "text", model.CategoryId); BarThreadQuery query = model.GetBarThreadQuery(); query.SectionId = section.SectionId; ViewData["BarThreads"] = barThreadService.Gets(TenantTypeIds.Instance().Topic(), query, model.PageSize ?? 20, pageIndex); model.SectionId = section.SectionId; ViewData["TenantType"] = new TenantTypeService().Get(TenantTypeIds.Instance().Topic()); return(View(model)); }
/// <summary> /// 专题空间主导航 /// </summary> /// <param name="spaceKey">专题空间标识</param> /// <returns></returns> //[HttpGet] public ActionResult _Menu_Main(string spaceKey) { long topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); TopicEntity topic = topicService.Get(topicId); if (topic == null) { return(Content(string.Empty)); } ManagementOperationService managementOperationService = new ManagementOperationService(); ViewData["ApplicationManagementOperations"] = managementOperationService.GetShortcuts(PresentAreaKeysOfExtension.TopicSpace, false); NavigationService navigationService = new NavigationService(); return(View(navigationService.GetRootNavigations(PresentAreaKeysOfExtension.TopicSpace, topic.TopicId))); }
public ActionResult ManageThreadCategories(string spaceKey, int pageIndex = 1) { long sectionId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey); if (!authorizer.BarSection_Manage(sectionId)) { return(Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Body = "您没有权限编辑此帖吧的分类", Title = "没有权限" }))); } var topic = topicService.Get(spaceKey); pageResourceManager.InsertTitlePart(topic.TopicName); pageResourceManager.InsertTitlePart("类别管理"); ViewData["SectionId"] = sectionId; return(View(categoryService.GetOwnerCategories(sectionId, TenantTypeIds.Instance().BarThread()))); }