Example #1
0
 public static HPanel AuthEdit(IHtmlControl editControl, string caption)
 {
     return(new HPanel(
                new HLabel(caption).Block(),
                editControl.Width("100%")
                ).WidthLimit("", "380px").MarginBottom(15));
 }
Example #2
0
        public static IHtmlControl GetNewsView(SiteState state, LightObject currentUser, TopicStorage topic,
                                               out string description)
        {
            LightObject news = topic.Topic;

            description = BasketballHlp.GetDescriptionForNews(news);

            DateTime    localTime   = (news.Get(ObjectType.ActFrom) ?? DateTime.UtcNow).ToLocalTime();
            int         publisherId = news.Get(NewsType.PublisherId);
            LightObject publisher   = context.UserStorage.FindUser(publisherId);

            IHtmlControl editPanel = null;

            if (currentUser != null && (currentUser.Id == publisherId || currentUser.Get(BasketballUserType.IsModerator)))
            {
                editPanel = ViewNewsHlp.GetNewsEditPanel(state, topic);
            }

            IHtmlControl moderatorPanel = GetModeratorPanel(state, currentUser, topic, localTime);

            return(new HPanel(
                       Decor.Title(news.Get(NewsType.Title)),
                       new HLabel(localTime.ToString(Decor.timeFormat)).Block().FontBold(),
                       new HTextView(news.Get(NewsType.Text)).PositionRelative().Overflow("hidden"),
                       new HPanel(
                           new HLabel("Добавил:").MarginRight(5),
                           new HLink(UrlHlp.ShopUrl("user", publisherId), publisher?.Get(UserType.Login))
                           ),
                       new HLink(news.Get(NewsType.OriginUrl), news.Get(NewsType.OriginName)),
                       ViewTagHlp.GetViewTagsPanel(context.Tags.TagBox, topic.Topic),
                       editPanel,
                       moderatorPanel,
                       ViewCommentHlp.GetCommentsPanel(context.MessageConnection, state, currentUser, topic, topic.MessageLink.AllRows)
                       ));
        }
Example #3
0
 public static HAttribute GetClassNames(IHtmlControl control, string cssClassName)
 {
   string[] classNames = control.GetExtended("classNames") as string[];
   if (classNames != null)
     return h.@class(ArrayHlp.Merge(new string[] { cssClassName }, classNames));
   return h.@class(cssClassName);
 }
Example #4
0
 public HLink(string url, IHtmlControl innerControl, params HStyle[] pseudoClasses) :
   base("HUrl", "")
 {
   this.url = url;
   this.innerControl = innerControl;
   this.pseudoClasses = pseudoClasses;
 }
Example #5
0
 public HSpoiler(string spoilerCaption, IHtmlControl spoilerText, params HStyle[] pseudoClasses) :
   base("HSpoiler", "")
 {
   this.spoilerCaption = spoilerCaption;
   this.spoilerText = spoilerText;
   this.pseudoClasses = pseudoClasses;
 }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Banner;

            if (control == null)
            {
                return(new HtmlString(""));
            }

            var tagBuilder = new TagBuilder("div");

            if (!control.AllowUserToHideTheBanner)
            {
                tagBuilder.AddCssClass("fiu-banner");
                var innerDiv = new TagBuilder("div");
                innerDiv.AddCssClass("fiu-width-container");

                var h2 = new TagBuilder("h2");
                h2.AddCssClass("fiu-banner__heading");
                h2.InnerHtml.Append(control.Title);
                innerDiv.InnerHtml.AppendHtml(h2.WriteString());

                //var content = new TagBuilder("div");
                //content.AddCssClass("fiu-banner__body fiu-article");
                //content.InnerHtml.Append(control.)
                tagBuilder.InnerHtml.AppendHtml(innerDiv.WriteString());
            }

            return(new HtmlString(tagBuilder.WriteString()));
        }
