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));
        }
Пример #2
0
        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 _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);
        }
        /// <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));
        }