Example #1
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="parentControl">The parent control.</param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField parentControl)
        {
            // Define Control: Group Member Data View Picker
            var ddlDataView = new DataViewPicker();

            ddlDataView.ID    = parentControl.GetChildControlInstanceName(_CtlDataView);
            ddlDataView.Label = "Has Group Memberships in this Data View";
            ddlDataView.Help  = "A Group Member Data View that provides the set of possible Group Members.";
            parentControl.Controls.Add(ddlDataView);

            var ddlCompare = ComparisonHelper.ComparisonControl(CountComparisonTypesSpecifier, false);

            ddlCompare.Label = "where the number of matching Group Memberships is";
            ddlCompare.ID    = parentControl.GetChildControlInstanceName(_CtlComparison);
            ddlCompare.AddCssClass("js-filter-compare");
            parentControl.Controls.Add(ddlCompare);

            var nbCount = new NumberBox();

            nbCount.Label = "&nbsp;";
            nbCount.ID    = parentControl.GetChildControlInstanceName(_CtlMemberCount);
            nbCount.AddCssClass("js-filter-control js-member-count");
            nbCount.FieldName = "Membership Count";
            parentControl.Controls.Add(nbCount);

            // Populate the Data View Picker
            ddlDataView.EntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.GroupMember)).Id;

            return(new Control[] { ddlDataView, ddlCompare, nbCount });
        }
Example #2
0
        /// <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());
        }
Example #3
0
        /// <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
            });
        }
Example #4
0
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// </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: Person Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID       = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.CssClass = "js-data-view-picker";
            dvpDataView.Label    = "Contains People from this Data View";
            dvpDataView.Help     = "A Person Data View that provides the set of possible Group Members.";
            filterControl.Controls.Add(dvpDataView);

            var ddlCompare = ComparisonHelper.ComparisonControl(CountComparisonTypesSpecifier);

            ddlCompare.Label = "where the number of matching Group Members is";
            ddlCompare.ID    = filterControl.GetChildControlInstanceName(_CtlComparison);
            ddlCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlCompare);

            var nbCount = new NumberBox();

            nbCount.Label = "&nbsp;";
            nbCount.ID    = filterControl.GetChildControlInstanceName(_CtlMemberCount);
            nbCount.AddCssClass("js-filter-control js-member-count");
            nbCount.FieldName = "Member Count";
            filterControl.Controls.Add(nbCount);

            // Populate the Data View Picker
            dvpDataView.EntityTypeId = EntityTypeCache.Get(typeof(Model.Person)).Id;

            return(new Control[] { dvpDataView, ddlCompare, nbCount });
        }
Example #5
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var cblNoteTypes = new RockListBox();

            cblNoteTypes.ID       = filterControl.GetChildControlInstanceName(_CtlNoteTypes);
            cblNoteTypes.CssClass = "js-notetypes";
            cblNoteTypes.Label    = "Note Types";
            cblNoteTypes.Help     = "The type of note to filter by. Leave blank to include all note types.";
            filterControl.Controls.Add(cblNoteTypes);

            var noteTypeService    = new NoteTypeService(new RockContext());
            var entityTypeIdPerson = EntityTypeCache.GetId <Rock.Model.Person>();
            var noteTypes          = noteTypeService.Queryable().Where(a => a.EntityTypeId == entityTypeIdPerson)
                                     .OrderBy(a => a.Order)
                                     .ThenBy(a => a.Name)
                                     .Select(a => new
            {
                a.Id,
                a.Name
            }).ToList();

            cblNoteTypes.Items.Clear();
            cblNoteTypes.Items.AddRange(noteTypes.Select(a => new ListItem(a.Name, a.Id.ToString())).ToArray());

            var slidingDateRangePicker = new SlidingDateRangePicker();

            slidingDateRangePicker.ID = filterControl.GetChildControlInstanceName(_CtlSlidingDateRangePicker);
            slidingDateRangePicker.AddCssClass("js-sliding-date-range");
            slidingDateRangePicker.Label    = "Date Range";
            slidingDateRangePicker.Help     = "The date range that the note was created during.";
            slidingDateRangePicker.Required = false;
            filterControl.Controls.Add(slidingDateRangePicker);

            var nbMinimumCount = new NumberBox();

            nbMinimumCount.ID           = filterControl.GetChildControlInstanceName(_CtlMinimumCount);
            nbMinimumCount.NumberType   = ValidationDataType.Integer;
            nbMinimumCount.MinimumValue = "1";
            nbMinimumCount.Label        = "Minimum Count";
            nbMinimumCount.Help         = "The minimum number of notes created during the date range to be considered a match.";
            nbMinimumCount.Required     = true;
            nbMinimumCount.AddCssClass("js-minimum-count");
            filterControl.Controls.Add(nbMinimumCount);

            return(new System.Web.UI.Control[3] {
                cblNoteTypes, slidingDateRangePicker, nbMinimumCount
            });
        }
