Inheritance: System.Web.UI.WebControls.TextBox, IRockControl, IDisplayRequiredIndicator
Exemplo n.º 1
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.Items.Add( new ListItem( None.Text, None.IdValue ) );
            foreach ( var entityType in new EntityTypeService( new RockContext() ).GetEntities().OrderBy( e => e.FriendlyName ).ThenBy( e => e.Name ) )
            {
                ddl.Items.Add( new ListItem( entityType.FriendlyName, entityType.Name ) );
            }
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Entity Type";
            ddl.Help = "The type of entity to display categories for.";

            var tbColumn = new RockTextBox();
            controls.Add( tbColumn );
            tbColumn.AutoPostBack = true;
            tbColumn.TextChanged += OnQualifierUpdated;
            tbColumn.Label = "Qualifier Column";
            tbColumn.Help = "Entity column qualifier.";

            var tbValue = new RockTextBox();
            controls.Add( tbValue );
            tbValue.AutoPostBack = true;
            tbValue.TextChanged += OnQualifierUpdated;
            tbValue.Label = "Qualifier Value";
            tbValue.Help = "Entity column value.";

            return controls;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override System.Collections.Generic.List<System.Web.UI.Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var textbox = new RockTextBox();
            controls.Add( textbox );
            textbox.Label = "Date Format";
            textbox.Help = "The format string to use for date (default is system short date).";

            var cbDisplayDiff = new RockCheckBox();
            controls.Add( cbDisplayDiff );
            cbDisplayDiff.Label = "Display as Elapsed Time";
            cbDisplayDiff.Text = "Yes";
            cbDisplayDiff.Help = "Display value as an elapsed time.";

            var cbDisplayCurrent = new RockCheckBox();
            controls.Add( cbDisplayCurrent );
            cbDisplayCurrent.AutoPostBack = true;
            cbDisplayCurrent.CheckedChanged += OnQualifierUpdated;
            cbDisplayCurrent.Label = "Display Current Option";
            cbDisplayCurrent.Text = "Yes";
            cbDisplayCurrent.Help = "Include option to specify value as the current date.";

            return controls;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the filter value control with the specified FilterMode
 /// </summary>
 /// <param name="configurationValues">The configuration values.</param>
 /// <param name="id">The identifier.</param>
 /// <param name="required">if set to <c>true</c> [required].</param>
 /// <param name="filterMode">The filter mode.</param>
 /// <returns></returns>
 public override Control FilterValueControl( Dictionary<string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode )
 {
     var control = new RockTextBox { ID = id };
     control.ID = string.Format( "{0}_ctlCompareValue", id );
     control.AddCssClass( "js-filter-control" );
     return control;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tbValuePrompt = new RockTextBox();
            controls.Add( tbValuePrompt );
            tbValuePrompt.AutoPostBack = true;
            tbValuePrompt.TextChanged += OnQualifierUpdated;
            tbValuePrompt.Label = "Label Prompt";
            tbValuePrompt.Help = "The text to display as a prompt in the label textbox.";

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.DataTextField = "Name";
            ddl.DataValueField = "Id";
            ddl.DataSource = new Rock.Model.DefinedTypeService( new RockContext() ).Queryable().OrderBy( d => d.Order ).ToList();
            ddl.DataBind();
            ddl.Items.Insert(0, new ListItem(string.Empty, string.Empty));
            ddl.Label = "Defined Type";
            ddl.Help = "Optional Defined Type to select values from, otherwise values will be free-form text fields.";

            var tbCustomValues = new RockTextBox();
            controls.Add( tbCustomValues );
            tbCustomValues.TextMode = TextBoxMode.MultiLine;
            tbCustomValues.Rows = 3;
            tbCustomValues.AutoPostBack = true;
            tbCustomValues.TextChanged += OnQualifierUpdated;
            tbCustomValues.Label = "Custom Values";
            tbCustomValues.Help = "Optional list of options to use for the values.  Format is either 'value1,value2,value3,...', or 'value1:text1,value2:text2,value3:text3,...'.";

            return controls;
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfOrder    = new HiddenField();
            _hfOrder.ID = this.ID + "_hfOrder";
            Controls.Add(_hfOrder);

            _cbVisible    = new CheckBox();
            _cbVisible.ID = this.ID + "_cbVisible";
            Controls.Add(_cbVisible);

            _cbEditable    = new CheckBox();
            _cbEditable.ID = this.ID + "_cbEditable";
            Controls.Add(_cbEditable);

            _cbRequired    = new CheckBox();
            _cbRequired.ID = this.ID + "_cbRequired";
            Controls.Add(_cbRequired);

            _cbHideLabel    = new CheckBox();
            _cbHideLabel.ID = this.ID + "_cbHideLabel";
            Controls.Add(_cbHideLabel);

            _cbPreHtml    = new CheckBox();
            _cbPreHtml.ID = this.ID + "_cbPreHtml";
            _cbPreHtml.AddCssClass("js-form-attribute-show-pre-html");
            Controls.Add(_cbPreHtml);

            _cbPostHtml    = new CheckBox();
            _cbPostHtml.ID = this.ID + "_cbPostHtml";
            _cbPostHtml.AddCssClass("js-form-attribute-show-post-html");
            Controls.Add(_cbPostHtml);

            _tbPreHtml                     = new RockTextBox();
            _tbPreHtml.ID                  = this.ID + "_tbPreHtml";
            _tbPreHtml.TextMode            = TextBoxMode.MultiLine;
            _tbPreHtml.Rows                = 3;
            _tbPreHtml.ValidateRequestMode = System.Web.UI.ValidateRequestMode.Disabled;
            Controls.Add(_tbPreHtml);

            _tbPostHtml                     = new RockTextBox();
            _tbPostHtml.ID                  = this.ID + "_tbPostHtml";
            _tbPostHtml.TextMode            = TextBoxMode.MultiLine;
            _tbPostHtml.Rows                = 3;
            _tbPostHtml.ValidateRequestMode = System.Web.UI.ValidateRequestMode.Disabled;
            Controls.Add(_tbPostHtml);

            _lbFilter          = new LinkButton();
            _lbFilter.ID       = $"{ID}{nameof( _lbFilter )}";
            _lbFilter.Text     = "<i class=\"fa fa-filter\"></i>";
            _lbFilter.CssClass = "btn btn-default btn-xs btn-square";
            _lbFilter.Click   += _lbFilter_Click;
            Controls.Add(_lbFilter);
        }
Exemplo n.º 6
0
        private void GenerateAddAddressPanel()
        {
            _pnlAddAddress = new Panel
            {
                ID       = $"{this.ClientID}{nameof( _pnlAddAddress )}",
                CssClass = "mt-3 well",
                Visible  = false,
            };
            Controls.Add(_pnlAddAddress);

            _txtName = new RockTextBox
            {
                ID          = $"{this.ClientID}{nameof( _txtName )}",
                CssClass    = "mb-3",
                Placeholder = "Location Name",
            };
            _pnlAddAddress.Controls.Add(_txtName);

            _acNewAddress = new AddressControl
            {
                ID       = $"{this.ClientID}{nameof( _acNewAddress )}",
                Required = IsAddressRequired,
            };
            _pnlAddAddress.Controls.Add(_acNewAddress);

            _avcAddressAttributeValues = new AttributeValuesContainer
            {
                ID = $"{this.ClientID}{nameof( _avcAddressAttributeValues )}",
            };
            _pnlAddAddress.Controls.Add(_avcAddressAttributeValues);

            _btnAdd = new BootstrapButton
            {
                ID       = $"{this.ClientID}{nameof( _btnAdd )}",
                Text     = "Add",
                CssClass = "btn btn-xs btn-primary mr-2",
            };
            _btnAdd.Click += btnAdd_Click;
            _pnlAddAddress.Controls.Add(_btnAdd);

            _btnCancel = new LinkButton
            {
                ID               = $"{this.ClientID}{nameof( _btnCancel )}",
                Text             = "Cancel",
                CssClass         = "btn btn-xs btn-link",
                CausesValidation = false,
            };
            _btnCancel.Click += btnCancel_Click;
            _pnlAddAddress.Controls.Add(_btnCancel);

            _avcAddressAttributeValues.AddEditControls(new Location {
                LocationTypeValueId = LocationTypeValueId, ParentLocationId = ParentLocationId
            });
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var textBoxGroupAndRolePickerLabel = new RockTextBox();
            controls.Add( textBoxGroupAndRolePickerLabel );
            textBoxGroupAndRolePickerLabel.Label = "Group/Role Picker Label";
            textBoxGroupAndRolePickerLabel.Help = "The label for the group/role picker";

            return controls;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var tbHelpText = new RockTextBox();
            controls.Add( tbHelpText );
            tbHelpText.Label = "Entity Control Help Text Format";
            tbHelpText.Help = "Include a {0} in places where you want the EntityType name (Campus, Group, etc) to be included and a {1} in places where you the the pluralized EntityType name (Campuses, Groups, etc) to be included.";

            return controls;
        }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteControl"/> class.
 /// </summary>
 public NoteControl()
 {
     _tbNote = new RockTextBox();
     _tbNote.Placeholder = "Write a note...";
     _cbAlert = new CheckBox();
     _cbPrivate = new CheckBox();
     _lbSaveNote = new LinkButton();
     _lbEditNote = new LinkButton();
     _lbDeleteNote = new LinkButton();
     _sbSecurity = new SecurityButton();
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteControl"/> class.
 /// </summary>
 public NoteControl()
 {
     _tbNote             = new RockTextBox();
     _tbNote.Placeholder = "Write a note...";
     _cbAlert            = new CheckBox();
     _cbPrivate          = new CheckBox();
     _lbSaveNote         = new LinkButton();
     _lbEditNote         = new LinkButton();
     _lbDeleteNote       = new LinkButton();
     _sbSecurity         = new SecurityButton();
 }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NoteEditor"/> class.
        /// </summary>
        public NoteEditor()
        {
            _tbNote       = new RockTextBox();
            _tbNote.Label = "Note";

            _cbAlert      = new CheckBox();
            _cbPrivate    = new CheckBox();
            _lbSaveNote   = new LinkButton();
            _lbEditNote   = new LinkButton();
            _lbDeleteNote = new LinkButton();
            _sbSecurity   = new SecurityButton();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tb = new RockTextBox();
            controls.Add( tb );
            tb.AutoPostBack = true;
            tb.TextChanged += OnQualifierUpdated;
            tb.Label = "Container Assembly Name";
            tb.Help = "The assembly name of the MEF container to show components of.";
            return controls;
        }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteControl"/> class.
 /// </summary>
 public NoteControl()
 {
     _ddlNoteType        = new DropDownList();
     _tbNote             = new RockTextBox();
     _tbNote.Placeholder = "Write a note...";
     _cbAlert            = new CheckBox();
     _cbPrivate          = new CheckBox();
     _lbSaveNote         = new LinkButton();
     _lbEditNote         = new LinkButton();
     _lbDeleteNote       = new LinkButton();
     _sbSecurity         = new SecurityButton();
     _dtCreateDate       = new DateTimePicker();
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteControl"/> class.
 /// </summary>
 public NoteControl()
 {
     _ddlNoteType = new DropDownList();
     _tbNote = new RockTextBox();
     _tbNote.Placeholder = "Write a note...";
     _cbAlert = new CheckBox();
     _cbPrivate = new CheckBox();
     _lbSaveNote = new LinkButton();
     _lbEditNote = new LinkButton();
     _lbDeleteNote = new LinkButton();
     _sbSecurity = new SecurityButton();
     _dtCreateDate = new DateTimePicker();
 }
Exemplo n.º 15
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tbKeyPrompt = new RockTextBox();
            controls.Insert(0, tbKeyPrompt );
            tbKeyPrompt.AutoPostBack = true;
            tbKeyPrompt.TextChanged += OnQualifierUpdated;
            tbKeyPrompt.Label = "Key Prompt";
            tbKeyPrompt.Help = "The text to display as a prompt in the key textbox.";

            return controls;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var tb = new RockTextBox();
            controls.Add( tb );
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows = 3;
            tb.AutoPostBack = true;
            tb.TextChanged += OnQualifierUpdated;
            tb.Label = "Values";
            tb.Help = "The source of the values to display in a list.  Format is either 'value1,value2,value3,...', 'value1:text1,value2:text2,value3:text3,...', or a SQL Select statement that returns result set with a 'Value' and 'Text' column.";
            return controls;
        }
Exemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyMembersRow" /> class.
 /// </summary>
 public NewFamilyMembersRow()
     : base()
 {
     _rblRole = new RockRadioButtonList();
     _ddlTitle = new DropDownList();
     _tbFirstName = new RockTextBox();
     _tbLastName = new RockTextBox();
     _ddlSuffix = new DropDownList();
     _rblGender = new RockRadioButtonList();
     _dpBirthdate = new DatePicker();
     _ddlConnectionStatus = new DropDownList();
     _ddlGrade = new RockDropDownList();
     _lbDelete = new LinkButton();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyMembersRow" /> class.
 /// </summary>
 public NewFamilyMembersRow()
     : base()
 {
     _rblRole             = new RockRadioButtonList();
     _ddlTitle            = new DropDownList();
     _tbFirstName         = new RockTextBox();
     _tbNickName          = new RockTextBox();
     _tbLastName          = new RockTextBox();
     _rblGender           = new RockRadioButtonList();
     _dpBirthdate         = new DatePicker();
     _ddlConnectionStatus = new DropDownList();
     _ddlGrade            = new RockDropDownList();
     _lbDelete            = new LinkButton();
 }
Exemplo n.º 19
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfOrder    = new HiddenField();
            _hfOrder.ID = this.ID + "_hfOrder";
            Controls.Add(_hfOrder);

            _cbVisible    = new CheckBox();
            _cbVisible.ID = this.ID + "_cbVisible";
            Controls.Add(_cbVisible);

            _cbEditable    = new CheckBox();
            _cbEditable.ID = this.ID + "_cbEditable";
            Controls.Add(_cbEditable);

            _cbRequired    = new CheckBox();
            _cbRequired.ID = this.ID + "_cbRequired";
            Controls.Add(_cbRequired);

            _cbHideLabel    = new CheckBox();
            _cbHideLabel.ID = this.ID + "_cbHideLabel";
            Controls.Add(_cbHideLabel);

            _cbPreHtml    = new CheckBox();
            _cbPreHtml.ID = this.ID + "_cbPreHtml";
            _cbPreHtml.AddCssClass("js-form-attribute-show-pre-html");
            Controls.Add(_cbPreHtml);

            _cbPostHtml    = new CheckBox();
            _cbPostHtml.ID = this.ID + "_cbPostHtml";
            _cbPostHtml.AddCssClass("js-form-attribute-show-post-html");
            Controls.Add(_cbPostHtml);

            _tbPreHtml                     = new RockTextBox();
            _tbPreHtml.ID                  = this.ID + "_tbPreHtml";
            _tbPreHtml.TextMode            = TextBoxMode.MultiLine;
            _tbPreHtml.Rows                = 3;
            _tbPreHtml.ValidateRequestMode = System.Web.UI.ValidateRequestMode.Disabled;
            Controls.Add(_tbPreHtml);

            _tbPostHtml                     = new RockTextBox();
            _tbPostHtml.ID                  = this.ID + "_tbPostHtml";
            _tbPostHtml.TextMode            = TextBoxMode.MultiLine;
            _tbPostHtml.Rows                = 3;
            _tbPostHtml.ValidateRequestMode = System.Web.UI.ValidateRequestMode.Disabled;

            Controls.Add(_tbPostHtml);
        }
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tbCustomValues = new RockTextBox();
            controls.Add( tbCustomValues );
            tbCustomValues.TextMode = TextBoxMode.MultiLine;
            tbCustomValues.Rows = 3;
            tbCustomValues.AutoPostBack = true;
            tbCustomValues.TextChanged += OnQualifierUpdated;
            tbCustomValues.Label = "Limit Attributes by Field Type";
            tbCustomValues.Help = "Optional list of field type classes for limiting selection to attributes using those field types (e.g. 'Rock.Field.Types.PersonFieldType|Rock.Field.Types.GroupFieldType').";

            return controls;
        }
Exemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyMembersRow" /> class.
 /// </summary>
 public NewFamilyMembersRow()
     : base()
 {
     _rblRole = new RockRadioButtonList();
     _ddlTitle = new DropDownList();
     _tbFirstName = new RockTextBox();
     _tbLastName = new RockTextBox();
     _ddlSuffix = new DropDownList();
     _ddlConnectionStatus = new DropDownList();
     _rblGender = new RockRadioButtonList();
     _dpBirthdate = new DatePicker();
     _ddlGradePicker = new GradePicker { UseAbbreviation = true, UseGradeOffsetAsValue = true };
     _ddlGradePicker.Label = string.Empty;
     _lbDelete = new LinkButton();
 }
Exemplo n.º 22
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _cbCurrent    = new CheckBox();
            _cbCurrent.ID = this.ID + "_cbCurrent";
            _cbCurrent.AddCssClass("js-current-date-checkbox");
            _cbCurrent.Text = "Current Date";
            this.Controls.Add(_cbCurrent);

            _nbDayOffset      = new RockTextBox();
            _nbDayOffset.ID   = this.ID + "_nbDayOffset";
            _nbDayOffset.Help = "Enter the number of days after the current date to use as the date. Use a negative number to specify days before.";
            _nbDayOffset.AddCssClass("input-width-md js-current-date-offset");
            _nbDayOffset.Label = "+- Days";
            this.Controls.Add(_nbDayOffset);
        }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyMembersRow" /> class.
 /// </summary>
 public NewFamilyMembersRow()
     : base()
 {
     _rblRole             = new RockRadioButtonList();
     _ddlTitle            = new DropDownList();
     _tbFirstName         = new RockTextBox();
     _tbLastName          = new RockTextBox();
     _ddlSuffix           = new DropDownList();
     _ddlConnectionStatus = new DropDownList();
     _rblGender           = new RockRadioButtonList();
     _dpBirthdate         = new DatePicker();
     _ddlGradePicker      = new GradePicker {
         UseAbbreviation = true, UseGradeOffsetAsValue = true
     };
     _ddlGradePicker.Label = string.Empty;
     _lbDelete             = new LinkButton();
 }
Exemplo n.º 24
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tbKeyPrompt = new RockTextBox();
            controls.Insert(0, tbKeyPrompt );
            tbKeyPrompt.AutoPostBack = true;
            tbKeyPrompt.TextChanged += OnQualifierUpdated;
            tbKeyPrompt.Label = "Key Prompt";
            tbKeyPrompt.Help = "The text to display as a prompt in the key textbox.";

            var cbDisplayValueFirst = new RockCheckBox();
            controls.Insert( 4, cbDisplayValueFirst );
            cbDisplayValueFirst.Label = "Display Value First";
            cbDisplayValueFirst.Help = "Reverses the display order of the key and the value.";

            return controls;
        }
Exemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewGroupMembersRow" /> class.
 /// </summary>
 public PreRegistrationChildRow()
     : base()
 {
     _lNickName      = new RockLiteral();
     _lLastName      = new RockLiteral();
     _tbNickName     = new RockTextBox();
     _tbLastName     = new RockTextBox();
     _ddlSuffix      = new DefinedValuePicker();
     _ddlGender      = new RockDropDownList();
     _dpBirthdate    = new DatePicker();
     _ddlGradePicker = new GradePicker {
         UseAbbreviation = true, UseGradeOffsetAsValue = true
     };
     _ddlGradePicker.Label = string.Empty;
     _pnbMobile            = new PhoneNumberBox();
     _ddlRelationshipType  = new RockDropDownList();
     _phAttributes         = new PlaceHolder();
     _lbDelete             = new LinkButton();
 }
Exemplo n.º 26
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hiddenField    = new HiddenField();
            _hiddenField.ID = this.ID + "_hiddenField";
            Controls.Add(_hiddenField);

            _hfDisableVrm       = new HiddenField();
            _hfDisableVrm.ID    = this.ID + "_hiddenField_dvrm";
            _hfDisableVrm.Value = "True";
            Controls.Add(_hfDisableVrm);

            _textBox    = new RockTextBox();
            _textBox.ID = this.ID + "_textBox";
            Controls.Add(_textBox);

            _dropDownList    = new RockDropDownList();
            _dropDownList.ID = this.ID + "_dropDownList";
            Controls.Add(_dropDownList);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            RockTextBox tbTrue = new RockTextBox();
            controls.Add( tbTrue );
            tbTrue.AutoPostBack = true;
            tbTrue.TextChanged += OnQualifierUpdated;
            tbTrue.Label = "True Text";
            tbTrue.Text = "Yes";
            tbTrue.Help = "The text to display when value is true.";

            RockTextBox tbFalse = new RockTextBox();
            controls.Add( tbFalse );
            tbFalse.AutoPostBack = true;
            tbFalse.TextChanged += OnQualifierUpdated;
            tbFalse.Label = "False Text";
            tbFalse.Text = "No";
            tbFalse.Help = "The text to display when value is false.";
            return controls;
        }
Exemplo n.º 28
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var tb = new RockTextBox();
            controls.Add( tb );
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows = 3;
            tb.AutoPostBack = true;
            tb.TextChanged += OnQualifierUpdated;
            tb.Label = "Values";
            tb.Help = "The source of the values to display in a list.  Format is either 'value1,value2,value3,...', 'value1:text1,value2:text2,value3:text3,...', or a SQL Select statement that returns result set with a 'Value' and 'Text' column.";

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.Items.Add( new ListItem( "Drop Down List", "ddl" ) );
            ddl.Items.Add( new ListItem( "Radio Buttons", "rb" ) );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Field Type";
            ddl.Help = "Field type to use for selection";
            return controls;
        }
Exemplo n.º 29
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Toolbar Type";
            ddl.Help = "The type of toolbar to display on editor.";
            ddl.Items.Add( "Light" );
            ddl.Items.Add( "Full" );

            var tbDocumentRoot = new RockTextBox();
            controls.Add(tbDocumentRoot);
            tbDocumentRoot.AutoPostBack = true;
            tbDocumentRoot.TextChanged += OnQualifierUpdated;
            tbDocumentRoot.Label = "Document Root Folder";
            tbDocumentRoot.Help = "The folder to use as the root when browsing or uploading documents ( e.g. ~/Content ).";

            var tbImageRoot = new RockTextBox();
            controls.Add( tbImageRoot );
            tbImageRoot.AutoPostBack = true;
            tbImageRoot.TextChanged += OnQualifierUpdated;
            tbImageRoot.Label = "Image Root Folder";
            tbImageRoot.Help = "The folder to use as the root when browsing or uploading images ( e.g. ~/Content ).";

            var cbUserSpecificFolder = new RockCheckBox();
            controls.Add( cbUserSpecificFolder );
            cbUserSpecificFolder.AutoPostBack = true;
            cbUserSpecificFolder.CheckedChanged += OnQualifierUpdated;
            cbUserSpecificFolder.Label = "User Specific Folders";
            cbUserSpecificFolder.Text = "Yes";
            cbUserSpecificFolder.Help = "Should the root folders be specific to current user?";
            return controls;
        }
Exemplo n.º 30
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            Panel pnlRow = new Panel
            {
                ID       = "pnlRow",
                CssClass = "row"
            };

            this.Controls.Add(pnlRow);

            Panel pnlCol1 = new Panel
            {
                ID       = "pnlCol1",
                CssClass = "col-sm-4"
            };

            pnlRow.Controls.Add(pnlCol1);
            _dvpPersonTitle = new DefinedValuePicker
            {
                ID              = "_dvpPersonTitle",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_TITLE.AsGuid()),
                Label           = "Title",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            pnlCol1.Controls.Add(_dvpPersonTitle);

            _tbPersonFirstName = new RockTextBox
            {
                ID               = "tbPersonFirstName",
                Label            = "First Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            pnlCol1.Controls.Add(_tbPersonFirstName);

            _tbPersonLastName = new RockTextBox
            {
                ID               = "tbPersonLastName",
                Label            = "Last Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            pnlCol1.Controls.Add(_tbPersonLastName);

            _dvpPersonSuffix = new DefinedValuePicker
            {
                ID              = "dvpPersonSuffix",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_SUFFIX.AsGuid()),
                Label           = "Suffix",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            pnlCol1.Controls.Add(_dvpPersonSuffix);

            Panel pnlCol2 = new Panel
            {
                ID       = "pnlCol2",
                CssClass = "col-sm-4"
            };

            pnlRow.Controls.Add(pnlCol2);

            _dvpPersonConnectionStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonConnectionStatus",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS.AsGuid()),
                Label           = "Connection Status",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            pnlCol2.Controls.Add(_dvpPersonConnectionStatus);

            _rblPersonRole = new RockRadioButtonList
            {
                ID              = "rblPersonRole",
                Label           = "Role",
                RepeatDirection = RepeatDirection.Horizontal,
                DataTextField   = "Name",
                DataValueField  = "Id",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            pnlCol2.Controls.Add(_rblPersonRole);

            _rblPersonGender = new RockRadioButtonList
            {
                ID              = "rblPersonGender",
                Label           = "Gender",
                RepeatDirection = RepeatDirection.Horizontal,
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            pnlCol2.Controls.Add(_rblPersonGender);

            Panel pnlCol3 = new Panel {
                ID = "pnlCol3", CssClass = "col-sm-4"
            };

            pnlRow.Controls.Add(pnlCol3);

            _dpPersonBirthDate = new DatePicker
            {
                ID    = "dpPersonBirthDate",
                Label = "Birthdate",
                AllowFutureDateSelection = false,
                ForceParse      = false,
                ValidationGroup = ValidationGroup
            };

            pnlCol3.Controls.Add(_dpPersonBirthDate);

            _ddlGradePicker = new GradePicker
            {
                ID                    = "ddlGradePicker",
                Label                 = "Grade",
                UseAbbreviation       = true,
                UseGradeOffsetAsValue = true,
                ValidationGroup       = ValidationGroup
            };

            pnlCol3.Controls.Add(_ddlGradePicker);

            _dvpPersonMaritalStatus = new DefinedValuePicker
            {
                ID              = "_vpPersonMaritalStatus",
                Label           = "Marital Status",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid()),
                ValidationGroup = ValidationGroup
            };

            pnlCol3.Controls.Add(_dvpPersonMaritalStatus);

            _ebPersonEmail = new EmailBox
            {
                ID              = "dbPersonEmail",
                Label           = "Email",
                ValidationGroup = ValidationGroup
            };

            pnlCol3.Controls.Add(_ebPersonEmail);

            var groupType = GroupTypeCache.GetFamilyGroupType();

            _rblPersonRole.DataSource = groupType.Roles.OrderBy(r => r.Order).ToList();
            _rblPersonRole.DataBind();

            _rblPersonGender.Items.Clear();
            _rblPersonGender.Items.Add(new ListItem(Gender.Male.ConvertToString(), Gender.Male.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Female.ConvertToString(), Gender.Female.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Unknown.ConvertToString(), Gender.Unknown.ConvertToInt().ToString()));
        }
Exemplo n.º 31
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfFormGuid = new HiddenField();
            Controls.Add(_hfFormGuid);
            _hfFormGuid.ID = this.ID + "_hfFormGuid";

            _hfFormId = new HiddenField();
            Controls.Add(_hfFormId);
            _hfFormId.ID = this.ID + "_hfFormId";

            _lblFormName = new Label();
            Controls.Add(_lblFormName);
            _lblFormName.ClientIDMode = ClientIDMode.Static;
            _lblFormName.ID           = this.ID + "_lblFormName";

            _lbDeleteForm = new LinkButton();
            Controls.Add(_lbDeleteForm);
            _lbDeleteForm.CausesValidation = false;
            _lbDeleteForm.ID       = this.ID + "_lbDeleteForm";
            _lbDeleteForm.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteForm.Click   += lbDeleteForm_Click;
            _lbDeleteForm.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-times'></i>"
            });

            _tbFormName = new RockTextBox();
            Controls.Add(_tbFormName);
            _tbFormName.ID                   = this.ID + "_tbFormName";
            _tbFormName.Label                = "Form Name";
            _tbFormName.Required             = true;
            _tbFormName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblFormName.ID);

            _gFields = new Grid();
            Controls.Add(_gFields);
            _gFields.ID          = this.ID + "_gFields";
            _gFields.AllowPaging = false;
            _gFields.DisplayType = GridDisplayType.Light;
            _gFields.RowItemText = "Field";
            _gFields.AddCssClass("field-grid");
            _gFields.DataKeyNames      = new string[] { "Guid" };
            _gFields.Actions.ShowAdd   = true;
            _gFields.Actions.AddClick += gFields_Add;
            _gFields.GridRebind       += gFields_Rebind;
            _gFields.GridReorder      += gFields_Reorder;

            var reorderField = new ReorderField();

            _gFields.Columns.Add(reorderField);

            var nameField = new BoundField();

            nameField.DataField  = "Name";
            nameField.HeaderText = "Field";
            _gFields.Columns.Add(nameField);

            var sourceField = new EnumField();

            sourceField.DataField  = "FieldSource";
            sourceField.HeaderText = "Source";
            _gFields.Columns.Add(sourceField);

            var typeField = new FieldTypeField();

            typeField.DataField  = "FieldType";
            typeField.HeaderText = "Type";
            _gFields.Columns.Add(typeField);

            var isInternalField = new BoolField();

            isInternalField.DataField  = "IsInternal";
            isInternalField.HeaderText = "Internal";
            _gFields.Columns.Add(isInternalField);

            var isSharedValueField = new BoolField();

            isSharedValueField.DataField  = "IsSharedValue";
            isSharedValueField.HeaderText = "Common";
            _gFields.Columns.Add(isSharedValueField);

            var showCurrentValueField = new BoolField();

            showCurrentValueField.DataField  = "ShowCurrentValue";
            showCurrentValueField.HeaderText = "Use Current Value";
            _gFields.Columns.Add(showCurrentValueField);

            var isRequiredField = new BoolField();

            isRequiredField.DataField  = "IsRequired";
            isRequiredField.HeaderText = "Required";
            _gFields.Columns.Add(isRequiredField);

            var isGridField = new BoolField();

            isGridField.DataField  = "IsGridField";
            isGridField.HeaderText = "Show on Grid";
            _gFields.Columns.Add(isGridField);

            var showOnWaitListField = new BoolField();

            showOnWaitListField.DataField  = "ShowOnWaitlist";
            showOnWaitListField.HeaderText = "Show on Wait List";
            _gFields.Columns.Add(showOnWaitListField);

            var editField = new EditField();

            editField.Click += gFields_Edit;
            _gFields.Columns.Add(editField);

            var delField = new DeleteField();

            delField.Click += gFields_Delete;
            _gFields.Columns.Add(delField);
        }
