/// <summary>
        ///   Create an unstyled list
        /// </summary>
        /// <param name="list">List to be converted</param>
        /// <returns>An unstyled list</returns>
        public static IExtendedHtmlStringLegacy AsUnstyled(this HtmlList list)
        {
            list.CssClasses.Add("unstyled list-unstyled");

            // TODO: Remove redundant re-conversion
            return(list.ToHtmlElement());
        }
        /// <summary>
        ///   Create an inline list.
        /// </summary>
        /// <param name="list">List to be converted</param>
        /// <returns>An inline list</returns>
        public static IExtendedHtmlStringLegacy AsInline(this HtmlList list)
        {
            list.CssClasses.Add("inline list-inline");

            // TODO: Remove redundant re-conversion
            return(list.ToHtmlElement());
        }
        public IElement CreateElement(string elementType, string props)
        {
            var      propArray = props.Split(';');
            IElement element;

            //determine element type
            switch (elementType)
            {
            case "Image":
                element = new HtmlImage(propArray[0], propArray[1], propArray[2]);
                return(element);

            case "Header":
                element = new HtmlHeader(propArray[0], propArray[1]);
                return(element);

            case "List":
                element = new HtmlList(propArray[0], propArray[1], propArray[2], propArray[3]);
                return(element);

            case "Table":
                element = new HtmlTable(propArray[0], propArray[1], propArray[2], propArray[3]);
                return(element);

            default:
                return(null);
            }
        }
 /// <summary>
 /// Adds a html string to the body of the tag.
 /// </summary>
 /// <param name="html">The HTML string.</param>
 public virtual void Add(string html)
 {
     if (html != null)
     {
         HtmlList.Add(html);
     }
 }
 /// <summary>
 /// Adds a html string at the specified index.
 /// </summary>
 /// <param name="tag">The tag object.</param>
 /// <param name="index">The zero-based index at which item should be inserted.</param>
 public void Append(TagBuilder tag, int index)
 {
     if (tag != null)
     {
         HtmlList.Insert(index, tag.ToString());
     }
 }
Beispiel #6
0
        private static HtmlList GetHtmlList(string uiTitle, string uiType)
        {
            dynamic htmlControl = new HtmlList(Browser.Locate(uiTitle, uiType));

            htmlControl.TechnologyName = TechnologyNameWeb;
            return(htmlControl);
        }
 /// <summary>
 /// Adds a html string to the body of the tag at the specified index.
 /// </summary>
 /// <param name="html">The HTML string.</param>
 /// <param name="index">The zero-based index at which item should be inserted.</param>
 public void Append(string html, int index)
 {
     if (html != null)
     {
         HtmlList.Insert(index, html);
     }
 }
Beispiel #8
0
        public void SelectedItems_OnHtmlList_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <select id=""selectId"" multiple=""multiple"">
            <option value=""1"">1</option>
            <option value=""2"">2</option>
            <option value=""3"">3</option>
        </select>
    </body>
</html>"))
            {
                var      browserWindow = BrowserWindow.Launch(webPage.FilePath);
                HtmlList list          = browserWindow.Find <HtmlList>(By.Id("selectId"));

                string[] itemsToSelect = { "1", "2" };

                //Act
                list.SelectedItems = itemsToSelect;

                //Assert
                CollectionAssert.AreEqual(itemsToSelect, list.SelectedItems);

                browserWindow.Close();
            }
        }
Beispiel #9
0
        /// <summary>
        /// Navigation links
        /// </summary>
        /// <param name="links">An unordered list of links</param>
        public void Links(Action <HtmlListBuilder> links)
        {
            var list = new HtmlList(links, string.IsNullOrEmpty(_activeLink)
                ? (object)new { @class = "nav" }
                : new { @class = "nav", data_activelink = _activeLink });

            _navbar.InnerHtml += list.ToHtmlString();
        }
 /// <summary>
 /// Adds another FWTagBuilder to the body of the tag.
 /// </summary>
 /// <param name="tag">The FWTagBuilder object.</param>
 public virtual T Add <T>(T tag)
     where T : TagBuilder
 {
     if (tag != null)
     {
         HtmlList.Add(tag);
     }
     return(tag);
 }
        public void HtmlListTest_IsMultipleSelection()
        {
            List.IsMultipleSelection.Should().BeTrue();

            HtmlList comboBox = new HtmlList(BasicTestPage);

            comboBox.SearchProperties.Add(HtmlList.PropertyNames.Id, "comboBox");
            comboBox.IsMultipleSelection.Should().BeFalse();
        }
