public virtual void Visit(FormButton formButton, HtmlContainer htmlContainer) { HtmlDiv htmlDiv = verbose ? new HtmlDiv(formButton.Path) : new HtmlDiv(); htmlDiv.Class.Add("formButton"); if (!string.IsNullOrWhiteSpace(formButton.CssClass)) { htmlDiv.Class.AddRange(formButton.CssClass.Split(' ').Where(s => s != string.Empty)); } if (!string.IsNullOrWhiteSpace(formButton.Path)) { htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formButton.Path)); } htmlDiv.Hidden.Value = formButton.IsHidden; htmlContainer.Add(htmlDiv); HtmlButton htmlButton = new HtmlButton(formButton.Path); htmlButton.Disabled.Value = formButton.IsDisabled; htmlDiv.Add(htmlButton); htmlButton.Add(new HtmlText(formButton.Content)); }
public Model() { Site = new SampleSiteDefinition(); ApplyButton = new FormButton { ButtonType = ButtonTypeEnum.Apply }; }
internal void AddFormButton(string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo) { FormButton child = new FormButton(); if (cmdNo > 1) { this.Controls.Add(new LiteralControl("</span></td><td class=\"ms-separator\"> </td><td class=\"ms-toolbar\" noWrap=\"nowrap\"><span>")); } child.ID = id; child.ToolTip = desc; if (string.IsNullOrEmpty(clickScript)) { child.NavigateUrl = clickUrl; } else { child.OnClientClick = clickScript + "return(event && (event.returnValue=!(event.cancelBubble=true)));"; } child.ImageUrl = img; child.CssClass = "roxlistformbutton"; child.Text = caption; child.ControlMode = SPControlMode.Display; child.PermissionContext = this.PermContext; child.Permissions = this.Perms; this.Controls.Add(child); if (ProductPage.Is14) { this.Page.ClientScript.RegisterClientScriptBlock(typeof(ClientScriptManager), ProductPage.AssemblyName + "_Script_" + cmdNo, " " + this.Prod + "Buttons['" + id + "'] = '" + child.ClientID + "'; ", true); this.AddRibbonButton(id, caption, img, desc, clickUrl, clickScript, cmdNo, child); } }
private void SetFormButtonObjects() { GridLayoutGroup glg = GetComponentInChildren <GridLayoutGroup> (); Button[] glgButtons = glg.GetComponentsInChildren <Button> (); int colorIndex = 0; int findex = 0; foreach (Button bObj in glgButtons) { string formText = FormData.Instance.gFormText [findex]; if (formText == "space") { colorIndex = FormData.Instance.gFormData [findex * Globals.FormQuantum]; findex++; } FormButton objectScript = bObj.GetComponent <FormButton> (); objectScript.FormIndex = findex; objectScript.ColorIndex = colorIndex; objectScript.Refresh(); findex++; } }
public void UpdateData(UserDefinition user) { switch (ModelProgress) { case EditModel.ModelProgressEnum.New: ShowRecoveryCodes = new FormButton { Text = this.__ResStr("showCode", "Show Recovery Code"), ButtonType = ButtonTypeEnum.Apply, }; break; case EditModel.ModelProgressEnum.ShowLogin: ShowRecoveryCodesLogin = new FormButton { Text = this.__ResStr("showCode", "Show Recovery Code"), ButtonType = ButtonTypeEnum.Apply, }; break; case EditModel.ModelProgressEnum.ShowCodes: GenerateRecoveryCode = new FormButton { Text = this.__ResStr("genCode", "Generate New Recovery Code"), ButtonType = ButtonTypeEnum.Apply, }; RecoveryCode = user.RecoveryCode; break; } }
public void Update(ImportModule mod, ImportModuleController ctrl) { UploadFile = new FileUpload1 { SelectButtonText = this.__ResStr("btnImport", "Import Binary or Source Code Package..."), SaveURL = ctrl.GetActionUrl("ImportPackage", new { __ModuleGuid = mod.ModuleGuid }), RemoveURL = ctrl.GetActionUrl("RemovePackage", new { __ModuleGuid = mod.ModuleGuid }), }; RemoteGo = new FormButton() { Text = "Download and Install", ButtonType = ButtonTypeEnum.Submit, }; }
public bool IsFormTabActive() { string className = FormButton.FindElement(By.XPath("..")).GetAttribute("class"); if (className == "active") { return(true); } else { return(false); } }
public async Task <string> RenderViewAsync(CurrencyConverterModule module, CurrencyConverterModuleController.Model model) { HtmlBuilder hb = new HtmlBuilder(); // based on https://openexchangerates.org await Manager.ScriptManager.AddScriptAsync(Package.AreaName, ExchangeRateDataProvider.JSFile, Bundle : false, Minify : false); string wantFocus = module.WantFocus ? " yFocusOnMe" : ""; FormButton button = new FormButton() { ButtonType = ButtonTypeEnum.Button, Name = "convert", Text = this.__ResStr("btnGo", "Go") }; hb.Append($@" <div class='t_converter'> <div class='t_amountlabel'> {Utility.HtmlEncode(this.__ResStr("amount", "Amount:"))} </div> <div class='t_amount{wantFocus}'> {await HtmlHelper.ForEditAsync(model, nameof(model.Amount))} </div> <div class='t_fromlabel'> {Utility.HtmlEncode(this.__ResStr("from", "From:"))} </div> <div class='t_from'> {await HtmlHelper.ForEditAsync(model, nameof(model.FromCountry))} </div> <div class='t_tolabel'> {Utility.HtmlEncode(this.__ResStr("to", "To:"))} </div> <div class='t_to'> {await HtmlHelper.ForEditAsync(model, nameof(model.ToCountry))} </div> <div class='t_button'> {await button.RenderAsync()} </div> <div class='t_result_from t_results'> </div> <div class='t_result_is t_results'> {Utility.HtmlEncode(this.__ResStr("is", " => "))} </div> <div class='t_result_to t_results'> </div> <div class='t_disclaimer'> {Utility.HtmlEncode(this.__ResStr("disclaimer", "Conversions are approximate and do not include taxes/fees and other conversion costs"))} </div> </div>"); return(hb.ToString()); }
//deprecated private void LoadFormButtonObjects() { for (int t = 0; t < 100; t++) { GameObject _sfObj = Instantiate(Resources.Load("Prefabs/FormButton", typeof(GameObject))) as GameObject; if (_sfObj != null) { if (GridLayout != null) { _sfObj.transform.parent = GridLayout.transform; } _sfObj.name = "FormButton_" + t.ToString(); FormButton objectScript = _sfObj.GetComponent <FormButton> (); objectScript.FormIndex = t; } else { Debug.Log("Couldn't load marker object prefab"); } } }
public void HandleCharacterCreationFormSelection(FormButton button, Form form) { var characterCreationForm = (CharacterCreationForm)form; switch (button) { case FormButton.Ok: CloseActivity(); _systemContainer.SaveSystem.Create(characterCreationForm); break; case FormButton.Cancel: _activitySystem.Pop(); _activitySystem.Push(new MenuActivity( _systemContainer.ActivitySystem.DefaultPosition, _systemContainer.ActivitySystem.DefaultPadding, new MainMenu(_systemContainer))); break; default: throw new ApplicationException("Unknown form button"); } }
private string RenderFormButton(FormButton formButton) { YTagBuilder tag = new YTagBuilder("input"); string text = formButton.Text; switch (formButton.ButtonType) { case ButtonTypeEnum.Submit: case ButtonTypeEnum.ConditionalSubmit: if (formButton.ButtonType == ButtonTypeEnum.ConditionalSubmit && !Manager.IsInPopup && !Manager.HaveReturnToUrl) { // if we don't have anyplace to return to and we're not in a popup we don't need a submit button return(null); } if (string.IsNullOrWhiteSpace(text)) { text = this.__ResStr("btnSave", "Save"); } tag.Attributes.Add("type", "submit"); break; case ButtonTypeEnum.Apply: if (string.IsNullOrWhiteSpace(text)) { text = this.__ResStr("btnApply", "Apply"); } tag.Attributes.Add("type", "button"); tag.Attributes.Add(Forms.CssDataApplyButton, ""); break; default: case ButtonTypeEnum.Button: tag.Attributes.Add("type", "button"); break; case ButtonTypeEnum.Cancel: //if (!Manager.IsInPopup && !Manager.HaveReturnToUrl) { // // if we don't have anyplace to return to and we're not in a popup so we don't need a cancel button // return null; //} if (string.IsNullOrWhiteSpace(text)) { text = this.__ResStr("btnCancel", "Cancel"); } tag.Attributes.Add("type", "button"); tag.AddCssClass(Manager.AddOnManager.CheckInvokedCssModule(Forms.CssFormCancel)); break; } if (!string.IsNullOrWhiteSpace(formButton.Id)) { tag.Attributes.Add("id", formButton.Id); } if (!string.IsNullOrWhiteSpace(formButton.Name)) { tag.Attributes.Add("name", formButton.Name); } if (formButton.Hidden) { tag.Attributes.Add("style", "display:none"); } if (!string.IsNullOrWhiteSpace(formButton.Title)) { tag.Attributes.Add("title", formButton.Title); } tag.Attributes.Add("value", text); if (!string.IsNullOrWhiteSpace(formButton.CssClass)) { tag.AddCssClass(formButton.CssClass); } return(tag.ToString(YTagRenderMode.StartTag)); }
internal void AddRibbonButton(string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo, FormButton btn) { object obj2 = this.Page.Items[refl.GetType("Microsoft.SharePoint.WebControls.SPRibbon")]; XmlDocument document = new XmlDocument(); if (obj2 != null) { document.LoadXml(string.Concat(new object[] { "<Button Id=\"Ribbon.", this.RibbonPath, ".", this.RibbonGroup, ".Controls.", this.ProdName, "Action_", id, "\" Sequence=\"100", this.baseSequence, cmdNo, "\" Command=\"", this.ProdName, "Action\" Image16by16=\"", this.SmallIconUrl, "\" Image32by32=\"", this.IconUrl, "\" LabelText=\"", HttpUtility.HtmlEncode(caption), "\" Description=\"", HttpUtility.HtmlEncode(desc), "\" ToolTipDescription=\"", HttpUtility.HtmlEncode(desc), "\" ToolTipTitle=\"", HttpUtility.HtmlEncode(caption), "\" Alt=\"\" TemplateAlias=\"o", (cmdNo == 1) ? 1 : 2, "\" />" })); refl.Call(obj2, "RegisterDataExtension", null, new object[] { document.DocumentElement, "Ribbon." + this.RibbonPath + "." + this.RibbonGroup + ".Controls._children" }); } }
public void ClickForm() { FormButton.Click(); }
/// <summary> /// Renders a form button. /// </summary> /// <param name="formButton">The form button to render.</param> /// <returns>Returns the rendered form button as HTML.</returns> public Task <string> RenderFormButtonAsync(FormButton formButton) { return(Task.FromResult(RenderFormButton(formButton))); }
internal void AddRibbonButton(string id, string caption, string img, string desc, string clickUrl, string clickScript, int cmdNo, FormButton btn) { object ribbon = Page.Items [refl.GetType("Microsoft.SharePoint.WebControls.SPRibbon")]; XmlDocument doc = new XmlDocument(); if (ribbon != null) { doc.LoadXml("<Button Id=\"Ribbon." + RibbonPath + "." + RibbonGroup + ".Controls." + ProdName + "Action_" + id + "\" Sequence=\"100" + baseSequence + cmdNo + "\" Command=\"" + ProdName + "Action\" Image16by16=\"" + SmallIconUrl + "\" Image32by32=\"" + IconUrl + "\" LabelText=\"" + HttpUtility.HtmlEncode(caption) + "\" Description=\"" + HttpUtility.HtmlEncode(desc) + "\" ToolTipDescription=\"" + HttpUtility.HtmlEncode(desc) + "\" ToolTipTitle=\"" + HttpUtility.HtmlEncode(caption) + "\" Alt=\"\" TemplateAlias=\"o" + ((cmdNo == 1) ? 1 : 2) + "\" />"); refl.Call(ribbon, "RegisterDataExtension", null, new object [] { doc.DocumentElement, "Ribbon." + RibbonPath + "." + RibbonGroup + ".Controls._children" }); } }
public FormPage OpenFormPage() { FormButton.Click(); return(new FormPage(this.driver)); }
public virtual void Visit(FormButton formButton, HtmlContainer htmlContainer) { HtmlDiv htmlDiv = verbose ? new HtmlDiv(formButton.Path) : new HtmlDiv(); htmlDiv.Class.Add("formButton"); if (!string.IsNullOrWhiteSpace(formButton.CssClass)) { htmlDiv.Class.AddRange(formButton.CssClass.Split(' ').Where(s => s != string.Empty)); } if (!string.IsNullOrWhiteSpace(formButton.Path)) { htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formButton.Path)); } htmlDiv.Hidden.Value = formButton.IsHidden; htmlContainer.Add(htmlDiv); HtmlButton htmlButton; string proceed = "Proceed"; string cancel = "Cancel"; switch (formButton.ConfirmationType) { case ConfirmationType.BootBox: htmlButton = new HtmlButton(formButton.Path, string.Format("ButtonConfirmBootbox('{0}', '{1}', '{2}');", formButton.ConfirmationMessage, formButton.Path, formButton.Parameter)); scriptRegistry.Include("ButtonConfirmBootbox", proceed, cancel); break; case ConfirmationType.Gritter: htmlButton = new HtmlButton(formButton.Path); scriptRegistry.Include("ButtonConfirmGritter", proceed, cancel); break; default: case ConfirmationType.NotSet: htmlButton = new HtmlButton(formButton.Path); break; } htmlButton.Class.AddRange(new string[] { "btnFix", "btn", "mt-2" }); switch (formButton.Type) { case ButtonType.Primary: case ButtonType.Secondary: case ButtonType.Success: case ButtonType.Danger: htmlButton.Class.Add(string.Format("btn-{0}", formButton.Type.ToString().ToLower())); break; default: case ButtonType.NotSet: break; } htmlButton.Disabled.Value = formButton.IsDisabled; htmlDiv.Add(htmlButton); htmlButton.Value.Value = formButton.Content; }