Beispiel #1
0
 private void ProcessClick(HelpBlock helpBlock)
 {
     foreach (var trackedBlock in trackedBlocks)
     {
         trackedBlock.LabText.color = helpBlock == trackedBlock ? activeTextColor : inactiveTextColor;
     }
 }
Beispiel #2
0
 public DynamicPhoneNumberPicker()
     : base()
 {
     HelpBlock              = new HelpBlock();
     WarningBlock           = new WarningBlock();
     RequiredFieldValidator = new RequiredFieldValidator();
     RequiredFieldValidator.ValidationGroup = this.ValidationGroup;
 }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PersonPicker" /> class.
        /// </summary>
        public FollowUpPersonPicker()
        {
            // note we are using HiddenFieldValidator instead of RequiredFieldValidator
            RequiredFieldValidator = new HiddenFieldValidator();

            HelpBlock    = new HelpBlock();
            WarningBlock = new WarningBlock();
        }
 public CascadingDropDownList()
     : base()
 {
     HelpBlock              = new HelpBlock();
     WarningBlock           = new WarningBlock();
     RequiredFieldValidator = new RequiredFieldValidator();
     RequiredFieldValidator.ValidationGroup = this.ValidationGroup;
 }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PersonPicker" /> class.
        /// </summary>
        public ConsolidatorLeaderPicker()
        {
            // note we are using HiddenFieldValidator instead of RequiredFieldValidator
            RequiredFieldValidator = new HiddenFieldValidator();

            HelpBlock    = new HelpBlock();
            WarningBlock = new WarningBlock();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FileTypeAndImageUploader"/> class.
 /// </summary>
 public FileTypeAndImageUploader()
     : base()
 {
     HelpBlock              = new HelpBlock();
     WarningBlock           = new WarningBlock();
     RequiredFieldValidator = new RequiredFieldValidator
     {
         ValidationGroup = this.ValidationGroup
     };
 }
Beispiel #7
0
        /// <summary>
        /// Adds the control.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="options">The options.</param>
        /// <returns></returns>
        public Control AddControl(ControlCollection controls, AttributeControlOptions options)
        {
            options.LabelText          = options.LabelText ?? Name;
            options.HelpText           = options.HelpText ?? Description;
            options.AttributeControlId = options.AttributeControlId ?? $"attribute_field_{Id}";

            EntityTypeCache entityType = EntityTypeId.HasValue ? EntityTypeCache.Get(this.EntityTypeId.Value) : null;

            bool showPrePostHtml = (entityType?.AttributesSupportPrePostHtml ?? false) && (options?.ShowPrePostHtml ?? true);

            var attributeControl = FieldType.Field.EditControl(QualifierValues, options.SetId ? options.AttributeControlId : string.Empty);

            if (attributeControl == null)
            {
                return(null);
            }

            if (options.SetId)
            {
                attributeControl.ClientIDMode = ClientIDMode.AutoID;
            }

            // If the control is a RockControl
            var rockControl        = attributeControl as IRockControl;
            var controlHasRequired = attributeControl as IHasRequired;

            if (showPrePostHtml)
            {
                if (this.PreHtml.IsNotNullOrWhiteSpace())
                {
                    controls.Add(new Literal {
                        Text = this.PreHtml
                    });
                }
            }

            if (rockControl != null)
            {
                rockControl.Label           = options.LabelText;
                rockControl.Help            = options.HelpText;
                rockControl.Warning         = options.WarningText;
                rockControl.Required        = options.Required ?? IsRequired;
                rockControl.ValidationGroup = options.ValidationGroup;

                controls.Add(attributeControl);
            }
            else
            {
                if (controlHasRequired != null)
                {
                    controlHasRequired.Required        = options.Required ?? IsRequired;
                    controlHasRequired.ValidationGroup = options.ValidationGroup;
                }

                bool renderLabel   = !string.IsNullOrEmpty(options.LabelText);
                bool renderHelp    = !string.IsNullOrWhiteSpace(options.HelpText);
                bool renderWarning = !string.IsNullOrWhiteSpace(options.WarningText);

                if (renderLabel || renderHelp || renderWarning)
                {
                    var div = new DynamicControlsHtmlGenericControl("div")
                    {
                        ID = $"_formgroup_div_{Id}"
                    };
                    controls.Add(div);

                    div.Controls.Clear();
                    div.AddCssClass("form-group");
                    if (IsRequired)
                    {
                        div.AddCssClass("required");
                    }

                    div.ClientIDMode = ClientIDMode.AutoID;

                    if (renderLabel)
                    {
                        var label = new Label
                        {
                            ID                  = $"_label_{Id}",
                            ClientIDMode        = ClientIDMode.AutoID,
                            Text                = options.LabelText,
                            CssClass            = "control-label",
                            AssociatedControlID = attributeControl.ID
                        };
                        div.Controls.Add(label);
                    }

                    if (renderHelp)
                    {
                        var helpBlock = new HelpBlock
                        {
                            ID           = $"_helpBlock_{Id}",
                            ClientIDMode = ClientIDMode.AutoID,
                            Text         = options.HelpText
                        };
                        div.Controls.Add(helpBlock);
                    }

                    if (renderWarning)
                    {
                        var warningBlock = new WarningBlock
                        {
                            ID           = $"_warningBlock_{Id}",
                            ClientIDMode = ClientIDMode.AutoID,
                            Text         = options.WarningText
                        };
                        div.Controls.Add(warningBlock);
                    }

                    div.Controls.Add(attributeControl);
                }
                else
                {
                    controls.Add(attributeControl);
                }
            }

            if (options.ShowPrePostHtml)
            {
                if (this.PostHtml.IsNotNullOrWhiteSpace())
                {
                    controls.Add(new Literal {
                        Text = this.PostHtml
                    });
                }
            }

            if (options.SetValue)
            {
                FieldType.Field.SetEditValue(attributeControl, QualifierValues, options.Value);
            }

            return(attributeControl);
        }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckinGroupPicker"/> class.
 /// </summary>
 public CheckinGroupPicker()
     : base()
 {
     HelpBlock    = new HelpBlock();
     WarningBlock = new WarningBlock();
 }
Beispiel #9
0
        /// <summary>
        /// Adds the control.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="options">The options.</param>
        /// <returns></returns>
        public Control AddControl(ControlCollection controls, AttributeControlOptions options)
        {
            var attributeControl = FieldType.Field.EditControl(QualifierValues, options.SetId ? options.AttributeControlId : string.Empty);

            if (attributeControl == null)
            {
                return(null);
            }

            if (options.SetId)
            {
                attributeControl.ClientIDMode = ClientIDMode.AutoID;
            }

            // If the control is a RockControl
            var rockControl        = attributeControl as IRockControl;
            var controlHasRequired = attributeControl as IHasRequired;

            if (rockControl != null)
            {
                rockControl.Label           = options.LabelText;
                rockControl.Help            = options.HelpText;
                rockControl.Warning         = options.WarningText;
                rockControl.Required        = options.Required ?? IsRequired;
                rockControl.ValidationGroup = options.ValidationGroup;

                controls.Add(attributeControl);
            }
            else
            {
                if (controlHasRequired != null)
                {
                    controlHasRequired.Required        = options.Required ?? IsRequired;
                    controlHasRequired.ValidationGroup = options.ValidationGroup;
                }

                bool renderLabel   = !string.IsNullOrEmpty(options.LabelText);
                bool renderHelp    = !string.IsNullOrWhiteSpace(options.HelpText);
                bool renderWarning = !string.IsNullOrWhiteSpace(options.WarningText);

                if (renderLabel || renderHelp || renderWarning)
                {
                    var div = new DynamicControlsHtmlGenericControl("div")
                    {
                        ID = $"_formgroup_div_{Id}"
                    };
                    controls.Add(div);

                    div.Controls.Clear();
                    div.AddCssClass("form-group");
                    if (IsRequired)
                    {
                        div.AddCssClass("required");
                    }

                    div.ClientIDMode = ClientIDMode.AutoID;

                    if (renderLabel)
                    {
                        var label = new Label
                        {
                            ID                  = $"_label_{Id}",
                            ClientIDMode        = ClientIDMode.AutoID,
                            Text                = options.LabelText,
                            CssClass            = "control-label",
                            AssociatedControlID = attributeControl.ID
                        };
                        div.Controls.Add(label);
                    }

                    if (renderHelp)
                    {
                        var helpBlock = new HelpBlock
                        {
                            ID           = $"_helpBlock_{Id}",
                            ClientIDMode = ClientIDMode.AutoID,
                            Text         = options.HelpText
                        };
                        div.Controls.Add(helpBlock);
                    }

                    if (renderWarning)
                    {
                        var warningBlock = new WarningBlock
                        {
                            ID           = $"_warningBlock_{Id}",
                            ClientIDMode = ClientIDMode.AutoID,
                            Text         = options.WarningText
                        };
                        div.Controls.Add(warningBlock);
                    }

                    div.Controls.Add(attributeControl);
                }
                else
                {
                    controls.Add(attributeControl);
                }
            }

            if (options.SetValue)
            {
                FieldType.Field.SetEditValue(attributeControl, QualifierValues, options.Value);
            }

            return(attributeControl);
        }