/// <summary> /// Handles the SelectItem event of the gp control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> void gp_SelectItem( object sender, EventArgs e ) { if ( GroupPickerSelect != null ) { GroupPicker gp = sender as GroupPicker; if ( gp != null ) { GridViewRow row = (GridViewRow)( (LinkButton)sender ).Parent.Parent; GroupPickerRowEventArgs args = new GroupPickerRowEventArgs( row, gp.SelectedValueAsInt() ); GroupPickerSelect( sender, args ); } } }
/// <summary> /// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template. /// </summary> /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param> public void InstantiateIn( Control container ) { DataControlFieldCell cell = container as DataControlFieldCell; if ( cell != null ) { GroupPickerField groupPickerField = cell.ContainingField as GroupPickerField; ParentGrid = groupPickerField.ParentGrid; ColumnIndex = groupPickerField.ColumnIndex; GroupPicker gp = new GroupPicker(); gp.ID = "groupPicker_" + ColumnIndex.ToString(); gp.RootGroupId = groupPickerField.RootGroupId; gp.SelectItem += gp_SelectItem; cell.Controls.Add( gp ); } }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = filterControl.ID + "_pGroupPicker"; pGroupPicker.AddCssClass( "js-group-picker" ); filterControl.Controls.Add( pGroupPicker ); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildGroups"; cbChildGroups.AddCssClass( "js-child-groups" ); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add( cbChildGroups ); var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes ); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass( "js-filter-compare" ); filterControl.Controls.Add( ddlIntegerCompare ); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass( "js-attended-count" ); filterControl.Controls.Add( tbAttendedCount ); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass( "js-sliding-date-range" ); filterControl.Controls.Add( slidingDateRangePicker ); var controls = new Control[5] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace( "|", "," ); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format( "{0}|{1}|{2}|{3}|false", string.Empty, ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues ) ); return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="entityType"></param> /// <param name="filterControl"></param> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { _GpkParentGroup = new GroupPicker(); _GpkParentGroup.ID = filterControl.ID + "_0"; _GpkParentGroup.Label = "Parent Group"; filterControl.Controls.Add( _GpkParentGroup ); _CboIncludedGroups = new RockDropDownList(); _CboIncludedGroups.ID = filterControl.ID + "_1"; _CboIncludedGroups.Label = "Branch Type"; _CboIncludedGroups.Items.Add( new ListItem { Text = "Parent and Descendants", Value = IncludedGroupsSpecifier.EntireBranch.ToString(), Selected = true } ); _CboIncludedGroups.Items.Add( new ListItem { Text = "Descendants Only", Value = IncludedGroupsSpecifier.DescendantsOnly.ToString() } ); filterControl.Controls.Add( _CboIncludedGroups ); return new Control[] { _GpkParentGroup, _CboIncludedGroups }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { gp = new GroupPicker(); gp.ID = filterControl.ID + "_0"; gp.Label = "Group"; gp.SelectItem += gp_SelectItem; filterControl.Controls.Add( gp ); cblRole = new RockCheckBoxList(); cblRole.Label = "with Group Role(s)"; cblRole.ID = filterControl.ID + "_1"; filterControl.Controls.Add( cblRole ); return new Control[2] { gp, cblRole }; }
/// <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 System.Web.UI.Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id ) { GroupPicker groupPicker = new GroupPicker { ID = id }; return groupPicker; }
/// <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 HiddenField(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.Value = "False"; _hfActivityGuid = new HiddenField(); Controls.Add(_hfActivityGuid); _hfActivityGuid.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"; _lblStatus = new Label(); Controls.Add(_lblStatus); _lblStatus.ClientIDMode = ClientIDMode.Static; _lblStatus.ID = this.ID + "_lblInactive"; _lblStatus.CssClass = "pull-right"; _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>" }); _cbActivityIsComplete = new RockCheckBox { Text = "Complete" }; Controls.Add(_cbActivityIsComplete); _cbActivityIsComplete.ID = this.ID + "_cbActivityTypeIsActive"; _cbActivityIsComplete.Label = "Activity Completed"; _cbActivityIsComplete.Text = "Yes"; _ppAssignedToPerson = new PersonPicker(); _ppAssignedToPerson.ID = this.ID + "_ppAssignedToPerson"; Controls.Add(_ppAssignedToPerson); _ppAssignedToPerson.Label = "Assign to Person"; _lAssignedToPerson = new RockLiteral(); _lAssignedToPerson.ID = this.ID + "_lAssignedToPerson"; Controls.Add(_lAssignedToPerson); _lAssignedToPerson.Label = "Assigned to Person"; _gpAssignedToGroup = new GroupPicker(); _gpAssignedToGroup.ID = this.ID + "_gpAssignedToGroup"; Controls.Add(_gpAssignedToGroup); _gpAssignedToGroup.Label = "Assign to Group"; _lAssignedToGroup = new RockLiteral(); _lAssignedToGroup.ID = this.ID + "_lAssignedToGroup"; Controls.Add(_lAssignedToGroup); _lAssignedToGroup.Label = "Assigned to Group"; _ddlAssignedToRole = new RockDropDownList(); Controls.Add(_ddlAssignedToRole); _ddlAssignedToRole.ID = this.ID + "_ddlAssignedToRole"; _ddlAssignedToRole.Label = "Assign to Security Role"; _lAssignedToRole = new RockLiteral(); _lAssignedToRole.ID = this.ID + "_lAssignedToRole"; Controls.Add(_lAssignedToRole); _lAssignedToRole.Label = "Assigned to Security Role"; _lState = new Literal(); Controls.Add(_lState); _lState.ID = this.ID + "_lState"; _ddlAssignedToRole.Items.Add(new ListItem(string.Empty, "0")); var roles = new GroupService(new RockContext()).Queryable().Where(g => g.IsSecurityRole).OrderBy(t => t.Name); if (roles.Any()) { foreach (var role in roles) { _ddlAssignedToRole.Items.Add(new ListItem(role.Name, role.Id.ToString())); } } _phAttributes = new PlaceHolder(); Controls.Add(_phAttributes); _phAttributes.ID = this.ID + "_phAttributes"; }
/// <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 HiddenField(); Controls.Add( _hfExpanded ); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.Value = "False"; _hfActivityGuid = new HiddenField(); Controls.Add( _hfActivityGuid ); _hfActivityGuid.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"; _lblStatus = new Label(); Controls.Add( _lblStatus ); _lblStatus.ClientIDMode = ClientIDMode.Static; _lblStatus.ID = this.ID + "_lblInactive"; _lblStatus.CssClass = "label label-important pull-right"; _lbDeleteActivityType = new LinkButton(); Controls.Add( _lbDeleteActivityType ); _lbDeleteActivityType.CausesValidation = false; _lbDeleteActivityType.ID = this.ID + "_lbDeleteActivityType"; _lbDeleteActivityType.CssClass = "btn btn-xs btn-danger js-activity-delete"; _lbDeleteActivityType.Click += lbDeleteActivityType_Click; _lbDeleteActivityType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } ); _cbActivityIsComplete = new RockCheckBox { Text = "Complete" }; Controls.Add( _cbActivityIsComplete ); _cbActivityIsComplete.ID = this.ID + "_cbActivityTypeIsActive"; _ppAssignedToPerson = new PersonPicker(); _ppAssignedToPerson.ID = this.ID + "_ppAssignedToPerson"; Controls.Add( _ppAssignedToPerson ); _ppAssignedToPerson.Label = "Assign to Person"; _gpAssignedToGroup = new GroupPicker(); _gpAssignedToGroup.ID = this.ID + "_gpAssignedToGroup"; Controls.Add( _gpAssignedToGroup ); _gpAssignedToGroup.Label = "Assign to Group"; _ddlAssignedToRole = new RockDropDownList(); Controls.Add( _ddlAssignedToRole ); _ddlAssignedToRole.ID = this.ID + "_ddlAssignedToRole"; _ddlAssignedToRole.Label = "Assign to Security Role"; _lState = new Literal(); Controls.Add( _lState ); _lState.ID = this.ID + "_lState"; _ddlAssignedToRole.Items.Add( new ListItem( string.Empty, "0" ) ); var roles = new GroupService( new RockContext() ).Queryable().Where( g => g.IsSecurityRole ).OrderBy( t => t.Name ); if ( roles.Any() ) { foreach ( var role in roles ) { _ddlAssignedToRole.Items.Add( new ListItem( role.Name, role.Id.ToString() ) ); } } _phAttributes = new PlaceHolder(); Controls.Add( _phAttributes ); _phAttributes.ID = this.ID + "_phAttributes"; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { gp = new GroupPicker(); gp.ID = filterControl.ID + "_gp"; gp.Label = "Group(s)"; gp.SelectItem += gp_SelectItem; gp.CssClass = "js-group-picker"; gp.AllowMultiSelect = true; filterControl.Controls.Add( gp ); cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildsGroups"; cbChildGroups.Text = "Include Child Group(s)"; cbChildGroups.CssClass = "js-include-child-groups"; cbChildGroups.AutoPostBack = true; cbChildGroups.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbChildGroups ); cbIncludeSelectedGroup = new RockCheckBox(); cbIncludeSelectedGroup.ID = filterControl.ID + "_cbIncludeSelectedGroup"; cbIncludeSelectedGroup.Text = "Include Selected Group(s)"; cbIncludeSelectedGroup.CssClass = "js-include-selected-groups"; cbIncludeSelectedGroup.AutoPostBack = true; cbIncludeSelectedGroup.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbIncludeSelectedGroup ); cbChildGroupsPlusDescendants = new RockCheckBox(); cbChildGroupsPlusDescendants.ID = filterControl.ID + "_cbChildGroupsPlusDescendants"; cbChildGroupsPlusDescendants.Text = "Include All Descendants(s)"; cbChildGroupsPlusDescendants.CssClass = "js-include-child-groups-descendants"; cbChildGroupsPlusDescendants.AutoPostBack = true; cbChildGroupsPlusDescendants.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbChildGroupsPlusDescendants ); cbIncludeInactiveGroups = new RockCheckBox(); cbIncludeInactiveGroups.ID = filterControl.ID + "_cbIncludeInactiveGroups"; cbIncludeInactiveGroups.Text = "Include Inactive Groups"; cbIncludeInactiveGroups.CssClass = "js-include-inactive-groups"; cbIncludeInactiveGroups.AutoPostBack = true; cbIncludeInactiveGroups.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbIncludeInactiveGroups ); cblRole = new RockCheckBoxList(); cblRole.Label = "with Group Member Role(s) (optional)"; cblRole.ID = filterControl.ID + "_cblRole"; cblRole.CssClass = "js-roles"; cblRole.Visible = false; filterControl.Controls.Add( cblRole ); RockDropDownList ddlGroupMemberStatus = new RockDropDownList(); ddlGroupMemberStatus.CssClass = "js-group-member-status"; ddlGroupMemberStatus.ID = filterControl.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() ); filterControl.Controls.Add( ddlGroupMemberStatus ); PanelWidget pwAdvanced = new PanelWidget(); filterControl.Controls.Add( pwAdvanced ); pwAdvanced.ID = filterControl.ID + "_pwAttributes"; pwAdvanced.Title = "Advanced Filters"; pwAdvanced.CssClass = "advanced-panel"; SlidingDateRangePicker addedOnDateRangePicker = new SlidingDateRangePicker(); addedOnDateRangePicker.ID = pwAdvanced.ID + "_addedOnDateRangePicker"; addedOnDateRangePicker.AddCssClass( "js-sliding-date-range" ); addedOnDateRangePicker.Label = "Date Added:"; addedOnDateRangePicker.Help = "Select the date range that the person was added to the group. Leaving this blank will not restrict results to a date range."; pwAdvanced.Controls.Add( addedOnDateRangePicker ); return new Control[9] { gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus, cbIncludeInactiveGroups, addedOnDateRangePicker, pwAdvanced }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { gp = new GroupPicker(); gp.ID = filterControl.ID + "_gp"; gp.Label = "Group"; gp.SelectItem += gp_SelectItem; filterControl.Controls.Add( gp ); cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildsGroups"; cbChildGroups.Text = "Include Child Group(s)"; cbChildGroups.AutoPostBack = true; cbChildGroups.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbChildGroups ); cblRole = new RockCheckBoxList(); cblRole.Label = "with Group Member Role(s) (optional)"; cblRole.ID = filterControl.ID + "_cblRole"; cblRole.Visible = false; filterControl.Controls.Add( cblRole ); return new Control[3] { gp, cbChildGroups, cblRole }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { gp = new GroupPicker(); gp.ID = filterControl.ID + "_gp"; gp.Label = "Group(s)"; gp.SelectItem += gp_SelectItem; gp.CssClass = "js-group-picker"; gp.AllowMultiSelect = true; filterControl.Controls.Add( gp ); cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildsGroups"; cbChildGroups.Text = "Include Child Group(s)"; cbChildGroups.CssClass = "js-include-child-groups"; cbChildGroups.AutoPostBack = true; cbChildGroups.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbChildGroups ); cbIncludeSelectedGroup = new RockCheckBox(); cbIncludeSelectedGroup.ID = filterControl.ID + "_cbIncludeSelectedGroup"; cbIncludeSelectedGroup.Text = "Include Selected Group(s)"; cbIncludeSelectedGroup.CssClass = "js-include-selected-groups"; cbIncludeSelectedGroup.AutoPostBack = true; cbIncludeSelectedGroup.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbIncludeSelectedGroup ); cbChildGroupsPlusDescendants = new RockCheckBox(); cbChildGroupsPlusDescendants.ID = filterControl.ID + "_cbChildGroupsPlusDescendants"; cbChildGroupsPlusDescendants.Text = "Include All Descendants(s)"; cbChildGroupsPlusDescendants.CssClass = "js-include-child-groups-descendants"; cbChildGroupsPlusDescendants.AutoPostBack = true; cbChildGroupsPlusDescendants.CheckedChanged += gp_SelectItem; filterControl.Controls.Add( cbChildGroupsPlusDescendants ); cblRole = new RockCheckBoxList(); cblRole.Label = "with Group Member Role(s) (optional)"; cblRole.ID = filterControl.ID + "_cblRole"; cblRole.CssClass = "js-roles"; cblRole.Visible = false; filterControl.Controls.Add( cblRole ); RockDropDownList ddlGroupMemberStatus = new RockDropDownList(); ddlGroupMemberStatus.CssClass = "js-group-member-status"; ddlGroupMemberStatus.ID = filterControl.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() ); filterControl.Controls.Add( ddlGroupMemberStatus ); return new Control[6] { gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { gp = new GroupPicker(); gp.ID = filterControl.ID + "_gp"; gp.Label = "Group"; filterControl.Controls.Add( gp ); return new Control[1] { gp }; }