/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { RockDropDownList groupLocationTypeList = new RockDropDownList(); groupLocationTypeList.Items.Clear(); foreach ( var value in Rock.Web.Cache.DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid() ).DefinedValues.OrderBy( a => a.Order ).ThenBy( a => a.Value ) ) { groupLocationTypeList.Items.Add( new ListItem( value.Value, value.Guid.ToString() ) ); } groupLocationTypeList.Items.Insert( 0, Rock.Constants.None.ListItem ); groupLocationTypeList.ID = filterControl.ID + "_groupLocationTypeList"; groupLocationTypeList.Label = "Location Type"; filterControl.Controls.Add( groupLocationTypeList ); LocationPicker locationPicker = new LocationPicker(); locationPicker.ID = filterControl.ID + "_locationPicker"; locationPicker.Label = "Location"; filterControl.Controls.Add( locationPicker ); NumberBox numberBox = new NumberBox(); numberBox.ID = filterControl.ID + "_numberBox"; numberBox.NumberType = ValidationDataType.Double; numberBox.Label = "Miles"; numberBox.AddCssClass( "number-box-miles" ); filterControl.Controls.Add( numberBox ); return new Control[3] { groupLocationTypeList, locationPicker, numberBox }; }
/// <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( new RockContext() ).Queryable() ) { ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Guid.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; }
/// <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( new RockContext() ).Queryable() ) { ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Guid.ToString() ) ); } var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes ); ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; filterControl.Controls.Add( ddlIntegerCompare ); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; filterControl.Controls.Add( tbAttendedCount ); var tbInLastWeeksCount = new RockTextBox(); tbInLastWeeksCount.ID = filterControl.ID + "_tbInLastWeeksCount"; filterControl.Controls.Add( tbInLastWeeksCount ); var controls = new Control[4] { ddlGroupType, ddlIntegerCompare, tbAttendedCount, tbInLastWeeksCount }; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format( "{0}|{1}|4|16", ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) ); return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var comparisonControl = this.ComparisonControl( ComparisonType.LessThan | ComparisonType.GreaterThanOrEqualTo ); comparisonControl.ID = filterControl.ID + "_0"; filterControl.Controls.Add( comparisonControl ); var globalAttributes = Rock.Web.Cache.GlobalAttributesCache.Read(); NumberBox numberBoxAmount = new NumberBox(); numberBoxAmount.PrependText = globalAttributes.GetValue("CurrencySymbol") ?? "$"; numberBoxAmount.NumberType = ValidationDataType.Currency; numberBoxAmount.ID = filterControl.ID + "_1"; numberBoxAmount.Label = "Amount"; filterControl.Controls.Add( numberBoxAmount ); DateRangePicker dateRangePicker = new DateRangePicker(); dateRangePicker.ID = filterControl.ID + "_2"; dateRangePicker.Label = "Date Range"; dateRangePicker.Required = true; filterControl.Controls.Add( dateRangePicker ); var controls = new Control[3] { comparisonControl, numberBoxAmount, dateRangePicker }; SetSelection( entityType, controls, string.Format( "{0}|||", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) ); return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var controls = new List<Control>(); var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes ); ddlIntegerCompare.ID = string.Format( "{0}_{1}", filterControl.ID, controls.Count() ); ddlIntegerCompare.AddCssClass( "js-filter-compare" ); filterControl.Controls.Add( ddlIntegerCompare ); controls.Add( ddlIntegerCompare ); var ddlGradeDefinedValue = new RockDropDownList(); ddlGradeDefinedValue.ID = string.Format( "{0}_{1}", filterControl.ID, controls.Count() ); ddlGradeDefinedValue.AddCssClass( "js-filter-control" ); ddlGradeDefinedValue.Items.Clear(); // add blank item as first item ddlGradeDefinedValue.Items.Add( new ListItem() ); var schoolGrades = DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.SCHOOL_GRADES.AsGuid() ); if ( schoolGrades != null ) { foreach ( var schoolGrade in schoolGrades.DefinedValues.OrderByDescending( a => a.Value.AsInteger() ) ) { ddlGradeDefinedValue.Items.Add( new ListItem( schoolGrade.Description, schoolGrade.Guid.ToString() ) ); } } filterControl.Controls.Add( ddlGradeDefinedValue ); controls.Add( ddlGradeDefinedValue ); return controls.ToArray(); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var controls = new List<Control>(); var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes | ComparisonType.Between ); ddlIntegerCompare.ID = string.Format( "{0}_{1}", filterControl.ID, "ddlIntegerCompare" ); ddlIntegerCompare.AddCssClass( "js-filter-compare" ); filterControl.Controls.Add( ddlIntegerCompare ); controls.Add( ddlIntegerCompare ); var numberBox = new NumberBox(); numberBox.ID = string.Format( "{0}_{1}", filterControl.ID, "numberBox" ); numberBox.AddCssClass( "js-filter-control" ); filterControl.Controls.Add( numberBox ); controls.Add( numberBox ); numberBox.FieldName = "Age"; var numberRangeEditor = new Rock.Web.UI.Controls.NumberRangeEditor(); numberRangeEditor.ID = string.Format( "{0}_{1}", filterControl.ID, "numberRangeEditor" ); numberRangeEditor.RangeLabel = "and"; numberRangeEditor.AddCssClass( "js-filter-control-between" ); filterControl.Controls.Add( numberRangeEditor ); controls.Add( numberRangeEditor ); return controls.ToArray(); }
/// <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 }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { CampusPicker campusPicker = new CampusPicker(); campusPicker.ID = filterControl.ID + "_campusPicker"; campusPicker.Label = "Campus"; campusPicker.Campuses = CampusCache.All(); filterControl.Controls.Add( campusPicker ); return new Control[] { campusPicker }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { WorkflowTypePicker workflowTypePicker = new WorkflowTypePicker(); workflowTypePicker.ID = filterControl.ID + "_workflowTypePicker"; workflowTypePicker.CssClass = "js-workflow-type-picker"; workflowTypePicker.Label = "Workflow Type"; filterControl.Controls.Add( workflowTypePicker ); return new Control[] { workflowTypePicker }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { CampusPicker campusPicker = new CampusPicker(); campusPicker.ID = filterControl.ID + "_campusPicker"; campusPicker.Label = "Campus"; campusPicker.Campuses = new CampusService( new RockContext() ).Queryable().OrderBy( a => a.Name ).ToList(); filterControl.Controls.Add( campusPicker ); return new Control[] { campusPicker }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { GroupTypePicker groupTypePicker = new GroupTypePicker(); groupTypePicker.ID = filterControl.ID + "_groupTypePicker"; groupTypePicker.Label = "Group Type"; groupTypePicker.GroupTypes = new GroupTypeService( new RockContext() ).Queryable().OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList(); filterControl.Controls.Add( groupTypePicker ); return new Control[] { groupTypePicker }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { lp = new LocationPicker(); lp.ID = filterControl.ID + "_lp"; lp.Label = "Location"; lp.AllowedPickerModes = LocationPickerMode.Named | LocationPickerMode.Polygon; lp.CurrentPickerMode = lp.GetBestPickerModeForLocation( null ); filterControl.Controls.Add( lp ); return new Control[1] { lp }; }
/// <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> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { CampusesPicker campusesPicker = new CampusesPicker(); campusesPicker.ID = filterControl.ID + "_0"; campusesPicker.Label = string.Empty; campusesPicker.CssClass = "js-campuses-picker campuses-picker"; campusesPicker.Campuses = CampusCache.All(); filterControl.Controls.Add( campusesPicker ); return new Control[1] { campusesPicker }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var gtpGroupType = new GroupTypePicker(); gtpGroupType.ID = filterControl.ID + "_0"; gtpGroupType.AddCssClass( "js-group-type" ); filterControl.Controls.Add( gtpGroupType ); gtpGroupType.UseGuidAsValue = true; gtpGroupType.GroupTypes = new GroupTypeService( new RockContext() ).Queryable().OrderBy(a => a.Name).ToList(); var cbChildGroupTypes = new RockCheckBox(); cbChildGroupTypes.ID = filterControl.ID + "_cbChildGroupTypes"; cbChildGroupTypes.AddCssClass( "js-child-group-types" ); cbChildGroupTypes.Text = "Include Child Group Types(s)"; filterControl.Controls.Add( cbChildGroupTypes ); 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] { gtpGroupType, cbChildGroupTypes, 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", gtpGroupType.Items.Count > 0 ? gtpGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues ) ); return controls; }
/// <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> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { LocationPicker locationPicker = new LocationPicker(); locationPicker.ID = filterControl.ID + "_0"; locationPicker.Label = "Location"; filterControl.Controls.Add( locationPicker ); NumberBox numberBox = new NumberBox(); numberBox.ID = filterControl.ID + "_1"; numberBox.NumberType = ValidationDataType.Double; numberBox.Label = "Miles"; numberBox.AddCssClass( "number-box-miles" ); filterControl.Controls.Add( numberBox ); return new Control[2] { locationPicker, numberBox }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var controls = new List<Control>(); var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes ); ddlIntegerCompare.ID = string.Format( "{0}_{1}", filterControl.ID, controls.Count() ); ddlIntegerCompare.AddCssClass( "js-filter-compare" ); filterControl.Controls.Add( ddlIntegerCompare ); controls.Add( ddlIntegerCompare ); var currencyBox = new CurrencyBox(); currencyBox.ID = string.Format( "{0}_{1}", filterControl.ID, controls.Count() ); currencyBox.AddCssClass( "js-filter-control" ); filterControl.Controls.Add( currencyBox ); controls.Add( currencyBox ); return controls.ToArray(); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { RockDropDownList contentChannelPicker = new RockDropDownList(); contentChannelPicker.CssClass = "js-content-channel-picker"; contentChannelPicker.ID = filterControl.ID + "_contentChannelPicker"; contentChannelPicker.Label = "Content Channel"; contentChannelPicker.Items.Clear(); var contentChannelList = new ContentChannelService( new RockContext() ).Queryable().OrderBy( a => a.Name ).ToList(); foreach ( var contentChannel in contentChannelList ) { contentChannelPicker.Items.Add( new ListItem( contentChannel.Name, contentChannel.Id.ToString() ) ); } filterControl.Controls.Add( contentChannelPicker ); return new Control[] { contentChannelPicker }; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var comparisonControl = ComparisonHelper.ComparisonControl( ComparisonType.LessThan | ComparisonType.GreaterThanOrEqualTo | ComparisonType.EqualTo ); comparisonControl.ID = filterControl.ID + "_comparisonControl"; filterControl.Controls.Add( comparisonControl ); var globalAttributes = Rock.Web.Cache.GlobalAttributesCache.Read(); NumberBox numberBoxAmount = new NumberBox(); numberBoxAmount.PrependText = globalAttributes.GetValue( "CurrencySymbol" ) ?? "$"; numberBoxAmount.NumberType = ValidationDataType.Currency; numberBoxAmount.ID = filterControl.ID + "_numberBoxAmount"; numberBoxAmount.Label = "Amount"; filterControl.Controls.Add( numberBoxAmount ); AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass( "js-account-picker" ); accountPicker.Label = "Accounts"; filterControl.Controls.Add( accountPicker ); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass( "js-sliding-date-range" ); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the transaction date of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add( slidingDateRangePicker ); RockCheckBox cbCombineGiving = new RockCheckBox(); cbCombineGiving.ID = filterControl.ID + "_cbCombineGiving"; cbCombineGiving.Label = "Combine Giving"; cbCombineGiving.CssClass = "js-combine-giving"; cbCombineGiving.Help = "Combine individuals in the same giving group when calculating totals and reporting the list of individuals."; filterControl.Controls.Add( cbCombineGiving ); var controls = new Control[5] { comparisonControl, numberBoxAmount, accountPicker, slidingDateRangePicker, cbCombineGiving }; SetSelection( entityType, controls, string.Format( "{0}||||||", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) ); return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass( "js-account-picker" ); accountPicker.Label = "Accounts"; filterControl.Controls.Add( accountPicker ); DateRangePicker dateRangePicker = new DateRangePicker(); dateRangePicker.ID = filterControl.ID + "_2"; dateRangePicker.Label = "Date Range"; dateRangePicker.Required = true; filterControl.Controls.Add( dateRangePicker ); var controls = new Control[2] { accountPicker, dateRangePicker }; return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var controls = new List<Control>(); var ddlIntegerCompare = ComparisonControl( NumericFilterComparisonTypes ); ddlIntegerCompare.ID = string.Format( "{0}_{1}", filterControl.ID, controls.Count() ); ddlIntegerCompare.AddCssClass( "js-filter-compare" ); filterControl.Controls.Add( ddlIntegerCompare ); controls.Add( ddlIntegerCompare ); var numberBox = new NumberBox(); numberBox.ID = string.Format( "{0}_{1}", filterControl.ID, controls.Count() ); numberBox.AddCssClass( "js-filter-control" ); filterControl.Controls.Add( numberBox ); controls.Add( numberBox ); numberBox.FieldName = "Grade"; return controls.ToArray(); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass( "js-account-picker" ); accountPicker.Label = "Accounts"; filterControl.Controls.Add( accountPicker ); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass( "js-sliding-date-range" ); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the 'Sunday Date' of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add( slidingDateRangePicker ); var controls = new Control[2] { accountPicker, slidingDateRangePicker }; return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { Panel pnlGroupAttributeFilterControls = new Panel(); pnlGroupAttributeFilterControls.ViewStateMode = ViewStateMode.Disabled; pnlGroupAttributeFilterControls.ID = filterControl.ID + "_pnlGroupAttributeFilterControls"; filterControl.Controls.Add( pnlGroupAttributeFilterControls ); GroupTypePicker groupTypePicker = new GroupTypePicker(); groupTypePicker.ID = filterControl.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; pnlGroupAttributeFilterControls.Controls.Add( groupTypePicker ); // set the GroupTypePicker selected value now so we can create the other controls the depending on know the groupTypeid int? groupTypeId = filterControl.Page.Request.Params[groupTypePicker.UniqueID].AsIntegerOrNull(); groupTypePicker.SelectedGroupTypeId = groupTypeId; groupTypePicker_SelectedIndexChanged( groupTypePicker, new EventArgs() ); return new Control[] { pnlGroupAttributeFilterControls }; }
/// <summary> /// Renders the controls. /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="filterControl">The filter control.</param> /// <param name="writer">The writer.</param> /// <param name="controls">The controls.</param> public override void RenderControls( Type entityType, FilterField filterControl, HtmlTextWriter writer, Control[] controls ) { writer.AddAttribute( HtmlTextWriterAttribute.Class, "row" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); writer.AddAttribute( "class", "col-md-2" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); writer.Write( "<span class='data-view-filter-label'>Attended</span>" ); writer.RenderEndTag(); writer.AddAttribute( "class", "col-md-5" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); controls[0].RenderControl( writer ); writer.RenderEndTag(); writer.AddAttribute( "class", "col-md-5" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); controls[1].RenderControl( writer ); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute( HtmlTextWriterAttribute.Class, "row" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); writer.AddAttribute( "class", "col-md-2" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); writer.RenderEndTag(); writer.AddAttribute( "class", "col-md-2" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); controls[2].RenderControl( writer ); writer.RenderEndTag(); writer.AddAttribute( "class", "col-md-3" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); writer.Write( "<span class='data-view-filter-label'>Times in the Last</span>" ); writer.RenderEndTag(); writer.AddAttribute( "class", "col-md-2" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); controls[3].RenderControl( writer ); writer.RenderEndTag(); writer.AddAttribute( "class", "col-md-3" ); writer.RenderBeginTag( HtmlTextWriterTag.Div ); writer.Write( "<span class='data-view-filter-label'>Week(s)</span>" ); writer.RenderEndTag(); writer.RenderEndTag(); }
/// <summary> /// Creates the filter control. /// </summary> /// <param name="parentControl">The parent control.</param> /// <param name="filter">The filter.</param> /// <param name="reportEntityType">Type of the report entity.</param> /// <param name="filteredEntityTypeName">Name of the filtered entity type.</param> /// <param name="setSelection">if set to <c>true</c> [set selection].</param> /// <param name="selectedDataFieldGuids">The selected data field guids.</param> /// <param name="configurableDataFieldGuids">The configurable data field guids.</param> /// <param name="rockContext">The rock context.</param> private void CreateFilterControl( Control parentControl, DataViewFilter filter, EntityType reportEntityType, bool setSelection, List<Guid> selectedDataFieldGuids, List<Guid> configurableDataFieldGuids, List<Guid> togglableDataFieldGuids, RockContext rockContext ) { try { var filteredEntityTypeName = EntityTypeCache.Read( reportEntityType ).Name; if ( filter.ExpressionType == FilterExpressionType.Filter ) { var filterControl = new FilterField(); filterControl.FilterMode = FilterMode.SimpleFilter; bool filterIsVisible = selectedDataFieldGuids.Contains( filter.Guid ); bool filterIsConfigurable = configurableDataFieldGuids.Contains( filter.Guid ); bool showCheckbox = togglableDataFieldGuids.Contains( filter.Guid ) || !filterIsConfigurable; filterControl.Visible = filterIsVisible; parentControl.Controls.Add( filterControl ); filterControl.DataViewFilterGuid = filter.Guid; filterControl.HideFilterCriteria = !filterIsConfigurable; filterControl.ID = string.Format( "ff_{0}", filterControl.DataViewFilterGuid.ToString( "N" ) ); filterControl.FilteredEntityTypeName = filteredEntityTypeName; if ( filter.EntityTypeId.HasValue ) { var entityTypeCache = Rock.Web.Cache.EntityTypeCache.Read( filter.EntityTypeId.Value, rockContext ); if ( entityTypeCache != null ) { filterControl.FilterEntityTypeName = entityTypeCache.Name; } } filterControl.Expanded = true; filterControl.ShowCheckbox = filterIsVisible && showCheckbox; var reportEntityTypeCache = EntityTypeCache.Read( reportEntityType ); var reportEntityTypeModel = reportEntityTypeCache.GetEntityType(); var filterEntityType = EntityTypeCache.Read( filter.EntityTypeId ?? 0 ); var component = Rock.Reporting.DataFilterContainer.GetComponent( filterEntityType.Name ); if ( component != null ) { string selectionUserPreference = null; bool? checkedUserPreference = null; if ( setSelection && filterIsVisible && filterIsConfigurable ) { selectionUserPreference = this.GetUserPreference( string.Format( "{0}_{1}_Selection", GetReportDataKeyPrefix(), filterControl.DataViewFilterGuid.ToString( "N" ) ) ); } else if ( setSelection && filterIsVisible && !filterIsConfigurable ) { checkedUserPreference = this.GetUserPreference( string.Format( "{0}_{1}_Checked", GetReportDataKeyPrefix(), filterControl.DataViewFilterGuid.ToString( "N" ) ) ).AsBooleanOrNull(); } if ( checkedUserPreference.HasValue ) { filterControl.SetCheckBoxChecked( checkedUserPreference.Value ); } if ( filterIsVisible && !filterIsConfigurable ) { // not configurable so just label it with the selection summary filterControl.Label = component.FormatSelection( reportEntityTypeModel, filter.Selection ); } else if ( component is Rock.Reporting.DataFilter.PropertyFilter ) { // a configurable property filter var propertyFilter = component as Rock.Reporting.DataFilter.PropertyFilter; if ( setSelection ) { var selection = filter.Selection; if ( !string.IsNullOrWhiteSpace( selectionUserPreference ) ) { selection = propertyFilter.UpdateSelectionFromUserPreferenceSelection( selection, selectionUserPreference ); } selection = propertyFilter.UpdateSelectionFromPageParameters( selection, this ); try { filterControl.SetSelection( selection ); } catch ( Exception ex ) { this.LogException( new Exception( "Exception setting selection for DataViewFilter: " + filter.Guid, ex ) ); } } } else { if ( setSelection ) { var selection = filter.Selection; if ( !string.IsNullOrWhiteSpace( selectionUserPreference ) ) { selection = selectionUserPreference; } if ( component is Rock.Reporting.DataFilter.IUpdateSelectionFromPageParameters ) { selection = ( component as Rock.Reporting.DataFilter.IUpdateSelectionFromPageParameters ).UpdateSelectionFromPageParameters( selection, this ); } filterControl.SetSelection( selection ); try { filterControl.SetSelection( selection ); } catch ( Exception ex ) { this.LogException( new Exception( "Exception setting selection for DataViewFilter: " + filter.Guid, ex ) ); } } // a configurable data filter filterControl.Label = component.GetTitle( reportEntityTypeModel ); } } } else { var groupControl = new FilterGroup(); parentControl.Controls.Add( groupControl ); groupControl.DataViewFilterGuid = filter.Guid; groupControl.ID = string.Format( "fg_{0}", groupControl.DataViewFilterGuid.ToString( "N" ) ); groupControl.FilteredEntityTypeName = filteredEntityTypeName; groupControl.IsDeleteEnabled = false; groupControl.HidePanelHeader = true; if ( setSelection ) { groupControl.FilterType = filter.ExpressionType; } foreach ( var childFilter in filter.ChildFilters ) { CreateFilterControl( groupControl, childFilter, reportEntityType, setSelection, selectedDataFieldGuids, configurableDataFieldGuids, togglableDataFieldGuids, rockContext ); } } } catch ( Exception ex ) { this.LogException( new Exception( "Exception creating FilterControl for DataViewFilter: " + filter.Guid, ex ) ); } }
/// <summary> /// Creates the model representation of the child controls used to display and edit the filter settings. /// Implement this version of CreateChildControls if your DataFilterComponent works the same in all filter modes /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="filterControl">The control that serves as the container for the filter controls.</param> /// <returns> /// The array of new controls created to implement the filter. /// </returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { // Define Control: Group Data View Picker var ddlDataView = new DataViewPicker(); ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView ); ddlDataView.Label = "Is Member of Group from Data View"; ddlDataView.Help = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included."; filterControl.Controls.Add( ddlDataView ); // Define Control: Group Member Status DropDown List var ddlGroupMemberStatus = new RockDropDownList(); ddlGroupMemberStatus.CssClass = "js-group-member-status"; ddlGroupMemberStatus.ID = filterControl.GetChildControlInstanceName( _CtlGroupStatus ); ddlGroupMemberStatus.Label = "with Group Member Status"; ddlGroupMemberStatus.Help = "Specifies the Status the Member must have to be included in the result. If no value is selected, Members of every Group Status will be shown."; ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true ); ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() ); filterControl.Controls.Add( ddlGroupMemberStatus ); // Define Control: Role Type DropDown List var ddlRoleType = new RockDropDownList(); ddlRoleType.ID = filterControl.GetChildControlInstanceName( _CtlRoleType ); ddlRoleType.Label = "with Group Role Type"; ddlRoleType.Help = "Specifies the type of Group Role the Member must have to be included in the result. If no value is selected, Members in every Role will be shown."; ddlRoleType.Items.Add( new ListItem( string.Empty, RoleTypeSpecifier.Any.ToString() ) ); ddlRoleType.Items.Add( new ListItem( "Leader", RoleTypeSpecifier.Leader.ToString() ) ); ddlRoleType.Items.Add( new ListItem( "Member", RoleTypeSpecifier.Member.ToString() ) ); filterControl.Controls.Add( ddlRoleType ); // Populate the Data View Picker int entityTypeId = EntityTypeCache.Read( typeof( Model.Group ) ).Id; ddlDataView.EntityTypeId = entityTypeId; return new Control[] { ddlDataView, ddlGroupMemberStatus, ddlRoleType }; }
private DataViewFilter GetFilterFieldControl( FilterField filterField ) { DataViewFilter filter = new DataViewFilter(); filter.ExpressionType = FilterExpressionType.Filter; filter.Expanded = filterField.Expanded; if ( filterField.FilterEntityTypeName != null ) { filter.EntityTypeId = Rock.Web.Cache.EntityTypeCache.Read( filterField.FilterEntityTypeName ).Id; filter.Selection = filterField.Selection; } return filter; }
private void CreateFilterControl( Control parentControl, DataViewFilter filter, string filteredEntityTypeName, bool setSelection ) { if ( filter.ExpressionType == FilterExpressionType.Filter ) { var filterControl = new FilterField(); parentControl.Controls.Add( filterControl ); filterControl.ID = string.Format( "{0}_ff_{1}", parentControl.ID, parentControl.Controls.Count ); filterControl.FilteredEntityTypeName = filteredEntityTypeName; if ( filter.EntityTypeId.HasValue ) { var entityTypeCache = Rock.Web.Cache.EntityTypeCache.Read( filter.EntityTypeId.Value ); if ( entityTypeCache != null ) { filterControl.FilterEntityTypeName = entityTypeCache.Name; } } filterControl.Expanded = filter.Expanded; if ( setSelection ) { filterControl.Selection = filter.Selection; } filterControl.DeleteClick += filterControl_DeleteClick; } else { var groupControl = new FilterGroup(); parentControl.Controls.Add( groupControl ); groupControl.ID = string.Format( "{0}_fg_{1}", parentControl.ID, parentControl.Controls.Count ); groupControl.FilteredEntityTypeName = filteredEntityTypeName; groupControl.IsDeleteEnabled = parentControl is FilterGroup; if ( setSelection ) { groupControl.FilterType = filter.ExpressionType; } groupControl.AddFilterClick += groupControl_AddFilterClick; groupControl.AddGroupClick += groupControl_AddGroupClick; groupControl.DeleteGroupClick += groupControl_DeleteGroupClick; foreach ( var childFilter in filter.ChildFilters ) { CreateFilterControl( groupControl, childFilter, filteredEntityTypeName, setSelection ); } } }
void groupControl_AddFilterClick( object sender, EventArgs e ) { FilterGroup groupControl = sender as FilterGroup; FilterField filterField = new FilterField(); groupControl.Controls.Add( filterField ); filterField.ID = string.Format( "{0}_ff_{1}", groupControl.ID, groupControl.Controls.Count ); filterField.FilteredEntityTypeName = groupControl.FilteredEntityTypeName; filterField.Expanded = true; }