示例#1
0
        protected virtual string GetContent()
        {
            string result = "";
            int startLevel = 0;
            var filter = new MenuFilter();
            var menuMan = new MenuManager(true, false);
            //var currentMenu = MenuHelper.GetCurrentMenu(this.MenuType);  //hide 20110325
            var currentMenu = ((PigeonCms.BasePage)this.Page).MenuEntry;
            var selectedIdList = new List<int>();     //list of parent id for current menu

            filter.FilterContentType = false;
            filter.MenuType = this.MenuType;
            filter.Visible = Utility.TristateBool.True;
            filter.ParentId = 0;

            selectedIdList = menuMan.GetParentIdList(currentMenu.Id);

            if (this.MenuLevel > 0)
            {
                //set current page as start level (used to build context menu)
                if (currentMenu.Id > 0)
                {
                    int currentMenuLevel = menuMan.GetMenuLevel(currentMenu.Id);
                    if (currentMenuLevel < this.MenuLevel)
                    {
                        filter.ParentId = currentMenu.Id;
                    }
                    else if (currentMenuLevel == this.MenuLevel)
                    {
                        filter.ParentId = currentMenu.ParentId;
                    }
                    else if (currentMenuLevel > this.MenuLevel)
                    {
                        //TO COMPLETE
                        filter.ParentId = menuMan.GetByKey(currentMenu.ParentId).ParentId;
                    }
                }
                else
                {
                    //if not found current page in menu does not load menu
                    filter.Id = -1;
                }
            }

            loadTree(ref result, filter, startLevel, selectedIdList, false);
            return result;
        }