Beispiel #12
0
        public EditDailyPlanPage SelectWorkItemsToday(string[] items)
        {
            var boxToday = new HtmlList(browser);

            boxToday.SearchProperties.Add(HtmlControl.PropertyNames.Class, AddDailyPlanPageConst.SELECT_DAILY_PLAN_TODAY_LISTBOX_CLASS);
            boxToday.Find();
            boxToday.SelectedItems = items;

            return(this);
        }
        // To click on HTML list item control from html list
        public void clickHTMLLIstItemTwoPropWithParent(string strControl)
        {
            Keywords      KeyFound  = reader.FindControlinList(strControl);
            BrowserWindow _browser  = new BrowserWindow();
            HtmlList      _htmllist = new HtmlList(_browser);

            _htmllist.SearchProperties["ControlType"]          = "List";
            _htmllist.SearchProperties[KeyFound.PropertyName1] = KeyFound.PropertyValue1;
            if (_htmllist.Exists)
            {
                HtmlListItem _htmllistitem = new HtmlListItem(_htmllist);
                _htmllistitem.SearchProperties["ControlType"]          = "ListItem";
                _htmllistitem.SearchProperties[KeyFound.PropertyName2] = KeyFound.PropertyValue2;
                Mouse.Click(_htmllistitem);
            }
            else
            {
                Console.WriteLine("List not found");
            }
        }
        /// <summary>
        ///   Constructor
        /// </summary>
        /// <param name="type">Navigation bar type</param>
        /// <param name="items">Navigation bar items</param>
        public BootstrapNavBar(EBootstrapNavbar type, params Hyperlink[] items)
            : this(type)
        {
            HtmlList list = new HtmlList(EList.Unordered);
            foreach (Hyperlink item in items)
            {
                if (item.CssClasses.Contains("brand") || item.CssClasses.Contains("navbar-brand"))
                {
                    Brand = item;
                }
                else
                {
                    HtmlListItem li = new HtmlListItem(string.Empty);
                    li.AppendTags.Add(item.Component);
                    list.AppendTags.Add(li);
                }
            }

            CreateNavBar(list);
        }
        //public CultureInfo Language { get; }

        //public void GetLanguage()
        //{
        //    string preferencesLocation = this.Location + "/about_you/preferences.html";
        //    HtmlDocument htmlDocument = new HtmlDocument();
        //    htmlDocument.Load(preferencesLocation);
        //    string locale = htmlDocument.DocumentNode.SelectSingleNode("/ html / body / div / div / div / div[2] / div[2] / div / div[3] / div / div[2] / div[1] / div[2] / div / div / div / div[1] / div[3]").InnerText;
        //    this.Language = this.Language(locale, false);
        //}

        public void GetHtmlFiles(ProgressBar progressBar, ListBox outputLog)
        {
            List <string> listOfHtml       = new List <string>();
            string        messagesLocation = this.Location + "/messages/archived_threads/";

            outputLog.Dispatcher.Invoke(() =>
            {
                outputLog.Items.Add("Gathering HTML files from archived threads...");
                outputLog.SelectedIndex = outputLog.Items.Count - 1;
                outputLog.ScrollIntoView(outputLog.SelectedItem);
            });
            listOfHtml = Directory.GetFiles(messagesLocation, "*.html", SearchOption.AllDirectories).ToList();
            outputLog.Dispatcher.Invoke(() =>
            {
                outputLog.Items.Add("Gathering HTML files from filtered threads...");
                outputLog.SelectedIndex = outputLog.Items.Count - 1;
                outputLog.ScrollIntoView(outputLog.SelectedItem);
            });
            messagesLocation = Location + "/messages/filtered_threads/";
            listOfHtml.AddRange(Directory.GetFiles(messagesLocation, "*.html", SearchOption.AllDirectories).ToList());
            outputLog.Dispatcher.Invoke(() =>
            {
                outputLog.Items.Add("Gathering HTML files from inbox...");
                outputLog.SelectedIndex = outputLog.Items.Count - 1;
                outputLog.ScrollIntoView(outputLog.SelectedItem);
            });
            messagesLocation = Location + "/messages/inbox/";
            listOfHtml.AddRange(Directory.GetFiles(messagesLocation, "*.html", SearchOption.AllDirectories).ToList());

            foreach (string htmlFile in listOfHtml)
            {
                HtmlList.Add(new HtmlFile(htmlFile));
            }
            outputLog.Dispatcher.Invoke(() =>
            {
                outputLog.Items.Add("Found " + HtmlList.Count + " HTML files to process");
                outputLog.SelectedIndex = outputLog.Items.Count - 1;
                progressBar.Maximum     = HtmlList.Count;
                outputLog.ScrollIntoView(outputLog.SelectedItem);
            });
        }