Example #7
0
        public static IHtmlControl GetDialogueView(SiteState state,
                                                   IDataLayer forumConnection, UserStorage userStorage, LightObject user, out string title)
        {
            title = "Диалоги";

            TableLink dialogueLink = DialogueHlp.LoadDialogueLink(forumConnection,
                                                                  "user_id = @userId order by modify_time desc",
                                                                  new DbParameter("userId", user.Id)
                                                                  );

            IHtmlControl[] messageBlocks = new IHtmlControl[dialogueLink.AllRows.Length];
            int            i             = -1;

            foreach (RowLink dialog in dialogueLink.AllRows)
            {
                ++i;
                messageBlocks[i] = GetDialogBlock(forumConnection, userStorage, user, dialog, i);
            }

            return(new HPanel(
                       Decor.Title("Диалоги"),
                       new HPanel(
                           messageBlocks
                           )
                       ));
        }
Example #8
0
 public HHoverDropdown(HDropStyle dropStyle, 
   IHtmlControl rootControl, params IHtmlControl[] listControls) :
   base("HHoverDropdown", "")
 {
   this.dropStyle = dropStyle;
   this.rootControl = rootControl;
   this.listControls = listControls;
 }
Example #9
0
 public static object[] ContentForHElement(IHtmlControl control, string cssClassName, params object[] coreAttrs)
 {
   List<object> content = new List<object>();
   content.Add(HtmlHlp.GetClassNames(control, cssClassName));
   content.AddRange(coreAttrs);
   foreach (TagExtensionAttribute extension in control.TagExtensions)
     content.Add(new HAttribute(extension.Name, extension.Value));
   return content.ToArray();
 }
Example #10
0
        public void Given_the_element_exists()
        {
            _componentFactory = SubstituteFor <IComponentFactory>();
            _control          = SubstituteFor <IHtmlControl>();

            _componentFactory
            .HtmlControlFor <IHtmlControl>(_propertySelector)
            .Returns(_control);
        }
        public void Given_the_element_exists()
        {
            _componentFactory = SubstituteFor<IComponentFactory>();
            _control = SubstituteFor<IHtmlControl>();
            
            _componentFactory
                .HtmlControlFor<IHtmlControl>(_propertySelector)
                .Returns(_control);

        }
Example #12
0
 public static void WaitForGivenElementToBeVisible(this IWebDriver driver, IHtmlControl element, int timeout = 45)
 {
     try
     {
         driver.WaitForElement(element, el => el.Visible, timeout);
     }
     catch (WebDriverTimeoutException)
     {
         string msg = "Waiting for element to be visible failed.";
         throw new WebDriverTimeoutException(msg);
     }
 }
Example #13
0
 public static void WaitForGivenElementToBeNotVisible(this IWebDriver driver, IHtmlControl element, int timeout = 45)
 {
     try
     {
         driver.WaitForElement(element, el => !element.Element.Displayed, timeout, false);
     }
     catch (WebDriverTimeoutException)
     {
         string msg = "Waiting for element to be not visible failed.";
         throw new WebDriverTimeoutException(msg);
     }
 }
Example #14
0
 public static bool TryWaitForGivenElementToBeVisible(this IWebDriver driver, IHtmlControl element, int timeout = 45)
 {
     try
     {
         driver.WaitForElement(element, el => el.Visible, timeout);
         return(true);
     }
     catch (WebDriverTimeoutException)
     {
         return(false);
     }
 }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as HorizontalRule;

            var rule = new TagBuilder($"hr");

            rule.TagRenderMode = TagRenderMode.SelfClosing;

            string result = rule.WriteString();

            return(new HtmlString(result));
        }
