private void AppendLinks(StringBuilder leftMenu, NavItem item, string currentPageId) { foreach (NavPageLink link in item.PageLinks.Values) { string str = (!string.IsNullOrEmpty(currentPageId) && (currentPageId == link.ID)) ? (link.Class + " active") : link.Class; leftMenu.Append("<li"); if (!string.IsNullOrEmpty(str)) { leftMenu.AppendFormat(" class=\"{0}\"", str); } if (!string.IsNullOrEmpty(link.Style)) { leftMenu.AppendFormat(" style=\"{0}\"", link.Style); } leftMenu.AppendFormat("><a href=\"{0}\" title=\"{1}\"", link.Link, link.Title); if (!string.IsNullOrEmpty(link.Target)) { leftMenu.AppendFormat(" target=\"{0}\"", link.Target); } leftMenu.AppendFormat(">{0}</a></li>", link.Title).AppendLine(); } }
private void LoadPageLinks(NavItem item, XmlNode itemNode) { XmlNodeList list = itemNode.SelectNodes("PageLink"); if ((list != null) && (list.Count != 0)) { foreach (XmlNode node in list) { NavPageLink link = new NavPageLink { ID = node.Attributes["ID"].Value, Title = node.Attributes["Title"].Value }; XmlAttribute attribute = node.Attributes["Link"]; if (attribute != null) { link.Link = attribute.Value.StartsWith("http") ? attribute.Value : (Globals.ApplicationPath + "/Admin/" + attribute.Value); } XmlAttribute attribute2 = node.Attributes["Class"]; if (attribute2 != null) { link.Class = attribute2.Value; } XmlAttribute attribute3 = node.Attributes["Style"]; if (attribute3 != null) { link.Style = attribute3.Value; } XmlAttribute attribute4 = node.Attributes["Target"]; if (attribute4 != null) { link.Target = attribute4.Value; } item.PageLinks.Add(link.ID, link); } } }