コード例 #1
0
        /// <summary>
        /// Get html representation
        /// </summary>
        /// <returns>html</returns>
        override public string GetHtml()
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("tr");
            b.open("th"); b.append(b.text(Label + ":")); b.close("th");
            b.open("td");

            string attr = b.attr("name", UniqueID, "style", "width: 300px");

            if (Form.AutoSubmit)
            {
                attr += b.attr("onchange", "this.form.submit();");
            }
            b.open("select", attr);

            for (int i = 0; i < options.Length; ++i)
            {
                attr = b.attr("value", i.ToString()) + GetExtraAttributes();
                if (GetValue().ToLower() == i.ToString())
                {
                    attr += b.attr("selected", "true");
                }
                b.open("option", attr);
                b.append(b.text(options[i]));
                b.close("option");
            }
            return(b.ToString());
        }
コード例 #2
0
        /// <summary>
        /// Get html representation
        /// </summary>
        /// <returns>html</returns>
        override public string GetHtml()
        {
            HtmlBuilder b = new HtmlBuilder();

            // Since the value of an unchecked checkbox is not sent via POST
            // we are going to use two radio buttons instead

            // build attributes
            string temp = GetExtraAttributes() + b.attr("type", "radio", "name", UniqueID);

            if (Form.AutoSubmit)
            {
                temp += b.attr("onclick", "this.form.submit();");
            }
            string[] at = new string[2];
            at[1] = temp + b.attr("value", "True");
            at[0] = temp + b.attr("value", "False");
            if (GetValue().ToLower() != "false")
            {
                at[1] += " checked";
            }
            else
            {
                at[0] += " checked";
            }

            b.open("tr");
            b.open("th"); b.append(b.text(Label + ":")); b.close("th");
            b.open("td");
            b.open("input", at[1]); b.close("input"); b.append(b.text(options[1]));
            b.open("input", at[0]); b.close("input"); b.append(b.text(options[0]));
            return(b.ToString());
        }
コード例 #3
0
        /// <summary>
        /// Get top page with frames
        /// </summary>
        /// <returns>html</returns>
        private string GetTopPage()
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("html");
            b.open("head");
            b.open("title");
            b.append("Web Config");
            b.close("title");
            b.close("head");
            b.open("frameset", b.attr("cols", "200,*"));
            b.open("frame", b.attr("src", "menu.cgi", "name", "menu")); b.close("frame");
            b.open("frame", b.attr("src", "contents.cgi", "name", "contents")); b.close("frame");
            b.open("noframes");
            b.append("A browser which supports frame display is required for browsing this page.");

            return(b.ToString());
        }
コード例 #4
0
        /// <summary>
        /// Get extra input attributes
        /// </summary>
        /// <returns>html</returns>
        protected string GetExtraAttributes()
        {
            HtmlBuilder b = new HtmlBuilder();

            if (ReadOnly)
            {
                b.append(b.attr("ReadOnly", "True"));
            }
            if (Disabled)
            {
                b.append(b.attr("Disabled", "True"));
            }
            if (null != Title)
            {
                b.append(b.attr("Title", Title));
            }
            return(b.ToString());
        }
コード例 #5
0
        /// <summary>
        /// Get html representation
        /// </summary>
        /// <returns>html</returns>
        override public string GetHtml()
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("tr");
            b.open("th"); b.close("th");
            b.open("td");

            string attr = b.attr("type", "button",
                                 "value", Label,
                                 "style", "width: 300px") + GetExtraAttributes();

            string script = b.fmt("document.location.href = \"{0}\";", url);

            attr += b.attr("onclick", script);

            b.open("input", attr);
            return(b.ToString());
        }