Example #16
0
        public static IHtmlControl[] GetNewsItems(SiteState state, IEnumerable <LightHead> newsList)
        {
            List <IHtmlControl> items = new List <IHtmlControl>();

            DateTime prevTime = DateTime.MinValue;

            foreach (LightHead news in newsList)
            {
                DateTime localTime        = (news.Get(ObjectType.ActFrom) ?? DateTime.UtcNow).ToLocalTime();
                DateTime currentLocalTime = DateTime.UtcNow.ToLocalTime();
                bool     isFixed          = localTime.Date > currentLocalTime.AddDays(1);

                if (prevTime.Date != localTime.Date)
                {
                    prevTime = localTime.Date;

                    if (!isFixed)
                    {
                        string dateFormat = localTime.Year == currentLocalTime.Year ?
                                            BasketballHlp.shortDateFormat : BasketballHlp.longDateFormat;

                        items.Add(
                            new HPanel(
                                new HLabel(localTime.ToString(dateFormat)).FontBold()
                                ).Padding(1).MarginTop(15).MarginBottom(4)
                            );
                    }
                    else
                    {
                        items.Add(
                            new HPanel().Height(15)
                            );
                    }
                }

                int    commentCount = context.NewsStorages.ForTopic(news.Id).MessageLink.AllRows.Length;
                string newsUrl      = UrlHlp.ShopUrl("news", news.Id);

                IHtmlControl commentElement = GetCommentElement(commentCount, newsUrl);

                items.Add(
                    new HPanel(
                        new HLabel(localTime.ToString("HH:mm")).MarginLeft(5).MarginRight(10),
                        new HLink(newsUrl,
                                  news.Get(NewsType.Title)
                                  ).FontBold(isFixed),
                        commentElement
                        ).FontSize("90%").Padding(1)
                    );
            }

            return(items.ToArray());
        }
        public static IHtmlControl GetHtmlElementInstance(Type elementType, IWebElement element, By selector)
        {
            IHtmlControl ctrl = CreateInstance(elementType, element) as IHtmlControl;

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

            ctrl.Selector = selector;
            return(ctrl);
        }
Example #18
0
        static IHtmlControl GetWhomBlock(SiteState state, UserStorage userStorage,
                                         TopicStorage topic, Dictionary <int, string> htmlRepresentByMessageId, RowLink comment)
        {
            int commentId = comment.Get(MessageType.Id);

            int?whomId = comment.Get(MessageType.WhomId);

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

            RowLink whom = topic.MessageLink.FindRow(MessageType.MessageById, whomId.Value);

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

            LightObject whomUser = userStorage.FindUser(whom.Get(MessageType.UserId));
            DateTime    whomTime = whom.Get(MessageType.CreateTime).ToLocalTime();

            string whomHint = string.Format("whom_{0}", commentId);

            IHtmlControl whomTextBlock = null;

            if (state.BlockHint == whomHint)
            {
                //string whomDisplay = BasketballHlp.PreViewComment(whom.Get(MessageType.Content));
                string whomDisplay = DictionaryHlp.GetValueOrDefault(htmlRepresentByMessageId, whomId.Value);
                whomTextBlock = new HPanel(
                    new HTextView(whomDisplay).FontSize(12)
                    ).Padding(5);
            }

            return(new HPanel(
                       new HPanel(
                           new HButton(
                               whomUser?.Get(UserType.Login),
                               new HHover().TextDecoration("none")
                               ).Color(Decor.linkColor).TextDecoration("underline").MarginRight(5)
                           .Event("whom_display", "", delegate
            {
                state.SetBlockHint(whomHint);
            },
                                  commentId
                                  ),
                           new HLabel(string.Format("({0})", whomTime.ToString(Decor.timeFormat)))
                           ),
                       whomTextBlock
                       ).Color(Decor.minorColor).FontSize("90%"));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as YouTube;

            var parentDiv = new TagBuilder($"div");

            parentDiv.Attributes.Add("class", "fiu-video-player");
            parentDiv.InnerHtml.AppendHtml(
                $"<div class=\"fiu-video-player__inner-wrap\"><iframe class=\"fiu-video-player__size-100\" src=\"{control.Url.Replace("watch?v=", "embed/")}\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe></div>");
            string result = parentDiv.WriteString();

            return(new HtmlString(result));
        }
Example #20
0
        public static IHtmlControl GetCommentElement(int commentCount, string newsUrl)
        {
            IHtmlControl innerElement = GetInnerCommentElement(commentCount, newsUrl);

            return(new HPanel(
                       new HLabel("(").MarginLeft(5),
                       innerElement,
                       new HLabel(")"),
                       new HLink(string.Format("{0}#bottom", newsUrl),
                                 "", new HBefore().ContentIcon(5, 10).BackgroundImage(UrlHlp.ImageUrl("bottom.png")).VAlign(-2)
                                 ).PaddingLeft(3).PaddingRight(3).MarginLeft(5).Title("к последним комментариям").Hide(commentCount < 4)
                       ).InlineBlock());
        }