Beispiel #16
0
        public static void SelectListItemByText(string option)
        {
            var list = new HtmlList(browserWindow);

            try
            {
                list.SearchProperties.Add(CSVReader.ControlType + ".PropertyNames." + CSVReader.LocatorType, CSVReader.LocatorValue, HtmlList.PropertyNames.Name, "ctl00$contplhDynamic$ddlStatus");
                list.WaitForControlEnabled();
                list.WaitForControlReady();
            }
            catch (Exception)
            {
                Assert.Fail("Failed to find " + CSVReader.ControlType + " Element - Element not Found");
            }
            list.DrawHighlight();
            var listItem = new HtmlListItem(list);

            listItem.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
            listItem.SearchProperties.Add(HtmlListItem.PropertyNames.InnerText, option, PropertyExpressionOperator.Contains);
            listItem.DrawHighlight();
        }
Beispiel #17
0
        /// <summary>
        ///   Create the Gumby navigation bar
        /// </summary>
        /// <param name="list">Navigation bar items</param>
        private void CreateNavBar(HtmlList list)
        {
            this["class"] = "row navbar metro";

            Component.AppendTags.Add(list);

            // append the logo/brand is it was supplied
            if (Logo == null)
            {
                return;
            }

            HtmlComponent logoDiv = new HtmlComponent(EHtmlTag.Div);

            logoDiv.CssClasses.AddRange(Logo.CssClasses);
            Logo.CssClasses.Clear();

            logoDiv.AppendTags.Add(Logo.Component);

            Component.PrependTags.Add(logoDiv);
        }
Beispiel #18
0
        /// <summary>
        ///   Constructor
        /// </summary>
        /// <param name="items">Navigation bar items</param>
        public GumbyNavbar(IEnumerable <Hyperlink> items)
            : base(EHtmlTag.Div)
        {
            HtmlList list = new HtmlList(EList.Unordered);

            foreach (Hyperlink item in items)
            {
                if (item.CssClasses.Contains("logo"))
                {
                    Logo = item;
                }
                else
                {
                    // check if this is the "brand"
                    HtmlListItem li = new HtmlListItem(string.Empty);
                    li.AppendTags.Add(item.Component);
                    list.AppendTags.Add(li);
                }
            }

            CreateNavBar(list);
        }
        /// <summary>
        ///   Creates a Bootstrap navigation bar from the given
        ///   list of items
        /// </summary>
        /// <param name="list">Navigation bar items</param>
        private void CreateNavBar(HtmlList list)
        {
            list.Attributes["class"] = "nav navbar-nav";

            Attributes["class"] = Type.GetStringValue();

            switch (WebExtrasSettings.BootstrapVersion)
            {
            case EBootstrapVersion.V2:
                HtmlComponent innerNav = new HtmlComponent(EHtmlTag.Div);

                innerNav.Attributes["class"] = "navbar-inner";

                if (Brand != null)
                {
                    innerNav.PrependTags.Add(Brand.Component);
                }

                innerNav.AppendTags.Add(list);

                AppendTags.Add(innerNav);
                break;

            case EBootstrapVersion.V3:
                if (Brand != null)
                {
                    Brand.Attributes["class"] = "navbar-brand";
                    PrependTags.Add(Brand.Component);
                }

                AppendTags.Add(list);
                break;

            default:
                throw new BootstrapVersionException();
            }
        }