コード例 #6
0
        /// <summary>
        /// Get html representation
        /// </summary>
        /// <returns>html</returns>
        override public string GetHtml()
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("tr");
            b.open("th"); b.close("th");
            b.open("td");
            b.open("input", b.attr("type", "hidden",
                                   "name", UniqueID));

            string attr = b.attr("type", "button",
                                 "value", Label,
                                 "style", "width: 300px") + GetExtraAttributes();

            // buttons always auto-submit
            string script = b.fmt("doclick(this.form.{0});", UniqueID);

            attr += b.attr("onclick", script);

            b.open("input", attr);
            return(b.ToString());
        }
コード例 #7
0
        /// <summary>
        /// Get html representation
        /// </summary>
        /// <returns>html</returns>
        override public string GetHtml()
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("tr");
            b.open("th"); b.append(b.text(Label + ":")); b.close("th");
            b.open("td");
            b.open("input", b.attr("type", "text",
                                   "name", UniqueID,
                                   "value", GetValue(),
                                   "style", "width: 300px") + GetExtraAttributes());
            return(b.ToString());
        }
コード例 #8
0
        /// <summary>
        /// Get menu with links to each form
        /// </summary>
        /// <returns>html</returns>
        private string GetMenuPage()
        {
            HtmlBuilder b = new HtmlBuilder();

            b.open("html");
            b.open("head");
            b.open("script", b.attr("language", "javascript"));
            b.append("function frmUpdate(page){ parent.contents.location=page; }\n");
            b.close("script");
            b.close("head");
            b.open("body");
            b.open("fieldset");
            b.open("table");

            List <string> uList = new List <string>();

            foreach (var pair in inputs)
            {
                string s = pair.Value.Form.Name;
                if (!uList.Contains(s))
                {
                    uList.Add(s);

                    b.open("tr");
                    b.open("td");
                    b.open("a", b.attr("href", "", "onClick", b.fmt("frmUpdate('{0}.cgi');", s)));
                    b.append(b.text(s));
                    b.close("a");
                    b.close("td");
                    b.close("tr");
                }
            }

            b.close_all();
            return(b.ToString());
        }
コード例 #9
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());
        }
コード例 #10
0
        /// <summary>
        /// Get html representation
        /// </summary>
        /// <returns>html</returns>
        override public string GetHtml()
        {
            // validate value within range and compute percent
            float value = (float)Convert.ToDouble(GetValue());

            if (value < minValue)
            {
                value = minValue;
            }
            else if (value > maxValue)
            {
                value = maxValue;
            }
            float range    = maxValue - minValue;
            int   pctValue = (int)(value * 100 / range);

            string sliderID  = UniqueID;
            string displayID = UniqueID + "_display";

            HtmlBuilder b = new HtmlBuilder();

            b.open("tr");
            b.open("th"); b.append(b.text(Label + ":")); b.close("th");
            b.open("td");

            b.open("div", b.attr("class", "carpe_horizontal_slider_display_combo"));
            b.open("div", b.attr("class", "carpe_horizontal_slider_track"));
            b.open("div", b.attr("class", "carpe_slider_slit"));
            b.nbsp();
            b.close("div");
            b.open("div", b.attr("class", "carpe_slider",
                                 "id", sliderID,
                                 "display", displayID,
                                 "style", b.fmt("left: {0}px;", pctValue.ToString())));
            b.nbsp();
            b.close("div");
            b.close("div");
            b.open("div", b.attr("class", "carpe_slider_display_holder"));

            string attr = b.attr("class", "carpe_slider_display",
                                 "name", UniqueID,
                                 "id", displayID,
                                 "type", "text",
                                 "from", minValue.ToString(),
                                 "to", maxValue.ToString(),
                                 "value", value.ToString(),
                                 "valuecount", valueCount.ToString(),
                                 "decimals", decimals.ToString(),
                                 "typelock", "off") + GetExtraAttributes();

            if (Form.AutoSubmit)
            {
                attr += b.attr("onchange", "this.form.submit();");
            }
            b.open("input", attr);

            b.close("input");
            b.close("div");
            b.close("div");
            return(b.ToString());
        }