Example #21
0
        public static IHtmlControl GetArticleView(SiteState state, LightObject currentUser, TopicStorage topic)
        {
            if (topic == null || topic.Topic == null)
            {
                return(null);
            }

            LightObject article = topic.Topic;

            DateTime    localTime   = (article.Get(ObjectType.ActFrom) ?? DateTime.UtcNow).ToLocalTime();
            int         publisherId = article.Get(NewsType.PublisherId);
            LightObject publisher   = context.UserStorage.FindUser(publisherId);

            IHtmlControl editPanel = null;

            if (currentUser != null && (currentUser.Id == publisherId || currentUser.Get(BasketballUserType.IsModerator)))
            {
                editPanel = ViewArticleHlp.GetArticleEditPanel(state, topic);
            }

            string author       = article.Get(ArticleType.Author);
            int    commentCount = topic.MessageLink.AllRows.Length;
            string articleUrl   = UrlHlp.ShopUrl("article", article.Id);

            return(new HPanel(
                       Decor.Title(article.Get(NewsType.Title)),
                       new HPanel(
                           new HLabel(string.Format("{0},", author)).FontBold().MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                           new HLabel(article.Get(ArticleType.OriginName))
                           .FontBold().MarginRight(5),
                           new HLabel(string.Format("| {0}", localTime.ToString("dd MMMM yyyy")))
                           ).FontSize("90%"),
                       new HPanel(
                           new HLabel("Комментарии:").Color(Decor.minorColor),
                           ViewNewsHlp.GetCommentElement(commentCount, articleUrl)
                           ).FontSize("90%"),
                       //new HLabel(localTime.ToString(Decor.timeFormat)).Block().FontBold(),
                       new HTextView(article.Get(NewsType.Text)),
                       new HLabel("Автор:").MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                       new HLabel(author).FontBold().MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                       new HLabel("|").MarginRight(5).Hide(StringHlp.IsEmpty(author)),
                       new HLink(article.Get(NewsType.OriginUrl), article.Get(NewsType.OriginName)),
                       new HPanel(
                           new HLabel("Добавил:").MarginRight(5),
                           new HLink(UrlHlp.ShopUrl("user", publisherId), publisher?.Get(UserType.Login))
                           ).MarginTop(5),
                       editPanel,
                       ViewCommentHlp.GetCommentsPanel(context.MessageConnection, state, currentUser, topic, topic.MessageLink.AllRows)
                       ));
        }
Example #22
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)
                       ));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Heading;

            var heading = new TagBuilder($"h{control.HeadingSize}");

            foreach (var value in control.Content)
            {
                heading.InnerHtml.AppendHtml(value.CheckForFontEffects().CheckForAndConstructHyperlinks());
            }

            string result = heading.WriteString();

            return(new HtmlString(result));
        }
Example #24
0
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Table;

            var para = new TagBuilder("table");

            para.AddCssClass("fiu-table");

            AddHeadingElements(para, control);
            AddRowElements(para, control);

            string result = para.WriteString();

            return(new HtmlString(result));
        }
Example #25
0
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Paragraph;

            var para = new TagBuilder("p");

            foreach (var value in control.Content)
            {
                para.InnerHtml.AppendHtml(value.CheckForFontEffects().CheckForAndConstructHyperlinks());
            }

            string result = para.WriteString();

            return(new HtmlString(result));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Image;

            var img = new TagBuilder($"img");

            img.AddCssClass("fiu-article-image");
            img.TagRenderMode = TagRenderMode.SelfClosing;
            img.Attributes.Add("title", control.Title);
            img.Attributes.Add("src", control.Url);
            img.Attributes.Add("alt", "");
            img.Attributes.Add("role", "presentation");

            string result = img.WriteString();

            return(new HtmlString(result));
        }
