예제 #1
0
 /// <summary>
 /// Returns the current instance of the TabCollection
 /// </summary>
 /// <returns></returns>
 protected TabCollection GetTabs()
 {
     if (tabs != null)
     {
         return(tabs);
     }
     else
     {
         if (!string.IsNullOrEmpty(FileName))
         {
             var path = FileLocation;
             return(TabCollection.GetTabs(path));
         }
         return(new TabCollection());
     }
 }
예제 #2
0
        public static List <Tab> GetTopMenuTabs()
        {
            var list = new List <Tab>();

            var menuPath = PathUtils.GetMenusPath("Top.config");

            if (!FileUtils.IsFileExists(menuPath))
            {
                return(list);
            }

            var tabs = TabCollection.GetTabs(menuPath);

            foreach (var parent in tabs.Tabs)
            {
                list.Add(parent);
            }

            return(list);
        }
예제 #3
0
 protected TabCollection GetAllTabs(int publishmentSystemId)
 {
     if (tabs != null)
     {
         return(tabs);
     }
     else
     {
         if (!string.IsNullOrEmpty(FileName))
         {
             var path = FileLocation;
             var tc   = TabCollection.GetTabs(path);
             foreach (Tab tab in tc.Tabs)
             {
                 if (!tab.HasChildren && StringUtils.EqualsIgnoreCase("cms", tab.MenuType))
                 {
                     var nodeIdList = DataProvider.NodeDao.GetHomeSiteNodeIdList();
                     foreach (var nodeId in nodeIdList)
                     {
                         var nodeInfo = NodeManager.GetNodeInfo(1, nodeId);
                         if (tab.Id != null && tab.Id.Equals(NodeManager.GetNodeModel(nodeInfo), StringComparison.OrdinalIgnoreCase))
                         {
                             if (nodeInfo != null)
                             {
                                 List <Tab> tabList    = tab.ChildrenChannels;
                                 Tab        tabChannel = ChannelInfoToTable(nodeInfo, publishmentSystemId);
                                 tabList.Add(tabChannel);
                                 if (tabList != null && tabList.Count > 0)
                                 {
                                     tab.Children = TabListToArray(tabList);
                                 }
                             }
                         }
                     }
                 }
             }
             return(tc);
         }
         return(new TabCollection());
     }
 }
예제 #4
0
        public static ArrayList GetMenuGroupTabArrayListOfApp(string appID, string menuID)
        {
            var arraylist = new ArrayList();

            var menuPath = PathUtils.GetMenusPath(appID, menuID + ".config");

            if (FileUtils.IsFileExists(menuPath))
            {
                try
                {
                    var tabs = TabCollection.GetTabs(menuPath);
                    foreach (var parent in tabs.Tabs)
                    {
                        arraylist.Add(parent);
                    }
                }
                catch { }
            }

            return(arraylist);
        }
예제 #5
0
        public static ArrayList GetMenuTopArrayList()
        {
            var tabArrayList = new ArrayList();

            var menuPath = PathUtils.GetMenusPath("Top.config");

            if (FileUtils.IsFileExists(menuPath))
            {
                try
                {
                    var tabs = TabCollection.GetTabs(menuPath);
                    foreach (var parent in tabs.Tabs)
                    {
                        parent.IsPlatform = true;
                        tabArrayList.Add(parent);
                    }
                }
                catch { }
            }

            return(tabArrayList);
        }
예제 #6
0
        public static List <Tab> GetTabList(string topId, int siteId)
        {
            var tabs = new List <Tab>();

            if (!string.IsNullOrEmpty(topId))
            {
                var filePath      = PathUtils.GetMenusPath($"{topId}.config");
                var tabCollection = TabCollection.GetTabs(filePath);
                if (tabCollection?.Tabs != null)
                {
                    foreach (var tabCollectionTab in tabCollection.Tabs)
                    {
                        tabs.Add(tabCollectionTab.Clone());
                    }
                }
            }

            var menus = new Dictionary <string, Menu>();

            if (siteId > 0 && topId == string.Empty)
            {
                var siteMenus = PluginMenuManager.GetSiteMenus(siteId);
                if (siteMenus != null)
                {
                    foreach (var siteMenu in siteMenus)
                    {
                        menus.Add(siteMenu.Key, siteMenu.Value);
                    }
                }
            }
            else if (topId == "Plugins")
            {
                var topMenus = PluginMenuManager.GetTopMenus();
                if (topMenus != null)
                {
                    foreach (var topMenu in topMenus)
                    {
                        menus.Add(topMenu.Key, topMenu.Value);
                    }
                }
            }

            foreach (var pluginId in menus.Keys)
            {
                var menu = menus[pluginId];

                var isExists = false;
                foreach (var childTab in tabs)
                {
                    if (childTab.Id == menu.Id)
                    {
                        isExists = true;
                    }
                }

                if (isExists)
                {
                    continue;
                }

                tabs.Add(GetPluginTab(menu, pluginId));

                //if (string.IsNullOrEmpty(menu.ParentId))
                //{
                //    var isExists = false;
                //    foreach (var childTab in tabs)
                //    {
                //        if (childTab.Id == menu.Id)
                //        {
                //            isExists = true;
                //        }
                //    }

                //    if (isExists) continue;

                //    tabs.Add(GetPluginTab(menu));
                //}
                //else
                //{
                //    foreach (var tab in tabs)
                //    {
                //        if (!StringUtils.EqualsIgnoreCase(menu.ParentId, tab.Id)) continue;

                //        var isExists = false;
                //        foreach (var childTab in tab.Children)
                //        {
                //            if (childTab.Id == menu.Id)
                //            {
                //                isExists = true;
                //            }
                //        }

                //        if (isExists) continue;

                //        var list = new List<Tab>();
                //        if (tab.Children != null)
                //        {
                //            list = tab.Children.ToList();
                //        }
                //        list.Add(GetPluginTab(menu));
                //        tab.Children = list.ToArray();
                //    }
                //}
            }

            return(tabs);
        }