Exemplo n.º 1
0
        private void LoadItems(NavModule module, XmlNode moduleNode)
        {
            XmlNodeList list = moduleNode.SelectNodes("Item");

            if ((list != null) && (list.Count != 0))
            {
                foreach (XmlNode node in list)
                {
                    NavItem      item      = new NavItem();
                    XmlAttribute attribute = node.Attributes["Title"];
                    if (attribute != null)
                    {
                        item.SpanName = attribute.Value;
                    }
                    XmlAttribute attribute2 = node.Attributes["Class"];
                    if (attribute2 != null)
                    {
                        item.Class = attribute2.Value;
                    }
                    item.ID = node.Attributes["ID"].Value;
                    module.ItemList.Add(item.ID, item);
                    this.LoadPageLinks(item, node);
                }
            }
        }
Exemplo n.º 2
0
        private void LoadNavigationFromXml()
        {
            XmlNodeList list = this._xmlDoc.SelectNodes("Menu/Module");

            if ((list != null) && (list.Count != 0))
            {
                foreach (XmlNode node in list)
                {
                    NavModule module = new NavModule {
                        Title = node.Attributes["Title"].Value,
                        ID    = node.Attributes["ID"].Value
                    };
                    XmlAttribute attribute = node.Attributes["Link"];
                    if (attribute != null)
                    {
                        module.Link = attribute.Value.StartsWith("http") ? attribute.Value : (Globals.ApplicationPath + "/Admin/" + attribute.Value);
                    }
                    XmlAttribute attribute2 = node.Attributes["IsDivide"];
                    if ((attribute2 != null) && (attribute2.Value.ToLower() == "true"))
                    {
                        module.IsDivide = true;
                    }
                    XmlAttribute attribute3 = node.Attributes["Class"];
                    if (attribute3 != null)
                    {
                        module.Class = attribute3.Value;
                    }
                    this.LoadItems(module, node);
                    this._moduleList.Add(module.ID, module);
                }
            }
        }
Exemplo n.º 3
0
        public string RenderLeftMenu(string currentModuleId, string currentPageId)
        {
            NavModule     module   = this._moduleList[currentModuleId];
            StringBuilder leftMenu = new StringBuilder();

            foreach (NavItem item in module.ItemList.Values)
            {
                if (!string.IsNullOrEmpty(item.SpanName))
                {
                    leftMenu.AppendFormat("<em class=\"{0}\"></em>", item.Class).AppendLine();
                    leftMenu.AppendFormat("<span>{0}</span>", item.SpanName).AppendLine();
                }
                leftMenu.AppendFormat("<ul iid=\"{0}\">", item.ID).AppendLine();
                this.AppendLinks(leftMenu, item, currentPageId);
                leftMenu.AppendLine("</ul>");
            }
            return(leftMenu.ToString());
        }