Beispiel #20
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <param name="context">Der Kontext, indem das Steuerelement dargestellt wird</param>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode Render(RenderContext context)
        {
            var profile = new ControlAvatar()
            {
                User  = User,
                Image = Image
            };

            var timespan = string.Empty;
            var days     = (DateTime.Now - Timestamp).Days;

            if (days == 1)
            {
                timespan = "vor ein Tag";
            }
            else if (days < 1)
            {
                var hours = (DateTime.Now - Timestamp).Hours;
                if (hours == 1)
                {
                    timespan = "vor einer Stunde";
                }
                else if (hours < 1)
                {
                    var minutes = (DateTime.Now - Timestamp).Minutes;

                    if (minutes == 1)
                    {
                        timespan = "vor einer Minute";
                    }
                    else if (minutes < 1)
                    {
                        timespan = "gerade ebend";
                    }
                    else
                    {
                        timespan = "vor " + minutes + " Minuten";
                    }
                }
                else
                {
                    timespan = "vor " + hours + " Stunden";
                }
            }
            else
            {
                timespan = "vor " + days + " Tagen";
            }

            var date = new ControlText()
            {
                Text      = timespan,
                Title     = "Am " + Timestamp.ToShortDateString() + " um " + Timestamp.ToShortTimeString() + " Uhr",
                Format    = TypeFormatText.Span,
                TextColor = new PropertyColorText(TypeColorText.Muted)
            };

            var headerText = new HtmlElementTextContentP
                             (
                new ControlText()
            {
                Text      = Action,
                TextColor = new PropertyColorText(TypeColorText.Info),
                Format    = TypeFormatText.Span
            }.Render(context),
                date.Render(context)
                             );

            var setting = new ControlDropdown()
            {
                //Icon = new PropertyIcon(TypeIcon.Cog),
                BackgroundColor     = new PropertyColorButton(TypeColorButton.Light),
                HorizontalAlignment = TypeHorizontalAlignment.Right,
                Size = TypeSizeButton.Small
            };

            setting.Add(new ControlDropdownItemLink()
            {
                Text      = "Löschen",
                Icon      = new PropertyIcon(TypeIcon.TrashAlt),
                TextColor = new PropertyColorText(TypeColorText.Danger),
                Uri       = context.Page.Uri
            });

            var header = new HtmlElementTextContentDiv(setting.Render(context), profile.Render(context), headerText)
            {
                Class = "header"
            };

            var body = new HtmlElementTextContentDiv(new HtmlText(Post))
            {
                Class = Css.Concatenate("post", GetClasses()),
                Style = GetStyles(),
                Role  = Role
            };

            var likeText = "Gefällt mir" + (Likes > 0 ? " (" + Likes + ")" : string.Empty);
            var like     = new ControlButtonLink()
            {
                Icon            = new PropertyIcon(TypeIcon.ThumbsUp),
                Text            = likeText,
                Uri             = context.Page.Uri,
                Size            = TypeSizeButton.Small,
                BackgroundColor = new PropertyColorButton(TypeColorButton.Light),
                Outline         = true,
                TextColor       = new PropertyColorText(TypeColorText.Primary)
            };

            var option = new HtmlElementTextContentDiv(like.Render(context))
            {
                Class = "options"
            };

            var html = new HtmlList(header, body, option);

            html.Elements.AddRange(from x in Comments select x.Render(context));

            var form = new ControlFormular()
            {
                Name = !string.IsNullOrWhiteSpace(Name) ? Name : "form",
                EnableCancelButton = false
            };

            form.SubmitButton.Icon    = new PropertyIcon(TypeIcon.PaperPlane);
            form.SubmitButton.Text    = "Antworten";
            form.SubmitButton.Outline = true;
            form.SubmitButton.Size    = TypeSizeButton.Small;
            //form.SubmitButton.HorizontalAlignment = TypeHorizontalAlignment.Default;

            form.Add(new ControlFormularItemInputTextBox()
            {
                Format = TypesEditTextFormat.Multiline, Placeholder = "Kommentieren..."
            });

            html.Elements.Add(form.Render(context));

            return(html);
        }
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="type">Navigation bar type</param>
 /// <param name="brandLink">Navigation bar brand link</param>
 /// <param name="items">Navigation bar items</param>
 public BootstrapNavBar(EBootstrapNavbar type, Hyperlink brandLink, HtmlList items)
     : this(type)
 {
     Brand = brandLink;
     CreateNavBar(items);
 }
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="type">Navigation bar type</param>
 /// <param name="items">Navigation bar items</param>
 public BootstrapNavBar(EBootstrapNavbar type, HtmlList items)
     : this(type)
 {
     CreateNavBar(items);
 }
 public HtmlListBuilder(HtmlList list)
 {
     _list = list;
 }
