public ActionResult _Menu_App(string spaceKey) { long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey); GroupEntity 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.GroupId); 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; } ManagementOperationService managementOperationService = new ManagementOperationService(); IEnumerable<ApplicationManagementOperation> applicationManagementOperations = managementOperationService.GetShortcuts(PresentAreaKeysOfBuiltIn.GroupSpace, false); if (applicationManagementOperations != null) { ViewData["ApplicationManagementOperations"] = applicationManagementOperations.Where(n => n.ApplicationId == navigation.ApplicationId); } } return View(navigations); }
public ActionResult _Menu_Main(string spaceKey) { long groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey); GroupEntity group = groupService.Get(groupId); if (group == null) return Content(string.Empty); ManagementOperationService managementOperationService = new ManagementOperationService(); ViewData["ApplicationManagementOperations"] = managementOperationService.GetShortcuts(PresentAreaKeysOfBuiltIn.GroupSpace, false); NavigationService navigationService = new NavigationService(); return View(navigationService.GetRootNavigations(PresentAreaKeysOfBuiltIn.GroupSpace, group.GroupId)); }
public ActionResult _ContentHeader() { #region 获取导航 int currentNavigationId = RouteData.Values.Get<int>("CurrentNavigationId", 0); if (currentNavigationId == 0) { object obj = null; TempData.TryGetValue("CurrentNavigationId", out obj); int.TryParse(obj.ToString(), out currentNavigationId); } Navigation currentNavigation = navigationService.GetNavigation(PresentAreaKeysOfBuiltIn.Channel, currentNavigationId); if (currentNavigation == null) return new EmptyResult(); IEnumerable<Navigation> navigations = new List<Navigation>(); if (currentNavigationId > 0) { IEnumerable<int> currentNavigationPath = navigationService.GetCurrentNavigationPath(PresentAreaKeysOfBuiltIn.ControlPanel, 0, currentNavigationId); IEnumerable<Navigation> rootNavigations = navigationService.GetRootNavigations(PresentAreaKeysOfBuiltIn.Channel); int parentNavigationId = 0; if (currentNavigationPath.Count() > 1) { parentNavigationId = currentNavigationPath.ElementAt(currentNavigationPath.Count() - 2); } else if (currentNavigationPath.Count() == 1) { parentNavigationId = currentNavigationPath.First(); } else if (currentNavigation.ParentNavigationId > 0) { parentNavigationId = currentNavigation.ParentNavigationId; } Navigation parentNavigation = new Navigation(); if (parentNavigationId == 0) { parentNavigation = currentNavigation; } else { parentNavigation = navigationService.GetNavigation(PresentAreaKeysOfBuiltIn.Channel, parentNavigationId); } if (parentNavigation.NavigationId > 0) { navigations = parentNavigation.Children; ApplicationBase application = applicationService.Get(parentNavigation.ApplicationId); ViewData["application"] = application; } } #endregion #region 快捷导航 ManagementOperationService managementOperationService = new ManagementOperationService(); ViewData["ManagementOperations"] = managementOperationService.GetShortcuts(PresentAreaKeysOfBuiltIn.Channel, false); #endregion return View(navigations); }
public ActionResult _MyHomeNavigations(string spaceKey, bool showOperation = false) { User user = userService.GetFullUser(spaceKey); if (user == null) return HttpNotFound(); IEnumerable<ApplicationModel> apps = applicationService.GetAll(true); ViewData["MicroblogApplication"] = applicationService.Get("Microblog"); IEnumerable<Navigation> navigations = new NavigationService().GetRootNavigations(PresentAreaKeysOfBuiltIn.UserSpace, user.UserId); navigations = navigations.Where(n => n.ApplicationId == 0 || (apps != null && apps.Select(s => s.ApplicationId).Contains(n.ApplicationId))); ViewData["navigations"] = navigations; if (showOperation) { IEnumerable<ApplicationManagementOperation> operations = new ManagementOperationService().GetShortcuts(PresentAreaKeysOfBuiltIn.UserSpace, true); operations = operations.Where(n => n.ApplicationId == 0 || (apps != null && apps.Select(s => s.ApplicationId).Contains(n.ApplicationId))); ViewData["ApplicationManagementOperations"] = operations; ViewData["ShowOperation"] = showOperation; } ViewData["user"] = user; return View(); }
public ActionResult _App_Panel(string spaceKey, AvatarSizeType? avatarSizeType) { User user = userService.GetFullUser(spaceKey); if (user == null) return new EmptyResult(); int currentNavigationId = RouteData.Values.Get<int>("CurrentNavigationId", 0); NavigationService navigationService = DIContainer.Resolve<NavigationService>(); Navigation navigation = navigationService.GetNavigation(PresentAreaKeysOfBuiltIn.UserSpace, currentNavigationId, user.UserId); IEnumerable<Navigation> navigations = new List<Navigation>(); if (navigation != null) { if (navigation.Depth == 0) { navigations = navigation.Children; ViewData["ParentNavigation"] = navigation; } else if (navigation.Parent != null) { navigations = navigation.Parent.Children; ViewData["ParentNavigation"] = navigation.Parent; } ApplicationModel app = applicationService.Get(navigation.ApplicationId); if (app != null) { ViewData["Application"] = app; ViewData["AppCount"] = new OwnerDataService(TenantTypeIds.Instance().User()).GetLong(user.UserId, app.ApplicationKey + "-ThreadCount"); } IEnumerable<ApplicationManagementOperation> applicationManagementOperations = new ManagementOperationService().GetShortcuts(PresentAreaKeysOfBuiltIn.UserSpace, false); ViewData["ApplicationManagementOperations"] = applicationManagementOperations.Where(n => n.ApplicationId == navigation.ApplicationId && n.PresentAreaKey == PresentAreaKeysOfBuiltIn.UserSpace); } ViewData["User"] = user; ViewData["AvatarSizeType"] = avatarSizeType; return View(navigations); }
/// <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)); }
/// <summary> /// 转换为ApplicationManagementOperation用于数据库存储 /// </summary> /// <returns></returns> public ApplicationManagementOperation AsApplicationManagementOperation() { ApplicationManagementOperation operation = null; ManagementOperationService managementOperationService = new ManagementOperationService(); if (managementOperationService.Get(this.OperationId) == null) { operation = new ApplicationManagementOperation(); operation.OperationId = this.OperationId; operation.DisplayOrder = this.OperationId; } else { operation = managementOperationService.Get(this.OperationId); } if (this.AssociatedNavigationId.HasValue) operation.AssociatedNavigationId = this.AssociatedNavigationId.Value; operation.ApplicationId = this.ApplicationId; operation.PresentAreaKey = this.PresentAreaKey; operation.OperationType = this.OperationType; //使用资源项 if (this.IsUseResourceItem) { operation.ResourceName = this.ResourceName; operation.OperationText = string.Empty; } else { operation.OperationText = this.OperationText; operation.ResourceName = string.Empty; } //使用路由 if (this.IsUseRoute) { operation.UrlRouteName = this.UrlRouteName ?? string.Empty; operation.NavigationUrl = string.Empty; } else { operation.NavigationUrl = this.NavigationUrl ?? string.Empty; operation.UrlRouteName = string.Empty; } if (IconNameOption) { operation.IconName = this.IconName; operation.ImageUrl = null; } else { operation.IconName = null; if (this.IsWholeLink) { operation.ImageUrl = this.ImageUrl; } else { if (this.ImageName != null) { operation.ImageUrl = "~/Uploads/NavigationImage/" + this.ImageName; } else { operation.ImageUrl = null; } } } operation.NavigationTarget = this.NavigationTarget; operation.OnlyOwnerVisible = this.OnlyOwnerVisible; operation.IsEnabled = this.IsEnabled; operation.IsLocked = this.IsLocked; return operation; }