Exemplo n.º 32
0
        /// <summary>
        /// Adds the field panel widget.
        /// </summary>
        /// <param name="reportFieldGuid">The report field unique identifier.</param>
        /// <param name="reportFieldType">Type of the report field.</param>
        /// <param name="fieldSelection">The field selection.</param>
        /// <param name="showExpanded">if set to <c>true</c> [show expanded].</param>
        /// <param name="setReportFieldValues">if set to <c>true</c> [set report field values].</param>
        /// <param name="reportField">The report field.</param>
        private void AddFieldPanelWidget( Guid reportFieldGuid, ReportFieldType reportFieldType, string fieldSelection, bool showExpanded, bool setReportFieldValues = false, ReportField reportField = null )
        {
            PanelWidget panelWidget = new PanelWidget();
            panelWidget.ID = string.Format( "reportFieldWidget_{0}", reportFieldGuid.ToString( "N" ) );

            panelWidget.ShowDeleteButton = true;
            panelWidget.DeleteClick += FieldsPanelWidget_DeleteClick;
            panelWidget.ShowReorderIcon = true;
            panelWidget.Expanded = showExpanded;

            Label lbFields = new Label();
            lbFields.Text = "Field Type";

            RockDropDownList ddlFields = new RockDropDownList();
            panelWidget.Controls.Add( ddlFields );
            ddlFields.ID = panelWidget.ID + "_ddlFields";
            ddlFields.AutoPostBack = true;
            ddlFields.SelectedIndexChanged += ddlFields_SelectedIndexChanged;

            panelWidget.HeaderControls = new Control[2] { lbFields, ddlFields };
            this.LoadFieldsDropDown( ddlFields );

            RockCheckBox showInGridCheckBox = new RockCheckBox();
            showInGridCheckBox.ID = panelWidget.ID + "_showInGridCheckBox";
            showInGridCheckBox.Text = "Show in Grid";

            panelWidget.Controls.Add( showInGridCheckBox );

            RockTextBox columnHeaderTextTextBox = new RockTextBox();
            columnHeaderTextTextBox.ID = panelWidget.ID + "_columnHeaderTextTextBox";
            columnHeaderTextTextBox.Label = "Column Label";
            columnHeaderTextTextBox.CssClass = "js-column-header-textbox";
            panelWidget.Controls.Add( columnHeaderTextTextBox );

            phReportFields.Controls.Add( panelWidget );

            CreateFieldTypeSpecificControls( reportFieldType, fieldSelection, panelWidget );

            if ( setReportFieldValues )
            {
                PopulateFieldPanelWidget( panelWidget, reportField, reportFieldType, fieldSelection );
            }
        }
Exemplo n.º 33
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _hfExistingKeyNames = new HtmlInputHidden();
                _hfExistingKeyNames.AddCssClass("js-existing-key-names");
                _hfExistingKeyNames.ID = this.ID + "_hfExistingKeyNames";
                Controls.Add(_hfExistingKeyNames);

                _lAttributeActionTitle    = new Literal();
                _lAttributeActionTitle.ID = "lAttributeActionTitle";
                Controls.Add(_lAttributeActionTitle);

                _validationSummary            = new ValidationSummary();
                _validationSummary.ID         = "valiationSummary";
                _validationSummary.CssClass   = "alert alert-danger";
                _validationSummary.HeaderText = "Please Correct the Following";
                Controls.Add(_validationSummary);

                _tbName          = new RockTextBox();
                _tbName.ID       = "tbName";
                _tbName.Label    = "Name";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _tbDescription          = new RockTextBox();
                _tbDescription.Label    = "Description";
                _tbDescription.ID       = "tbDescription";
                _tbDescription.TextMode = TextBoxMode.MultiLine;
                _tbDescription.Rows     = 3;
                Controls.Add(_tbDescription);

                _cpCategories                           = new CategoryPicker();
                _cpCategories.ID                        = "cpCategories_" + this.ID.ToString();
                _cpCategories.Label                     = "Categories";
                _cpCategories.AllowMultiSelect          = true;
                _cpCategories.EntityTypeId              = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id;
                _cpCategories.EntityTypeQualifierColumn = "EntityTypeId";
                Controls.Add(_cpCategories);

                _tbKey          = new RockTextBox();
                _tbKey.ID       = "tbKey";
                _tbKey.Label    = "Key";
                _tbKey.Required = true;
                Controls.Add(_tbKey);

                _cvKey    = new CustomValidator();
                _cvKey.ID = "cvKey";
                _cvKey.ControlToValidate        = _tbKey.ID;
                _cvKey.ClientValidationFunction = "validateKey";
                _cvKey.ServerValidate          += cvKey_ServerValidate;
                _cvKey.Display      = ValidatorDisplay.Dynamic;
                _cvKey.CssClass     = "validation-error help-inline";
                _cvKey.ErrorMessage = "There is already an existing property with the key value you entered or the key has illegal characters. Please select a different key value and use only letters, numbers and underscores.";
                Controls.Add(_cvKey);

                _tbIconCssClass       = new RockTextBox();
                _tbIconCssClass.ID    = "_tbIconCssClass";
                _tbIconCssClass.Label = "Icon CSS Class";
                Controls.Add(_tbIconCssClass);

                _cbRequired       = new RockCheckBox();
                _cbRequired.ID    = "cbRequired";
                _cbRequired.Label = "Required";
                _cbRequired.Text  = "Require a value";
                Controls.Add(_cbRequired);

                _cbShowInGrid       = new RockCheckBox();
                _cbShowInGrid.ID    = "cbShowInGrid";
                _cbShowInGrid.Label = "Show in Grid";
                _cbShowInGrid.Text  = "Yes";
                _cbShowInGrid.Help  = "If selected, this attribute will be included in a grid.";
                Controls.Add(_cbShowInGrid);

                _cbAllowSearch         = new RockCheckBox();
                _cbAllowSearch.ID      = "cbAllowSearch";
                _cbAllowSearch.Label   = "Allow Search";
                _cbAllowSearch.Text    = "Yes";
                _cbAllowSearch.Help    = "If selected, this attribute can be search on.";
                _cbAllowSearch.Visible = false;  // Default is to not show this option
                Controls.Add(_cbAllowSearch);

                _ddlFieldType                       = new RockDropDownList();
                _ddlFieldType.ID                    = "ddlFieldType";
                _ddlFieldType.Label                 = "Field Type";
                _ddlFieldType.AutoPostBack          = true;
                _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged;
                _ddlFieldType.DataValueField        = "Id";
                _ddlFieldType.DataTextField         = "Name";
                Controls.Add(_ddlFieldType);

                _phQualifiers    = new PlaceHolder();
                _phQualifiers.ID = "phQualifiers";
                _phQualifiers.EnableViewState = false;
                Controls.Add(_phQualifiers);

                _phDefaultValue    = new PlaceHolder();
                _phDefaultValue.ID = "phDefaultValue";
                _phDefaultValue.EnableViewState = false;
                Controls.Add(_phDefaultValue);

                _btnSave          = new LinkButton();
                _btnSave.ID       = "btnSave";
                _btnSave.Text     = "OK";
                _btnSave.CssClass = "btn btn-primary";
                _btnSave.Click   += btnSave_Click;
                Controls.Add(_btnSave);

                _btnCancel                  = new LinkButton();
                _btnCancel.ID               = "btnCancel";
                _btnCancel.Text             = "Cancel";
                _btnCancel.CssClass         = "btn btn-link";
                _btnCancel.CausesValidation = false;
                _btnCancel.Click           += btnCancel_Click;
                Controls.Add(_btnCancel);

                _controlsLoaded = true;
            }
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit( EventArgs e )
        {
            try
            {
                int? pageId = PageParameter( "Page" ).AsIntegerOrNull();
                if ( pageId.HasValue )
                {
                    // hide the current page in the page picker to prevent setting this page's parent page to itself (or one of it's child pages)
                    ppParentPage.HiddenPageIds = new int[] { pageId.Value };

                    var pageCache = Rock.Web.Cache.PageCache.Read( pageId.Value );

                    DialogPage dialogPage = this.Page as DialogPage;
                    if ( dialogPage != null )
                    {
                        dialogPage.OnSave += new EventHandler<EventArgs>( masterPage_OnSave );
                        dialogPage.SubTitle = string.Format( "Id: {0}", pageCache.Id );
                    }

                    if ( pageCache.IsAuthorized( Authorization.ADMINISTRATE, CurrentPerson ) )
                    {
                        ddlMenuWhen.BindToEnum<DisplayInNavWhen>();

                        var blockContexts = new Dictionary<string, string>();
                        foreach ( var block in pageCache.Blocks )
                        {
                            var blockControl = TemplateControl.LoadControl( block.BlockType.Path ) as RockBlock;
                            if ( blockControl != null )
                            {
                                blockControl.SetBlock( pageCache, block );
                                foreach ( var context in blockControl.ContextTypesRequired )
                                {
                                    if ( !blockContexts.ContainsKey( context.Name ) )
                                    {
                                        blockContexts.Add( context.Name, context.FriendlyName );
                                    }
                                }
                            }
                        }

                        phContextPanel.Visible = blockContexts.Count > 0;

                        foreach ( var context in blockContexts )
                        {
                            var tbContext = new RockTextBox();
                            tbContext.ID = string.Format( "context_{0}", context.Key.Replace( '.', '_' ) );
                            tbContext.Required = true;
                            tbContext.Label = context.Value + " Parameter Name";
                            tbContext.Help = "The page parameter name that contains the id of this context entity.";
                            if ( pageCache.PageContexts.ContainsKey( context.Key ) )
                            {
                                tbContext.Text = pageCache.PageContexts[context.Key];
                            }

                            phContext.Controls.Add( tbContext );
                        }

                        _pageId = pageCache.Id;
                    }
                    else
                    {
                        DisplayError( "You are not authorized to administrate this page" );
                    }
                }
                else
                {
                    DisplayError( "Invalid Page Id value" );
                }
            }
            catch ( SystemException ex )
            {
                DisplayError( ex.Message );
            }

            base.OnInit( e );
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add( _hfExpanded );
            _hfExpanded.ID = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value = "False";

            _hfFormGuid = new HiddenField();
            Controls.Add( _hfFormGuid );
            _hfFormGuid.ID = this.ID + "_hfFormGuid";

            _hfFormId = new HiddenField();
            Controls.Add( _hfFormId );
            _hfFormId.ID = this.ID + "_hfFormId";

            _lblFormName = new Label();
            Controls.Add( _lblFormName );
            _lblFormName.ClientIDMode = ClientIDMode.Static;
            _lblFormName.ID = this.ID + "_lblFormName";

            _lbDeleteForm = new LinkButton();
            Controls.Add( _lbDeleteForm );
            _lbDeleteForm.CausesValidation = false;
            _lbDeleteForm.ID = this.ID + "_lbDeleteForm";
            _lbDeleteForm.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteForm.Click += lbDeleteForm_Click;
            _lbDeleteForm.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } );

            _tbFormName = new RockTextBox();
            Controls.Add( _tbFormName );
            _tbFormName.ID = this.ID + "_tbFormName";
            _tbFormName.Label = "Form Name";
            _tbFormName.Required = true;
            _tbFormName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblFormName.ID );

            _gFields = new Grid();
            Controls.Add( _gFields );
            _gFields.ID = this.ID + "_gFields";
            _gFields.AllowPaging = false;
            _gFields.DisplayType = GridDisplayType.Light;
            _gFields.RowItemText = "Field";
            _gFields.AddCssClass( "field-grid" );
            _gFields.DataKeyNames = new string[] { "Guid" };
            _gFields.Actions.ShowAdd = true;
            _gFields.Actions.AddClick += gFields_Add;
            _gFields.GridRebind += gFields_Rebind;
            _gFields.GridReorder += gFields_Reorder;

            var reorderField = new ReorderField();
            _gFields.Columns.Add( reorderField );

            var nameField = new BoundField();
            nameField.DataField = "Name";
            nameField.HeaderText = "Field";
            _gFields.Columns.Add( nameField );

            var sourceField = new EnumField();
            sourceField.DataField = "FieldSource";
            sourceField.HeaderText = "Source";
            _gFields.Columns.Add( sourceField );

            var typeField = new FieldTypeField();
            typeField.DataField = "FieldType";
            typeField.HeaderText = "Type";
            _gFields.Columns.Add( typeField );

            var isInternalField = new BoolField();
            isInternalField.DataField = "IsInternal";
            isInternalField.HeaderText = "Internal";
            _gFields.Columns.Add( isInternalField );

            var isSharedValueField = new BoolField();
            isSharedValueField.DataField = "IsSharedValue";
            isSharedValueField.HeaderText = "Common";
            _gFields.Columns.Add( isSharedValueField );

            var showCurrentValueField = new BoolField();
            showCurrentValueField.DataField = "ShowCurrentValue";
            showCurrentValueField.HeaderText = "Use Current Value";
            _gFields.Columns.Add( showCurrentValueField );

            var isRequiredField = new BoolField();
            isRequiredField.DataField = "IsRequired";
            isRequiredField.HeaderText = "Required";
            _gFields.Columns.Add( isRequiredField );

            var isGridField = new BoolField();
            isGridField.DataField = "IsGridField";
            isGridField.HeaderText = "Show on Grid";
            _gFields.Columns.Add( isGridField );

            var editField = new EditField();
            editField.Click += gFields_Edit;
            _gFields.Columns.Add( editField );

            var delField = new DeleteField();
            delField.Click += gFields_Delete;
            _gFields.Columns.Add( delField );
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _tbName          = new RockTextBox();
                _tbName.ID       = this.ID + "_tbName";
                _tbName.Label    = "Registration Instance Name";
                _tbName.Help     = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _cbIsActive       = new RockCheckBox();
                _cbIsActive.ID    = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text  = "Yes";
                Controls.Add(_cbIsActive);

                _tbUrlSlug         = new RockTextBox();
                _tbUrlSlug.ID      = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label   = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add(_tbUrlSlug);


                _ceDetails              = new CodeEditor();
                _ceDetails.ID           = this.ID + "_ceDetails";
                _ceDetails.Label        = "Details";
                _ceDetails.EditorMode   = CodeEditorMode.Html;
                _ceDetails.EditorTheme  = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible      = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add(_ceDetails);


                _dtpStart       = new DateTimePicker();
                _dtpStart.ID    = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add(_dtpStart);

                _dtpEnd       = new DateTimePicker();
                _dtpEnd.ID    = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add(_dtpEnd);

                _nbMaxAttendees            = new NumberBox();
                _nbMaxAttendees.ID         = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label      = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add(_nbMaxAttendees);

                _apAccount          = new AccountPicker();
                _apAccount.ID       = this.ID + "_apAccount";
                _apAccount.Label    = "Account";
                _apAccount.Required = true;
                Controls.Add(_apAccount);

                _ppContact                     = new PersonPicker();
                _ppContact.ID                  = this.ID + "_ppContact";
                _ppContact.Label               = "Contact";
                _ppContact.SelectPerson       += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add(_ppContact);

                _pnContactPhone       = new PhoneNumberBox();
                _pnContactPhone.ID    = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add(_pnContactPhone);

                _ebContactEmail       = new EmailBox();
                _ebContactEmail.ID    = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add(_ebContactEmail);

                _dtpSendReminder       = new DateTimePicker();
                _dtpSendReminder.ID    = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add(_dtpSendReminder);

                _cbReminderSent       = new RockCheckBox();
                _cbReminderSent.ID    = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text  = "Yes";
                Controls.Add(_cbReminderSent);

                _htmlAdditionalReminderDetails         = new HtmlEditor();
                _htmlAdditionalReminderDetails.ID      = this.ID + "_htmlAdditionalReminderDetails";
                _htmlAdditionalReminderDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalReminderDetails.Label   = "Additional Reminder Details";
                _htmlAdditionalReminderDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalReminderDetails.Height  = 200;
                Controls.Add(_htmlAdditionalReminderDetails);

                _htmlAdditionalConfirmationDetails         = new HtmlEditor();
                _htmlAdditionalConfirmationDetails.ID      = this.ID + "_htmlAdditionalConfirmationDetails";
                _htmlAdditionalConfirmationDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalConfirmationDetails.Label   = "Additional Confirmation Details";
                _htmlAdditionalConfirmationDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalConfirmationDetails.Height  = 200;
                Controls.Add(_htmlAdditionalConfirmationDetails);

                _controlsLoaded = true;
            }
        }
