public static void ValidateEmail(this ValidationManager validationManager, ControlDefinitionDTO control, string errorMessage = null) { if (!Utilities.RegexUtilities.IsValidEmailAddress(control.Value)) { validationManager.SetError(errorMessage ?? "Not a valid e-mail address", control); } }
protected override string ResolveControlName(ControlDefinitionDTO control) { string ownerName; return(_ownerNameByControl.TryGetValue(control, out ownerName) ? ActivityHelper.GetDynamicControlName(control.Name, ownerName) : base.ResolveControlName(control)); }
private void PublishCollectionControl(ControlDefinitionDTO controlDefinitionDTO, CrateSignaller.FieldConfigurator fieldConfigurator) { var isLabelBasedPublishable = controlDefinitionDTO is TextBox || controlDefinitionDTO is RadioButtonGroup || controlDefinitionDTO is DropDownList || controlDefinitionDTO is CheckBox; ; if (isLabelBasedPublishable) { fieldConfigurator.AddField(controlDefinitionDTO.Label); } }
private ControlDefinitionDTO TraverseNestedControls(List <ControlDefinitionDTO> controls, string childControl) { ControlDefinitionDTO controlDefinitionDTO = null; var controlNames = childControl.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); if (controlNames.Length > 0 && controls.Count > 0) { var control = controls.FirstOrDefault(a => a.Name == controlNames[0]); if (control != null) { if (controlNames.Count() == 1) { controlDefinitionDTO = control; } else { List <ControlDefinitionDTO> nestedControls = null; if (control.Type == "RadioButtonGroup") { var radio = (control as RadioButtonGroup).Radios.FirstOrDefault(a => a.Name == controlNames[1]); if (radio != null) { radio.Selected = true; nestedControls = radio.Controls.ToList(); controlDefinitionDTO = TraverseNestedControls(nestedControls, string.Join(".", controlNames.Skip(2))); } } //TODO: Add support for future controls with nested child controls else { throw new NotImplementedException("Can't search for controls inside of " + control.Type); } } } } return(controlDefinitionDTO); }
private void ProcessCollectionControl(ControlDefinitionDTO controlDefinitionDTO) { var isValueBasedProcessed = controlDefinitionDTO is TextBox || controlDefinitionDTO is RadioButtonGroup; if (isValueBasedProcessed) { var fieldsCrate = Payload.CratesOfType <StandardPayloadDataCM>(c => c.Label == RuntimeFieldCrateLabelPrefix).First(); fieldsCrate.Content.PayloadObjects[0].PayloadObject.Add(new KeyValueDTO(controlDefinitionDTO.Label, controlDefinitionDTO.Value)); } if (controlDefinitionDTO is DropDownList) { var fieldsCrate = Payload.CratesOfType <StandardPayloadDataCM>(c => c.Label == RuntimeFieldCrateLabelPrefix).First(); fieldsCrate.Content.PayloadObjects[0].PayloadObject.Add(new KeyValueDTO(controlDefinitionDTO.Label, controlDefinitionDTO.Value)); } if (controlDefinitionDTO is CheckBox) { var fieldsCrate = Payload.CratesOfType <StandardPayloadDataCM>(c => c.Label == RuntimeFieldCrateLabelPrefix).First(); fieldsCrate.Content.PayloadObjects[0].PayloadObject.Add(new KeyValueDTO(controlDefinitionDTO.Label, controlDefinitionDTO.Selected.ToString())); } }
public ActivityUi(string uploadedFileName = null, string uploadedFilePath = null) { Controls = new List <ControlDefinitionDTO>(); Controls.Add((select_file = new ControlDefinitionDTO(ControlTypes.FilePicker) { Label = "Select an Excel file", Name = "select_file", Required = true, Events = new List <ControlEvent>() { new ControlEvent("onChange", "requestConfig") }, Source = new FieldSourceDTO { Label = "Select an Excel file", ManifestType = CrateManifestTypes.StandardConfigurationControls }, Value = uploadedFilePath, })); if (!string.IsNullOrEmpty(uploadedFileName)) { Controls.Add(new TextBlock { Label = "", Value = "Uploaded file: " + Uri.UnescapeDataString(uploadedFileName), CssClass = "well well-lg" }); } Controls.Add(new TextBlock { Label = "", Value = "This Action will try to extract a table of rows from the first spreadsheet in the file.", CssClass = "well well-lg TextBlockClass" }); }
private string GetFileDescriptionLabel(ControlDefinitionDTO filepicker, int labeless_filepickers) { return(filepicker.Label ?? ("File from App Builder #" + ++labeless_filepickers)); }
protected void AddControl(ControlDefinitionDTO control) { EnsureControlsCrate(); ConfigurationControls.Controls.Add(control); }
protected virtual string ResolveControlName(ControlDefinitionDTO control) { return(control?.Name); }
protected void AddControl(ControlDefinitionDTO control) { ConfigurationControls.Controls.Add(control); }
public static bool ValidateControlExistance(this ValidationManager validationManager, ControlDefinitionDTO control) { if (control == null) { validationManager.SetError(ControlsAreNotConfiguredErrorMessage); return(false); } return(true); }
public void Add(ControlDefinitionDTO control) { Controls.Add(control); }
public ActivityUi() { AvailableProjects = new DropDownList() { Label = "Projects", Name = "AvailableProjects", Value = null, Events = new List <ControlEvent> { ControlEvent.RequestConfig }, Source = null }; Controls.Add(AvailableProjects); SelectProjectLabel = new TextBlock() { Value = "Please select Jira project.", Name = "SelectProjectLabel", CssClass = "well well-lg", IsHidden = false }; Controls.Add(SelectProjectLabel); AvailableIssueTypes = new DropDownList() { Label = "Issue Types", Name = "AvailableIssueTypes", Value = null, Events = new List <ControlEvent> { ControlEvent.RequestConfig }, Source = null, IsHidden = true }; Controls.Add(AvailableIssueTypes); SelectIssueTypeLabel = new TextBlock() { Value = "Please select Jira issue type.", Name = "SelectIssueTypeLabel", CssClass = "well well-lg", IsHidden = true }; Controls.Add(SelectIssueTypeLabel); Sprint = new DropDownList() { Name = "Sprint", Label = "Sprint", IsHidden = true }; Controls.Add(Sprint); AvailablePriorities = new DropDownList() { Label = "Priority", Name = "AvailablePriorities", Value = null, Source = null, IsHidden = true }; Controls.Add(AvailablePriorities); AssigneeSelector = new DropDownList { Label = "Asignee", Name = "Asignee", IsHidden = true }; Controls.Add(AssigneeSelector); Summary = new TextSource() { Label = "Summary", Name = "SummaryTextSource", InitialLabel = "Summary", IsHidden = true }; Controls.Add(Summary); Description = new TextSource() { Label = "Description", Name = "DescriptionTextSource", InitialLabel = "Description", IsHidden = true }; Controls.Add(Description); SprintFieldName = new ControlDefinitionDTO() { Name = "SprintFieldName", IsHidden = true }; Controls.Add(SprintFieldName); }
protected string GetFieldId(ControlDefinitionDTO control) { return(control.Name.Substring(BehaviorPrefix.Length)); }
protected bool IsBehaviorControl(ControlDefinitionDTO control) { return(control.Name != null && control.Name.StartsWith(BehaviorPrefix)); }