示例#1
0
        static TopicStorage GetLastTopicForForumSection(LightSection forumSection)
        {
            LightHead lastTopic = _.First(context.Forum.ForSection(forumSection.Id).Topics);

            if (lastTopic == null)
            {
                return(null);
            }

            return(context.Forum.TopicsStorages.ForTopic(lastTopic.Id));
        }
示例#2
0
        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)));
        }
示例#3
0
        public static IHtmlControl GetTopicView(SiteState state,
                                                LightObject currentUser, TopicStorage topic, int pageNumber)
        {
            if (topic == null || topic.Topic == null)
            {
                return(null);
            }

            int?         forumSectionId = topic.Topic.GetParentId(ForumSectionType.TopicLinks);
            LightSection forumSection   = context.Store.Sections.FindSection(forumSectionId);

            if (forumSection == null)
            {
                return(null);
            }

            IHtmlControl editPanel = null;

            if (state.ModeratorMode)
            {
                editPanel = GetTopicRedoPanel(state, currentUser, forumSection, topic);
            }

            RowLink[] allMessages  = topic.MessageLink.AllRows;
            RowLink[] pageMessages = ViewJumpHlp.GetPageItems(allMessages, forumMessageCountOnPage, pageNumber);

            if (pageMessages == null)
            {
                return(null);
            }

            return(new HPanel(
                       Decor.Title(topic.Topic.Get(TopicType.Title)).MarginBottom(15),
                       new HPanel(
                           new HLink("/forum", "Форумы"),
                           ArrowElement(),
                           new HLink(UrlHlp.ShopUrl("page", forumSectionId),
                                     forumSection?.Get(SectionType.Title)
                                     )
                           ).MarginBottom(10),
                       editPanel,
                       ViewJumpHlp.JumpBar(string.Format("/topic/{0}", topic.TopicId),
                                           allMessages.Length, forumMessageCountOnPage, pageNumber
                                           ).MarginBottom(5),
                       ViewCommentHlp.GetCommentsPanel(context.ForumConnection, state, currentUser, topic, pageMessages),
                       ViewJumpHlp.JumpBar(string.Format("/topic/{0}", topic.TopicId),
                                           allMessages.Length, forumMessageCountOnPage, pageNumber
                                           ).MarginTop(10)
                       ));
        }
示例#4
0
        public static IHtmlControl GetReclameColumnView(SiteState state)
        {
            LightSection main = context.Store.Sections.FindMenu("main");

            return(new HPanel(
                       new HGrid <LightKin>(main.Units, delegate(LightKin unit)
            {
                return new HPanel(
                    new HLink(unit.Get(UnitType.Link),
                              new HImage(UrlHlp.ImageUrl(unit.Id, true))
                              .Alt(unit.Get(UnitType.ImageAlt)).Title(unit.Get(UnitType.Annotation))
                              ).TargetBlank(),
                    DecorEdit.AdminUnitRedoIcon(state.EditMode, unit.Id)
                    ).PositionRelative().MarginBottom(5);
            },
                                            new HRowStyle()
                                            ),
                       DecorEdit.AdminUnitPanel(state.EditMode, main.Id)
                       ).Width(220));
        }
示例#5
0
        public static IHtmlControl GetMenuItem(SiteState state, LightSection section, string url, bool isSelected)
        {
            HLabel label = new HLabel(section.NameInMenu, new HHover().TextDecoration("none"))
                           .Padding(10, 17, 12, 17).TextDecoration("underline");

            if (!isSelected)
            {
                label.Color(Decor.menuColor);
            }
            else
            {
                label.Color(Decor.menuSelectedColor).FontBold().Background(Decor.menuSelectedBackground);
            }

            return(new HPanel(
                       //new HLink(UrlHlp.ShopUrl("page", section.Id),
                       new HLink(url,
                                 label
                                 )
                       ).InlineBlock());
        }
