/// <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()); }
/// <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()); }
/// <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()); }
/// <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()); }
/// <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()); }