コード例 #1
0
 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);
     }
 }
コード例 #2
0
        protected override string ResolveControlName(ControlDefinitionDTO control)
        {
            string ownerName;

            return(_ownerNameByControl.TryGetValue(control, out ownerName)
                       ? ActivityHelper.GetDynamicControlName(control.Name, ownerName)
                       : base.ResolveControlName(control));
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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()));
            }
        }
コード例 #6
0
            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"
                });
            }
コード例 #7
0
 private string GetFileDescriptionLabel(ControlDefinitionDTO filepicker, int labeless_filepickers)
 {
     return(filepicker.Label ?? ("File from App Builder #" + ++labeless_filepickers));
 }
コード例 #8
0
 protected void AddControl(ControlDefinitionDTO control)
 {
     EnsureControlsCrate();
     ConfigurationControls.Controls.Add(control);
 }
コード例 #9
0
 protected virtual string ResolveControlName(ControlDefinitionDTO control)
 {
     return(control?.Name);
 }
コード例 #10
0
 protected void AddControl(ControlDefinitionDTO control)
 {
     ConfigurationControls.Controls.Add(control);
 }
コード例 #11
0
        public static bool ValidateControlExistance(this ValidationManager validationManager, ControlDefinitionDTO control)
        {
            if (control == null)
            {
                validationManager.SetError(ControlsAreNotConfiguredErrorMessage);
                return(false);
            }

            return(true);
        }
コード例 #12
0
 public void Add(ControlDefinitionDTO control)
 {
     Controls.Add(control);
 }
コード例 #13
0
            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);
            }
コード例 #14
0
 protected string GetFieldId(ControlDefinitionDTO control)
 {
     return(control.Name.Substring(BehaviorPrefix.Length));
 }
コード例 #15
0
 protected bool IsBehaviorControl(ControlDefinitionDTO control)
 {
     return(control.Name != null && control.Name.StartsWith(BehaviorPrefix));
 }