示例#6
0
        public static IHtmlControl GetForumSectionView(SiteState state, LightObject currentUser, LightSection section)
        {
            LightHead[] topics = context.Forum.ForSection(section.Id).Topics;

            IHtmlControl addPanel = null;

            if (currentUser != null)
            {
                addPanel = GetTopicAddPanel(state, currentUser, section);
            }

            return(new HPanel(
                       Decor.Title(section.Get(SectionType.Title)).MarginBottom(15),
                       new HPanel(
                           new HLink("/forum", "Форумы")
                           ).MarginBottom(25),
                       //new HPanel(
                       //  new HLink("/forum", "Форумы"),
                       //  ArrowElement(),
                       //  new HLabel(section.Get(SectionType.Title))
                       //).MarginBottom(10),
                       addPanel,
                       new HGrid <LightHead>(topics, delegate(LightHead topic)
            {
                TopicStorage topicStorage = context.Forum.TopicsStorages.ForTopic(topic.Id);
                //int publisherId = topicStorage.Topic.Get(TopicType.PublisherId);
                //LightObject user = context.UserStorage.FindUser(publisherId);

                RowLink lastMessage = _.Last(topicStorage.MessageLink.AllRows);
                LightObject lastUser = FindUserForMessage(lastMessage);

                return new HPanel(
                    new HPanel(
                        new HLink(string.Format("{0}?page=last", UrlHlp.ShopUrl("topic", topic.Id)),
                                  topic.Get(TopicType.Title)
                                  ).FontBold()
                        ).RelativeWidth(55).Padding(8, 5, 9, 5).BorderRight(Decor.columnBorder)
                    .MediaTablet(new HStyle().Block().Width("auto")),
                    //new HPanel(
                    //  new HLink(UrlHlp.ShopUrl("user", publisherId),
                    //    user?.Get(UserType.Login)
                    //  ).FontBold()
                    //).Align(null),
                    new HPanel(
                        new HLabel(topicStorage.MessageLink.AllRows.Length)
                        ).Align(null).RelativeWidth(10).PaddingTop(8).PaddingBottom(9).BorderRight(Decor.columnBorder)
                    .MediaTablet(new HStyle().Width(50).PaddingTop(0)),
                    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", topic.Id)),
                            new HImage("/images/full.gif")
                            )
                        ).RelativeWidth(35).Padding(0, 5)
                    .MediaTablet(new HStyle().Width("auto"))
                    );
            },
                                             new HRowStyle().Even(new HTone().Background(Decor.evenBackground))
                                             ).BorderBottom(Decor.bottomBorder).MarginBottom(10)
                       ));
        }
示例#7
0
        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)
                       ));
        }
示例#8
0
        static IHtmlControl GetTopicRedoPanel(SiteState state,
                                              LightObject currentUser, LightSection forumSection, TopicStorage topic)
        {
            string blockHint = string.Format("topic_edit_{0}", topic.TopicId);

            IHtmlControl redoPanel = null;

            if (state.BlockHint == blockHint)
            {
                redoPanel = new HPanel(
                    new HPanel(
                        Decor.Button("Удалить тему").Event("delete_topic", "", delegate
                {
                    int messageCount = topic.MessageLink.AllRows.Length;
                    if (!state.Operation.Validate(messageCount > 1, "Тема с комментариями не может быть удалена"))
                    {
                        return;
                    }

                    MessageHlp.DeleteTopicMessages(context.ForumConnection, topic.Topic.Id);
                    BasketballHlp.DeleteTopic(context.FabricConnection, topic.TopicId);

                    topic.UpdateTopic();
                    topic.UpdateMessages();
                    context.UpdateLastComments(true);
                    context.Forum.ForSection(forumSection.Id).Update();

                    state.RedirectUrl = "/";
                }
                                                           )
                        ).Align(false),
                    Decor.PropertyEdit("editTopicTitle", "Заголовок темы", topic.Topic.Get(TopicType.Title)),
                    Decor.Button("Переименовать тему")
                    .Event("save_topic_edit", "editTopicData",
                           delegate(JsonData json)
                {
                    string title = json.GetText("editTopicTitle");

                    WebOperation operation = state.Operation;

                    if (!operation.Validate(title, "Не задан заголовок"))
                    {
                        return;
                    }

                    LightObject editTopic = DataBox.LoadObject(context.FabricConnection, TopicType.Topic, topic.TopicId);
                    editTopic.SetWithoutCheck(TopicType.Title, title);

                    editTopic.Box.Update();

                    context.Forum.ForSection(forumSection.Id).Update();
                    topic.UpdateTopic();

                    state.BlockHint = "";
                },
                           topic.TopicId
                           )
                    ).EditContainer("editTopicData")
                            .Padding(5, 10).MarginTop(5).Background(Decor.pageBackground);
            }

            return(new HPanel(
                       Decor.Button("Редактировать")
                       .Event("topic_edit", "", delegate
            {
                state.SetBlockHint(blockHint);
            }
                              ),
                       redoPanel
                       ).MarginTop(5).MarginBottom(10));
        }