Example #6
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.Label = "Count";
            ddlIntegerCompare.ID    = string.Format("{0}_ddlIntegerCompare", filterControl.ID);
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);

            var nbMemberCount = new NumberBox();

            nbMemberCount.Label = "&nbsp;";
            nbMemberCount.ID    = string.Format("{0}_nbMemberCount", filterControl.ID);
            nbMemberCount.AddCssClass("js-filter-control js-member-count");
            nbMemberCount.FieldName = "Member Count";
            filterControl.Controls.Add(nbMemberCount);

            RockDropDownList ddlLeader = new RockDropDownList();

            ddlLeader.ID = string.Format("{0}_ddlMemberType", filterControl.ID);
            ddlLeader.AddCssClass("js-filter-control js-member-is-leader");
            ddlLeader.Label = "Member Type";
            ddlLeader.Items.Add(new ListItem(string.Empty, string.Empty));
            ddlLeader.Items.Add(new ListItem("Leader", "true"));
            ddlLeader.Items.Add(new ListItem("Not Leader", "false"));
            filterControl.Controls.Add(ddlLeader);
            ddlLeader.Style[HtmlTextWriterStyle.Display] = this.SimpleMemberCountMode ? "none" : string.Empty;

            RockDropDownList ddlMemberStatus = new RockDropDownList();

            ddlMemberStatus.ID = string.Format("{0}_ddlMemberStatus", filterControl.ID);
            ddlMemberStatus.AddCssClass("js-filter-control js-member-status");
            ddlMemberStatus.Label = "Member Status";
            ddlMemberStatus.Items.Add(new ListItem(string.Empty, string.Empty));
            foreach (GroupMemberStatus memberStatus in Enum.GetValues(typeof(GroupMemberStatus)))
            {
                ddlMemberStatus.Items.Add(new ListItem(memberStatus.ConvertToString(), memberStatus.ConvertToInt().ToString()));
            }

            filterControl.Controls.Add(ddlMemberStatus);

            ddlLeader.Visible       = !this.SimpleMemberCountMode;
            ddlMemberStatus.Visible = !this.SimpleMemberCountMode;

            return(new Control[] { ddlIntegerCompare, nbMemberCount, ddlLeader, ddlMemberStatus });
        }
Example #7
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.Label = "Count";
            ddlIntegerCompare.ID    = string.Format("{0}_ddlIntegerCompare", filterControl.ID);
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);

            var nbCapacityCount = new NumberBox();

            nbCapacityCount.Label = "&nbsp;";
            nbCapacityCount.ID    = string.Format("{0}_nbCapacityCount", filterControl.ID);
            nbCapacityCount.AddCssClass("js-filter-control js-capacity-count");
            nbCapacityCount.FieldName = "Capacity Count";
            filterControl.Controls.Add(nbCapacityCount);

            return(new Control[] { ddlIntegerCompare, nbCapacityCount });
        }
Example #8
0
        /// <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
            });
        }
Example #9
0
        /// <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 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 = "Age";

            return(controls.ToArray());
        }
Example #10
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlActivityType = new RockDropDownList();

            ddlActivityType.ID = filterControl.ID + "_ddlActivityType";
            ddlActivityType.AddCssClass("js-activity-type");
            ddlActivityType.Label = "Activity Type";
            filterControl.Controls.Add(ddlActivityType);
            var activityTypes = new ConnectionActivityTypeService(new RockContext()).Queryable("ConnectionType").AsNoTracking().Where(a => a.IsActive)
                                .OrderBy(a => a.ConnectionTypeId.HasValue)
                                .ThenBy(a => a.Name)
                                .ToList();

            ddlActivityType.Items.Clear();
            ddlActivityType.Items.Insert(0, new ListItem());
            foreach (var activityType in activityTypes)
            {
                var activityName = GetActivityName(activityType);
                ddlActivityType.Items.Add(new ListItem(activityName, activityType.Guid.ToString()));
            }

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.Label = "Count";
            ddlIntegerCompare.ID    = filterControl.ID + "_ddlIntegerCompare";
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);

            var nbCount = new NumberBox();

            nbCount.ID    = filterControl.ID + "_nbCount";
            nbCount.Label = "&nbsp;"; // give it whitespace label so it lines up nicely
            nbCount.AddCssClass("js-count");
            filterControl.Controls.Add(nbCount);

            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[4] {
                ddlActivityType, ddlIntegerCompare, nbCount, slidingDateRangePicker
            };

            // convert pipe to comma delimited
            var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ",");
            var defaultCount           = 1;

            // set the default values in case this is a newly added filter
            var selectionConfig = new SelectionConfig()
            {
                IntegerCompare = ComparisonType.GreaterThanOrEqualTo,
                MinimumCount   = defaultCount,
                SlidingDateRangeDelimitedValues = defaultDelimitedValues
            };

            SetSelection(
                entityType,
                controls,
                selectionConfig.ToJson());

            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}_{nameof( pGroupPicker )}";
            pGroupPicker.AddCssClass("js-group-picker");
            filterControl.Controls.Add(pGroupPicker);

            var cbChildGroups = new RockCheckBox();

            cbChildGroups.ID = $"{filterControl.ID}_{nameof( 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}_{nameof( ddlIntegerCompare )}";
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);

            var tbAttendedCount = new NumberBox();

            tbAttendedCount.ID    = $"{filterControl.ID}_{nameof( tbAttendedCount )}";
            tbAttendedCount.Label = "&nbsp;"; // 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}_{nameof( slidingDateRangePicker )}";
            slidingDateRangePicker.AddCssClass("js-sliding-date-range");
            filterControl.Controls.Add(slidingDateRangePicker);

            var schedulePicker = new SchedulePicker();

            schedulePicker.Label = "Schedules";
            schedulePicker.ID    = $"{filterControl.ID}_{nameof( schedulePicker )}";
            schedulePicker.AddCssClass("js-schedule-picker");
            schedulePicker.AllowMultiSelect = true;
            filterControl.Controls.Add(schedulePicker);

            var controls = new Control[6] {
                pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker, schedulePicker
            };

            var defaultGroupAttendanceFilterSelection = new GroupAttendanceFilterSelection
            {
                IntegerCompare = ComparisonType.GreaterThanOrEqualTo,
                AttendedCount  = 4,
                SlidingDateRangeDelimitedValues = slidingDateRangePicker.DelimitedValues,
                IncludeChildGroups = false,
            };

            // set the default values in case this is a newly added filter
            SetSelection(
                entityType,
                controls,
                defaultGroupAttendanceFilterSelection.ToJson());

            return(controls);
        }