Beispiel #24
0
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="items">Navigation bar items</param>
 public GumbyNavbar(HtmlList items)
     : base(EHtmlTag.Div)
 {
     CreateNavBar(items);
 }
Beispiel #25
0
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="logoLink">Navigation bar logo link</param>
 /// <param name="items">Navigation bar items</param>
 public GumbyNavbar(Hyperlink logoLink, HtmlList items)
     : base(EHtmlTag.Div)
 {
     Logo = logoLink;
     CreateNavBar(items);
 }
 /// <summary>
 /// Clears any string previously added and adds the html string to the body of the tag.
 /// </summary>
 /// <param name="html"></param>
 public void AddOnce(string html)
 {
     HtmlList.Clear();
     base.Add(html);
 }
Beispiel #27
0
 /// <summary>
 ///   Create a navigation bar
 /// </summary>
 /// <param name="html">Current Html helper object</param>
 /// <param name="items">Navigation bar items</param>
 /// <returns>A navigation bar</returns>
 public static GumbyNavbar Navbar(this HtmlHelper html, HtmlList items)
 {
     return(new GumbyNavbar(items));
 }
Beispiel #28
0
 /// <summary>
 ///   Create a navigation bar
 /// </summary>
 /// <param name="html">Current Html helper object</param>
 /// <param name="logoLink">Navigation bar logo link</param>
 /// <param name="items">Navigation bar items</param>
 /// <returns>A navigation bar</returns>
 public static GumbyNavbar Navbar(this HtmlHelper html, Hyperlink logoLink, HtmlList items)
 {
     return(new GumbyNavbar(logoLink, items));
 }
