/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var rbl = new RockRadioButtonList(); rbl.ID = filterControl.ID + "_0"; rbl.RepeatDirection = RepeatDirection.Horizontal; rbl.Items.Add( new ListItem( "Yes", "1" ) ); rbl.Items.Add( new ListItem( "No", "0" ) ); filterControl.Controls.Add( rbl ); rbl.SelectedValue = "1"; return new Control[1] { rbl }; }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); _hfPageRouteId = new HiddenField(); _hfPageRouteId.ID = string.Format("hfPageRouteId_{0}", this.ID); _btnShowPageRoutePicker = new HyperLink(); _btnShowPageRoutePicker.CssClass = "btn btn-xs btn-link js-hide-on-select-none"; _btnShowPageRoutePicker.ID = string.Format("btnShowPageRoutePicker_{0}", this.ID); _btnShowPageRoutePicker.Text = "Pick Route"; _btnShowPageRoutePicker.Style[HtmlTextWriterStyle.Display] = "none"; _rblSelectPageRoute = new RockRadioButtonList(); _rblSelectPageRoute.ID = "rblSelectPageRoute_" + this.ID; _rblSelectPageRoute.Visible = false; _rblSelectPageRoute.EnableViewState = true; _btnSelectPageRoute = new LinkButton(); _btnSelectPageRoute.CssClass = "btn btn-xs btn-primary"; _btnSelectPageRoute.ID = string.Format("btnSelectPageRoute_{0}", this.ID); _btnSelectPageRoute.Text = "Select"; _btnSelectPageRoute.CausesValidation = false; _btnSelectPageRoute.Click += _btnSelectPageRoute_Click; _btnCancelPageRoute = new HyperLink(); _btnCancelPageRoute.CssClass = "btn btn-link btn-xs"; _btnCancelPageRoute.ID = string.Format("btnCancelPageRoute_{0}", this.ID); _btnCancelPageRoute.Text = "Cancel"; if (ShowSelectCurrentPage) { _btnSelectCurrentPage = new LinkButton(); _btnSelectCurrentPage.ID = this.ID + "_btnSelectCurrentPage"; _btnSelectCurrentPage.CssClass = "btn btn-xs btn-link pull-right"; _btnSelectCurrentPage.Text = "<i class='fa fa-file-o'></i>"; _btnSelectCurrentPage.ToolTip = "Select Current Page"; _btnSelectCurrentPage.CausesValidation = false; _btnSelectCurrentPage.Click += _btnSelectCurrentPage_Click; Controls.Add(_btnSelectCurrentPage); } Controls.Add(_hfPageRouteId); Controls.Add(_rblSelectPageRoute); Controls.Add(_btnShowPageRoutePicker); Controls.Add(_btnSelectPageRoute); Controls.Add(_btnCancelPageRoute); }
/// <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(); _cacheabilityType = new RockRadioButtonList { ID = $"{ID}_{CACHEABILITY_PICKER_NAME}", Label = "Cacheability Type", Help = @"This determines how the item will be treated in cache.<br /> Public - This item can be cached on the browser or any other shared network cache like a CDN.<br /> Private - This item can only be cached in the browser.<br /> No-Cache - The item will be checked on every load, but if it is deemed to not have changed since the last load it will use a local copy.<br /> No-Store - This item will never be stored by the local browser.This is used for sensitive files like check images." }; _cacheabilityType.Items.AddRange(new ListItem[] { new ListItem { Text = "Public", Value = RockCacheablityType.Public.ConvertToInt().ToString() }, new ListItem { Text = "Private", Value = RockCacheablityType.Private.ConvertToInt().ToString() }, new ListItem { Text = "No-Cache", Value = RockCacheablityType.NoCache.ConvertToInt().ToString() }, new ListItem { Text = "No-Store", Value = RockCacheablityType.NoStore.ConvertToInt().ToString() } }); _cacheabilityType.RepeatDirection = RepeatDirection.Horizontal; _cacheabilityType.AutoPostBack = true; _cacheabilityType.SelectedIndexChanged += CacheabilityType_SelectedIndexChanged; CreateMaxAgeControls(); CreateMaxSharedAgeControls(); Controls.Add(_cacheabilityType); Controls.Add(_maxAgeLabel); Controls.Add(_maxAgeValue); Controls.Add(_maxAgeUnit); Controls.Add(_maxSharedAgeLabel); Controls.Add(_maxSharedAgeValue); Controls.Add(_maxSharedAgeUnit); }
/// <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(); }
/// <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(); _bpBirthdate = new BirthdayPicker(); _ddlGradePicker = new GradePicker { UseAbbreviation = true, UseGradeOffsetAsValue = true }; _ddlGradePicker.Label = string.Empty; _pnbMobile = new PhoneNumberBox(); _ebEmail = new EmailBox(); _ddlRelationshipType = new RockDropDownList(); _phAttributes = new PlaceHolder(); _lbDelete = new LinkButton(); _rblCommunicationPreference = new RockRadioButtonList(); }
/// <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(); _hfPageRouteId = new HiddenField(); _hfPageRouteId.ClientIDMode = ClientIDMode.Static; _hfPageRouteId.ID = string.Format("hfPageRouteId_{0}", this.ID); _btnShowPageRoutePicker = new HyperLink(); _btnShowPageRoutePicker.CssClass = "btn btn-xs"; _btnShowPageRoutePicker.ID = string.Format("btnShowPageRoutePicker_{0}", this.ID); _btnShowPageRoutePicker.Text = "Pick Route"; _btnShowPageRoutePicker.Style[HtmlTextWriterStyle.Display] = "none"; _rblSelectPageRoute = new RockRadioButtonList(); _rblSelectPageRoute.ID = "rblSelectPageRoute_" + this.ID; _rblSelectPageRoute.Visible = false; _rblSelectPageRoute.EnableViewState = true; _btnSelectPageRoute = new LinkButton(); _btnSelectPageRoute.CssClass = "btn btn-xs btn-primary"; _btnSelectPageRoute.ID = string.Format("btnSelectPageRoute_{0}", this.ID); _btnSelectPageRoute.Text = "Select"; _btnSelectPageRoute.CausesValidation = false; _btnSelectPageRoute.Click += _btnSelectPageRoute_Click; _btnCancelPageRoute = new HyperLink(); _btnCancelPageRoute.CssClass = "btn btn-link btn-xs"; _btnCancelPageRoute.ID = string.Format("btnCancelPageRoute_{0}", this.ID); _btnCancelPageRoute.Text = "Cancel"; Controls.Add(_hfPageRouteId); Controls.Add(_rblSelectPageRoute); Controls.Add(_btnShowPageRoutePicker); Controls.Add(_btnSelectPageRoute); Controls.Add(_btnCancelPageRoute); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { _rblTagType = new RockRadioButtonList(); _rblTagType.ID = filterControl.ID + "_tagType"; _rblTagType.RepeatDirection = RepeatDirection.Horizontal; _rblTagType.Items.Add( new ListItem( "Personal Tags", "1" ) ); _rblTagType.Items.Add( new ListItem( "Organizational Tags", "2" ) ); _rblTagType.SelectedValue = "1"; _rblTagType.AutoPostBack = true; _rblTagType.SelectedIndexChanged += rblTagType_SelectedIndexChanged; filterControl.Controls.Add( _rblTagType ); _ddlTagList = new RockDropDownList(); _ddlTagList.ID = filterControl.ID + "_ddlTagList"; _ddlTagList.AddCssClass( "js-tag-filter-list" ); filterControl.Controls.Add( _ddlTagList ); PopulateTagList(); return new Control[2] { _rblTagType, _ddlTagList }; }
/// <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(); _hfPageRouteId = new HiddenField(); _hfPageRouteId.ID = string.Format( "hfPageRouteId_{0}", this.ID ); _btnShowPageRoutePicker = new HyperLink(); _btnShowPageRoutePicker.CssClass = "btn btn-xs btn-link js-hide-on-select-none"; _btnShowPageRoutePicker.ID = string.Format( "btnShowPageRoutePicker_{0}", this.ID ); _btnShowPageRoutePicker.Text = "Pick Route"; _btnShowPageRoutePicker.Style[HtmlTextWriterStyle.Display] = "none"; _rblSelectPageRoute = new RockRadioButtonList(); _rblSelectPageRoute.ID = "rblSelectPageRoute_" + this.ID; _rblSelectPageRoute.Visible = false; _rblSelectPageRoute.EnableViewState = true; _btnSelectPageRoute = new LinkButton(); _btnSelectPageRoute.CssClass = "btn btn-xs btn-primary"; _btnSelectPageRoute.ID = string.Format( "btnSelectPageRoute_{0}", this.ID ); _btnSelectPageRoute.Text = "Select"; _btnSelectPageRoute.CausesValidation = false; _btnSelectPageRoute.Click += _btnSelectPageRoute_Click; _btnCancelPageRoute = new HyperLink(); _btnCancelPageRoute.CssClass = "btn btn-link btn-xs"; _btnCancelPageRoute.ID = string.Format( "btnCancelPageRoute_{0}", this.ID ); _btnCancelPageRoute.Text = "Cancel"; Controls.Add( _hfPageRouteId ); Controls.Add( _rblSelectPageRoute ); Controls.Add( _btnShowPageRoutePicker ); Controls.Add( _btnSelectPageRoute ); Controls.Add( _btnCancelPageRoute ); }
/// <summary> /// Creates the control(s) neccessary for prompting user for a new value /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id"></param> /// <returns> /// The control /// </returns> public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id ) { ListControl editControl = null; if ( configurationValues != null ) { if ( configurationValues.ContainsKey( "fieldtype" ) && configurationValues["fieldtype"].Value == "rb" ) { editControl = new RockRadioButtonList { ID = id }; ( (RadioButtonList)editControl ).RepeatDirection = RepeatDirection.Horizontal; } else { editControl = new RockDropDownList { ID = id }; } if ( configurationValues.ContainsKey( "values" ) ) { string listSource = configurationValues["values"].Value; if ( listSource.ToUpper().Contains( "SELECT" ) && listSource.ToUpper().Contains( "FROM" ) ) { var tableValues = new List<string>(); DataTable dataTable = new Rock.Data.Service().GetDataTable( listSource, CommandType.Text, null ); if ( dataTable != null && dataTable.Columns.Contains( "Value" ) && dataTable.Columns.Contains( "Text" ) ) { foreach ( DataRow row in dataTable.Rows ) { editControl.Items.Add( new ListItem( row["text"].ToString(), row["value"].ToString() ) ); } } } else { foreach ( string keyvalue in listSource.Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries ) ) { var keyValueArray = keyvalue.Split( new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries ); if ( keyValueArray.Length > 0 ) { ListItem li = new ListItem(); li.Value = keyValueArray[0]; li.Text = keyValueArray.Length > 1 ? keyValueArray[1] : keyValueArray[0]; editControl.Items.Add( li ); } } } } } return editControl; }
/// <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())); }
/// <summary> /// Creates the control(s) necessary for prompting user for a new value /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id"></param> /// <returns> /// The control /// </returns> public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id ) { if ( configurationValues != null ) { ListControl editControl = null; if ( configurationValues.ContainsKey( "fieldtype" ) && configurationValues["fieldtype"].Value == "rb" ) { editControl = new RockRadioButtonList { ID = id }; ( (RadioButtonList)editControl ).RepeatDirection = RepeatDirection.Horizontal; } else { editControl = new RockDropDownList { ID = id }; editControl.Items.Add( new ListItem() ); } foreach( var keyVal in Helper.GetConfiguredValues( configurationValues ) ) { editControl.Items.Add( new ListItem( keyVal.Value, keyVal.Key ) ); } if ( editControl.Items.Count > 0 ) { return editControl; } } return null; }
/// <summary> /// Adds a control to move the block to another zone on the page. /// </summary> private void AddBlockMove() { // Add Zone Selection Popup (for moving blocks to another zone) ModalDialog modalBlockMove = new ModalDialog(); modalBlockMove.ID = "modal-block-move"; modalBlockMove.Title = "Move Block"; modalBlockMove.OnOkScript = "Rock.admin.pageAdmin.saveBlockMove();"; this.Form.Controls.Add( modalBlockMove ); HtmlGenericControl fsZoneSelect = new HtmlGenericControl( "fieldset" ); fsZoneSelect.ClientIDMode = ClientIDMode.Static; fsZoneSelect.Attributes.Add( "id", "fsZoneSelect" ); modalBlockMove.Content.Controls.Add( fsZoneSelect ); HtmlGenericControl legend = new HtmlGenericControl( "legend" ); legend.InnerText = "New Location"; fsZoneSelect.Controls.Add( legend ); RockDropDownList ddlZones = new RockDropDownList(); ddlZones.ClientIDMode = ClientIDMode.Static; ddlZones.ID = "block-move-zone"; ddlZones.Label = "Zone"; foreach ( var zone in Zones ) ddlZones.Items.Add( new ListItem( zone.Value.Key, zone.Key ) ); fsZoneSelect.Controls.Add( ddlZones ); RockRadioButtonList rblLocation = new RockRadioButtonList(); rblLocation.RepeatDirection = RepeatDirection.Horizontal; rblLocation.ClientIDMode = ClientIDMode.Static; rblLocation.ID = "block-move-Location"; rblLocation.CssClass = "inputs-list"; rblLocation.Items.Add( new ListItem( "Current Page" ) ); rblLocation.Items.Add( new ListItem( string.Format( "All Pages Using the '{0}' Layout", _pageCache.Layout.Name ) ) ); rblLocation.Label = "Parent"; fsZoneSelect.Controls.Add( rblLocation ); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var controls = new List<Control>(); // Add the registration template picker int? selectedTemplateId = null; if ( _ddlRegistrationTemplate != null ) { selectedTemplateId = _ddlRegistrationTemplate.SelectedValueAsId(); } _ddlRegistrationTemplate = new RockDropDownList(); _ddlRegistrationTemplate.CssClass = "js-registration-template"; _ddlRegistrationTemplate.ID = filterControl.ID + "_ddlRegistrationTemplate"; _ddlRegistrationTemplate.Label = "Registration Template"; _ddlRegistrationTemplate.DataTextField = "Name"; _ddlRegistrationTemplate.DataValueField = "Id"; _ddlRegistrationTemplate.DataSource = new RegistrationTemplateService( new RockContext() ).Queryable() .OrderBy( a => a.Name ) .Select( d => new { d.Id, d.Name } ) .ToList(); _ddlRegistrationTemplate.DataBind(); _ddlRegistrationTemplate.SelectedIndexChanged += ddlRegistrationTemplate_SelectedIndexChanged; _ddlRegistrationTemplate.AutoPostBack = true; _ddlRegistrationTemplate.SelectedValue = selectedTemplateId.ToStringSafe(); filterControl.Controls.Add( _ddlRegistrationTemplate ); // Now add the registration instance picker _ddlRegistrationInstance = new RockDropDownList(); _ddlRegistrationInstance.CssClass = "js-registration-instance"; _ddlRegistrationInstance.Label = "Registration Instance"; _ddlRegistrationInstance.ID = filterControl.ID + "_ddlRegistrationInstance"; filterControl.Controls.Add( _ddlRegistrationInstance ); PopulateRegistrationInstanceList( _ddlRegistrationTemplate.SelectedValueAsId () ?? 0 ); _rblRegistrationType = new RockRadioButtonList(); _rblRegistrationType.CssClass = "js-registration-type"; _rblRegistrationType.ID = filterControl.ID + "_registrationType"; _rblRegistrationType.RepeatDirection = RepeatDirection.Horizontal; _rblRegistrationType.Label = "Person"; _rblRegistrationType.Help = "Choose whether to filter by the person who did the registering (registrar) or the person who was registered (registrant)."; _rblRegistrationType.Items.Add( new ListItem( "Registrar", "1" ) ); _rblRegistrationType.Items.Add( new ListItem( "Registrant", "2" ) ); _rblRegistrationType.SelectedValue = "2"; filterControl.Controls.Add( _rblRegistrationType ); return new Control[3] { _ddlRegistrationTemplate, _ddlRegistrationInstance, _rblRegistrationType }; }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="parentControl"></param> /// <returns></returns> public override System.Web.UI.Control[] CreateChildControls( System.Web.UI.Control parentControl ) { RockDropDownList locationTypeList = new RockDropDownList(); locationTypeList.Items.Clear(); foreach ( var value in DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid() ).DefinedValues.OrderBy( a => a.Order ).ThenBy( a => a.Value ) ) { locationTypeList.Items.Add( new ListItem( value.Value, value.Guid.ToString() ) ); } locationTypeList.ID = parentControl.ID + "_grouplocationType"; locationTypeList.Label = "Address Type"; locationTypeList.SelectedIndex = 0; parentControl.Controls.Add( locationTypeList ); RockRadioButtonList addressPartRadioButtonList = new RockRadioButtonList(); addressPartRadioButtonList.Items.Clear(); addressPartRadioButtonList.BindToEnum<RockUdfHelper.AddressNamePart>( false ); // Localises the radio button list by modifying the text Value of radio buttons Dictionary<string, string> newLabels = new Dictionary<string, string>(); var globalAttributesCache = GlobalAttributesCache.Read(); var defaultCountry = ( !string.IsNullOrWhiteSpace( globalAttributesCache.OrganizationCountry ) ) ? globalAttributesCache.OrganizationCountry : "US"; var countryValue = DefinedTypeCache.Read( new Guid( SystemGuid.DefinedType.LOCATION_COUNTRIES ) ) .DefinedValues .Where( v => v.Value.Equals( defaultCountry, StringComparison.OrdinalIgnoreCase ) ) .FirstOrDefault(); if ( countryValue != null ) { if ( !newLabels.ContainsKey( "City" ) ) { newLabels.Add( "City", countryValue.GetAttributeValue( "CityLabel" ) ); } if ( !newLabels.ContainsKey( "Region" ) ) { newLabels.Add( "Region", countryValue.GetAttributeValue( "StateLabel" ) ); } if ( !newLabels.ContainsKey( "PostalCode" ) ) { newLabels.Add( "PostalCode", countryValue.GetAttributeValue( "PostalCodeLabel" ) ); } } foreach ( KeyValuePair<string, string> pair in newLabels ) { string oldValue = pair.Key.SplitCase(); string newValue = pair.Value.SplitCase(); var listItem = addressPartRadioButtonList.Items.FindByText( oldValue ); if ( listItem != null ) { listItem.Text = newValue; } } // default to first one addressPartRadioButtonList.SelectedIndex = 0; addressPartRadioButtonList.ID = parentControl.ID + "_addressPartRadioButtonList"; addressPartRadioButtonList.Label = "Address Part"; addressPartRadioButtonList.Help = "Select the part of the address to show in the grid, or select Full to show the full address"; parentControl.Controls.Add( addressPartRadioButtonList ); return new System.Web.UI.Control[] { locationTypeList, addressPartRadioButtonList }; }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="parentControl"></param> /// <returns></returns> public override System.Web.UI.Control[] CreateChildControls( System.Web.UI.Control parentControl ) { RockRadioButtonList rblShowAsLinkType = new RockRadioButtonList(); rblShowAsLinkType.ID = parentControl.ID + "_rblShowAsLinkType"; rblShowAsLinkType.Items.Add( new ListItem( "Show Name Only", ShowAsLinkType.NameOnly.ConvertToInt().ToString() ) ); rblShowAsLinkType.Items.Add( new ListItem( "Show as Person Link", ShowAsLinkType.PersonLink.ConvertToInt().ToString() ) ); rblShowAsLinkType.Items.Add( new ListItem( "Show as Group Member Link", ShowAsLinkType.GroupMemberLink.ConvertToInt().ToString() ) ); parentControl.Controls.Add( rblShowAsLinkType ); return new System.Web.UI.Control[] { rblShowAsLinkType }; }
/// <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(); }
/// <summary> /// Updates the entity type controls. /// </summary> private void UpdateEntityTypeControls() { var metricService = new MetricService( new RockContext() ); var metric = metricService.Get( this.MetricId ?? 0 ); _phEntityTypeEntityIdValue.Controls.Clear(); string fieldTypeName = null; Control entityTypeEditControl = null; if ( metric != null ) { var entityType = EntityTypeCache.Read( metric.EntityTypeId ?? 0 ); if ( entityType != null && entityType.SingleValueFieldType != null ) { fieldTypeName = entityType.SingleValueFieldType.Name; entityTypeEditControl = entityType.SingleValueFieldType.Field.EditControl( new Dictionary<string, Field.ConfigurationValue>(), string.Format( "{0}_{1}_Picker", this.ID, fieldTypeName ) ); } } // only set the _entityTypeEditControl is needs to be if ( _entityTypeEditControl == null || !_entityTypeEditControl.GetType().Equals( entityTypeEditControl.GetType() ) || _entityTypeEditControl.ID != entityTypeEditControl.ID ) { _entityTypeEditControl = entityTypeEditControl; } if ( _entityTypeEditControl != null ) { var rockControlWrapper = new RockControlWrapper(); rockControlWrapper.Label = string.Format( "{0} filter", fieldTypeName ); rockControlWrapper.Help = string.Format( "Either select a specific {0}, or select 'Get from page context' to determine the {0} based on the page context. Leave {0} blank to show values for all {1}", fieldTypeName, fieldTypeName.Pluralize() ); rockControlWrapper.ID = string.Format( "{0}_{1}", this.ID, "rockControlWrapper" ); _phEntityTypeEntityIdValue.Controls.Add( rockControlWrapper ); if ( _rblSelectOrContext == null ) { _rblSelectOrContext = new RockRadioButtonList(); _rblSelectOrContext.ID = string.Format( "{0}_{1}", this.ID, "rblSelectOrContext" ); _rblSelectOrContext.RepeatDirection = RepeatDirection.Horizontal; _rblSelectOrContext.Items.Add( new ListItem( "Select " + fieldTypeName, "0" ) ); _rblSelectOrContext.Items.Add( new ListItem( "Get from page context", "1" ) ); _rblSelectOrContext.AutoPostBack = true; _rblSelectOrContext.SelectedIndexChanged += rblSelectOrContext_SelectedIndexChanged; } else { _rblSelectOrContext.Items[0].Text = "Select " + fieldTypeName; } rockControlWrapper.Controls.Add( _rblSelectOrContext ); if ( string.IsNullOrEmpty( _rblSelectOrContext.SelectedValue ) ) { // might have to get the SelectedValue since we re-created the control after Load() _rblSelectOrContext.SelectedValue = this.Page.Request.Params[_rblSelectOrContext.UniqueID]; } if ( string.IsNullOrEmpty( _rblSelectOrContext.SelectedValue ) ) { // if not set from either what it was, or from PageContext, default it to "Get from page context" _rblSelectOrContext.SelectedValue = "1"; } _entityTypeEditControl.Visible = _rblSelectOrContext.SelectedValue.AsIntegerOrNull() == 0; rockControlWrapper.Controls.Add( _entityTypeEditControl ); if ( _cbCombine == null ) { _cbCombine = new RockCheckBox(); _cbCombine.ID = string.Format( "{0}_{1}", this.ID, "cbCombine" ); } _cbCombine.Text = "Combine multiple values to one line when showing values for multiple " + fieldTypeName.Pluralize(); rockControlWrapper.Controls.Add( _cbCombine ); } }
/// <summary> /// Updates the entity type controls. /// </summary> private void UpdateEntityTypeControls() { var metricService = new MetricService(new RockContext()); var metric = metricService.Get(this.MetricId ?? 0); _phEntityTypeEntityIdValue.Controls.Clear(); string fieldTypeName = null; Control entityTypeEditControl = null; if (metric != null) { var entityType = EntityTypeCache.Read(metric.EntityTypeId ?? 0); if (entityType != null && entityType.SingleValueFieldType != null) { fieldTypeName = entityType.SingleValueFieldType.Name; entityTypeEditControl = entityType.SingleValueFieldType.Field.EditControl(new Dictionary <string, Field.ConfigurationValue>(), string.Format("{0}_{1}_Picker", this.ID, fieldTypeName)); } } // only set the _entityTypeEditControl is needs to be if (_entityTypeEditControl == null || !_entityTypeEditControl.GetType().Equals(entityTypeEditControl.GetType()) || _entityTypeEditControl.ID != entityTypeEditControl.ID) { _entityTypeEditControl = entityTypeEditControl; } if (_entityTypeEditControl != null) { var rockControlWrapper = new RockControlWrapper(); rockControlWrapper.Label = string.Format("{0} filter", fieldTypeName); rockControlWrapper.Help = string.Format( "Either select a specific {0}, or select 'Get from page context' to determine the {0} based on the page context. Leave {0} blank to show values for all {1}", fieldTypeName, fieldTypeName.Pluralize()); rockControlWrapper.ID = string.Format("{0}_{1}", this.ID, "rockControlWrapper"); _phEntityTypeEntityIdValue.Controls.Add(rockControlWrapper); if (_rblSelectOrContext == null) { _rblSelectOrContext = new RockRadioButtonList(); _rblSelectOrContext.ID = string.Format("{0}_{1}", this.ID, "rblSelectOrContext"); _rblSelectOrContext.RepeatDirection = RepeatDirection.Horizontal; _rblSelectOrContext.Items.Add(new ListItem("Select " + fieldTypeName, "0")); _rblSelectOrContext.Items.Add(new ListItem("Get from page context", "1")); _rblSelectOrContext.AutoPostBack = true; _rblSelectOrContext.SelectedIndexChanged += rblSelectOrContext_SelectedIndexChanged; } else { _rblSelectOrContext.Items[0].Text = "Select " + fieldTypeName; } rockControlWrapper.Controls.Add(_rblSelectOrContext); if (string.IsNullOrEmpty(_rblSelectOrContext.SelectedValue)) { // might have to get the SelectedValue since we re-created the control after Load() _rblSelectOrContext.SelectedValue = this.Page.Request.Params[_rblSelectOrContext.UniqueID]; } if (string.IsNullOrEmpty(_rblSelectOrContext.SelectedValue)) { // if not set from either what it was, or from PageContext, default it to "Get from page context" _rblSelectOrContext.SelectedValue = "1"; } _entityTypeEditControl.Visible = _rblSelectOrContext.SelectedValue.AsIntegerOrNull() == 0; rockControlWrapper.Controls.Add(_entityTypeEditControl); if (_cbCombine == null) { _cbCombine = new RockCheckBox(); _cbCombine.ID = string.Format("{0}_{1}", this.ID, "cbCombine"); } _cbCombine.Text = "Combine multiple values to one line when showing values for multiple " + fieldTypeName.Pluralize(); rockControlWrapper.Controls.Add(_cbCombine); } }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="parentControl"></param> /// <returns></returns> public override System.Web.UI.Control[] CreateChildControls( System.Web.UI.Control parentControl ) { RockDropDownList locationTypeList = new RockDropDownList(); locationTypeList.Items.Clear(); foreach ( var value in DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid() ).DefinedValues.OrderBy( a => a.Order ).ThenBy( a => a.Value ) ) { locationTypeList.Items.Add( new ListItem( value.Value, value.Guid.ToString() ) ); } locationTypeList.Items.Insert( 0, Rock.Constants.None.ListItem ); locationTypeList.ID = parentControl.ID + "_grouplocationType"; locationTypeList.Label = "Address Type"; parentControl.Controls.Add( locationTypeList ); RockRadioButtonList addressPartRadioButtonList = new RockRadioButtonList(); addressPartRadioButtonList.Items.Clear(); addressPartRadioButtonList.BindToEnum<AddressNamePart>( false ); // default to first one addressPartRadioButtonList.SelectedIndex = 0; addressPartRadioButtonList.ID = parentControl.ID + "_addressPartRadioButtonList"; addressPartRadioButtonList.Label = "Address Part"; addressPartRadioButtonList.Help = "Select the part of the address to show in the grid, or select Full to show the full address"; parentControl.Controls.Add( addressPartRadioButtonList ); return new System.Web.UI.Control[] { locationTypeList, addressPartRadioButtonList }; }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="parentControl"></param> /// <returns></returns> public override System.Web.UI.Control[] CreateChildControls( System.Web.UI.Control parentControl ) { RockRadioButtonList rblShowAsLinkType = new RockRadioButtonList(); rblShowAsLinkType.ID = parentControl.ID + "_rblShowAsLinkType"; rblShowAsLinkType.Items.Add( new ListItem( "Show Name Only", ShowAsLinkType.NameOnly.ConvertToInt().ToString() ) ); rblShowAsLinkType.Items.Add( new ListItem( "Show as Person Link", ShowAsLinkType.PersonLink.ConvertToInt().ToString() ) ); rblShowAsLinkType.Items.Add( new ListItem( "Show as Group Member Link", ShowAsLinkType.GroupMemberLink.ConvertToInt().ToString() ) ); parentControl.Controls.Add( rblShowAsLinkType ); int? selectedGroupTypeId = null; if ( groupTypePicker != null ) { selectedGroupTypeId = groupTypePicker.SelectedGroupTypeId; } groupTypePicker = new GroupTypePicker(); groupTypePicker.ID = parentControl.ID + "_groupTypePicker"; groupTypePicker.Label = "Group Type"; groupTypePicker.GroupTypes = new GroupTypeService( new RockContext() ).Queryable().OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList(); groupTypePicker.SelectedIndexChanged += groupTypePicker_SelectedIndexChanged; groupTypePicker.AutoPostBack = true; groupTypePicker.SelectedGroupTypeId = selectedGroupTypeId; parentControl.Controls.Add( groupTypePicker ); cblRole = new RockCheckBoxList(); cblRole.Label = "with Group Role(s)"; cblRole.ID = parentControl.ID + "_cblRole"; parentControl.Controls.Add( cblRole ); PopulateGroupRolesCheckList( groupTypePicker.SelectedGroupTypeId ?? 0 ); RockDropDownList ddlGroupMemberStatus = new RockDropDownList(); ddlGroupMemberStatus.CssClass = "js-group-member-status"; ddlGroupMemberStatus.ID = parentControl.ID + "_ddlGroupMemberStatus"; ddlGroupMemberStatus.Label = "with Group Member Status"; ddlGroupMemberStatus.Help = "Select a specific group member status to only include group members with that status. Leaving this blank will return all members."; ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true ); ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() ); parentControl.Controls.Add( ddlGroupMemberStatus ); return new System.Web.UI.Control[] { rblShowAsLinkType, groupTypePicker, cblRole, ddlGroupMemberStatus }; }