Example #1
0
        public static HtmlString AdminForm(DocumentNode Model, string adminUrl, string divClassName = "")
        {
            var div = new HtmlTag("div");

            if (divClassName != "") div.AddClass(divClassName);

            var form = new FormTag().Method("post").Action("#");

            form.Append(HtmlBuilder.HtmlTagLabelInput("Name (header)", "name", Model.Name));
            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "update").Attr("value", "Update"));
            form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Hide header", "hideHeader", Model.HideHeader));
            form.Append(HtmlBuilder.HtmlTagLabelTextArea("Body text", "body", Model.Body));
            form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 1", "extraContent1", Model.ExtraContent1, 5));
            //form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 2", "extraContent2", Model.ExtraContent2, 5));
            //form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 3", "extraContent3", Model.ExtraContent3, 3));
            form.Append(HtmlBuilder.HtmlTagLabelInput("Author", "author", Model.Author));
            form.Append(HtmlBuilder.HtmlTagLabelInput("ViewPath", "viewPath", Model.ViewPath));
            form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Hidden", "isHidden", Model.IsHidden));
            form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Deleted", "isDeleted", Model.IsDeleted));
            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "update").Attr("value", "Update"));

            if (!String.IsNullOrEmpty(Model.Url))
            {
                form.Append(new HtmlTag("p").Append(new HtmlTag("a").Attr("href", Model.Url).Text("View page")));
            }

            div.Append(form);
            return new HtmlString(div.ToHtmlString());
        }
Example #2
0
        public static HtmlString ChildNodes(this IDocumentNode IDocumentNode, int atLevel = 0, bool includeHidden = false, bool includeDeleted = false)
        {
            var ul = new HtmlTags.HtmlTag("ul");
            ul.AddClass("topnavigation");

            foreach (var c in IDocumentNode.AncestorAtLevel(atLevel).Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden)))
            {
                var li = new HtmlTags.HtmlTag("li");
                if (IDocumentNode.IsDescendantOrSameAs(c)) li.AddClass("selected");
                li.Add("a").Attr("href", c.Url).Text(c.Name);
                ul.Children.Add(li);
            }
            return new HtmlString(ul.ToHtmlString());
        }
Example #3
0
        public static HtmlString ChildNodes(this IDocumentNode IDocumentNode, int atLevel = 0, bool includeHidden = false, bool includeDeleted = false)
        {
            var ul = new HtmlTags.HtmlTag("ul");

            ul.AddClass("topnavigation");

            foreach (var c in IDocumentNode.AncestorAtLevel(atLevel).Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden)))
            {
                var li = new HtmlTags.HtmlTag("li");
                if (IDocumentNode.IsDescendantOrSameAs(c))
                {
                    li.AddClass("selected");
                }
                li.Add("a").Attr("href", c.Url).Text(c.Name);
                ul.Children.Add(li);
            }
            return(new HtmlString(ul.ToHtmlString()));
        }
Example #4
0
        public static HtmlString AdminTree(IDocumentNode Model, string adminUrl, string divClassName = "")
        {
            var div = new HtmlTag("div");
            if (divClassName != "") div.AddClass(divClassName);

            var p = new HtmlTag("p").Append(new HtmlTag("a").Text("Root node").Attr("href", adminUrl));
            var tree = HtmlBuilder.ChildNodesRecursiveHtmlTag(Model, Model.AncestorAtLevel(0), 99, true, false, adminUrl);

            var pInfo = new HtmlTag("p").Text("Add new child");

            var form = new HtmlTag("form").Attr("method", "post").Attr("action", "#");

            form.Append(new HtmlTag("label").Attr("for", "new-name").Text("Header (name)"));
            form.Append(new HtmlTag("input").Id("new-name").Attr("name", "new-name").Attr("type", "text"));
            form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "insert-new").Attr("value", "Add"));

            div.Append(p).Append(tree).Append(pInfo).Append(form);

            return new HtmlString(div.ToHtmlString());
        }
Example #5
0
        public string Execute(GetFlashes input)
        {
            /*
                <div class="alert">
                  <a class="close" data-dismiss="alert">×</a>
                  <strong>Warning!</strong> Best check yo self, you're not looking too good.
                </div>
             */

            var array = _flash.Retrieve<string[]>();
            if (array == null) return new NoTag().ToHtmlString();

            var div = new HtmlTag("div").AddClass("alert");
            var closeLink = new HtmlTag("a").AddClass("close").Data("dismiss", "alert");
            div.Append(closeLink);

            var ul = new HtmlTag("ul");

            array.Each(i => ul.Append("li", l => l.Text(i)));

            div.Append(ul);
            return div.ToHtmlString();
        }
        static void Main(string[] args)
        {
            var arguments = new Arguments(args);
            var input = arguments["input"];
            var output = arguments["output"];

            var results = File.ReadAllText(input);
            var visits = ParseVisits(results);

            var failureTag = CreateFailureTag(visits);
            var statsTag = CreateStatsTag(visits);

            var html = new HtmlTag("html")
                .Append(new HtmlTag("head")
                            .Append(new HtmlTag("title").Text("JMeter Load Test Report")))
                .Append(new HtmlTag("body")
                            .Append(new HtmlTag("h1").Text("JMeter Load Test Report - " + DateTime.Now.ToString()))
                            .Append(failureTag)
                            .Append(statsTag));

            File.WriteAllText(output, html.ToHtmlString());
        }