public MenuItemInfo(XmlNode xmlNode, MenuSectionInfo parent) { if (parent == null) throw new ArgumentNullException("parent"); _parent = parent; ReadXmlAttributes(xmlNode); _isNew = false; }
public Boolean AddSection(Int32 menuID, MenuSectionInfo section) { Boolean isOk = false; if (section.IsNew) { MenuInfo menu = FindMenuByID(menuID); if (menu != null && !menu.IsNew) { section.ID = ++_nextItemID; isOk = menu.AddSection(section); } } return isOk; }
public Boolean AddSection(MenuSectionInfo section) { Boolean isOk = false; if (section.IsNew) { _sections.Add(section); isOk = true; } return isOk; }
public MenuInfo GetMenuInfo() { MenuInfo menu = new MenuInfo(); menu.Bullet = VerticalMenuBulletType.Sun; MenuSectionInfo section = new MenuSectionInfo(menu); section.Title = "Other Contacts"; foreach (ContactFormData formData in FormsData) { if (formData.IsDisplayInMenu) { MenuItemInfo menuItem = new MenuItemInfo(); menuItem.Title = formData.Name; menuItem.Href = LinkUtils.ResolveClientUrl(String.Format(Settings.Forms.ContactUs.UrlTemplate, formData.ID)); section.AddMenuItem(menuItem); } } menu.AddSection(section); return menu; }
private void RenderSectionVertical(StringBuilder sb, PageInfo page, BlogArticle article, MenuSectionInfo section) { String listClass = section.Bullet == VerticalMenuBulletType.Sun ? "sun-bullet-list" : section.Bullet == VerticalMenuBulletType.Triangle ? "triangle-bullet-list" : null; sb.AppendFormat("<div class='menu-list-container'><ul class='{0}'>", listClass); foreach (MenuItemInfo item in section.Items) { if (item.IsVisible(page, article)) { sb.Append("<li>"); item.Render(sb, page, article); sb.Append("</li>"); } } sb.Append("</ul></div>"); }
private void RenderSectionHorizontal(StringBuilder sb, PageInfo page, BlogArticle article, MenuSectionInfo section) { foreach (MenuItemInfo item in section.Items) { if (item.IsVisible(page, article)) { sb.AppendFormat(" {0} ", section.HorizontalSeparator); item.Render(sb, page, article); } } sb.AppendFormat(" {0} ", section.HorizontalSeparator); }
public Boolean MoveUp(MenuSectionInfo section) { Boolean isOk = false; Int32 sectionIndex = _sections.IndexOf(section); if (sectionIndex > 0) { _sections.RemoveAt(sectionIndex); _sections.Insert(sectionIndex - 1, section); isOk = true; } return isOk; }
public Boolean MoveDown(MenuSectionInfo section) { Boolean isOk = false; Int32 sectionIndex = _sections.IndexOf(section); if (sectionIndex >= 0 && sectionIndex < (_sections.Count - 1)) { _sections.RemoveAt(sectionIndex); _sections.Insert(sectionIndex + 1, section); isOk = true; } return isOk; }
private Boolean SaveSection() { Boolean isCancel = false; try { if (Section != null) { Section.Title = SectionTitle.Text; Section.ShowHeader = ShowHeader.Checked; Section.IsHtml = IsHtmlContent.Checked; if (Section.IsHtml) Section.InnerHtml = HtmlContentEditor.Content; if (!isCancel) { if (Section.IsNew) isCancel = !MenuManager.Current.AddSection(Menu.ID, Section); if (!isCancel) { SectionID = _section.ID; MenuManager.Current.Save(); _section = null; } } } } finally { MenuManager.Current.Reset(); } return !isCancel; }