Exemplo n.º 37
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _tbNote                    = new RockTextBox();
            _hfNoteId                  = new HiddenFieldWithClass();
            _tbNote.Placeholder        = "Write a note...";
            _ddlNoteType               = new DropDownList();
            _hfHasUnselectableNoteType = new HiddenFieldWithClass();
            _cbAlert                   = new CheckBox();
            _cbPrivate                 = new CheckBox();
            _lbSaveNote                = new LinkButton();
            _aSecurity                 = new HtmlAnchor();
            _dtCreateDate              = new DateTimePicker();
            _hfParentNoteId            = new HiddenFieldWithClass();
            _mdEditWarning             = new ModalAlert();

            _hfNoteId.ID       = this.ID + "_hfNoteId";
            _hfNoteId.CssClass = "js-noteid";
            Controls.Add(_hfNoteId);

            _hfParentNoteId.ID       = this.ID + "_hfParentNoteId";
            _hfParentNoteId.CssClass = "js-parentnoteid";
            Controls.Add(_hfParentNoteId);

            _tbNote.ID                  = this.ID + "_tbNewNote";
            _tbNote.TextMode            = TextBoxMode.MultiLine;
            _tbNote.Rows                = 3;
            _tbNote.CssClass            = "js-notetext";
            _tbNote.ValidateRequestMode = ValidateRequestMode.Disabled;
            Controls.Add(_tbNote);

            _ddlNoteType.ID             = this.ID + "_ddlNoteType";
            _ddlNoteType.CssClass       = "form-control input-sm input-width-lg noteentry-notetype js-notenotetype";
            _ddlNoteType.DataValueField = "Id";
            _ddlNoteType.DataTextField  = "Name";
            Controls.Add(_ddlNoteType);

            _hfHasUnselectableNoteType.ID       = this.ID + "_hfHasUnselectableNoteType";
            _hfHasUnselectableNoteType.CssClass = "js-has-unselectable-notetype";
            Controls.Add(_hfHasUnselectableNoteType);

            _cbAlert.ID       = this.ID + "_cbAlert";
            _cbAlert.Text     = "Alert";
            _cbAlert.CssClass = "js-notealert";
            Controls.Add(_cbAlert);

            _cbPrivate.ID       = this.ID + "_cbPrivate";
            _cbPrivate.Text     = "Private";
            _cbPrivate.CssClass = "js-noteprivate";
            Controls.Add(_cbPrivate);

            _mdEditWarning.ID = this.ID + "_mdEditWarning";
            Controls.Add(_mdEditWarning);

            _lbSaveNote.ID = this.ID + "_lbSaveNote";
            _lbSaveNote.Attributes["class"] = "btn btn-primary btn-xs";
            _lbSaveNote.CausesValidation    = false;
            _lbSaveNote.Click += lbSaveNote_Click;

            Controls.Add(_lbSaveNote);

            _aSecurity.ID = "_aSecurity";
            _aSecurity.Attributes["class"] = "btn btn-security btn-xs btn-square security js-notesecurity";
            _aSecurity.Attributes["data-entitytype-id"] = EntityTypeCache.Get(typeof(Rock.Model.Note)).Id.ToString();
            _aSecurity.InnerHtml = "<i class='fa fa-lock'></i>";
            Controls.Add(_aSecurity);

            _dtCreateDate.ID    = this.ID + "_tbCreateDate";
            _dtCreateDate.Label = "Note Created Date";
            Controls.Add(_dtCreateDate);
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add( _hfExpanded );
            _hfExpanded.ID = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value = "False";

            _hfActionTypeGuid = new HiddenField();
            Controls.Add( _hfActionTypeGuid );
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            Controls.Add( _lblActionTypeName );
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            Controls.Add( _lbDeleteActionType );
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete";
            _lbDeleteActionType.Click += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl( "i" );
            _lbDeleteActionType.Controls.Add( iDelete );
            iDelete.AddCssClass( "fa fa-times" );

            _ddlCriteriaAttribute = new RockDropDownList();
            Controls.Add( _ddlCriteriaAttribute );
            _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute";
            _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria";
            _ddlCriteriaAttribute.Label = "Run If";
            _ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running.  If the criteria is not met, this action will be skipped when this activity is processed.";

            _ddlCriteriaComparisonType = new RockDropDownList();
            Controls.Add( _ddlCriteriaComparisonType );
            _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType";
            _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison";
            _ddlCriteriaComparisonType.BindToEnum<ComparisonType>();
            _ddlCriteriaComparisonType.Label = "&nbsp;";

            _tbddlCriteriaValue = new RockTextOrDropDownList();
            Controls.Add( _tbddlCriteriaValue );
            _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue";
            _tbddlCriteriaValue.TextBox.Label = "Text Value";
            _tbddlCriteriaValue.DropDownList.Label = "Attribute Value";

            _tbActionTypeName = new RockTextBox();
            Controls.Add( _tbActionTypeName );
            _tbActionTypeName.ID = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label = "Name";
            _tbActionTypeName.Required = true;
            _tbActionTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID );

            _ddlEntityType = new RockDropDownList();
            Controls.Add( _ddlEntityType );
            _ddlEntityType.ID = this.ID + "_ddlEntityType";
            _ddlEntityType.Label = "Action Type";

            // make it autopostback since Attributes are dependant on which EntityType is selected
            _ddlEntityType.AutoPostBack = true;
            _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;

            foreach ( var item in ActionContainer.Instance.Components.Values.OrderBy( a => a.Value.EntityType.FriendlyName ) )
            {
                var type = item.Value.GetType();
                if (type != null)
                {
                    var entityType = EntityTypeCache.Read( type );
                    var li = new ListItem( entityType.FriendlyName, entityType.Id.ToString() );

                    // Get description
                    string description = string.Empty;
                    var descAttributes = type.GetCustomAttributes( typeof( System.ComponentModel.DescriptionAttribute ), false );
                    if ( descAttributes != null )
                    {
                        foreach ( System.ComponentModel.DescriptionAttribute descAttribute in descAttributes )
                        {
                            description = descAttribute.Description;
                        }
                    }
                    if ( !string.IsNullOrWhiteSpace( description ) )
                    {
                        li.Attributes.Add( "title", description );
                    }

                    _ddlEntityType.Items.Add( li );
                }
            }

            _cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" };
            Controls.Add( _cbIsActionCompletedOnSuccess );
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox { Text = "Activity is Completed on Success" };
            Controls.Add( _cbIsActivityCompletedOnSuccess );
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _formEditor = new WorkflowFormEditor();
            Controls.Add( _formEditor );
            _formEditor.ID = this.ID + "_formEditor";

            _phActionAttributes = new PlaceHolder();
            Controls.Add( _phActionAttributes );
            _phActionAttributes.ID = this.ID + "_phActionAttributes";
        }
Exemplo n.º 39
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfValue.ID = this.ID + "_hfValue";
            Controls.Add(_hfValue);

            _actionControls     = new List <RockTextBox>();
            _buttonHtmlControls = new List <RockDropDownList>();
            _activityControls   = new List <RockDropDownList>();
            _responseControls   = new List <RockTextBox>();

            string[] nameValues = this.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < nameValues.Length; i++)
            {
                string[] nameValueResponse = nameValues[i].Split(new char[] { '^' });

                var tbAction = new RockTextBox();
                tbAction.ID = this.ID + "_tbAction" + i.ToString();
                Controls.Add(tbAction);
                tbAction.Placeholder = "Action";
                tbAction.AddCssClass("form-action-key");
                tbAction.AddCssClass("form-control");
                tbAction.AddCssClass("js-form-action-input");
                tbAction.Text = nameValueResponse.Length > 0 ? nameValueResponse[0] : string.Empty;
                _actionControls.Add(tbAction);

                var ddlButtonHtml = new RockDropDownList();
                ddlButtonHtml.ID = this.ID + "_ddlButtonHtml" + i.ToString();
                ddlButtonHtml.EnableViewState = false;
                Controls.Add(ddlButtonHtml);
                ddlButtonHtml.AddCssClass("form-action-button");
                ddlButtonHtml.AddCssClass("form-control");
                ddlButtonHtml.AddCssClass("js-form-action-input");
                var definedType = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.BUTTON_HTML.AsGuid());
                foreach (var definedValue in definedType.DefinedValues)
                {
                    var li = new ListItem(definedValue.Value, definedValue.Guid.ToString());
                    li.Selected = nameValueResponse.Length > 1 && li.Value.Equals(nameValueResponse[1], StringComparison.OrdinalIgnoreCase);
                    ddlButtonHtml.Items.Add(li);
                }
                _buttonHtmlControls.Add(ddlButtonHtml);

                var ddlActivity = new RockDropDownList();
                ddlActivity.ID = this.ID + "_ddlActivity" + i.ToString();
                ddlActivity.EnableViewState = false;
                Controls.Add(ddlActivity);
                ddlActivity.AddCssClass("form-action-value");
                ddlActivity.AddCssClass("form-control");
                ddlActivity.AddCssClass("js-form-action-input");
                ddlActivity.DataTextField  = "Value";
                ddlActivity.DataValueField = "Key";
                ddlActivity.DataSource     = Activities;
                ddlActivity.DataBind();
                ddlActivity.Items.Insert(0, new ListItem(string.Empty, string.Empty));
                foreach (ListItem li in ddlActivity.Items)
                {
                    li.Selected = nameValueResponse.Length > 2 && li.Value.Equals(nameValueResponse[2], StringComparison.OrdinalIgnoreCase);
                }
                _activityControls.Add(ddlActivity);

                var tbResponse = new RockTextBox();
                tbResponse.ID = this.ID + "_tbResponse" + i.ToString();
                Controls.Add(tbResponse);
                tbResponse.Placeholder = "Response Text";
                tbResponse.AddCssClass("form-action-response");
                tbResponse.AddCssClass("form-control");
                tbResponse.AddCssClass("js-form-action-input");
                tbResponse.Text = nameValueResponse.Length > 3 ? nameValueResponse[3] : string.Empty;
                _responseControls.Add(tbResponse);
            }
        }
Exemplo n.º 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewGroupAdvanceInfoRow" /> class.
 /// </summary>
 public NewGroupAdvanceInfoRow()
     : base()
 {
     _tbAlternateId = new RockTextBox();
 }
