/// <summary> /// 栏目详细页 /// </summary> public ActionResult FolderDetail(int contentFolderId, int pageSize = 15, int pageIndex = 1) { var contentFolderService = new ContentFolderService(); var folder = contentFolderService.Get(contentFolderId); if (folder == null || !folder.IsEnabled) { return(HttpNotFound()); } pageResourceManager.InsertTitlePart(folder.FolderName); pageResourceManager.SetMeta(new MetaEntry("Title", folder.METATitle)); pageResourceManager.SetMetaOfKeywords(folder.METAKeywords); pageResourceManager.SetMetaOfDescription(folder.METADescription); PagingDataSet <ContentItem> contentItems = contentItemService.GetContentItemsSortBy(ContentItemSortBy.ReleaseDate_Desc, null, contentFolderId, true, null, pageSize, pageIndex); if (Request.IsAjaxRequest()) { return(PartialView("_List", contentItems)); } ViewData["currentFolder"] = folder; ViewData["allParentContentFolders"] = folder.Parents; //设置路由数据中的当前导航Id RouteData.Values["CurrentNavigationId"] = NavigationService.GenerateDynamicNavigationId(folder.Parents.FirstOrDefault() == null ? contentFolderId : folder.Parents.First().ContentFolderId); return(View(contentItems)); }
public ActionResult ManageContentItems(AuditStatus?auditStatus = null, int?folderId = null, string subjectKeyWord = null, string tagNameKeyword = null, string userId = null, DateTime?minDate = null, DateTime?maxDate = null, int pageSize = 20, int pageIndex = 1) { IUser currentUser = UserContext.CurrentUser; if (currentUser == null) { return(Redirect(SiteUrls.Instance().Login(true))); } long?id = null; if (!string.IsNullOrEmpty(userId)) { userId = userId.TrimStart(',').TrimEnd(','); if (!string.IsNullOrEmpty(userId)) { id = long.Parse(userId); } } ViewData["userId"] = id; var contentFolderService = new ContentFolderService(); if (folderId.HasValue && folderId.Value > 0) { ContentFolder contentFolder = contentFolderService.Get(folderId.Value); if (!authorizer.CMS_ManageContentFolder(contentFolder)) { return(Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Body = string.Format("您没有权限管理 {0} !", contentFolder == null ? "" : contentFolder.FolderName), Title = "没有权限", StatusMessageType = StatusMessageType.Hint }))); } } else { //判断用户是否为栏目管理员 if (!authorizer.CMS_ManageContentItemsForChannel()) { return(Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Body = "您没有权限在前台管理资讯", Title = "没有权限", StatusMessageType = StatusMessageType.Hint }))); } } var contentTypes = new MetadataService().GetContentTypes(true); ViewData["ContentTypes"] = contentTypes; long?moderatorUserId = null; if (!authorizer.IsAdministrator(CmsConfig.Instance().ApplicationId)) { moderatorUserId = currentUser.UserId; } PagingDataSet <ContentItem> items = contentItemService.GetContentItemsForAdmin(auditStatus, subjectKeyWord, folderId, true, tagNameKeyword: tagNameKeyword, userId: id, moderatorUserId: moderatorUserId, minDate: minDate, maxDate: maxDate, pageSize: pageSize, pageIndex: pageIndex); pageResourceManager.InsertTitlePart("资讯管理"); RouteData.Values["CurrentNavigationId"] = "10101501"; return(View(items)); }
public ActionResult ManageContentItems(AuditStatus? auditStatus = null, int? folderId = null, string subjectKeyWord = null, string tagNameKeyword = null, string userId = null, DateTime? minDate = null, DateTime? maxDate = null, int pageSize = 20, int pageIndex = 1) { IUser currentUser = UserContext.CurrentUser; if (currentUser == null) return Redirect(SiteUrls.Instance().Login(true)); long? id = null; if (!string.IsNullOrEmpty(userId)) { userId = userId.TrimStart(',').TrimEnd(','); if (!string.IsNullOrEmpty(userId)) { id = long.Parse(userId); } } ViewData["userId"] = id; var contentFolderService = new ContentFolderService(); if (folderId.HasValue && folderId.Value > 0) { ContentFolder contentFolder = contentFolderService.Get(folderId.Value); if (!authorizer.CMS_ManageContentFolder(contentFolder)) { return Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Body = string.Format("您没有权限管理 {0} !", contentFolder == null ? "" : contentFolder.FolderName), Title = "没有权限", StatusMessageType = StatusMessageType.Hint })); } } else { //判断用户是否为栏目管理员 if (!authorizer.CMS_ManageContentItemsForChannel()) { return Redirect(SiteUrls.Instance().SystemMessage(TempData, new SystemMessageViewModel { Body = "您没有权限在前台管理资讯", Title = "没有权限", StatusMessageType = StatusMessageType.Hint })); } } var contentTypes = new MetadataService().GetContentTypes(true); ViewData["ContentTypes"] = contentTypes; long? moderatorUserId = null; if (!authorizer.IsAdministrator(CmsConfig.Instance().ApplicationId)) moderatorUserId = currentUser.UserId; PagingDataSet<ContentItem> items = contentItemService.GetContentItemsForAdmin(auditStatus, subjectKeyWord, folderId, true, tagNameKeyword: tagNameKeyword, userId: id, moderatorUserId: moderatorUserId, minDate: minDate, maxDate: maxDate, pageSize: pageSize, pageIndex: pageIndex); pageResourceManager.InsertTitlePart("资讯管理"); RouteData.Values["CurrentNavigationId"] = "10101501"; return View(items); }
/// <summary> /// 栏目详细页 /// </summary> public ActionResult FolderDetail(int contentFolderId, int pageSize = 15, int pageIndex = 1) { var contentFolderService = new ContentFolderService(); var folder = contentFolderService.Get(contentFolderId); if (folder == null || !folder.IsEnabled) { return HttpNotFound(); } pageResourceManager.InsertTitlePart(folder.FolderName); pageResourceManager.SetMeta(new MetaEntry("Title", folder.METATitle)); pageResourceManager.SetMetaOfKeywords(folder.METAKeywords); pageResourceManager.SetMetaOfDescription(folder.METADescription); PagingDataSet<ContentItem> contentItems = contentItemService.GetContentItemsSortBy(ContentItemSortBy.ReleaseDate_Desc, null, contentFolderId, true, null, pageSize, pageIndex); if (Request.IsAjaxRequest()) return PartialView("_List", contentItems); ViewData["currentFolder"] = folder; ViewData["allParentContentFolders"] = folder.Parents; //设置路由数据中的当前导航Id RouteData.Values["CurrentNavigationId"] = NavigationService.GenerateDynamicNavigationId(folder.Parents.FirstOrDefault() == null ? contentFolderId : folder.Parents.First().ContentFolderId); return View(contentItems); }