public static IHtmlControl GetMenu(SiteState state, LightObject currentUser, string kind, int?id, bool isForum) { LightSection main = store.Sections.FindMenu("main"); List <IHtmlControl> items = new List <IHtmlControl>(); foreach (LightSection section in main.Subsections) { bool isSelected = kind == "page" && id == section.Id; string designKind = section.Get(SectionType.DesignKind); if (designKind == "news" && kind == "news") { isSelected = true; } //hack захардкодена статья с правилами else if (designKind == "articles" && kind == "article" && id != 118210) { isSelected = true; } else if (designKind == "forum" && isForum) { isSelected = true; } else if (designKind == "rules" && id == 118210) { isSelected = true; } string url = designKind != "rules" ? UrlHlp.ShopUrl("page", section.Id) : section.Get(SectionType.Link); items.Add( ViewHeaderHlp.GetMenuItem(state, section, url, isSelected) ); } if (state.EditMode) { items.Add(DecorEdit.AdminGroupPanel(true, main.Id)); } items.Add(GetSearchPanel(state)); return(new HPanel( new HPanel( items.ToArray() ), GetDialogItem(state, currentUser, kind) ).PositionRelative().Align(true).Padding(3, 60, 2, 2).Background(Decor.menuBackground) .Media(360, new HStyle().PaddingRight(20))); }
public static IHtmlControl GetForumView(SiteState state, LightObject currentUser, LightSection forum) { return(new HPanel( Decor.Title("Форумы").MarginBottom(15), new HGrid <LightSection>(forum.Subsections, delegate(LightSection subSection) { TopicStorage lastTopic = GetLastTopicForForumSection(subSection); RowLink lastMessage = lastTopic == null ? null : _.Last(lastTopic.MessageLink.AllRows); LightObject lastUser = FindUserForMessage(lastMessage); return new HPanel( new HPanel( new HLink(UrlHlp.ShopUrl("page", subSection.Id), subSection.Get(SectionType.Title) ).FontBold() ).RelativeWidth(50).PaddingLeft(5).VAlign(true).PaddingTop(15) .MediaTablet(new HStyle().Block().Width("auto")), new HPanel( new HPanel( new HLink(UrlHlp.ShopUrl("topic", lastTopic?.TopicId), lastTopic?.Topic.Get(TopicType.Title) ) ).MarginTop(7).MarginBottom(3), new HPanel( new HLink(UrlHlp.ShopUrl("user", lastUser?.Id), lastUser?.Get(UserType.Login) ), new HLabel( lastMessage?.Get(MessageType.CreateTime).ToLocalTime().ToString(Decor.timeFormat) ).MarginLeft(7).MarginRight(7), new HLink( string.Format("{0}?page=last#bottom", UrlHlp.ShopUrl("topic", lastTopic?.TopicId)), new HImage("/images/full.gif") ).Hide(lastMessage == null) ).MarginBottom(7) ).RelativeWidth(50).Padding(0, 5).Height(45).BorderLeft(Decor.columnBorder) .MediaTablet(new HStyle().Width("auto").Border("none")) ); }, new HRowStyle().Even(new HTone().Background(Decor.evenBackground)) ).BorderBottom(Decor.bottomBorder).MarginBottom(10), DecorEdit.AdminGroupPanel(state.EditMode, forum.Id) )); }