Exemplo n.º 41
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Controls.Clear();

            this.CssClass = "picker picker-select rollover-container";

            _hfLocationId = new HiddenField { ID = "hfLocationId" };
            this.Controls.Add( _hfLocationId );

            _btnPickerLabel = new HtmlAnchor { ID = "btnPickerLabel" };
            _btnPickerLabel.Attributes["class"] = "picker-label";
            this.Controls.Add( _btnPickerLabel );

            _btnSelectNone = new HtmlAnchor();
            _btnSelectNone.Attributes["class"] = "picker-select-none";
            _btnSelectNone.ID = string.Format( "btnSelectNone_{0}", this.ID );
            _btnSelectNone.InnerHtml = "<i class='fa fa-times'></i>";
            _btnSelectNone.CausesValidation = false;
            _btnSelectNone.Style[HtmlTextWriterStyle.Display] = "none";
            _btnSelectNone.ServerClick += _btnSelectNone_ServerClick;
            this.Controls.Add( _btnSelectNone );

            // PickerMenu (DropDown menu)
            _pnlPickerMenu = new Panel { ID = "pnlPickerMenu" };
            _pnlPickerMenu.CssClass = "picker-menu dropdown-menu";
            _pnlPickerMenu.Style[HtmlTextWriterStyle.Display] = "none";
            this.Controls.Add( _pnlPickerMenu );
            SetPickerOnClick();

            // Address Entry
            _pnlAddressEntry = new Panel { ID = "pnlAddressEntry" };
            _pnlAddressEntry.CssClass = "locationpicker-address-entry";
            _pnlPickerMenu.Controls.Add( _pnlAddressEntry );

            _tbAddress1 = new RockTextBox { ID = "tbAddress1" };
            _tbAddress1.Label = "Address Line 1";
            _pnlAddressEntry.Controls.Add( _tbAddress1 );

            _tbAddress2 = new RockTextBox { ID = "tbAddress2" };
            _tbAddress2.Label = "Address Line 2";
            _pnlAddressEntry.Controls.Add( _tbAddress2 );

            // Address Entry - City State Zip
            _divCityStateZipRow = new HtmlGenericContainer( "div", "row" );
            _pnlAddressEntry.Controls.Add( _divCityStateZipRow );

            _divCityColumn = new HtmlGenericContainer( "div", "col-sm-5" );
            _divCityStateZipRow.Controls.Add( _divCityColumn );
            _tbCity = new RockTextBox { ID = "tbCity" };
            _tbCity.Label = "City";
            _divCityColumn.Controls.Add( _tbCity );

            _divStateColumn = new HtmlGenericContainer( "div", "col-sm-3" );
            _divCityStateZipRow.Controls.Add( _divStateColumn );
            _ddlState = new StateDropDownList { ID = "ddlState" };
            _ddlState.UseAbbreviation = true;
            _ddlState.CssClass = "input-mini";
            _ddlState.Label = "State";
            _divStateColumn.Controls.Add( _ddlState );

            _divZipColumn = new HtmlGenericContainer( "div", "col-sm-4" );
            _divCityStateZipRow.Controls.Add( _divZipColumn );
            _tbZip = new RockTextBox { ID = "tbZip" };
            _tbZip.CssClass = "input-small";
            _tbZip.Label = "Zip";
            _divZipColumn.Controls.Add( _tbZip );

            // picker actions
            _pnlPickerActions = new Panel { ID = "pnlPickerActions", CssClass = "picker-actions" };
            _pnlPickerMenu.Controls.Add( _pnlPickerActions );
            _btnSelect = new LinkButton { ID = "btnSelect", CssClass = "btn btn-xs btn-primary", Text = "Select", CausesValidation = false };
            _btnSelect.Click += _btnSelect_Click;
            _pnlPickerActions.Controls.Add( _btnSelect );
            _btnCancel = new LinkButton { ID = "btnCancel", CssClass = "btn btn-xs btn-link", Text = "Cancel" };
            _btnCancel.OnClientClick = string.Format( "$('#{0}').hide();", _pnlPickerMenu.ClientID );
            _pnlPickerActions.Controls.Add( _btnCancel );
        }
Exemplo n.º 42
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _lAttributeActionTitle    = new Literal();
                _lAttributeActionTitle.ID = "lAttributeActionTitle";
                Controls.Add(_lAttributeActionTitle);

                _validationSummary            = new ValidationSummary();
                _validationSummary.ID         = "valiationSummary";
                _validationSummary.CssClass   = "alert alert-danger";
                _validationSummary.HeaderText = "Please Correct the Following";
                Controls.Add(_validationSummary);

                _tbName          = new RockTextBox();
                _tbName.ID       = "tbName";
                _tbName.Label    = "Name";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _tbDescription          = new RockTextBox();
                _tbDescription.Label    = "Description";
                _tbDescription.ID       = "tbDescription";
                _tbDescription.TextMode = TextBoxMode.MultiLine;
                _tbDescription.Rows     = 3;
                Controls.Add(_tbDescription);

                _cpCategories                           = new CategoryPicker();
                _cpCategories.ID                        = "cpCategories_" + this.ID.ToString();
                _cpCategories.Label                     = "Categories";
                _cpCategories.AllowMultiSelect          = true;
                _cpCategories.EntityTypeId              = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id;
                _cpCategories.EntityTypeQualifierColumn = "EntityTypeId";
                Controls.Add(_cpCategories);

                _tbKey          = new RockTextBox();
                _tbKey.ID       = "tbKey";
                _tbKey.Label    = "Key";
                _tbKey.Required = true;
                Controls.Add(_tbKey);

                _cvKey    = new CustomValidator();
                _cvKey.ID = "cvKey";
                _cvKey.ControlToValidate        = _tbKey.ID;
                _cvKey.ClientValidationFunction = "validateKey";
                _cvKey.ServerValidate          += cvKey_ServerValidate;
                _cvKey.Display      = ValidatorDisplay.Dynamic;
                _cvKey.CssClass     = "validation-error help-inline";
                _cvKey.ErrorMessage = "There is already an existing property with the key value you entered.  Please select a different key value.";
                Controls.Add(_cvKey);

                _cbRequired       = new RockCheckBox();
                _cbRequired.ID    = "cbRequired";
                _cbRequired.Label = "Required";
                _cbRequired.Text  = "Require a value";
                Controls.Add(_cbRequired);

                _cbShowInGrid       = new RockCheckBox();
                _cbShowInGrid.ID    = "cbShowInGrid";
                _cbShowInGrid.Label = "Show in Grid";
                _cbShowInGrid.Text  = "Yes";
                _cbShowInGrid.Help  = "If selected, this attribute will be included in a grid.";
                Controls.Add(_cbShowInGrid);

                _ddlFieldType                       = new RockDropDownList();
                _ddlFieldType.ID                    = "ddlFieldType";
                _ddlFieldType.Label                 = "Field Type";
                _ddlFieldType.AutoPostBack          = true;
                _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged;
                Controls.Add(_ddlFieldType);

                if (!Page.IsPostBack)
                {
                    _ddlFieldType.DataValueField = "Id";
                    _ddlFieldType.DataTextField  = "Name";
                    _ddlFieldType.DataSource     = new FieldTypeService()
                                                   .Queryable()
                                                   .OrderBy(a => a.Name)
                                                   .Select(a => new { a.Id, a.Name }).ToList();;
                    _ddlFieldType.DataBind();
                }

                _phQualifiers    = new PlaceHolder();
                _phQualifiers.ID = "phQualifiers";
                _phQualifiers.EnableViewState = false;
                Controls.Add(_phQualifiers);

                _phDefaultValue    = new PlaceHolder();
                _phDefaultValue.ID = "phDefaultValue";
                _phDefaultValue.EnableViewState = false;
                Controls.Add(_phDefaultValue);

                _btnSave          = new LinkButton();
                _btnSave.ID       = "btnSave";
                _btnSave.Text     = "OK";
                _btnSave.CssClass = "btn btn-primary";
                _btnSave.Click   += btnSave_Click;
                Controls.Add(_btnSave);

                _btnCancel                  = new LinkButton();
                _btnCancel.ID               = "btnCancel";
                _btnCancel.Text             = "Cancel";
                _btnCancel.CssClass         = "btn btn-link";
                _btnCancel.CausesValidation = false;
                _btnCancel.Click           += btnCancel_Click;
                Controls.Add(_btnCancel);

                _tbName.Attributes["onblur"] = string.Format("populateAttributeKey('{0}','{1}')", _tbName.ClientID, _tbKey.ClientID);

                _controlsLoaded = true;
            }
        }
Exemplo n.º 43
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if ( !_controlsLoaded )
            {
                Controls.Clear();

                _hfExistingKeyNames = new HtmlInputHidden();
                _hfExistingKeyNames.AddCssClass( "js-existing-key-names" );
                _hfExistingKeyNames.ID = this.ID + "_hfExistingKeyNames";
                Controls.Add( _hfExistingKeyNames );

                _lAttributeActionTitle = new Literal();
                _lAttributeActionTitle.ID = "lAttributeActionTitle";
                Controls.Add( _lAttributeActionTitle );

                _validationSummary = new ValidationSummary();
                _validationSummary.ID = "valiationSummary";
                _validationSummary.CssClass = "alert alert-danger";
                _validationSummary.HeaderText = "Please Correct the Following";
                Controls.Add( _validationSummary );

                _tbName = new RockTextBox();
                _tbName.ID = "tbName";
                _tbName.Label = "Name";
                _tbName.Required = true;
                Controls.Add( _tbName );

                _tbDescription = new RockTextBox();
                _tbDescription.Label = "Description";
                _tbDescription.ID = "tbDescription";
                _tbDescription.TextMode = TextBoxMode.MultiLine;
                _tbDescription.Rows = 3;
                Controls.Add( _tbDescription );

                _cpCategories = new CategoryPicker();
                _cpCategories.ID = "cpCategories_" + this.ID.ToString();
                _cpCategories.Label = "Categories";
                _cpCategories.AllowMultiSelect = true;
                _cpCategories.EntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Attribute ) ).Id;
                _cpCategories.EntityTypeQualifierColumn = "EntityTypeId";
                Controls.Add( _cpCategories );

                _tbKey = new RockTextBox();
                _tbKey.ID = "tbKey";
                _tbKey.Label = "Key";
                _tbKey.Required = true;
                Controls.Add( _tbKey );

                _cvKey = new CustomValidator();
                _cvKey.ID = "cvKey";
                _cvKey.ControlToValidate = _tbKey.ID;
                _cvKey.ClientValidationFunction = "validateKey";
                _cvKey.ServerValidate += cvKey_ServerValidate;
                _cvKey.Display = ValidatorDisplay.Dynamic;
                _cvKey.CssClass = "validation-error help-inline";
                _cvKey.ErrorMessage = "There is already an existing property with the key value you entered or the key has illegal characters. Please select a different key value and use only letters, numbers and underscores.";
                Controls.Add( _cvKey );

                _tbIconCssClass = new RockTextBox();
                _tbIconCssClass.ID = "_tbIconCssClass";
                _tbIconCssClass.Label = "Icon CSS Class";
                Controls.Add( _tbIconCssClass );

                _cbRequired = new RockCheckBox();
                _cbRequired.ID ="cbRequired";
                _cbRequired.Label = "Required";
                _cbRequired.Text = "Require a value";
                Controls.Add( _cbRequired );

                _cbShowInGrid = new RockCheckBox();
                _cbShowInGrid.ID = "cbShowInGrid";
                _cbShowInGrid.Label = "Show in Grid";
                _cbShowInGrid.Text = "Yes";
                _cbShowInGrid.Help = "If selected, this attribute will be included in a grid.";
                Controls.Add( _cbShowInGrid );

                _cbAllowSearch = new RockCheckBox();
                _cbAllowSearch.ID = "cbAllowSearch";
                _cbAllowSearch.Label = "Allow Search";
                _cbAllowSearch.Text = "Yes";
                _cbAllowSearch.Help = "If selected, this attribute can be search on.";
                _cbAllowSearch.Visible = false;  // Default is to not show this option
                Controls.Add( _cbAllowSearch );

                _ddlFieldType = new RockDropDownList();
                _ddlFieldType.ID = "ddlFieldType";
                _ddlFieldType.Label = "Field Type";
                _ddlFieldType.AutoPostBack = true;
                _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged;
                _ddlFieldType.DataValueField = "Id";
                _ddlFieldType.DataTextField = "Name";
                Controls.Add( _ddlFieldType );

                _phQualifiers = new PlaceHolder();
                _phQualifiers.ID = "phQualifiers";
                _phQualifiers.EnableViewState = false;
                Controls.Add( _phQualifiers );

                _phDefaultValue = new PlaceHolder();
                _phDefaultValue.ID = "phDefaultValue";
                _phDefaultValue.EnableViewState = false;
                Controls.Add( _phDefaultValue );

                _btnSave = new LinkButton();
                _btnSave.ID = "btnSave";
                _btnSave.Text = "OK";
                _btnSave.CssClass = "btn btn-primary";
                _btnSave.Click += btnSave_Click;
                Controls.Add( _btnSave );

                _btnCancel = new LinkButton();
                _btnCancel.ID = "btnCancel";
                _btnCancel.Text = "Cancel";
                _btnCancel.CssClass = "btn btn-link";
                _btnCancel.CausesValidation = false;
                _btnCancel.Click += btnCancel_Click;
                Controls.Add( _btnCancel );

                _controlsLoaded = true;
            }
        }
Exemplo n.º 44
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _tbName          = new RockTextBox();
                _tbName.ID       = this.ID + "_tbName";
                _tbName.Label    = "Registration Instance Name";
                _tbName.Help     = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _cbIsActive       = new RockCheckBox();
                _cbIsActive.ID    = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text  = "Yes";
                Controls.Add(_cbIsActive);

                _tbUrlSlug         = new RockTextBox();
                _tbUrlSlug.ID      = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label   = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add(_tbUrlSlug);


                _ceDetails              = new CodeEditor();
                _ceDetails.ID           = this.ID + "_ceDetails";
                _ceDetails.Label        = "Details";
                _ceDetails.EditorMode   = CodeEditorMode.Html;
                _ceDetails.EditorTheme  = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible      = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add(_ceDetails);


                _dtpStart       = new DateTimePicker();
                _dtpStart.ID    = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add(_dtpStart);

                _dtpEnd       = new DateTimePicker();
                _dtpEnd.ID    = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add(_dtpEnd);

                _nbMaxAttendees            = new NumberBox();
                _nbMaxAttendees.ID         = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label      = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add(_nbMaxAttendees);

                _wtpRegistrationWorkflow       = new WorkflowTypePicker();
                _wtpRegistrationWorkflow.ID    = this.ID + "_wtpRegistrationWorkflow";
                _wtpRegistrationWorkflow.Label = "Registration Workflow";
                _wtpRegistrationWorkflow.Help  = "An optional workflow type to launch when a new registration is completed.";
                Controls.Add(_wtpRegistrationWorkflow);

                _cbCost       = new CurrencyBox();
                _cbCost.ID    = this.ID + "_cbCost";
                _cbCost.Label = "Cost";
                _cbCost.Help  = "The cost per registrant";
                Controls.Add(_cbCost);

                _cbMinimumInitialPayment       = new CurrencyBox();
                _cbMinimumInitialPayment.ID    = this.ID + "_cbMinimumInitialPayment";
                _cbMinimumInitialPayment.Label = "Minimum Initial Payment";
                _cbMinimumInitialPayment.Help  = "The minimum amount required per registrant. Leave value blank if full amount is required.";
                Controls.Add(_cbMinimumInitialPayment);

                _cbDefaultPaymentAmount       = new CurrencyBox();
                _cbDefaultPaymentAmount.ID    = this.ID + "_cbDefaultPaymentAmount";
                _cbDefaultPaymentAmount.Label = "Default Payment Amount";
                _cbDefaultPaymentAmount.Help  = "The default payment amount per registrant. Leave value blank to default to the full amount. NOTE: This requires that a Minimum Initial Payment is defined.";
                Controls.Add(_cbDefaultPaymentAmount);

                _apAccount          = new AccountPicker();
                _apAccount.ID       = this.ID + "_apAccount";
                _apAccount.Label    = "Account";
                _apAccount.Required = true;
                Controls.Add(_apAccount);

                _ppContact                     = new PersonPicker();
                _ppContact.ID                  = this.ID + "_ppContact";
                _ppContact.Label               = "Contact";
                _ppContact.SelectPerson       += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add(_ppContact);

                _pnContactPhone       = new PhoneNumberBox();
                _pnContactPhone.ID    = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add(_pnContactPhone);

                _ebContactEmail       = new EmailBox();
                _ebContactEmail.ID    = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add(_ebContactEmail);

                _dtpSendReminder       = new DateTimePicker();
                _dtpSendReminder.ID    = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add(_dtpSendReminder);

                _cbReminderSent       = new RockCheckBox();
                _cbReminderSent.ID    = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text  = "Yes";
                Controls.Add(_cbReminderSent);

                _htmlRegistrationInstructions         = new HtmlEditor();
                _htmlRegistrationInstructions.ID      = this.ID + "_htmlRegistrationInstructions";
                _htmlRegistrationInstructions.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlRegistrationInstructions.Label   = "Registration Instructions";
                _htmlRegistrationInstructions.Help    = "These instructions will appear at the beginning of the registration process when selecting how many registrants for the registration. These instructions can be provided on the registration template also. Any instructions here will override the instructions on the template.";
                _htmlRegistrationInstructions.Height  = 200;
                Controls.Add(_htmlRegistrationInstructions);

                _htmlAdditionalReminderDetails         = new HtmlEditor();
                _htmlAdditionalReminderDetails.ID      = this.ID + "_htmlAdditionalReminderDetails";
                _htmlAdditionalReminderDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalReminderDetails.Label   = "Additional Reminder Details";
                _htmlAdditionalReminderDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalReminderDetails.Height  = 200;
                Controls.Add(_htmlAdditionalReminderDetails);

                _htmlAdditionalConfirmationDetails         = new HtmlEditor();
                _htmlAdditionalConfirmationDetails.ID      = this.ID + "_htmlAdditionalConfirmationDetails";
                _htmlAdditionalConfirmationDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalConfirmationDetails.Label   = "Additional Confirmation Details";
                _htmlAdditionalConfirmationDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalConfirmationDetails.Height  = 200;
                Controls.Add(_htmlAdditionalConfirmationDetails);

                _controlsLoaded = true;
            }
        }