Beispiel #29
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode ToHtml()
        {
            var classes = new List <string>();

            classes.Add(Class);
            classes.Add("post");

            var profile = new ControlAvatar(Page)
            {
                User  = User,
                Image = Image
            };

            var timespan = string.Empty;
            var days     = (DateTime.Now - Timestamp).Days;

            if (days == 1)
            {
                timespan = "vor ein Tag";
            }
            else if (days < 1)
            {
                var hours = (DateTime.Now - Timestamp).Hours;
                if (hours == 1)
                {
                    timespan = "vor einer Stunde";
                }
                else if (hours < 1)
                {
                    var minutes = (DateTime.Now - Timestamp).Minutes;

                    if (minutes == 1)
                    {
                        timespan = "vor einer Minute";
                    }
                    else if (minutes < 1)
                    {
                        timespan = "gerade ebend";
                    }
                    else
                    {
                        timespan = "vor " + minutes + " Minuten";
                    }
                }
                else
                {
                    timespan = "vor " + hours + " Stunden";
                }
            }
            else
            {
                timespan = "vor " + days + " Tagen";
            }

            var date = new ControlText(Page)
            {
                Text    = timespan,
                Tooltip = "Am " + Timestamp.ToShortDateString() + " um " + Timestamp.ToShortTimeString() + " Uhr",
                Format  = TypesTextFormat.Span,
                Color   = TypesTextColor.Muted
            };

            var headerText = new HtmlElementP
                             (
                new ControlText(Page)
            {
                Text = Action, Color = TypesTextColor.Info, Format = TypesTextFormat.Span
            }.ToHtml(),
                date.ToHtml()
                             );

            var setting = new ControlDropdownMenu(Page)
            {
                Icon   = "fas fa-cog",
                Layout = TypesLayoutButton.Light,
                HorizontalAlignment = TypesHorizontalAlignment.Right,
                Size = TypesSize.Small
            };

            setting.Add(new ControlLink(Page)
            {
                Text = "Löschen", Icon = "fas fa-trash-alt", Color = TypesTextColor.Danger, Url = Page.GetUrl()
            });

            var header = new HtmlElementDiv(setting.ToHtml(), profile.ToHtml(), headerText)
            {
                Class = "header"
            };

            var body = new HtmlElementDiv(new HtmlText(Post))
            {
                Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x)))
            };

            var likeText = "Gefällt mir" + (Likes > 0 ? " (" + Likes + ")" : string.Empty);
            var like     = new ControlButtonLink(Page)
            {
                Icon = "fas fa-thumbs-up", Text = likeText, Url = Page.GetUrl(), Size = TypesSize.Small, Layout = TypesLayoutButton.Light, Outline = true, Color = TypesTextColor.Primary
            };
            //var comment = new ControlButtonLink(Page) { Icon = "fas fa-comment", Text = "Antworten", Url = Page.GetUrl(), Size = TypesSize.Small, Layout = TypesLayoutButton.Light, Color = TypesTextColor.Primary };

            var option = new HtmlElementDiv(like.ToHtml())
            {
                Class = "options"
            };

            var html = new HtmlList(header, body, option);

            //if (Comments.Count > 0)
            //{
            //    html.Elements.Add(new HtmlElementHr());
            //}
            html.Elements.AddRange(from x in Comments select x.ToHtml());

            var form = new ControlPanelFormular(Page)
            {
                Name = !string.IsNullOrWhiteSpace(Name)? Name : "form",
                EnableCancelButton = false
            };

            form.SubmitButton.Icon                = "fas fa-paper-plane";
            form.SubmitButton.Text                = "Antworten";
            form.SubmitButton.Outline             = true;
            form.SubmitButton.Size                = TypesSize.Small;
            form.SubmitButton.HorizontalAlignment = TypesHorizontalAlignment.Default;

            form.Add(new ControlFormularItemTextBox(form)
            {
                Format = TypesEditTextFormat.Multiline, Placeholder = "Kommentieren..."
            });

            html.Elements.Add(form.ToHtml());

            return(html);
        }
Beispiel #30
0
 public static void SelectListItemByText(string option)
 {
     var list = new HtmlList(browserWindow);
     try
     {
         list.SearchProperties.Add(CSVReader.ControlType + ".PropertyNames." + CSVReader.LocatorType, CSVReader.LocatorValue, HtmlList.PropertyNames.Name, "ctl00$contplhDynamic$ddlStatus");
         list.WaitForControlEnabled();
         list.WaitForControlReady();
     }
     catch (Exception)
     {
         Assert.Fail("Failed to find " + CSVReader.ControlType + " Element - Element not Found");
     }
     list.DrawHighlight();
     var listItem = new HtmlListItem(list);
     listItem.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
     listItem.SearchProperties.Add(HtmlListItem.PropertyNames.InnerText, option, PropertyExpressionOperator.Contains);
     listItem.DrawHighlight();
 }
 /// <summary>
 ///   Create a navigation bar
 /// </summary>
 /// <param name="html">Current HTML helper object</param>
 /// <param name="type">Navigation bar type</param>
 /// <param name="items">Navigation bar items</param>
 /// <returns>A navigation bar</returns>
 public static BootstrapNavBar Navbar(this HtmlHelper html, EBootstrapNavbar type, HtmlList items)
 {
     return(new BootstrapNavBar(type, items));
 }
 public void SetUp()
 {
     mocks       = new Mockery();
     iWebElement = mocks.NewMock <IWebElement>();
     listBox     = new HtmlList(iWebElement);
 }