Ejemplo n.º 1
0
        /// <summary>
        /// Get specified form
        /// </summary>
        /// <param name="formName">name of form</param>
        /// <returns>html</returns>
        private string GetFormPage(string formName)
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("html");
            b.open("head");
            b.open("title");
            b.append(b.text(formName));
            b.close("title");
            b.open("style", b.attr("type", "text/css"));
            b.append("th	{text-align: right;}\n");
            b.append("td	{padding-left: 1em; text-align: left;}\n");
            b.close("style");
            b.include_js("scripts/slider.js");
            b.include_css("styles/slider.css");
            b.open("script", b.attr("type", "text/javascript"));
            b.append("function doclick(sel){\n");
            b.append("  sel.value=\"True\";\n");
            b.append("  sel.form.submit();\n");
            b.append("}\n");
            b.close("script");
            b.close("head");
            b.open("body");
            b.open("h2");
            b.append(b.text(formName));
            b.close("h2");
            b.hr();
            b.open("form", b.attr("name", formName,
                                  "action", b.fmt("{0}.cgi", formName),
                                  "method", "post"));
            b.open("table");
            foreach (var pair in inputs)
            {
                InputBase input = pair.Value;
                if (input.Form.Name == formName)
                {
                    b.append(input.GetHtml());
                }
            }
            b.open("tr");
            b.open("th");
            b.close("th");
            b.open("td");

            FormSettings form = GetForm(formName);

            if (!form.AutoSubmit)
            {
                b.open("input", b.attr("type", "submit", "value", "SUBMIT"));
                b.close("input");
                b.open("input", b.attr("type", "reset", "value", "RESET"));
                b.close("input");
            }

            b.close("td");
            b.close("tr");
            b.close("table");
            b.close("form");

            // required "linkware" credits
            b.hr();
            //b.link("http://carpe.ambiprospect.com/slider/", "sliders by CARPE Design");

            return(b.ToString());
        }