Exemplo n.º 45
0
        /// <summary>
        /// Creates the person field.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="setValue">if set to <c>true</c> [set value].</param>
        /// <param name="fieldValue">The field value.</param>
        private void CreatePersonField( RegistrationTemplateFormField field, bool setValue, object fieldValue )
        {
            switch ( field.PersonFieldType )
            {
                case RegistrationPersonFieldType.FirstName:
                    {
                        var tbFirstName = new RockTextBox();
                        tbFirstName.ID = "tbFirstName";
                        tbFirstName.Label = "First Name";
                        tbFirstName.Required = field.IsRequired;
                        tbFirstName.ValidationGroup = BlockValidationGroup;
                        tbFirstName.AddCssClass( "js-first-name" );
                        phRegistrantControls.Controls.Add( tbFirstName );

                        if ( setValue && fieldValue != null )
                        {
                            tbFirstName.Text = fieldValue.ToString();
                        }

                        break;
                    }

                case RegistrationPersonFieldType.LastName:
                    {
                        var tbLastName = new RockTextBox();
                        tbLastName.ID = "tbLastName";
                        tbLastName.Label = "Last Name";
                        tbLastName.Required = field.IsRequired;
                        tbLastName.ValidationGroup = BlockValidationGroup;
                        phRegistrantControls.Controls.Add( tbLastName );

                        if ( setValue && fieldValue != null )
                        {
                            tbLastName.Text = fieldValue.ToString();
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Campus:
                    {
                        var cpHomeCampus = new CampusPicker();
                        cpHomeCampus.ID = "cpHomeCampus";
                        cpHomeCampus.Label = "Campus";
                        cpHomeCampus.Required = field.IsRequired;
                        cpHomeCampus.ValidationGroup = BlockValidationGroup;
                        cpHomeCampus.Campuses = CampusCache.All();

                        phRegistrantControls.Controls.Add( cpHomeCampus );

                        if ( setValue && fieldValue != null )
                        {
                            cpHomeCampus.SelectedCampusId = fieldValue.ToString().AsIntegerOrNull();
                        }
                        break;
                    }

                case RegistrationPersonFieldType.Address:
                    {
                        var acAddress = new AddressControl();
                        acAddress.ID = "acAddress";
                        acAddress.Label = "Address";
                        acAddress.UseStateAbbreviation = true;
                        acAddress.UseCountryAbbreviation = false;
                        acAddress.Required = field.IsRequired;
                        acAddress.ValidationGroup = BlockValidationGroup;

                        phRegistrantControls.Controls.Add( acAddress );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue.ToString().FromJsonOrNull<Location>();
                            acAddress.SetValues( value );
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Email:
                    {
                        var tbEmail = new EmailBox();
                        tbEmail.ID = "tbEmail";
                        tbEmail.Label = "Email";
                        tbEmail.Required = field.IsRequired;
                        tbEmail.ValidationGroup = BlockValidationGroup;
                        phRegistrantControls.Controls.Add( tbEmail );

                        if ( setValue && fieldValue != null )
                        {
                            tbEmail.Text = fieldValue.ToString();
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Birthdate:
                    {
                        var bpBirthday = new BirthdayPicker();
                        bpBirthday.ID = "bpBirthday";
                        bpBirthday.Label = "Birthday";
                        bpBirthday.Required = field.IsRequired;
                        bpBirthday.ValidationGroup = BlockValidationGroup;
                        phRegistrantControls.Controls.Add( bpBirthday );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue as DateTime?;
                            bpBirthday.SelectedDate = value;
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Gender:
                    {
                        var ddlGender = new RockDropDownList();
                        ddlGender.ID = "ddlGender";
                        ddlGender.Label = "Gender";
                        ddlGender.Required = field.IsRequired;
                        ddlGender.ValidationGroup = BlockValidationGroup;
                        ddlGender.BindToEnum<Gender>( false );

                        // change the 'Unknow' value to be blank instead
                        ddlGender.Items.FindByValue( "0" ).Text = string.Empty;

                        phRegistrantControls.Controls.Add( ddlGender );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue.ToString().ConvertToEnumOrNull<Gender>() ?? Gender.Unknown;
                            ddlGender.SetValue( value.ConvertToInt() );
                        }

                        break;
                    }

                case RegistrationPersonFieldType.MaritalStatus:
                    {
                        var ddlMaritalStatus = new RockDropDownList();
                        ddlMaritalStatus.ID = "ddlMaritalStatus";
                        ddlMaritalStatus.Label = "Marital Status";
                        ddlMaritalStatus.Required = field.IsRequired;
                        ddlMaritalStatus.ValidationGroup = BlockValidationGroup;
                        ddlMaritalStatus.BindToDefinedType( DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid() ), true );
                        phRegistrantControls.Controls.Add( ddlMaritalStatus );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue.ToString().AsInteger();
                            ddlMaritalStatus.SetValue( value );
                        }

                        break;
                    }

                case RegistrationPersonFieldType.MobilePhone:
                    {
                        var dv = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE );
                        if ( dv != null )
                        {
                            var ppMobile = new PhoneNumberBox();
                            ppMobile.ID = "ppMobile";
                            ppMobile.Label = dv.Value;
                            ppMobile.Required = field.IsRequired;
                            ppMobile.ValidationGroup = BlockValidationGroup;
                            ppMobile.CountryCode = PhoneNumber.DefaultCountryCode();

                            phRegistrantControls.Controls.Add( ppMobile );

                            if ( setValue && fieldValue != null )
                            {
                                var value = fieldValue as PhoneNumber;
                                if ( value != null )
                                {
                                    ppMobile.CountryCode = value.CountryCode;
                                    ppMobile.Number = value.ToString();
                                }
                            }
                        }

                        break;
                    }
                case RegistrationPersonFieldType.HomePhone:
                    {
                        var dv = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME );
                        if ( dv != null )
                        {
                            var ppHome = new PhoneNumberBox();
                            ppHome.ID = "ppHome";
                            ppHome.Label = dv.Value;
                            ppHome.Required = field.IsRequired;
                            ppHome.ValidationGroup = BlockValidationGroup;
                            ppHome.CountryCode = PhoneNumber.DefaultCountryCode();

                            phRegistrantControls.Controls.Add( ppHome );

                            if ( setValue && fieldValue != null )
                            {
                                var value = fieldValue as PhoneNumber;
                                if ( value != null )
                                {
                                    ppHome.CountryCode = value.CountryCode;
                                    ppHome.Number = value.ToString();
                                }
                            }
                        }

                        break;
                    }

                case RegistrationPersonFieldType.WorkPhone:
                    {
                        var dv = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_WORK );
                        if ( dv != null )
                        {
                            var ppWork = new PhoneNumberBox();
                            ppWork.ID = "ppWork";
                            ppWork.Label = dv.Value;
                            ppWork.Required = field.IsRequired;
                            ppWork.ValidationGroup = BlockValidationGroup;
                            ppWork.CountryCode = PhoneNumber.DefaultCountryCode();

                            phRegistrantControls.Controls.Add( ppWork );

                            if ( setValue && fieldValue != null )
                            {
                                var value = fieldValue.ToString().FromJsonOrNull<PhoneNumber>();
                                if ( value != null )
                                {
                                    ppWork.CountryCode = value.CountryCode;
                                    ppWork.Number = value.ToString();
                                }
                            }
                        }

                        break;
                    }
            }
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfActionTypeGuid = new HiddenField();
            Controls.Add(_hfActionTypeGuid);
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            Controls.Add(_lblActionTypeName);
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID           = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            Controls.Add(_lbDeleteActionType);
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID       = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete";
            _lbDeleteActionType.Click   += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl("i");

            _lbDeleteActionType.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _ddlCriteriaAttribute = new RockDropDownList();
            Controls.Add(_ddlCriteriaAttribute);
            _ddlCriteriaAttribute.ID       = this.ID + "_ddlCriteriaAttribute";
            _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria";
            _ddlCriteriaAttribute.Label    = "Run If";
            _ddlCriteriaAttribute.Help     = "Optional criteria to prevent the action from running.  If the criteria is not met, this action will be skipped when this activity is processed.";

            _ddlCriteriaComparisonType = new RockDropDownList();
            Controls.Add(_ddlCriteriaComparisonType);
            _ddlCriteriaComparisonType.ID       = this.ID + "_ddlCriteriaComparisonType";
            _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison";
            _ddlCriteriaComparisonType.BindToEnum <ComparisonType>();
            _ddlCriteriaComparisonType.Label = "&nbsp;";

            _tbddlCriteriaValue = new RockTextOrDropDownList();
            Controls.Add(_tbddlCriteriaValue);
            _tbddlCriteriaValue.ID                 = this.ID + "_tbddlCriteriaValue";
            _tbddlCriteriaValue.TextBox.Label      = "Text Value";
            _tbddlCriteriaValue.DropDownList.Label = "Attribute Value";

            _tbActionTypeName = new RockTextBox();
            Controls.Add(_tbActionTypeName);
            _tbActionTypeName.ID                   = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label                = "Name";
            _tbActionTypeName.Required             = true;
            _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID);

            _ddlEntityType = new RockDropDownList();
            Controls.Add(_ddlEntityType);
            _ddlEntityType.ID    = this.ID + "_ddlEntityType";
            _ddlEntityType.Label = "Action Type";

            // make it autopostback since Attributes are dependant on which EntityType is selected
            _ddlEntityType.AutoPostBack          = true;
            _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;

            foreach (var item in ActionContainer.Instance.Components.Values.OrderBy(a => a.Value.EntityType.FriendlyName))
            {
                var type = item.Value.GetType();
                if (type != null)
                {
                    var entityType = EntityTypeCache.Read(type);
                    var li         = new ListItem(entityType.FriendlyName, entityType.Id.ToString());

                    // Get description
                    string description    = string.Empty;
                    var    descAttributes = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
                    if (descAttributes != null)
                    {
                        foreach (System.ComponentModel.DescriptionAttribute descAttribute in descAttributes)
                        {
                            description = descAttribute.Description;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(description))
                    {
                        li.Attributes.Add("title", description);
                    }

                    _ddlEntityType.Items.Add(li);
                }
            }

            _cbIsActionCompletedOnSuccess = new RockCheckBox {
                Text = "Action is Completed on Success"
            };
            Controls.Add(_cbIsActionCompletedOnSuccess);
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox {
                Text = "Activity is Completed on Success"
            };
            Controls.Add(_cbIsActivityCompletedOnSuccess);
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _formEditor = new WorkflowFormEditor();
            Controls.Add(_formEditor);
            _formEditor.ID = this.ID + "_formEditor";

            _phActionAttributes = new PlaceHolder();
            Controls.Add(_phActionAttributes);
            _phActionAttributes.ID = this.ID + "_phActionAttributes";
        }
Exemplo n.º 47
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Controls.Clear();

            this.CssClass = "picker picker-select";

            _hfLocationId = new HiddenField {
                ID = "hfLocationId"
            };
            this.Controls.Add(_hfLocationId);

            _btnPickerLabel = new HtmlAnchor {
                ID = "btnPickerLabel"
            };
            _btnPickerLabel.Attributes["class"] = "picker-label";
            _btnPickerLabel.InnerHtml           = string.Format("<i class='fa fa-user'></i>{0}<b class='fa fa-caret-down pull-right'></b>", this.AddressSummaryText);
            this.Controls.Add(_btnPickerLabel);

            // PickerMenu (DropDown menu)
            _pnlPickerMenu = new Panel {
                ID = "pnlPickerMenu"
            };
            _pnlPickerMenu.CssClass = "picker-menu dropdown-menu";
            _pnlPickerMenu.Style[HtmlTextWriterStyle.Display] = "none";
            this.Controls.Add(_pnlPickerMenu);
            SetPickerOnClick();

            // Address Entry
            _pnlAddressEntry = new Panel {
                ID = "pnlAddressEntry"
            };
            _pnlAddressEntry.CssClass = "locationpicker-address-entry";
            _pnlPickerMenu.Controls.Add(_pnlAddressEntry);

            _tbAddress1 = new RockTextBox {
                ID = "tbAddress1"
            };
            _tbAddress1.Label = "Address Line 1";
            _pnlAddressEntry.Controls.Add(_tbAddress1);

            _tbAddress2 = new RockTextBox {
                ID = "tbAddress2"
            };
            _tbAddress2.Label = "Address Line 2";
            _pnlAddressEntry.Controls.Add(_tbAddress2);

            // Address Entry - City State Zip
            _divCityStateZipRow = new HtmlGenericContainer("div", "row");
            _pnlAddressEntry.Controls.Add(_divCityStateZipRow);

            _divCityColumn = new HtmlGenericContainer("div", "col-lg-5");
            _divCityStateZipRow.Controls.Add(_divCityColumn);
            _tbCity = new RockTextBox {
                ID = "tbCity"
            };
            _tbCity.Label = "City";
            _divCityColumn.Controls.Add(_tbCity);

            _divStateColumn = new HtmlGenericContainer("div", "col-lg-3");
            _divCityStateZipRow.Controls.Add(_divStateColumn);
            _ddlState = new StateDropDownList {
                ID = "ddlState"
            };
            _ddlState.UseAbbreviation = true;
            _ddlState.CssClass        = "input-mini";
            _ddlState.Label           = "State";
            _divStateColumn.Controls.Add(_ddlState);

            _divZipColumn = new HtmlGenericContainer("div", "col-lg-4");
            _divCityStateZipRow.Controls.Add(_divZipColumn);
            _tbZip = new RockTextBox {
                ID = "tbZip"
            };
            _tbZip.CssClass = "input-small";
            _tbZip.Label    = "Zip";
            _divZipColumn.Controls.Add(_tbZip);

            // picker actions
            _pnlPickerActions = new Panel {
                ID = "pnlPickerActions", CssClass = "picker-actions"
            };
            _pnlPickerMenu.Controls.Add(_pnlPickerActions);
            _btnSelect = new LinkButton {
                ID = "btnSelect", CssClass = "btn btn-xs btn-primary", Text = "Select", CausesValidation = false
            };
            _btnSelect.Click += _btnSelect_Click;
            _pnlPickerActions.Controls.Add(_btnSelect);
            _btnCancel = new LinkButton {
                ID = "btnCancel", CssClass = "btn btn-xs btn-link", Text = "Cancel"
            };
            _btnCancel.OnClientClick = string.Format("$('#{0}').hide();", _pnlPickerMenu.ClientID);
            _pnlPickerActions.Controls.Add(_btnCancel);
        }
