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); }