/// <summary> /// for Form /// </summary> private void DoForForm() { string dataName = ""; var theTag = TagList.FirstOrDefault(a => a is FormTag); if (theTag != null) { FormTag form = theTag as FormTag; dataName = form.DataName; FieldTag field = null; List <FieldTag> Fields = new List <FieldTag>(); foreach (var c in TagList.Where(a => a is FieldTag)) { if (c is FieldTag) { field = c as FieldTag; if (field.Type == FieldType.form_value) { field.SetDataName(dataName, FieldType.form_value); form.AddField(field); } } } theTag = TagList.FirstOrDefault(a => a is MethodTag && (a as MethodTag).Type == MethodType.form_method); if (theTag != null) { MethodTag method = theTag as MethodTag; form.SetMethod(method); } } }
public virtual HtmlDocument BuildView(IUrlRegistry urls, IOutputWriter writer, LoginRequest request) { // TODO -- Revisit all of this when we get HTML conventions everywhere var view = new HtmlDocument(); var form = new FormTag(urls.UrlFor <LoginRequest>("POST")); form.Append(new HtmlTag("legend").Text(LoginKeys.Login)); if (request.Message.IsNotEmpty()) { form.Append(new HtmlTag("p").Text(request.Message).Style("color", "red")); } form.Append(new TextboxTag("UserName", request.UserName)); form.Append(new TextboxTag("Password", request.Password)); form.Append(new CheckboxTag(request.RememberMe).Name("RememberMe")); form.Append(new DivTag().Text(request.Message).Id("login-message")); form.Append(new HiddenTag().Name("Url").Attr("value", request.Url)); form.Append(new HtmlTag("input").Attr("type", "submit").Attr("value", LoginKeys.Login).Id("login-submit")); view.Add(form); return(view); }
public static MvcForm BeginForm(this HtmlHelper html, string controller = null, string action = null, Action <FormTag> config = null, object routeValues = null) { var form = new FormTag(); form.Method("POST"); if (controller.IsNullOrEmpty()) { controller = html.ViewContext.GetControllerName(); } if (action.IsNullOrEmpty()) { action = html.ViewContext.GetActionName(); } if (config != null) { config(form); } form.Action(UrlHelper.GenerateUrl(null, action, controller, new RouteValueDictionary(routeValues), html.RouteCollection, html.ViewContext.RequestContext, true)); form.NoClosingTag(); html.ViewContext.Writer.Write(form.ToString()); return(new MvcForm(html.ViewContext)); }
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())); }
public FormINFO(string _playername, FormType _type, FormTag _tag) { playername = _playername; Type = _type; Tag = _tag; playeruuid = Program.GetUUID(_playername); }
public override HtmlTag Build(FormRequest request) { var tag = new FormTag(request.Url); tag.NoClosingTag(); return(tag); }
private HtmlTag formForMode(FormMode mode) { var form = new FormTag("test"); mode.Modify(form); return(form); }
public void SetUp() { theRequest = new FormRequest(new ChainSearch { Type = typeof(object) }, new object()); var theForm = new FormTag("test"); theRequest.ReplaceTag(theForm); }
public MfccChartForm(FormTag tag) { Tag = tag; InitializeComponent(); for (int i = 0; i < sColStyle.Count <string>(); i++) { colStyle_cbx.Items.Add(sColStyle[i]); } colStyle_cbx.SelectedIndex = 0; }
public static FormTag WithValidationSummary <T>(this FormTag form) { form.Id(typeof(T).Name); var summary = new HtmlTag("div") .AddClasses("alert", "alert-error", "validation-container") .Append(new HtmlTag("p").Text(HelloValidationKeys.Summary)) .Append(new HtmlTag("ul").AddClass("validation-summary")) .Style("display", "none"); form.Append(summary); return(form); }
public static FormTag ValidationSummary <T>(this FormTag form) { form.Id(typeof(T).Name); var summary = new HtmlTag("div") .AddClasses("alert", "alert-error", "validation-container") .Append(new HtmlTag("p").Text("There are errors with the information you provided.")) .Append(new HtmlTag("ul").AddClass("validation-summary")) .Style("display", "none"); form.Append(summary); return(form); }
public HtmlTag Build(ElementRequest request) { var naming = request.Get <ElementNaming>(); var form = new FormTag().NoClosingTag(); if (request.Model != null) { form.Id(naming.Form(request.Model)); } return(form); }
public bool StartCreateTagDialog() { if (!InvokeEvent(PreCreateTag)) { return(true); } var form = new FormTag(); form.ShowDialog(); InvokeEvent(PostCreateTag); return(true); }
static HtmlTag GenerateForm <TModel> (TModel model, FormType formType, FormTag formTag) { foreach (var prop in model.GetType().GetProperties()) { //var value = prop.GetValue (model, null); var visibility = (ScaffoldVisibilityType)model.GetAttributeValue(prop, typeof(ScaffoldVisibilityAttribute), formType.ToString()); if (visibility == ScaffoldVisibilityType.None) { continue; } if (visibility == ScaffoldVisibilityType.Show) { var type = prop.PropertyType; if (type == typeof(string)) { formTag.Append(GenerateInputText <TModel> (model, prop)); } else if (type == typeof(bool)) { formTag.Append(GenerateInputCheck <TModel> (model, prop)); } else if (typeof(IEnumerable).IsAssignableFrom(type)) { formTag.Append(GenerateSelect <TModel> (model, prop)); } else if (type.IsEnum) { formTag.Append(GenerateSelect <TModel> (model, prop)); } else if (typeof(DateTime).IsAssignableFrom(type) || typeof(DateTimeOffset).IsAssignableFrom(type)) { formTag.Append(GenerateCalendar <TModel> (model, prop)); } } else { formTag.Append(GenerateInputHidden <TModel> (model, prop)); } } if (formTag.Children.Count == 0) { return(null); } return(formTag); }
public SamlResponseRedirectionDocument(string response, string destination) { Title = "Saml2 Response Redirection"; var form = new FormTag(destination); Push(form); var hiddenTag = new HiddenTag().Attr("name", SamlAuthenticationStrategy.SamlResponseKey) .Attr("value", response); Add(hiddenTag); Pop(); AddJavaScript("window.onload = function () { document.forms[0].submit(); }"); }
public HtmlTag Build(ElementRequest request) { var naming = request.Get <ElementNaming>(); var formTag = new FormTag(); if (request.Model != null) { formTag .Id(naming.Form(request.Model)) .Attr("data-form-summary", naming.FormSummaryId(request.Model)); } return(formTag .NoClosingTag() .Attr("data-controller", "form")); }
public static ScopedHtmlHelper <TPostModel> FormFor <TViewModel, TPostModel>(this HtmlHelper <TViewModel> helper, TPostModel postModel, Action <FormTag> mutator = null) { var form = new FormTag(); form.AddClasses("sg-form").NoClosingTag(); if (mutator != null) { mutator(form); } helper.ViewContext.Writer.Write(form.ToHtmlString()); return(helper.ForModel(postModel, () => { helper.ViewContext.Writer.Write($"</{form.TagName()}>"); })); }
public bool StartCreateTagDialog(IWin32Window owner) { if (!RequiresValidWorkingDir(owner)) { return(false); } if (!InvokeEvent(owner, PreCreateTag)) { return(true); } using (var form = new FormTag()) form.ShowDialog(owner); InvokeEvent(owner, PostCreateTag); return(true); }
public bool StartCreateTagDialog() { if (!RequiresValidWorkingDir()) { return(false); } if (!InvokeEvent(PreCreateTag)) { return(true); } var form = new FormTag(); form.ShowDialog(); InvokeEvent(PostCreateTag); return(true); }
public HtmlDocument get_saml_poster() { var document = new HtmlDocument(); document.Title = "Saml Poster"; var form = new FormTag(_urls.UrlFor <SamlEndpoint>(x => x.post_test_saml())); document.Push(form); var textarea = form.Add("textarea").Attr("name", SamlAuthenticationStrategy.SamlResponseKey).Attr("rows", 20).Attr("cols", "100"); if (SamlResponse != null) { var xml = _writer.Write(SamlResponse); textarea.Attr("value", xml); SamlResponse = null; } form.Add("input").Attr("type", "submit").Attr("value", "Submit").Id("saml-submit"); return(document); }
protected override void beforeEach() { theGraph = BehaviorGraph.BuildFrom(x => x.Actions.IncludeType <ValidationSummaryTargetEndpoint>()); Services.Inject <IChainResolver>(new ChainResolutionCache(theGraph)); theRequest = new FormRequest(new ChainSearch { Type = typeof(ValidationSummaryTarget) }, new ValidationSummaryTarget()); theRequest.Attach(new StructureMapServiceLocator(Services.Container)); ValidationPolicy.ApplyValidation(theRequest.Chain.FirstCall(), new ValidationSettings()); theRequest.Chain.ValidationNode().Clear(); theRequest.Chain.ValidationNode().RegisterStrategy(RenderingStrategies.Summary); var theForm = new FormTag("test"); theForm.Append(new HtmlTag("input").Attr("type", "text").Attr("name", "Name")); theRequest.ReplaceTag(theForm); MockFor <IPartialInvoker>().Stub(x => x.Invoke <ValidationSummary>()).Return(theValidationSummary.ToCompletionTask()); }
public bool StartCreateTagDialog() { if (!InvokeEvent(PreCreateTag)) return true; FormTag form = new FormTag(); form.ShowDialog(); InvokeEvent(PostCreateTag); return true; }
public void form_tag_creates_the_opening_element_of_a_form_with_id_mainForm() { var tag = new FormTag(); tag.Attr("method").ShouldEqual("post"); }
public void form_action_can_be_specified_via_constructor() { var tag = new FormTag("/user/create"); tag.ToString().ShouldEqual("<form id=\"mainForm\" method=\"post\" action=\"/user/create\">"); }
public void form_method_can_be_customized() { var tag = new FormTag().Method("get"); tag.ToString().ShouldEqual("<form id=\"mainForm\" method=\"get\">"); }
public bool StartCreateTagDialog(IWin32Window owner) { if (!RequiresValidWorkingDir(owner)) return false; if (!InvokeEvent(owner, PreCreateTag)) return true; using (var form = new FormTag(this)) form.ShowDialog(owner); InvokeEvent(owner, PostCreateTag); return true; }
//public static ValidationMessageTag CreateValidationTag(this HtmlTag tag, ModelInfo info) //{ // var errMsg = ""; // if (info.ValidationFailed) // { // errMsg = info.ModelErrors[0].ErrorMessage; // } // return new ValidationMessageTag(info.HtmlId, info.ValidationFailed, errMsg); //} public static FormTag DoPOST(this FormTag tag) { return(tag.Method("POST")); }
public void form_action_can_be_specified() { var tag = new FormTag().Action("/user/create"); tag.ToString().ShouldEqual("<form method=\"post\" action=\"/user/create\">"); }
private void ShowChart(FormTag tag, bool value) { if (InvokeRequired) { Action <FormTag, bool> act = new Action <FormTag, bool>(ShowChart); Invoke(act, new object[] { tag, value }); } else { switch (tag) { case FormTag.REF_WAVE: if (refvoice_wave == null || refvoice_wave.IsDisposed) { refvoice_wave = new WaveViewerForm(tag); SetDataChart(FormTag.REF_WAVE); } if (value) { if (!refvoice_wave.Visible) { refvoice_wave.Show(); } } else { if (refvoice_wave.Visible) { refvoice_wave.Hide(); } } break; case FormTag.REF_FREQ: if (refvoice_freq == null || refvoice_freq.IsDisposed) { refvoice_freq = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_freq.Visible) { refvoice_freq.Show(); } } else { if (refvoice_freq.Visible) { refvoice_freq.Hide(); } } break; case FormTag.REF_MFCC: if (refvoice_mfcc == null || refvoice_mfcc.IsDisposed) { refvoice_mfcc = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_mfcc.Visible) { refvoice_mfcc.Show(); } } else { if (refvoice_mfcc.Visible) { refvoice_mfcc.Hide(); } } break; case FormTag.REF_DOUBLE: if (refvoice_double == null || refvoice_double.IsDisposed) { refvoice_double = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_double.Visible) { refvoice_double.Show(); } } else { if (refvoice_double.Visible) { refvoice_double.Hide(); } } break; case FormTag.REF_DETAL: if (refvoice_detal == null || refvoice_detal.IsDisposed) { refvoice_detal = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_detal.Visible) { refvoice_detal.Show(); } } else { if (refvoice_detal.Visible) { refvoice_detal.Hide(); } } break; case FormTag.REF_PITCH: if (refvoice_pitch == null || refvoice_pitch.IsDisposed) { refvoice_pitch = new LineChartForm(tag); SetDataChart(tag); } if (value) { if (!refvoice_pitch.Visible) { refvoice_pitch.Show(); } } else { if (refvoice_pitch.Visible) { refvoice_pitch.Hide(); } } break; case FormTag.YOUR_WAVE: if (yourvoice_wave == null || yourvoice_wave.IsDisposed) { yourvoice_wave = new WaveViewerForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_wave.Visible) { yourvoice_wave.Show(); } } else { if (yourvoice_wave.Visible) { yourvoice_wave.Hide(); } } break; case FormTag.YOUR_FREQ: if (yourvoice_freq == null || yourvoice_freq.IsDisposed) { yourvoice_freq = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_freq.Visible) { yourvoice_freq.Show(); } } else { if (yourvoice_freq.Visible) { yourvoice_freq.Hide(); } } break; case FormTag.YOUR_MFCC: if (yourvoice_mfcc == null || yourvoice_mfcc.IsDisposed) { yourvoice_mfcc = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_mfcc.Visible) { yourvoice_mfcc.Show(); } } else { if (yourvoice_mfcc.Visible) { yourvoice_mfcc.Hide(); } } break; case FormTag.YOUR_DOUBLE: if (yourvoice_double == null || yourvoice_double.IsDisposed) { yourvoice_double = new MfccChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_double.Visible) { yourvoice_double.Show(); } } else { if (yourvoice_double.Visible) { yourvoice_double.Hide(); } } break; case FormTag.YOUR_DETAL: if (yourvoice_detal == null || yourvoice_detal.IsDisposed) { yourvoice_detal = new MfccChartForm(tag); SetDataChart(tag); yourvoice_detal.Text = ""; } if (value) { if (!yourvoice_detal.Visible) { yourvoice_detal.Show(); } } else { if (yourvoice_detal.Visible) { yourvoice_detal.Hide(); } } break; case FormTag.YOUR_PITCH: if (yourvoice_pitch == null || yourvoice_pitch.IsDisposed) { yourvoice_pitch = new LineChartForm(tag); SetDataChart(tag); } if (value) { if (!yourvoice_pitch.Visible) { yourvoice_pitch.Show(); } } else { if (yourvoice_pitch.Visible) { yourvoice_pitch.Hide(); } } break; } } }
public void form_id_can_be_customized() { var tag = new FormTag().Id("other-form"); tag.ToString().ShouldEqual("<form id=\"other-form\" method=\"post\">"); }
public void form_method_can_be_customized() { var tag = new FormTag().Method("get"); tag.Attr("method").ShouldEqual("get"); }
public void form_action_can_be_specified() { var tag = new FormTag().Action("/user/create"); tag.Attr("action").ShouldEqual("/user/create"); }
public void form_action_can_be_specified_via_constructor() { var tag = new FormTag("/user/create"); tag.Attr("action").ShouldEqual("/user/create"); }
private void SetDataChart(FormTag tag) { if (this.InvokeRequired) { Action <FormTag> act = new Action <FormTag>(SetDataChart); Invoke(act, new object[] { tag }); } else { switch (tag) { case FormTag.REF_WAVE: if (refvoice_wave == null || refvoice_wave.IsDisposed) { refvoice_wave = new WaveViewerForm(tag); refvoice_wave.Text = "Ref Wave Chart"; } if (refmfcc != null && refmfcc.ProcessDone) { refvoice_wave.FilePath = refmfcc.Path + " FSize: " + refmfcc.FrameSize.ToString() + " SRate:" + _refWav.SampleRate.ToString(); refvoice_wave.Data = _refWav.SelectedData; } break; case FormTag.REF_FREQ: if (refvoice_freq == null || refvoice_freq.IsDisposed) { refvoice_freq = new MfccChartForm(tag); refvoice_freq.Text = "Ref Freq Chart"; } if (refmfcc != null && refmfcc.ProcessDone) { refvoice_freq.Title = refmfcc.Path; refvoice_freq.Data = refmfcc.Freq; } break; case FormTag.REF_MFCC: if (refvoice_mfcc == null || refvoice_mfcc.IsDisposed) { refvoice_mfcc = new MfccChartForm(tag); refvoice_mfcc.Text = "Ref MFCC Chart"; } if (refmfcc != null && refmfcc.ProcessDone) { refvoice_mfcc.Title = refmfcc.Path; refvoice_mfcc.Data = refmfcc.Mfcc; } break; case FormTag.REF_DOUBLE: if (refvoice_double == null || refvoice_double.IsDisposed) { refvoice_double = new MfccChartForm(tag); refvoice_double.Text = "Ref Double Chart"; } if (refmfcc != null && refmfcc.ProcessDone) { refvoice_double.Title = refmfcc.Path; refvoice_double.Data = refmfcc.DoubleDetalMfcc; } break; case FormTag.REF_DETAL: if (refvoice_detal == null || refvoice_detal.IsDisposed) { refvoice_detal = new MfccChartForm(tag); refvoice_detal.Text = "Ref Delta Chart"; } if (refmfcc != null && refmfcc.ProcessDone) { refvoice_detal.Title = refmfcc.Path; refvoice_detal.Data = refmfcc.DetalMfcc; } break; case FormTag.REF_PITCH: if (refvoice_pitch == null || refvoice_pitch.IsDisposed) { refvoice_pitch = new LineChartForm(tag); refvoice_pitch.Text = "Ref Pitch Chart"; } if (refpitch != null /*&& refpitch.IsProcessed == (int)State.SUCCESSED*/) { refvoice_pitch.Data = refpitch.SmoothPitchs; } break; case FormTag.YOUR_WAVE: if (yourvoice_wave == null || yourvoice_wave.IsDisposed) { yourvoice_wave = new WaveViewerForm(tag); yourvoice_wave.Text = "Your Wave Chart"; } if (yourmfcc != null && yourmfcc.ProcessDone) { yourvoice_wave.FilePath = yourmfcc.Path + " FSize: " + yourmfcc.FrameSize.ToString() + " SRate:" + _yourWav.SampleRate.ToString();; yourvoice_wave.Data = _yourWav.SelectedData; } break; case FormTag.YOUR_FREQ: if (yourvoice_freq == null || yourvoice_freq.IsDisposed) { yourvoice_freq = new MfccChartForm(tag); yourvoice_freq.Text = "Your Freq Chart"; } if (yourmfcc != null && yourmfcc.ProcessDone) { yourvoice_freq.Title = yourmfcc.Path; yourvoice_freq.Data = yourmfcc.Freq; //yourvoice_freq.Pitch = yourpitch.Pitchs; } break; case FormTag.YOUR_MFCC: if (yourvoice_mfcc == null || yourvoice_mfcc.IsDisposed) { yourvoice_mfcc = new MfccChartForm(tag); yourvoice_mfcc.Text = "Your MFCC Chart"; } if (yourmfcc != null && yourmfcc.ProcessDone) { yourvoice_mfcc.Title = yourmfcc.Path; yourvoice_mfcc.Data = yourmfcc.Mfcc; } break; case FormTag.YOUR_DOUBLE: if (yourvoice_double == null || yourvoice_double.IsDisposed) { yourvoice_double = new MfccChartForm(tag); yourvoice_double.Text = "Your Double Chart"; } if (yourmfcc != null && yourmfcc.ProcessDone) { yourvoice_double.Title = yourmfcc.Path; yourvoice_double.Data = yourmfcc.DoubleDetalMfcc; } break; case FormTag.YOUR_DETAL: if (yourvoice_detal == null || yourvoice_detal.IsDisposed) { yourvoice_detal = new MfccChartForm(tag); yourvoice_detal.Text = "Your Delta Chart"; } if (yourmfcc != null && yourmfcc.ProcessDone) { yourvoice_detal.Title = yourmfcc.Path; yourvoice_detal.Data = yourmfcc.DetalMfcc; } break; case FormTag.YOUR_PITCH: if (yourvoice_pitch == null || yourvoice_pitch.IsDisposed) { yourvoice_pitch = new LineChartForm(tag); yourvoice_pitch.Text = "Your Pitch Chart"; } if (yourpitch != null) { yourvoice_pitch.Data = yourpitch.SmoothPitchs; } break; } } }
public bool StartCreateTagDialog() { if (!RequiresValidWorkingDir()) return false; if (!InvokeEvent(PreCreateTag)) return true; var form = new FormTag(); form.ShowDialog(); InvokeEvent(PostCreateTag); return true; }
private void ShowSelectedChart(FormTag tag, bool value) { //SetDataChart(tag); ShowChart(tag, value); }
public static FormTag DoGET(this FormTag tag) { return(tag.Method("GET")); }
public SelectedChartEventArgs(FormTag tag, bool value) { Tag = tag; Value = value; }
public void form_id_can_be_customized() { var tag = new FormTag().Id("other-form"); tag.Id().ShouldEqual("other-form"); }
public void form_tag_creates_the_opening_element_of_a_form_with_id_mainForm() { var tag = new FormTag(); tag.ToString().ShouldEqual("<form id=\"mainForm\" method=\"post\">"); }