Exemplo n.º 48
0
        /// <summary>
        /// Adds the grid columns.
        /// </summary>
        /// <param name="dataTable">The data table.</param>
        private void AddGridColumns( Grid grid, DataTable dataTable )
        {
            bool showColumns = GetAttributeValue( "ShowColumns" ).AsBoolean();
            var columnList = GetAttributeValue( "Columns" ).SplitDelimitedValues().ToList();

            int rowsToEval = 10;
            if ( dataTable.Rows.Count < 10 )
            {
                rowsToEval = dataTable.Rows.Count;
            }

            grid.Columns.Clear();

            if ( !string.IsNullOrWhiteSpace( grid.PersonIdField ) )
            {
                grid.Columns.Add( new SelectField() );
            }

            GridFilterColumnLookup = new Dictionary<Control, string>();

            foreach ( DataColumn dataTableColumn in dataTable.Columns )
            {
                if ( columnList.Count > 0 &&
                    ( ( showColumns && !columnList.Contains( dataTableColumn.ColumnName, StringComparer.OrdinalIgnoreCase ) ) ||
                        ( !showColumns && columnList.Contains( dataTableColumn.ColumnName, StringComparer.OrdinalIgnoreCase ) ) ) )
                {
                    continue;
                }

                BoundField bf = new BoundField();
                var splitCaseName = dataTableColumn.ColumnName.SplitCase();

                if ( dataTableColumn.DataType == typeof( bool ) )
                {
                    bf = new BoolField();

                    if ( GridFilter != null )
                    {
                        var id = "ddl" + dataTableColumn.ColumnName.RemoveSpecialCharacters();

                        var filterControl = new RockDropDownList()
                        {
                            Label = splitCaseName,
                            ID = id
                        };

                        GridFilterColumnLookup.Add( filterControl, dataTableColumn.ColumnName );

                        filterControl.Items.Add( BoolToString( null ) );
                        filterControl.Items.Add( BoolToString( true ) );
                        filterControl.Items.Add( BoolToString( false ) );
                        GridFilter.Controls.Add( filterControl );

                        var value = GridFilter.GetUserPreference( id );

                        if ( value != null )
                        {
                            filterControl.SetValue( value );
                        }
                    }
                }
                else if ( dataTableColumn.DataType == typeof( DateTime ) )
                {
                    bf = new DateField();

                    for ( int i = 0; i < rowsToEval; i++ )
                    {
                        object dateObj = dataTable.Rows[i][dataTableColumn];
                        if ( dateObj is DateTime )
                        {
                            DateTime dateTime = ( DateTime ) dateObj;
                            if ( dateTime.TimeOfDay.Seconds != 0 )
                            {
                                bf = new DateTimeField();
                                break;
                            }
                        }
                    }

                    if ( GridFilter != null )
                    {
                        var id = "drp" + dataTableColumn.ColumnName.RemoveSpecialCharacters();

                        var filterControl = new DateRangePicker()
                        {
                            Label = splitCaseName,
                            ID = id,
                        };

                        GridFilterColumnLookup.Add( filterControl, dataTableColumn.ColumnName );

                        GridFilter.Controls.Add( filterControl );

                        var value = GridFilter.GetUserPreference( id );

                        if ( value != null )
                        {
                            DateTime upper;
                            DateTime lower;

                            if ( DateRangePicker.TryParse( value, out lower, out upper ) )
                            {
                                filterControl.LowerValue = lower;
                                filterControl.UpperValue = upper;
                            }
                        }
                    }
                }
                else
                {
                    bf.HtmlEncode = false;

                    if ( GridFilter != null )
                    {
                        var id = "tb" + dataTableColumn.ColumnName.RemoveSpecialCharacters();
                        var filterControl = new RockTextBox()
                        {
                            Label = splitCaseName,
                            ID = id
                        };

                        GridFilterColumnLookup.Add( filterControl, dataTableColumn.ColumnName );

                        GridFilter.Controls.Add( filterControl );
                        var key = filterControl.ID;
                        var value = GridFilter.GetUserPreference( key );

                        if ( value != null )
                        {
                            filterControl.Text = value;
                        }
                    }
                }

                bf.DataField = dataTableColumn.ColumnName;
                bf.SortExpression = dataTableColumn.ColumnName;
                bf.HeaderText = splitCaseName;
                grid.Columns.Add( bf );
            }
        }
Exemplo n.º 49
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfActivityTypeGuid = new HiddenField();
            Controls.Add(_hfActivityTypeGuid);
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            Controls.Add(_lblActivityTypeName);
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID           = this.ID + "_lblActivityTypeName";

            _lblActivityTypeDescription = new Label();
            Controls.Add(_lblActivityTypeDescription);
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID           = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            Controls.Add(_lblInactive);
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID           = this.ID + "_lblInactive";
            _lblInactive.CssClass     = "pull-right";
            _lblInactive.Text         = "<span class='label label-danger'>Inactive</span>";

            _lbDeleteActivityType = new LinkButton();
            Controls.Add(_lbDeleteActivityType);
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID       = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-square btn-danger js-activity-delete";
            _lbDeleteActivityType.Click   += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-times'></i>"
            });

            _sbSecurity = new SecurityButton();
            Controls.Add(_sbSecurity);
            _sbSecurity.ID = this.ID + "_sbSecurity";
            _sbSecurity.Attributes["class"] = "btn btn-security btn-xs security pull-right";
            _sbSecurity.EntityTypeId        = EntityTypeCache.Get(typeof(Rock.Model.WorkflowActivityType)).Id;

            _cbActivityTypeIsActive = new RockCheckBox {
                Text = "Active"
            };
            Controls.Add(_cbActivityTypeIsActive);
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').hide(); 
        $('#{1}').removeClass('workflow-activity-inactive'); 
    }} 
    else {{ 
        $('#{0}').show(); 
        $('#{1}').addClass('workflow-activity-inactive'); 
    }}
";

            _cbActivityTypeIsActive.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, _lblInactive.ID, this.ID + "_section"));

            _tbActivityTypeName = new RockTextBox();
            Controls.Add(_tbActivityTypeName);
            _tbActivityTypeName.ID                   = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label                = "Name";
            _tbActivityTypeName.Required             = true;
            _tbActivityTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID);

            _tbActivityTypeDescription = new RockTextBox();
            Controls.Add(_tbActivityTypeDescription);
            _tbActivityTypeDescription.ID                   = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label                = "Description";
            _tbActivityTypeDescription.TextMode             = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows                 = 2;
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID);

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox {
                Text = "Activated with Workflow"
            };
            Controls.Add(_cbActivityTypeIsActivatedWithWorkflow);
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";
            checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').addClass('activated-with-workflow'); 
    }} 
    else {{ 
        $('#{0}').removeClass('activated-with-workflow'); 
    }}
";
            _cbActivityTypeIsActivatedWithWorkflow.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, this.ID + "_section"));


            _lbAddActionType = new LinkButton();
            Controls.Add(_lbAddActionType);
            _lbAddActionType.ID               = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass         = "btn btn-xs btn-action add-action";
            _lbAddActionType.Click           += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-plus'></i> Add Action"
            });

            _pwAttributes = new PanelWidget();
            Controls.Add(_pwAttributes);
            _pwAttributes.ID       = this.ID + "_pwAttributes";
            _pwAttributes.Title    = "Activity Attributes";
            _pwAttributes.CssClass = "attribute-panel";

            _gAttributes = new Grid();
            _pwAttributes.Controls.Add(_gAttributes);
            _gAttributes.ID          = this.ID + "_gAttributes";
            _gAttributes.AllowPaging = false;
            _gAttributes.DisplayType = GridDisplayType.Light;
            _gAttributes.RowItemText = "Activity Attribute";
            _gAttributes.AddCssClass("attribute-grid");
            _gAttributes.DataKeyNames        = new string[] { "Guid" };
            _gAttributes.Actions.ShowAdd     = true;
            _gAttributes.Actions.AddClick   += gAttributes_Add;
            _gAttributes.GridRebind         += gAttributes_Rebind;
            _gAttributes.GridReorder        += gAttributes_Reorder;
            _gAttributes.ShowActionsInHeader = false;

            var reorderField = new ReorderField();

            _gAttributes.Columns.Add(reorderField);

            var nameField = new BoundField();

            nameField.DataField  = "Name";
            nameField.HeaderText = "Attribute";
            _gAttributes.Columns.Add(nameField);

            var descField = new BoundField();

            descField.DataField  = "Description";
            descField.HeaderText = "Description";
            _gAttributes.Columns.Add(descField);

            var fieldTypeField = new BoundField();

            fieldTypeField.DataField  = "FieldType";
            fieldTypeField.HeaderText = "Field Type";
            _gAttributes.Columns.Add(fieldTypeField);

            var reqField = new BoolField();

            reqField.DataField  = "IsRequired";
            reqField.HeaderText = "Required";
            _gAttributes.Columns.Add(reqField);

            var editField = new EditField();

            editField.Click += gAttributes_Edit;
            _gAttributes.Columns.Add(editField);

            var delField = new DeleteField();

            delField.Click += gAttributes_Delete;
            _gAttributes.Columns.Add(delField);
        }
Exemplo n.º 50
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hfExpanded = new HiddenFieldWithClass();
            Controls.Add(_hfExpanded);
            _hfExpanded.ID       = this.ID + "_hfExpanded";
            _hfExpanded.CssClass = "filter-expanded";
            _hfExpanded.Value    = "False";

            _hfActionTypeGuid = new HiddenField();
            Controls.Add(_hfActionTypeGuid);
            _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";

            _lblActionTypeName = new Label();
            Controls.Add(_lblActionTypeName);
            _lblActionTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActionTypeName.ID           = this.ID + "_lblActionTypeName";

            _lbDeleteActionType = new LinkButton();
            Controls.Add(_lbDeleteActionType);
            _lbDeleteActionType.CausesValidation = false;
            _lbDeleteActionType.ID       = this.ID + "_lbDeleteActionType";
            _lbDeleteActionType.CssClass = "btn btn-xs btn-square btn-danger js-action-delete";
            _lbDeleteActionType.Click   += lbDeleteActionType_Click;

            var iDelete = new HtmlGenericControl("i");

            _lbDeleteActionType.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _ddlCriteriaAttribute = new RockDropDownList();
            Controls.Add(_ddlCriteriaAttribute);
            _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute";
            _ddlCriteriaAttribute.EnableViewState = false;
            _ddlCriteriaAttribute.CssClass        = "js-conditional-run-criteria";
            _ddlCriteriaAttribute.Label           = "Run If";
            _ddlCriteriaAttribute.Help            = "Optional criteria to prevent the action from running.  If the criteria is not met, this action will be skipped when this activity is processed.";

            _ddlCriteriaComparisonType = new RockDropDownList();
            Controls.Add(_ddlCriteriaComparisonType);
            _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType";
            _ddlCriteriaComparisonType.EnableViewState = false;
            _ddlCriteriaComparisonType.CssClass        = "js-action-criteria-comparison";
            _ddlCriteriaComparisonType.BindToEnum <ComparisonType>();
            _ddlCriteriaComparisonType.Label = "&nbsp;";

            _tbddlCriteriaValue = new RockTextOrDropDownList();
            Controls.Add(_tbddlCriteriaValue);
            _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue";
            _tbddlCriteriaValue.EnableViewState    = false;
            _tbddlCriteriaValue.TextBox.Label      = "Text Value";
            _tbddlCriteriaValue.DropDownList.Label = "Attribute Value";

            _tbActionTypeName = new RockTextBox();
            Controls.Add(_tbActionTypeName);
            _tbActionTypeName.ID                   = this.ID + "_tbActionTypeName";
            _tbActionTypeName.Label                = "Name";
            _tbActionTypeName.Required             = true;
            _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID);

            _wfatpEntityType             = new WorkflowActionTypePicker();
            _wfatpEntityType.SelectItem += wfatpEntityType_SelectItem;
            Controls.Add(_wfatpEntityType);
            _wfatpEntityType.ID    = this.ID + "_wfatpEntityType";
            _wfatpEntityType.Label = "Action Type";

            _rlEntityTypeOverview = new RockLiteral();
            Controls.Add(_rlEntityTypeOverview);
            _rlEntityTypeOverview.ID    = this.ID + "";
            _rlEntityTypeOverview.Label = "Action Type Overview";

            _cbIsActionCompletedOnSuccess = new RockCheckBox {
                Text = "Action is Completed on Success"
            };
            Controls.Add(_cbIsActionCompletedOnSuccess);
            _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";

            _cbIsActivityCompletedOnSuccess = new RockCheckBox {
                Text = "Activity is Completed on Success"
            };
            Controls.Add(_cbIsActivityCompletedOnSuccess);
            _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";

            _formEditor = new WorkflowFormEditor();
            Controls.Add(_formEditor);
            _formEditor.ID = this.ID + "_formEditor";

            _phActionAttributes = new PlaceHolder();
            Controls.Add(_phActionAttributes);
            _phActionAttributes.ID = this.ID + "_phActionAttributes";
        }