示例#9
0
        static IHtmlControl GetTopicAddPanel(SiteState state, LightObject currentUser, LightSection section)
        {
            string blockHint = "topic_add";

            IHtmlControl addPanel = null;

            if (state.BlockHint == blockHint)
            {
                addPanel = new HPanel(
                    Decor.PropertyEdit("addTopicTitle", "Заголовок темы"),
                    new HTextArea("addTopicText")
                    .Width("100%").Height("6em").MarginBottom(5),
                    Decor.Button("Сохранить").MarginTop(10)
                    .Event("save_topic_add", "addTopicData", delegate(JsonData json)
                {
                    string title = json.GetText("addTopicTitle");
                    string text  = json.GetText("addTopicText");

                    WebOperation operation = state.Operation;

                    if (!operation.Validate(title, "Не задан заголовок"))
                    {
                        return;
                    }
                    if (!operation.Validate(text, "Не задан текст"))
                    {
                        return;
                    }

                    KinBox editBox = new KinBox(context.FabricConnection, "1=0");

                    int addTopicId    = editBox.CreateObject(TopicType.Topic, TopicType.Title.CreateXmlIds(title), DateTime.UtcNow);
                    LightKin addTopic = new LightKin(editBox, addTopicId);

                    addTopic.SetParentId(ForumSectionType.TopicLinks, section.Id);

                    addTopic.Set(ObjectType.ActTill, DateTime.UtcNow);
                    addTopic.Set(TopicType.PublisherId, currentUser.Id);

                    editBox.Update();

                    MessageHlp.InsertMessage(context.ForumConnection, addTopic.Id, currentUser.Id, null, text);

                    context.UpdateLastComments(true);
                    context.Forum.ForSection(section.Id).Update();

                    state.BlockHint = "";

                    //context.Forum.TopicsStorages.ForTopic(addTopic.Id);
                }
                           )
                    ).EditContainer("addTopicData").MarginTop(5);
            }

            return(new HPanel(
                       Decor.Button("Создать тему")
                       .Event("topic_add", "", delegate
            {
                state.SetBlockHint(blockHint);
            }
                              ),
                       addPanel
                       ).MarginTop(5).MarginBottom(10));
        }