Example #27
0
 public static void WaitForElement(this IWebDriver driver, IHtmlControl element, Func <IHtmlControl, bool> condition, int timeout, bool returnFalseIfNotExists = true)
 {
     driver.WaitUntil(dr =>
     {
         try
         {
             return(condition(element));
         }
         catch (WebDriverException)
         {
             return(!returnFalseIfNotExists);
         }
         catch (InvalidOperationException)
         {
             return(!returnFalseIfNotExists);
         }
     }, timeout);
 }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Card;

            var card = new TagBuilder($"div");

            card.AddCssClass("govuk-grid-column-one-quarter");
            card.InnerHtml.AppendHtml("<div class=\"fiu-card\">");
            card.InnerHtml.AppendHtml("<span class=\"fiu-card__category\">");
            card.InnerHtml.AppendHtml($"<a class=\"fiu-card__category-link\" href=\"{(control?.LandingPage?.Url).ToLower()}\">{control?.LandingPage?.Title}</a></span>");
            card.InnerHtml.AppendHtml($"<h3 class=\"fiu-card__heading\">{control?.Title}</h3>");
            card.InnerHtml.AppendHtml($"<p class=\"fiu-card__content\">{control?.Summary}</p>");
            card.InnerHtml.AppendHtml(
                $"<a href=\"{control?.Url.ToString().ToLower()}\" class=\"fiu-card__link\">Learn more <span class=\"fiu-vh\"> about {control?.Title}</span></a></div>");
            string result = card.WriteString();

            return(new HtmlString(result));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as ArticleRelated;

            var quote = new TagBuilder($"div");

            quote.AddCssClass("govuk-grid-column-one-half");
            quote.InnerHtml.AppendHtml("<div class=\"fiu-card\">");
            quote.InnerHtml.AppendHtml("<span class=\"fiu-card__category\">");
            quote.InnerHtml.AppendHtml($"<a class=\"fiu-card__category-link\" href=\"{control.Url}\">{control.Title}</a></span>");
            quote.InnerHtml.AppendHtml($"<h3 class=\"fiu-card__heading\">{control.Title}</h3>");
            quote.InnerHtml.AppendHtml($"<p class=\"fiu-card__content\">{control.Description}</p>");
            quote.InnerHtml.AppendHtml(
                $"<a href=\"{control.Url}\" class=\"fiu-card__link\">Learn more <span class=\"fiu-vh\"> about {control.Title}</span></a></div>");
            string result = quote.WriteString();

            return(new HtmlString(result));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as Tabs;

            if (control == null)
            {
                return(new HtmlString(""));
            }

            var parentDiv = new TagBuilder("div");

            parentDiv.AddCssClass("fiu-tabs");
            parentDiv.Attributes.Add("data-fiu-tabs", bool.TrueString);

            //construct title of tabs
            ConstructTabHeaders(parentDiv, control);
            ConstructTabContent(parentDiv, control);
            return(new HtmlString(parentDiv.WriteString()));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as SiteMapUrls;

            if (control == null)
            {
                return(new HtmlString(""));
            }

            var currentHub = string.Empty;

            var parentDiv = new TagBuilder("div");

            parentDiv.AddCssClass("govuk-grid-row");
            TagBuilder columnDiv = null;

            foreach (var url in control.Urls.Where(o => string.Compare(o.PageType, "hub", StringComparison.OrdinalIgnoreCase) == 0).OrderBy(o => o.Hub))
            {
                if (string.Compare(url.Hub, currentHub, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    if (columnDiv != null)
                    {
                        parentDiv.InnerHtml.AppendHtml(columnDiv.WriteString());
                    }

                    columnDiv = new TagBuilder("div");
                    columnDiv.AddCssClass("govuk-grid-column-one-third");

                    AddHubUrl(columnDiv, url);

                    currentHub = url.Hub;
                }

                AddLandingPageUrl(control.Urls.Where(o => string.Compare(o.PageType, "LandingPage", StringComparison.OrdinalIgnoreCase) == 0 &&
                                                     string.Compare(o.Hub, currentHub, StringComparison.OrdinalIgnoreCase) == 0).ToList(), columnDiv, control);
            }

            parentDiv.InnerHtml.AppendHtml(columnDiv.WriteString());

            string result = parentDiv.WriteString();

            return(new HtmlString(result));
        }
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as DocumentAttachment;

            var quote = new TagBuilder($"div");

            quote.AddCssClass("fiu-attachment");

            quote.InnerHtml.AppendHtml($"<h2 class=\"govuk-heading-m fiu-attachment__heading\">{control.Title}</h2>");
            quote.InnerHtml.AppendHtml("<dl class=\"fiu-attachment__meta\"><dt class=\"fiu-attachment__meta-title\">File type</dt>");
            quote.InnerHtml.AppendHtml($"<dd class=\"fiu-attachment__meta-description\">{GetFileTypeFromContentTypeValue(control)}</dd>");
            quote.InnerHtml.AppendHtml("<dt class=\"fiu-attachment__meta-title\">File size</dt>");
            quote.InnerHtml.AppendHtml($"<dd class=\"fiu-attachment__meta-description\">{control.FileSize / 1000}KB</dd>");
            quote.InnerHtml.AppendHtml($"</dl><p class=\"govuk-body fiu-attachment__description\">{control.Description}</p>");
            quote.InnerHtml.AppendHtml($"<p class=\"govuk-body fiu-attachment__link-wrap\"><a href=\"{control.Url}\" class=\"govuk-link fiu-attachment__link\" target=\"_blank\">Download <span class=\"fiu-vh\">{control.Title}</span></a></p>");
            quote.InnerHtml.AppendHtml($"<span class=\"fiu-attachment__icon\"><span class=\"fiu-attachment__icon-label\">{GetFileTypeFromContentTypeValue(control)}</span></span>");
            string result = quote.WriteString();

            return(new HtmlString(result));
        }
