private void BindJsTree() { string str = string.Empty; if (this.Request["tab"] != null) { str = this.Request["tab"]; } if (string.IsNullOrEmpty(str)) { return; } List <JsonTreeNode> nodes = new List <JsonTreeNode>(); Navigation navigation = XmlModelHelper.GetNavigation("LeftMenu", string.Empty); if (navigation == null || navigation.Tabs == null) { return; } foreach (Tab tab in navigation.Tabs.Tab) { if (!string.IsNullOrEmpty(str) && str == tab.id || string.IsNullOrEmpty(str)) { JsonTreeNode jsonTreeNode = new JsonTreeNode(); jsonTreeNode.id = tab.id; jsonTreeNode.text = UtilHelper.GetResFileString(tab.text); jsonTreeNode.cls = "nodeCls"; if (!string.IsNullOrEmpty(tab.imageUrl)) { jsonTreeNode.icon = this.ResolveUrl(tab.imageUrl); } jsonTreeNode.children = new List <JsonTreeNode>(); jsonTreeNode.expanded = true; int num = 0; if (tab.Items != null) { num = this.BindRecursive(jsonTreeNode.children, tab.Items); } if (num == 0) { jsonTreeNode.leaf = true; jsonTreeNode.children = (List <JsonTreeNode>)null; } nodes.Add(jsonTreeNode); } } this.WriteArray(nodes); }
private void BindFullTree() { List <JsonTreeNode> nodes = new List <JsonTreeNode>(); XmlBuilder.GetCustomizableXml2(StructureType.View, 1 != 0, new Selector(new string[1] { "LeftMenu" })); Navigation navigation = XmlModelHelper.GetNavigation("LeftMenu", string.Empty); if (navigation == null || navigation.Tabs == null) { return; } if (navigation.Commands.Command != null) { foreach (Mediachase.BusinessFoundation.XmlObjectModel.Command command in navigation.Commands.Command) { XmlCommand.GetCommandByName("", "LeftMenu", "", command.id); } } foreach (Tab tab in navigation.Tabs.Tab) { JsonTreeNode jsonTreeNode = new JsonTreeNode(); jsonTreeNode.id = tab.id; jsonTreeNode.text = UtilHelper.GetResFileString(tab.text); jsonTreeNode.cls = "nodeCls"; if (!string.IsNullOrEmpty(tab.imageUrl)) { jsonTreeNode.icon = this.ResolveUrl(tab.imageUrl); } jsonTreeNode.children = new List <JsonTreeNode>(); int num = 0; if (tab.Items != null) { num = this.BindRecursiveNoAsync(jsonTreeNode.children, tab.Items); } if (num == 0) { jsonTreeNode.leaf = true; jsonTreeNode.children = (List <JsonTreeNode>)null; } nodes.Add(jsonTreeNode); } this.WriteArray(nodes); }