示例#10
0
        public static IHtmlControl GetCenter(HttpContext httpContext, SiteState state,
                                             LightObject currentUser, string kind, int?id,
                                             out string title, out string description, out SchemaOrg schema, out bool wideContent)
        {
            title       = "";
            description = "";
            schema      = null;
            wideContent = false;

            SiteSettings settings = context.SiteSettings;

            switch (kind)
            {
            case "":
            {
                title       = store.SEO.Get(SEOType.MainTitle);
                description = store.SEO.Get(SEOType.MainDescription);
                LightSection main = store.Sections.FindMenu("main");
                return(ViewHlp.GetMainView(state, currentUser));
            }

            case "news":
            {
                if (!context.News.ObjectById.Exist(id))
                {
                    return(null);
                }
                TopicStorage topicStorage = context.NewsStorages.ForTopic(id ?? 0);
                LightKin     topic        = topicStorage.Topic;
                //string tagsDisplay;
                IHtmlControl view = ViewNewsHlp.GetNewsView(state, currentUser, topicStorage, out description);

                title = topic.Get(NewsType.Title);

                //string postfix = "";
                //if (!StringHlp.IsEmpty(tagsDisplay))
                //  postfix = ". ";
                //description = string.Format("{0}{1}Живое обсуждение баскетбольных событий на basketball.ru.com",
                //  tagsDisplay, postfix
                //);

                string logoUrl = settings.FullUrl("/images/logo.gif");
                schema = new SchemaOrg("NewsArticle", settings.FullUrl(UrlHlp.ShopUrl("news", id)),
                                       title, new string[] { logoUrl }, topic.Get(ObjectType.ActFrom), topic.Get(ObjectType.ActTill),
                                       topic.Get(TopicType.OriginName), settings.Organization,
                                       logoUrl, description
                                       );

                return(view);
            }

            case "article":
            {
                if (!context.Articles.ObjectById.Exist(id))
                {
                    return(null);
                }
                TopicStorage topicStorage = context.ArticleStorages.ForTopic(id ?? 0);
                LightKin     topic        = topicStorage.Topic;
                title       = topic.Get(ArticleType.Title);
                description = topic.Get(ArticleType.Annotation);

                string logoUrl = settings.FullUrl("/images/logo.gif");
                schema = new SchemaOrg("Article", settings.FullUrl(UrlHlp.ShopUrl("article", id)),
                                       title, new string[] { logoUrl }, topic.Get(ObjectType.ActFrom), topic.Get(ObjectType.ActTill),
                                       topic.Get(TopicType.OriginName), settings.Organization,
                                       logoUrl, description
                                       );
                wideContent = topic.Get(ArticleType.WideContent);
                return(ViewArticleHlp.GetArticleView(state, currentUser, topicStorage));
            }

            case "topic":
            {
                TopicStorage topic = context.Forum.TopicsStorages.ForTopic(id ?? 0);
                title = topic.Topic.Get(TopicType.Title);

                int pageNumber = 0;
                {
                    string pageArg      = httpContext.Get("page");
                    int    messageCount = topic.MessageLink.AllRows.Length;
                    if (pageArg == "last" && messageCount > 0)
                    {
                        pageNumber = BinaryHlp.RoundUp(messageCount, ViewForumHlp.forumMessageCountOnPage) - 1;
                    }
                    else
                    {
                        pageNumber = ConvertHlp.ToInt(pageArg) ?? 0;
                    }
                }

                return(ViewForumHlp.GetTopicView(state, currentUser, topic, pageNumber));
            }

            case "tags":
            {
                int?tagId      = httpContext.GetUInt("tag");
                int pageNumber = httpContext.GetUInt("page") ?? 0;
                return(ViewNewsHlp.GetTagView(state, currentUser, tagId, pageNumber, out title, out description));
            }

            case "search":
            {
                return(ViewNewsHlp.GetFoundTagListView(state, out title));
            }

            case "user":
            {
                LightObject user = context.UserStorage.FindUser(id ?? -1);
                if (user == null)
                {
                    return(null);
                }
                title = string.Format("{0} - Basketball.ru.com", user.Get(UserType.Login));
                return(ViewUserHlp.GetUserView(state, currentUser, user));
            }

            case "page":
            {
                LightSection section = store.Sections.FindSection(id);
                title       = FabricHlp.GetSeoTitle(section, section.Get(SectionType.Title));
                description = FabricHlp.GetSeoDescription(section, section.Get(SectionType.Annotation));

                int    pageNumber = httpContext.GetUInt("page") ?? 0;
                string designKind = section.Get(SectionType.DesignKind);
                switch (designKind)
                {
                case "news":
                {
                    int[] allNewsIds = context.News.AllObjectIds;
                    return(ViewNewsHlp.GetNewsListView(state, currentUser, pageNumber));
                }

                case "articles":
                    return(ViewArticleHlp.GetArticleListView(state, currentUser, pageNumber));

                case "forum":
                    return(ViewForumHlp.GetForumView(state, currentUser, section));

                case "forumSection":
                    return(ViewForumHlp.GetForumSectionView(state, currentUser, section));

                default:
                    return(null);
                }
            }

            case "dialog":
            {
                if (currentUser == null)
                {
                    return(null);
                }

                if (id == null)
                {
                    return(ViewDialogueHlp.GetDialogueView(state,
                                                           context.ForumConnection, context.UserStorage, currentUser, out title
                                                           ));
                }

                LightObject collocutor = context.UserStorage.FindUser(id.Value);
                if (collocutor == null)
                {
                    return(null);
                }

                return(ViewDialogueHlp.GetCorrespondenceView(state, context.ForumConnection,
                                                             currentUser, collocutor, out title
                                                             ));
            }

            case "passwordreset":
                title = "Восстановление пароля - basketball.ru.com";
                return(ViewHlp.GetRestorePasswordView(state));

            case "register":
                title = "Регистрация - basketball.ru.com";
                return(ViewHlp.GetRegisterView(state));

            case "confirmation":
            {
                title = "Подтверждение аккаунта";

                int?   userId = httpContext.GetUInt("id");
                string hash   = httpContext.Get("hash");

                if (userId == null)
                {
                    return(ViewUserHlp.GetMessageView(
                               "Вам выслано письмо с кодом активации. Чтобы завершить процедуру регистрации, пройдите по ссылке, указанной в письме, и учётная запись будет активирована. Если вы не получили письмо, то попробуйте войти на сайт со своим логином и паролем. Тогда письмо будет отправлено повторно."
                               ));
                }

                if (StringHlp.IsEmpty(hash))
                {
                    return(null);
                }

                LightObject user = context.UserStorage.FindUser(userId.Value);
                if (userId == null)
                {
                    return(null);
                }

                if (!user.Get(UserType.NotConfirmed))
                {
                    return(ViewUserHlp.GetMessageView("Пользователь успешно активирован"));
                }

                string login  = user.Get(UserType.Login);
                string etalon = UserHlp.CalcConfirmationCode(user.Id, login, "bbbin");
                if (hash?.ToLower() != etalon?.ToLower())
                {
                    return(ViewUserHlp.GetMessageView("Неверный хэш"));
                }

                LightObject editUser = DataBox.LoadObject(context.UserConnection, UserType.User, user.Id);
                editUser.Set(UserType.NotConfirmed, false);
                editUser.Box.Update();

                context.UserStorage.Update();

                string xmlLogin = UserType.Login.CreateXmlIds("", login);
                HttpContext.Current.SetUserAndCookie(xmlLogin);

                state.RedirectUrl = "/";

                return(new HPanel());
            }
            }

            return(null);
        }
