Esempio n. 1
0
        public void Render(HtmlTextWriter writer, IEnumerable menuItems, PageInfo page, BlogArticle article, MenuRenderingType direction)
        {
            StringBuilder sb = new StringBuilder();

            Render(sb, menuItems, page, article, direction);

            writer.Write(sb.ToString());
        }
Esempio n. 2
0
        public void Render(StringBuilder sb, IEnumerable menuItems, PageInfo page, BlogArticle article, MenuRenderingType direction)
        {
            if (direction != MenuRenderingType.None)
            {
                sb.AppendFormat("<div class='page-navigation-menu {0}'>", direction == MenuRenderingType.Horizontal ? "horizontal" : "vertical");

                Boolean isFirst = true;

                foreach (Object menuItem in menuItems)
                {
                    MenuInfo menu = null;

                    if (menuItem is String)
                    {
                        String menuItemName = menuItem as String;

                        if (String.IsNullOrEmpty(menuItemName))
                            continue;

                        menu = FindMenuByName(menuItemName);
                    }
                    else if (menuItem is MenuInfo)
                    {
                        menu = menuItem as MenuInfo;
                    }
                    else
                        throw new Exception(String.Format("Unknown type {0}.", menuItem.GetType().Name));

                    if (menu == null)
                        continue;

                    if (!isFirst)
                        sb.Append("<div class='menu-separator'>&nbsp;</div>");

                    menu.Render(sb, page, article, direction);

                    isFirst = false;
                }

                sb.Append("</div>");
            }
        }
Esempio n. 3
0
        public void Render(StringBuilder sb, PageInfo page, BlogArticle article, MenuRenderingType direction)
        {
            foreach (MenuSectionInfo section in _sections)
            {
                if (section.ShowHeader && !String.IsNullOrEmpty(section.Title))
                    sb.AppendFormat("<div class='menu-section-title'>{0}</div>", section.Title);

                if (!section.IsHtml)
                {
                    if (direction == MenuRenderingType.Horizontal)
                        RenderSectionHorizontal(sb, page, article, section);
                    else if (direction == MenuRenderingType.Vertical)
                        RenderSectionVertical(sb, page, article, section);
                }
                else
                {
                    sb.AppendFormat("<div class='menu-list-container'>{0}</div>", section.InnerHtml);
                }
            }
        }