Exemplo n.º 51
0
        /// <summary>
        /// Adds the filter controls and grid columns for all of the registration template's form fields
        /// that were configured to 'Show on Grid'
        /// </summary>
        private void AddDynamicRegistrantControls()
        {
            phRegistrantFormFieldFilters.Controls.Clear();

            // Remove any of the dynamic person fields
            var dynamicColumns = new List<string> {
                "PersonAlias.Person.BirthDate",
            };
            foreach ( var column in gRegistrants.Columns
                .OfType<BoundField>()
                .Where( c => dynamicColumns.Contains( c.DataField ) )
                .ToList() )
            {
                gRegistrants.Columns.Remove( column );
            }

            // Remove any of the dynamic attribute fields
            foreach ( var column in gRegistrants.Columns
                .OfType<AttributeField>()
                .ToList() )
            {
                gRegistrants.Columns.Remove( column );
            }

            // Remove the fees field
            foreach ( var column in gRegistrants.Columns
                .OfType<TemplateField>()
                .Where( c => c.HeaderText == "Fees" )
                .ToList() )
            {
                gRegistrants.Columns.Remove( column );
            }

            // Remove the delete field
            foreach ( var column in gRegistrants.Columns
                .OfType<DeleteField>()
                .ToList() )
            {
                gRegistrants.Columns.Remove( column );
            }

            if ( RegistrantFields != null )
            {
                foreach ( var field in RegistrantFields )
                {
                    if ( field.FieldSource == RegistrationFieldSource.PersonField && field.PersonFieldType.HasValue )
                    {
                        switch ( field.PersonFieldType.Value )
                        {
                            case RegistrationPersonFieldType.Campus:
                                {
                                    var ddlCampus = new RockDropDownList();
                                    ddlCampus.ID = "ddlCampus";
                                    ddlCampus.Label = "Home Campus";
                                    ddlCampus.DataValueField = "Id";
                                    ddlCampus.DataTextField = "Name";
                                    ddlCampus.DataSource = CampusCache.All();
                                    ddlCampus.DataBind();
                                    ddlCampus.Items.Insert( 0, new ListItem( "", "" ) );
                                    ddlCampus.SetValue( fRegistrants.GetUserPreference( "Home Campus" ) );
                                    phRegistrantFormFieldFilters.Controls.Add( ddlCampus );

                                    var templateField = new TemplateField();
                                    templateField.ItemTemplate = new LiteralFieldTemplate( "lCampus" );
                                    templateField.HeaderText = "Campus";
                                    gRegistrants.Columns.Add( templateField );

                                    break;
                                }

                            case RegistrationPersonFieldType.Email:
                                {
                                    var tbEmailFilter = new RockTextBox();
                                    tbEmailFilter.ID = "tbEmailFilter";
                                    tbEmailFilter.Label = "Email";
                                    tbEmailFilter.Text = fRegistrants.GetUserPreference( "Email" );
                                    phRegistrantFormFieldFilters.Controls.Add( tbEmailFilter );

                                    string dataFieldExpression = "PersonAlias.Person.Email";
                                    var emailField = new BoundField();
                                    emailField.DataField = dataFieldExpression;
                                    emailField.HeaderText = "Email";
                                    emailField.SortExpression = dataFieldExpression;
                                    gRegistrants.Columns.Add( emailField );

                                    break;
                                }

                            case RegistrationPersonFieldType.Birthdate:
                                {
                                    var drpBirthdateFilter = new DateRangePicker();
                                    drpBirthdateFilter.ID = "drpBirthdateFilter";
                                    drpBirthdateFilter.Label = "Birthdate Range";
                                    drpBirthdateFilter.DelimitedValues = fRegistrants.GetUserPreference( "Birthdate Range" );
                                    phRegistrantFormFieldFilters.Controls.Add( drpBirthdateFilter );

                                    string dataFieldExpression = "PersonAlias.Person.BirthDate";
                                    var birthdateField = new DateField();
                                    birthdateField.DataField = dataFieldExpression;
                                    birthdateField.HeaderText = "Birthdate";
                                    birthdateField.SortExpression = dataFieldExpression;
                                    gRegistrants.Columns.Add( birthdateField );

                                    break;
                                }

                            case RegistrationPersonFieldType.Gender:
                                {
                                    var ddlGenderFilter = new RockDropDownList();
                                    ddlGenderFilter.BindToEnum<Gender>( true );
                                    ddlGenderFilter.ID = "ddlGenderFilter";
                                    ddlGenderFilter.Label = "Gender";
                                    ddlGenderFilter.SetValue( fRegistrants.GetUserPreference( "Gender" ) );
                                    phRegistrantFormFieldFilters.Controls.Add( ddlGenderFilter );

                                    string dataFieldExpression = "PersonAlias.Person.Gender";
                                    var genderField = new EnumField();
                                    genderField.DataField = dataFieldExpression;
                                    genderField.HeaderText = "Gender";
                                    genderField.SortExpression = dataFieldExpression;
                                    gRegistrants.Columns.Add( genderField );

                                    break;
                                }

                            case RegistrationPersonFieldType.MaritalStatus:
                                {
                                    var ddlMaritalStatusFilter = new RockDropDownList();
                                    ddlMaritalStatusFilter.BindToDefinedType( DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid() ), true );
                                    ddlMaritalStatusFilter.ID = "ddlMaritalStatusFilter";
                                    ddlMaritalStatusFilter.Label = "Marital Status";
                                    ddlMaritalStatusFilter.SetValue( fRegistrants.GetUserPreference( "Marital Status" ) );
                                    phRegistrantFormFieldFilters.Controls.Add( ddlMaritalStatusFilter );

                                    string dataFieldExpression = "PersonAlias.Person.MaritalStatusValue.Value";
                                    var maritalStatusField = new BoundField();
                                    maritalStatusField.DataField = dataFieldExpression;
                                    maritalStatusField.HeaderText = "MaritalStatus";
                                    maritalStatusField.SortExpression = dataFieldExpression;
                                    gRegistrants.Columns.Add( maritalStatusField );

                                    break;
                                }

                            case RegistrationPersonFieldType.MobilePhone:
                                {
                                    var tbPhoneFilter = new RockTextBox();
                                    tbPhoneFilter.ID = "tbPhoneFilter";
                                    tbPhoneFilter.Label = "Phone";
                                    tbPhoneFilter.Text = fRegistrants.GetUserPreference( "Phone" );
                                    phRegistrantFormFieldFilters.Controls.Add( tbPhoneFilter );

                                    var templateField = new TemplateField();
                                    templateField.ItemTemplate = new LiteralFieldTemplate( "lPhone" );
                                    templateField.HeaderText = "Phone(s)";
                                    gRegistrants.Columns.Add( templateField );

                                    break;
                                }
                        }
                    }

                    else if ( field.Attribute != null )
                    {
                        var attribute = field.Attribute;
                        var control = attribute.FieldType.Field.FilterControl( attribute.QualifierValues, "filter_" + attribute.Id.ToString(), false, Rock.Reporting.FilterMode.SimpleFilter );
                        if ( control != null )
                        {
                            if ( control is IRockControl )
                            {
                                var rockControl = (IRockControl)control;
                                rockControl.Label = attribute.Name;
                                rockControl.Help = attribute.Description;
                                phRegistrantFormFieldFilters.Controls.Add( control );
                            }
                            else
                            {
                                var wrapper = new RockControlWrapper();
                                wrapper.ID = control.ID + "_wrapper";
                                wrapper.Label = attribute.Name;
                                wrapper.Controls.Add( control );
                                phRegistrantFormFieldFilters.Controls.Add( wrapper );
                            }

                            string savedValue = fRegistrants.GetUserPreference( attribute.Key );
                            if ( !string.IsNullOrWhiteSpace( savedValue ) )
                            {
                                try
                                {
                                    var values = JsonConvert.DeserializeObject<List<string>>( savedValue );
                                    attribute.FieldType.Field.SetFilterValues( control, attribute.QualifierValues, values );
                                }
                                catch { }
                            }
                        }

                        string dataFieldExpression = attribute.Id.ToString() + attribute.Key;
                        bool columnExists = gRegistrants.Columns.OfType<AttributeField>().FirstOrDefault( a => a.DataField.Equals( dataFieldExpression ) ) != null;
                        if ( !columnExists )
                        {
                            AttributeField boundField = new AttributeField();
                            boundField.DataField = dataFieldExpression;
                            boundField.HeaderText = attribute.Name;
                            boundField.SortExpression = string.Empty;

                            var attributeCache = Rock.Web.Cache.AttributeCache.Read( attribute.Id );
                            if ( attributeCache != null )
                            {
                                boundField.ItemStyle.HorizontalAlign = attributeCache.FieldType.Field.AlignValue;
                            }

                            gRegistrants.Columns.Add( boundField );
                        }

                    }
                }
            }

            // Add fee column
            var feeField = new TemplateField();
            feeField.HeaderText = "Fees";
            feeField.ItemTemplate = new LiteralFieldTemplate( "lFees" );
            gRegistrants.Columns.Add( feeField );

            var deleteField = new DeleteField();
            gRegistrants.Columns.Add( deleteField );
            deleteField.Click += gRegistrants_Delete;
        }
Exemplo n.º 52
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            _hiddenField = new HiddenField();
            _hiddenField.ID = this.ID + "_hiddenField";
            Controls.Add( _hiddenField );

            _textBox = new RockTextBox();
            _textBox.ID = this.ID + "_textBox";
            Controls.Add( _textBox );

            _dropDownList = new RockDropDownList();
            _dropDownList.ID = this.ID + "_dropDownList";
            Controls.Add( _dropDownList );
        }
Exemplo n.º 53
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _phControls = new DynamicPlaceholder {
                ID = "phControls"
            };
            this.Controls.Add(_phControls);

            _pnlRow = new DynamicControlsPanel {
                ID = "pnlRow", CssClass = "row"
            };
            _pnlCol1 = new DynamicControlsPanel {
                ID = "pnlCol1", CssClass = "col-sm-4"
            };
            _pnlCol2 = new DynamicControlsPanel {
                ID = "pnlCol2", CssClass = "col-sm-4"
            };
            _pnlCol3 = new DynamicControlsPanel {
                ID = "pnlCol3", CssClass = "col-sm-4"
            };
            _phControls.Controls.Add(_pnlRow);
            _pnlRow.Controls.Add(_pnlCol1);
            _pnlRow.Controls.Add(_pnlCol2);
            _pnlRow.Controls.Add(_pnlCol3);


            _hfPersonId = new HiddenField
            {
                ID = "_hfPersonId"
            };

            _phControls.Controls.Add(_hfPersonId);

            _dvpPersonTitle = new DefinedValuePicker
            {
                ID              = "_dvpPersonTitle",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_TITLE.AsGuid()),
                Label           = "Title",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            _tbPersonFirstName = new RockTextBox
            {
                ID               = "tbPersonFirstName",
                Label            = "First Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            _tbPersonLastName = new RockTextBox
            {
                ID               = "tbPersonLastName",
                Label            = "Last Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            _dvpPersonSuffix = new DefinedValuePicker
            {
                ID              = "dvpPersonSuffix",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_SUFFIX.AsGuid()),
                Label           = "Suffix",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            // Have Email and PhoneNumber hidden by default
            _ebPersonEmail = new EmailBox
            {
                ID              = "ebPersonEmail",
                Label           = "Email",
                ValidationGroup = ValidationGroup,
                Visible         = false
            };

            _pnbMobilePhoneNumber = new PhoneNumberBox
            {
                Label   = "Mobile Phone",
                ID      = "pnbMobilePhoneNumber",
                Visible = false
            };

            _dvpPersonConnectionStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonConnectionStatus",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS.AsGuid()),
                Label           = "Connection Status",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            _rblPersonRole = new RockRadioButtonList
            {
                ID              = "rblPersonRole",
                Label           = "Role",
                RepeatDirection = RepeatDirection.Horizontal,
                DataTextField   = "Name",
                DataValueField  = "Id",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            _rblPersonGender = new RockRadioButtonList
            {
                ID              = "rblPersonGender",
                Label           = "Gender",
                RepeatDirection = RepeatDirection.Horizontal,
                Required        = this.RequireGender,
                ValidationGroup = this.RequireGender == true ? ValidationGroup : string.Empty,
                ShowNoneOption  = false
            };

            _bdpPersonBirthDate = new BirthdayPicker
            {
                ID              = "bdpPersonBirthDate",
                Label           = "Birthdate",
                ValidationGroup = ValidationGroup
            };

            _ddlGradePicker = new GradePicker
            {
                ID                    = "ddlGradePicker",
                Label                 = "Grade",
                UseAbbreviation       = true,
                UseGradeOffsetAsValue = true,
                ValidationGroup       = ValidationGroup
            };

            _dvpPersonMaritalStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonMaritalStatus",
                Label           = "Marital Status",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid()),
                ValidationGroup = ValidationGroup
            };

            var groupType = GroupTypeCache.GetFamilyGroupType();

            _rblPersonRole.DataSource = groupType.Roles.OrderBy(r => r.Order).ToList();
            _rblPersonRole.DataBind();

            _rblPersonGender.Items.Clear();
            _rblPersonGender.Items.Add(new ListItem(Gender.Male.ConvertToString(), Gender.Male.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Female.ConvertToString(), Gender.Female.ConvertToInt().ToString()));

            ArrangePersonControls(this.ShowInColumns);
            UpdatePersonControlLabels();
        }
Exemplo n.º 54
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            var ddlGroupType = new RockDropDownList();
            ddlGroupType.ID = filterControl.ID + "_0";
            filterControl.Controls.Add( ddlGroupType );

            foreach ( Rock.Model.GroupType groupType in new GroupTypeService().Queryable() )
            {
                ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Id.ToString() ) );
            }

            var ddl = ComparisonControl( NumericFilterComparisonTypes );
            ddl.ID = filterControl.ID + "_1";
            filterControl.Controls.Add( ddl );

            var tb = new RockTextBox();
            tb.ID = filterControl.ID + "_2";
            filterControl.Controls.Add( tb );

            var tb2 = new RockTextBox();
            tb2.ID = filterControl.ID + "_3";
            filterControl.Controls.Add( tb );

            var controls = new Control[4] { ddlGroupType, ddl, tb, tb2 };

            SetSelection( entityType, controls, string.Format( "{0}|{1}|4|16",
                ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0",
                ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) );

            return controls;
        }
Exemplo n.º 55
0
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id">The id.</param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            RockTextBox tb = new RockTextBox { ID = id, TextMode = TextBoxMode.MultiLine };
            int? rows = 3;
            bool allowHtml = false;

            if ( configurationValues != null )
            {
                if ( configurationValues.ContainsKey( NUMBER_OF_ROWS ) )
                {
                    rows = configurationValues[NUMBER_OF_ROWS].Value.AsIntegerOrNull() ?? 3;
                }
                if ( configurationValues.ContainsKey( ALLOW_HTML ) )
                {
                    allowHtml = configurationValues[ALLOW_HTML].Value.AsBoolean();
                }
            }

            tb.Rows = rows.HasValue ? rows.Value : 3;
            tb.ValidateRequestMode = allowHtml ? ValidateRequestMode.Disabled : ValidateRequestMode.Enabled;

            return tb;
        }