示例#11
0
        static HElement Page(HttpContext httpContext, SiteState state, string kind, int?id)
        {
            UserHlp.DirectAuthorization(httpContext, SiteContext.Default.SiteSettings);

            LightObject currentUser = UserHlp.GetCurrentUser(httpContext, SiteContext.Default.UserStorage);

            if (currentUser != null && (BasketballHlp.IsBanned(currentUser) || currentUser.Get(UserType.NotConfirmed)))
            {
                currentUser = null;
                httpContext.Logout();
            }

            state.EditMode = httpContext.IsInRole("edit");
            state.SeoMode  = httpContext.IsInRole("seo");
            state.UserMode = currentUser != null;

            int[] foundTagIds = state.Option.Get(OptionType.FoundTagIds);
            if (foundTagIds != null && foundTagIds.Length > 0)
            {
                kind = "search";
                id   = null;
            }

            IHtmlControl adminSectionPanel = null;

            if (kind == "page")
            {
                LightSection section = store.Sections.FindSection(id);
                adminSectionPanel = DecorEdit.AdminSectionPanel(
                    state.EditMode, state.SeoMode, kind, section, false
                    );
            }

            IHtmlControl dialogBox = null;

            if (!StringHlp.IsEmpty(state.Operation.Message))
            {
                dialogBox = DecorEdit.GetDialogBox(state);
            }

            bool isForum = kind == "topic";

            if (kind == "page")
            {
                LightSection pageSection = store.Sections.FindSection(id);
                string       designKind  = pageSection.Get(SectionType.DesignKind);
                if (pageSection != null && (designKind == "forum" || designKind == "forumSection"))
                {
                    isForum = true;
                }
            }


            string    title       = "";
            string    description = "";
            SchemaOrg schema      = null;
            bool      wideContent;

            IHtmlControl centerView = ViewHlp.GetCenter(httpContext,
                                                        state, currentUser, kind, id, out title, out description, out schema, out wideContent
                                                        );

            if (centerView == null && StringHlp.IsEmpty(state.RedirectUrl))
            {
                return(null);
            }

            BasketballContext context = (BasketballContext)SiteContext.Default;

            try
            {
                if (currentUser != null && kind == "dialog" && id != null)
                {
                    if (context.UnreadDialogLink.FindRow(DialogReadType.UnreadByUserId, currentUser.Id) != null)
                    {
                        DialogueHlp.MarkReadCorrespondence(context.ForumConnection, currentUser.Id, id.Value);
                        context.UpdateUnreadDialogs();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteException(ex);
            }

            HEventPanel mainPanel = new HEventPanel(
                new HPanel(
                    new HAnchor("top"),
                    DecorEdit.AdminMainPanel(SiteContext.Default.SiteSettings, httpContext),
                    ViewHeaderHlp.GetHeader(httpContext, state, currentUser, kind, id, isForum),
                    adminSectionPanel,
                    new HPanel(
                        new HPanel(
                            centerView,
                            new HPanel(
                                ViewRightColumnHlp.GetRightColumnView(state, isForum).InlineBlock().MarginRight(15)
                                .MediaLaptop(new HStyle().Block().MarginRight(0))
                                .MediaTablet(new HStyle().InlineBlock().MarginRight(15))
                                .MediaSmartfon(new HStyle().Width("100%").MarginRight(0)),
                                ViewRightColumnHlp.GetReclameColumnView(state).InlineBlock().VAlign(true)
                                ).Hide(wideContent).PositionAbsolute().Top(13).Right(15)
                            .MediaTablet(new HStyle().Position("static").MarginTop(15))
                            //.MediaSmartfon(new HStyle().Width("100%"))
                            ).PositionRelative().Align(true)
                        .Padding(15).PaddingRight(485)
                        .WidthLimit("", kind == "" ? "727px" : "892px")
                        .MediaLaptop(new HStyle().PaddingRight(250))
                        .MediaTablet(new HStyle().PaddingRight(15))
                        .MediaSmartfon(new HStyle().PaddingLeft(5).PaddingRight(5))
                        ).MarginLeft(12).MarginRight(12).PaddingBottom(160).Background(Decor.panelBackground)
                    .BoxSizing().HeightLimit("900px", "")
                    .MediaTablet(new HStyle().MarginLeft(0).MarginRight(0))
                    ),
                ViewHlp.GetFooterView(kind == ""),
                dialogBox
                //popupPanel
                ).Width("100%").BoxSizing().Align(null).Background(Decor.pageBackground)
                                    .Padding(1)
                                    .FontFamily("Tahoma").FontSize(12); //.Color(Decor.textColor);

            if (!StringHlp.IsEmpty(state.PopupHint) || dialogBox != null)
            {
                mainPanel.OnClick(";");
                mainPanel.Event("popup_reset", "", delegate
                {
                    state.PopupHint = "";
                    state.Operation.Reset();
                });
            }

            StringBuilder css = new StringBuilder();

            std.AddStyleForFileUploaderButtons(css);

            HElement mainElement = mainPanel.ToHtml("main", css);

            SiteSettings settings = SiteContext.Default.SiteSettings;

            //string blockHint = state.BlockHint;
            //bool withCkeditor = false;
            //if (!StringHlp.IsEmpty(blockHint))
            //{
            //  withCkeditor = blockHint == "news_add" || blockHint.StartsWith("article_edit_") ||
            //    blockHint.StartsWith("news_edit_");
            //}
            //bool withFileuploader = kind == "user" || withCkeditor;

            return(h.Html
                   (
                       h.Head(
                           h.Element("title", title),
                           h.MetaDescription(description),
                           h.LinkCss(UrlHlp.FileUrl("/css/static.css")),
                           h.LinkShortcutIcon("/images/favicon.ico"),
                           h.Meta("viewport", "width=device-width"),
                           //h.LinkCss("/css/font-awesome.css"),
                           //h.LinkCss("/css/fileuploader.css"),
                           h.LinkScript("/scripts/fileuploader.js"),
                           h.LinkScript("/ckeditor/ckeditor.js?v=4113"),
                           HtmlHlp.CKEditorUpdateAll(),
                           h.Raw(store.SeoWidgets.WidgetsCode),
                           HtmlHlp.SchemaOrg(schema),
                           h.OpenGraph("type", "website"),
                           h.OpenGraph("title", title),
                           h.OpenGraph("url", description),
                           h.OpenGraph("site_name", settings.Organization),
                           h.OpenGraph("image", settings.FullUrl("/images/logo_mini.jpg"))
                           ),
                       h.Body(
                           h.Css(h.Raw(css.ToString())),
                           h.Div(
                               HtmlHlp.RedirectScript(state.RedirectUrl)
                               ),
                           //h.Div(
                           //  withFileuploader ? h.LinkScript("/scripts/fileuploader.js") : null,
                           //  withCkeditor ? h.LinkScript("/ckeditor/ckeditor.js") : null,
                           //  withCkeditor ? HtmlHlp.CKEditorUpdateAll() : null
                           //),
                           mainElement
                           //withEditor ? h.Script(h.type("text/javascript"), "console.log('withScript');") : null,
                           //!withFileuploader && withEditor ? h.LinkScript("/scripts/fileuploader.js") : null,
                           //withEditor ? h.LinkScript("/ckeditor/ckeditor.js") : null,
                           //withEditor ? HtmlHlp.CKEditorUpdateAll() : null
                           //HtmlHlp.SchemaOrg(schema),
                           )
                   ));
        }