Example #33
0
        public static IHtmlControl GetRightColumnView(SiteState state, bool isForum)
        {
            List <IHtmlControl> items = new List <IHtmlControl>(2);

            items.Add(GetActualPublicationPanel(state));

            IHtmlControl forumPanel = GetActualForumPanel(state);

            if (isForum)
            {
                items.Insert(0, forumPanel);
            }
            else
            {
                items.Add(forumPanel);
            }

            return(new HPanel(
                       items.ToArray()
                       ).Align(true).BoxSizing().Width(220));
        }
Example #34
0
        static IHtmlControl GetUserEditPanel(SiteState state, LightObject user)
        {
            string blockHint = string.Format("userEdit_{0}", user.Id);

            IHtmlControl redoPanel = null;

            if (state.BlockHint == blockHint)
            {
                redoPanel = GetUserRedoPanel(state, user);
            }

            return(new HPanel(
                       Decor.Button("Редактировать профиль").MarginBottom(5)
                       .Event("user_edit", "", delegate
            {
                state.SetBlockHint(blockHint);
            }
                              ),
                       redoPanel
                       ).MarginTop(5).WidthLimit("", "480px"));
        }
Example #35
0
        public HtmlString Render(IHtmlControl content)
        {
            var control = content as UnorderedList;

            var ul = new TagBuilder("ul");

            foreach (var value in control.Items)
            {
                ul.InnerHtml.AppendHtml("<li>");

                foreach (var childValue in value)
                {
                    ul.InnerHtml.AppendHtml($"{childValue.CheckForFontEffects().CheckForAndConstructHyperlinks()}");
                }

                ul.InnerHtml.AppendHtml("</li>");
            }

            string result = ul.WriteString();

            return(new HtmlString(result));
        }
Example #36
0
        static IHtmlControl JumpElement(string urlWithoutPageIndex, int pageIndex, bool isSelected, bool isFirst)
        {
            IHtmlControl jumpItem = null;

            if (!isSelected)
            {
                jumpItem = new HLink(JumpPageUrl(urlWithoutPageIndex, pageIndex), (pageIndex + 1).ToString());
            }
            else
            {
                jumpItem = new HLabel(pageIndex + 1).FontBold();
            }

            HPanel jumpElement = new HPanel(
                !isFirst ? new HLabel(" | ").MarginLeft(5).MarginRight(5) : null,
                jumpItem
                ).InlineBlock();

            //if (!isFirst)
            //  jumpElement.BorderLeft("1px solid #000");

            return(jumpElement);
        }
Example #37
0
 public static HPanel DockFill(IHtmlControl control)
 {
   ((IEditExtension)control).Width("100%");
   return new HPanel(control).WidthFill();
 }