Exemple #1
0
        /// <summary>
        /// Handles the ItemDataBound event of the rptIgnoreCampusChanges control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rptIgnoreCampusChanges_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var              ignoreCampusChangeRow = e.Item.DataItem as IgnoreCampusChangeRow;
            CampusPicker     fromCampus            = e.Item.FindControl("cpFromCampus") as CampusPicker;
            CampusPicker     toCampus = e.Item.FindControl("cpToCampus") as CampusPicker;
            RockDropDownList ddlCampusAttendanceOrGiving = e.Item.FindControl("ddlAttendanceOrGiving") as RockDropDownList;

            if (ignoreCampusChangeRow != null && fromCampus != null && toCampus != null && ddlCampusAttendanceOrGiving != null)
            {
                fromCampus.Campuses         = _campuses;
                fromCampus.SelectedCampusId = ignoreCampusChangeRow.FromCampusId;

                toCampus.Campuses         = _campuses;
                toCampus.SelectedCampusId = ignoreCampusChangeRow.ToCampusId;

                if (ignoreCampusChangeRow.CampusCriteria.HasValue)
                {
                    ddlCampusAttendanceOrGiving.SetValue(ignoreCampusChangeRow.CampusCriteria.ConvertToInt());
                }
                else
                {
                    ddlCampusAttendanceOrGiving.SetValue(string.Empty);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 2)
            {
                Guid groupTypeGuid = selectionValues[0].AsGuid();
                var  groupType     = new GroupTypeService(new RockContext()).Get(groupTypeGuid);
                if (groupType != null)
                {
                    (controls[0] as GroupTypePicker).SetValue(groupType.Id);
                }

                groupTypePicker_SelectedIndexChanged(this, new EventArgs());

                string[]         selectedRoleGuids = selectionValues[1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                RockCheckBoxList cblRole           = controls[1] as RockCheckBoxList;

                foreach (var item in cblRole.Items.OfType <ListItem>())
                {
                    item.Selected = selectedRoleGuids.Contains(item.Value);
                }

                RockDropDownList ddlGroupMemberStatus = controls[2] as RockDropDownList;
                if (selectionValues.Length >= 3)
                {
                    ddlGroupMemberStatus.SetValue(selectionValues[2]);
                }
                else
                {
                    ddlGroupMemberStatus.SetValue(string.Empty);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Sets control values from a communication record.
        /// </summary>
        /// <param name="communication">The communication.</param>
        public override void SetFromCommunication(CommunicationDetails communication)
        {
            EnsureChildControls();
            var valueItem = dvpFrom.Items.FindByValue(communication.SMSFromDefinedValueId.ToString());

            if (valueItem == null && communication.SMSFromDefinedValueId != null)
            {
                var lookupDefinedValue = DefinedValueCache.Get(communication.SMSFromDefinedValueId.GetValueOrDefault());
                dvpFrom.Items.Add(new ListItem(lookupDefinedValue.Description, lookupDefinedValue.Id.ToString()));
            }
            dvpFrom.SetValue(communication.SMSFromDefinedValueId);
            tbMessage.Text = communication.SMSMessage;
        }
Exemple #4
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(System.Web.UI.Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 1)
            {
                RockRadioButtonList rblShowAsLinkType    = controls[0] as RockRadioButtonList;
                GroupTypePicker     groupTypePicker      = controls[1] as GroupTypePicker;
                RockCheckBoxList    cblRole              = controls[2] as RockCheckBoxList;
                RockDropDownList    ddlGroupMemberStatus = controls[3] as RockDropDownList;

                rblShowAsLinkType.SelectedValue = selectionValues[0].ConvertToEnum <ShowAsLinkType>(ShowAsLinkType.NameOnly).ConvertToInt().ToString();

                if (selectionValues.Length >= 3)
                {
                    Guid groupTypeGuid = selectionValues[1].AsGuid();
                    var  groupTypeId   = new GroupTypeService(new RockContext()).GetId(groupTypeGuid);
                    if (groupTypeId.HasValue)
                    {
                        groupTypePicker.SetValue(groupTypeId.Value);
                    }

                    groupTypePicker_SelectedIndexChanged(groupTypePicker, new EventArgs());

                    string[] selectedRoleGuids = selectionValues[2].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (var item in cblRole.Items.OfType <ListItem>())
                    {
                        item.Selected = selectedRoleGuids.Contains(item.Value);
                    }

                    ddlGroupMemberStatus.SetValue(selectionValues[3]);
                }
            }
        }
Exemple #5
0
        /// <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);

            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";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            filterControl.Controls.Add(ddlGroupMemberStatus);

            return(new Control[4] {
                gp, cbChildGroups, cblRole, ddlGroupMemberStatus
            });
        }
Exemple #6
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlInteractionChannel = new RockDropDownList();

            ddlInteractionChannel.ID                    = filterControl.ID + "_ddlInteractionChannel";
            ddlInteractionChannel.Label                 = "Interaction Channel";
            ddlInteractionChannel.CssClass              = "js-interaction-channel";
            ddlInteractionChannel.Required              = true;
            ddlInteractionChannel.AutoPostBack          = true;
            ddlInteractionChannel.EnhanceForLongLists   = true;
            ddlInteractionChannel.SelectedIndexChanged += ddlInteractionChannel_SelectedIndexChanged;
            filterControl.Controls.Add(ddlInteractionChannel);

            var interactionChannelService = new InteractionChannelService(new RockContext());
            var interactionChannels       = interactionChannelService.Queryable().OrderBy(a => a.Name).Select(a => new
            {
                a.Id,
                a.Name
            }).ToList();

            ddlInteractionChannel.Items.Clear();
            ddlInteractionChannel.Items.Add(new ListItem());
            ddlInteractionChannel.Items.AddRange(interactionChannels.Select(a => new ListItem(a.Name, a.Id.ToString())).ToArray());

            int?selectedInteractionChannelId = filterControl.Page.Request.Params[ddlInteractionChannel.UniqueID].AsIntegerOrNull();

            ddlInteractionChannel.SetValue(selectedInteractionChannelId);

            var ddlInteractionComponent = new RockDropDownList();

            ddlInteractionComponent.ID                  = filterControl.ID + "_ddlInteractionComponent";
            ddlInteractionComponent.Label               = "Interaction Component";
            ddlInteractionComponent.CssClass            = "js-interaction-component";
            ddlInteractionComponent.EnhanceForLongLists = true;
            filterControl.Controls.Add(ddlInteractionComponent);

            PopulateInteractionComponent(selectedInteractionChannelId, ddlInteractionComponent);

            RockTextBox tbOperation = new RockTextBox();

            tbOperation.Label    = "Operation";
            tbOperation.ID       = filterControl.ID + "_tbOperation";
            tbOperation.CssClass = "js-tbOperation";
            filterControl.Controls.Add(tbOperation);

            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 interactions";
            filterControl.Controls.Add(slidingDateRangePicker);

            return(new Control[4] {
                ddlInteractionChannel, ddlInteractionComponent, tbOperation, slidingDateRangePicker
            });
        }
 /// <summary>
 /// Sets the selection.
 /// </summary>
 /// <param name="controls">The controls.</param>
 /// <param name="selection">The selection.</param>
 public override void SetSelection(System.Web.UI.Control[] controls, string selection)
 {
     if (controls.Count() == 1)
     {
         RockDropDownList dropDownList = controls[0] as RockDropDownList;
         if (dropDownList != null)
         {
             dropDownList.SetValue(selection);
         }
     }
 }
        /// <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 ddlInteractionChannel = new RockDropDownList();

            ddlInteractionChannel.ID                    = parentControl.ID + "_ddlInteractionChannel";
            ddlInteractionChannel.Label                 = "Interaction Channel";
            ddlInteractionChannel.Required              = true;
            ddlInteractionChannel.AutoPostBack          = true;
            ddlInteractionChannel.SelectedIndexChanged += ddlInteractionChannel_SelectedIndexChanged;
            parentControl.Controls.Add(ddlInteractionChannel);

            var interactionChannelService = new InteractionChannelService(new RockContext());
            var noteTypes = interactionChannelService.Queryable().OrderBy(a => a.Name).Select(a => new
            {
                a.Id,
                a.Name
            }).ToList();

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

            int?selectedInteractionChannelId = parentControl.Page.Request.Params[ddlInteractionChannel.UniqueID].AsIntegerOrNull();

            ddlInteractionChannel.SetValue(selectedInteractionChannelId);


            RockDropDownList ddlInteractionComponent = new RockDropDownList();

            ddlInteractionComponent.ID    = parentControl.ID + "_ddlInteractionComponent";
            ddlInteractionComponent.Label = "Interaction Component";
            ddlInteractionComponent.EnhanceForLongLists = true;
            parentControl.Controls.Add(ddlInteractionComponent);

            PopulateInteractionComponent(selectedInteractionChannelId, ddlInteractionComponent);
            RockTextBox tbOperation = new RockTextBox();

            tbOperation.Label = "Operation";
            tbOperation.ID    = parentControl.ID + "_tbOperation";
            parentControl.Controls.Add(tbOperation);


            RockRadioButtonList rblSelectionMode = new RockRadioButtonList();

            rblSelectionMode.ID    = parentControl.ID + "rblSelectionMode";
            rblSelectionMode.Label = "Selection Mode";
            rblSelectionMode.BindToEnum <FirstLastInteraction>();
            rblSelectionMode.SetValue(FirstLastInteraction.First.ConvertToInt());
            parentControl.Controls.Add(rblSelectionMode);

            return(new System.Web.UI.Control[] { ddlInteractionChannel, ddlInteractionComponent, tbOperation, rblSelectionMode });
        }
Exemple #9
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');

            if (selectionValues.Length >= 2)
            {
                RockDropDownList ddlFilterBy = controls[0] as RockDropDownList;
                ddlFilterBy.SelectedValue = selectionValues[0];

                RockDropDownList ddlCourseRequirement = controls[1] as RockDropDownList;
                ddlCourseRequirement.SetValue(selectionValues[1]);
            }
        }
Exemple #10
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 2)
            {
                Guid groupGuid = selectionValues[0].AsGuid();
                var  group     = new GroupService(new RockContext()).Get(groupGuid);
                if (group != null)
                {
                    (controls[0] as GroupPicker).SetValue(group.Id);
                }

                CheckBox cbChildGroups = controls[1] as CheckBox;
                if (selectionValues.Length >= 3)
                {
                    cbChildGroups.Checked = selectionValues[2].AsBooleanOrNull() ?? false;
                }

                gp_SelectItem(this, new EventArgs());

                string[]         selectedRoleGuids = selectionValues[1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                RockCheckBoxList cblRole           = controls[2] as RockCheckBoxList;

                foreach (var item in cblRole.Items.OfType <ListItem>())
                {
                    item.Selected = selectedRoleGuids.Contains(item.Value);
                }

                RockDropDownList ddlGroupMemberStatus = controls[3] as RockDropDownList;
                if (selectionValues.Length >= 4)
                {
                    ddlGroupMemberStatus.SetValue(selectionValues[3]);
                }
                else
                {
                    ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
                }
            }
        }
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            var values = selection.Split('|');

            DropDownList     ddlCompare           = controls[0] as DropDownList;
            RockDropDownList ddlGradeDefinedValue = controls[1] as RockDropDownList;

            if (values.Length == 2)
            {
                ddlCompare.SelectedValue = values[0];
                ddlGradeDefinedValue.SetValue(values[1]);
            }
        }
Exemple #12
0
        /// <summary>
        /// Gets the multiple option single quantity fee control
        /// </summary>
        /// <param name="setValues">if set to <c>true</c> [set values].</param>
        /// <param name="feeValues">The fee values.</param>
        /// <param name="registrationInstance">The registration instance.</param>
        /// <param name="otherRegistrants">The other registrants that have been registered so far in this registration</param>
        /// <returns></returns>
        private Control GetFeeMultipleOptionSingleQuantityControl(bool setValues, List <FeeInfo> feeValues, RegistrationInstance registrationInstance, List <RegistrantInfo> otherRegistrants)
        {
            var fee = this;
            var ddl = new RockDropDownList();

            ddl.ID = "fee_" + fee.Id.ToString();
            ddl.AddCssClass("input-width-md");
            ddl.Label          = fee.Name;
            ddl.DataValueField = "Key";
            ddl.DataTextField  = "Value";
            ddl.Required       = fee.IsRequired;

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem());
            foreach (var feeItem in fee.FeeItems)
            {
                var feeInfo      = feeValues?.FirstOrDefault(a => a.RegistrationTemplateFeeItemId == feeItem.Id);
                int currentValue = feeInfo?.Quantity ?? 0;

                int?usageCountRemaining = feeItem.GetUsageCountRemaining(registrationInstance, otherRegistrants);
                var listItem            = new ListItem(string.Format("{0} ({1})", feeItem.Name, feeItem.Cost.FormatAsCurrency()), feeItem.Id.ToString());
                if (usageCountRemaining.HasValue)
                {
                    if (usageCountRemaining <= 0)
                    {
                        // if there aren't any remaining, and the currentValue isn't counted in the used counts, disable the option
                        if (currentValue == 0)
                        {
                            listItem.Enabled = false;
                        }

                        listItem.Text += " (none remaining)";
                    }
                    else
                    {
                        listItem.Text += $" ({usageCountRemaining} remaining)";
                    }
                }

                ddl.Items.Add(listItem);
            }

            if (setValues && feeValues != null && feeValues.Any())
            {
                var defaultFeeItemId = feeValues.Where(f => f.Quantity > 0).Select(f => f.RegistrationTemplateFeeItemId).FirstOrDefault();

                ddl.SetValue(defaultFeeItemId);
            }

            return(ddl);
        }
Exemple #13
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Control parentControl)
        {
            // Define Control: Output Format DropDown List
            var ddlFormat = new RockDropDownList();

            ddlFormat.ID    = parentControl.GetChildControlInstanceName(_CtlFormat);
            ddlFormat.Label = "Output Format";
            ddlFormat.Help  = "Specifies the content and format of the values in this field.";
            ddlFormat.Items.Add(new ListItem("Group List: Name And Role", ListFormatSpecifier.GroupAndRole.ToString()));
            ddlFormat.Items.Add(new ListItem("Group List: Group Name", ListFormatSpecifier.GroupOnly.ToString()));
            ddlFormat.Items.Add(new ListItem("Yes/No: Yes if any participation", ListFormatSpecifier.YesNo.ToString()));

            parentControl.Controls.Add(ddlFormat);

            // Define Control: Group Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = parentControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Participates in Groups";
            dvpDataView.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.";
            parentControl.Controls.Add(dvpDataView);

            // Define Control: Role Type DropDown List
            var ddlRoleType = new RockDropDownList();

            ddlRoleType.ID    = parentControl.GetChildControlInstanceName(_CtlRoleType);
            ddlRoleType.Label = "with Group Member 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 any Role will be included.";
            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()));
            parentControl.Controls.Add(ddlRoleType);

            // Define Control: Group Member Status DropDown List
            var ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID       = parentControl.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 any Group Status will be shown.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            parentControl.Controls.Add(ddlGroupMemberStatus);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.Group)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView, ddlRoleType, ddlFormat, ddlGroupMemberStatus });
        }
Exemple #14
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Control parentControl)
        {
            // Define Control: Output Format DropDown List
            var ddlFormat = new RockDropDownList();

            ddlFormat.ID    = parentControl.GetChildControlInstanceName(_CtlFormat);
            ddlFormat.Label = "Output Format";
            ddlFormat.Help  = "Specifies the content and format of the items in this field.";
            ddlFormat.Items.Add(new ListItem("First Name/Last Name/Role", ListFormatSpecifier.FirstNameLastNameRole.ToString()));
            ddlFormat.Items.Add(new ListItem("First Name/Last Name", ListFormatSpecifier.FirstNameLastName.ToString()));

            parentControl.Controls.Add(ddlFormat);

            // Define Control: Group Data View Picker
            var ddlDataView = new DataViewPicker();

            ddlDataView.ID    = parentControl.GetChildControlInstanceName(_CtlDataView);
            ddlDataView.Label = "Exists in this Person Data View";
            ddlDataView.Help  = "A Data View that filters the people included in the result. If no value is selected, all Group Members will be included.";
            parentControl.Controls.Add(ddlDataView);

            // Define Control: Role Type DropDown List
            var ddlRoleType = new RockDropDownList();

            ddlRoleType.ID    = parentControl.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()));
            parentControl.Controls.Add(ddlRoleType);

            // Define Control: Group Member Status DropDown List
            var ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID       = parentControl.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());
            parentControl.Controls.Add(ddlGroupMemberStatus);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Read(typeof(Model.Person)).Id;

            ddlDataView.EntityTypeId = entityTypeId;

            return(new Control[] { ddlDataView, ddlRoleType, ddlFormat, ddlGroupMemberStatus });
        }
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            int?selectedGroupTypeId = null;

            if (groupTypePicker != null)
            {
                selectedGroupTypeId = groupTypePicker.SelectedGroupTypeId;
            }

            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;
            groupTypePicker.SelectedGroupTypeId   = selectedGroupTypeId;
            filterControl.Controls.Add(groupTypePicker);

            cblRole       = new RockCheckBoxList();
            cblRole.Label = "with Group Role(s)";
            cblRole.ID    = filterControl.ID + "_cblRole";
            filterControl.Controls.Add(cblRole);

            PopulateGroupRolesCheckList(groupTypePicker.SelectedGroupTypeId ?? 0);

            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);

            RockDropDownList ddlGroupStatus = new RockDropDownList();

            ddlGroupStatus.CssClass = "js-group-status";
            ddlGroupStatus.ID       = filterControl.ID + "_ddlGroupStatus";
            ddlGroupStatus.Label    = "with Group Status";
            ddlGroupStatus.Items.Insert(0, new ListItem("[All]", ""));
            ddlGroupStatus.Items.Insert(1, new ListItem("Active", "True"));
            ddlGroupStatus.Items.Insert(2, new ListItem("Inactive", "False"));
            ddlGroupStatus.SetValue(true.ToString());
            filterControl.Controls.Add(ddlGroupStatus);

            return(new Control[4] {
                groupTypePicker, cblRole, ddlGroupStatus, ddlGroupMemberStatus
            });
        }
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            if (controls.Count() >= 2)
            {
                NumberBox        nbCommunicationId      = controls[0] as NumberBox;
                RockDropDownList ddlCommunicationStatus = controls[1] as RockDropDownList;

                string[] selectionValues = selection.Split('|');
                if (selectionValues.Length >= 2)
                {
                    nbCommunicationId.Text = selectionValues[0];
                    ddlCommunicationStatus.SetValue(( int )selectionValues[1].ConvertToEnum <CommunicationStatusType>());
                }
            }
        }
Exemple #17
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');

            if (selectionValues.Length >= 3)
            {
                RockDropDownList ddlCourseRequirement = controls[0] as RockDropDownList;
                ddlCourseRequirement.SetValue(selectionValues[0]);

                RockTextBox tbDays = controls[1] as RockTextBox;
                tbDays.Text = selectionValues[1];

                RockCheckBox cbIncludeExpired = controls[2] as RockCheckBox;
                cbIncludeExpired.Checked = selectionValues[2].AsBoolean();
            }
        }
Exemple #18
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(System.Web.UI.Control[] controls, string selection)
        {
            if (controls.Count() == 2)
            {
                string[] selectionValues = selection.Split('|');
                if (selectionValues.Length >= 2)
                {
                    var locationPicker   = controls[0] as LocationPicker;
                    var selectedLocation = new LocationService(new RockContext()).Get(selectionValues[0].AsGuid());
                    locationPicker.SetBestPickerModeForLocation(selectedLocation);
                    locationPicker.Location = selectedLocation;

                    RockDropDownList dropDownList = controls[1] as RockDropDownList;
                    dropDownList.SetValue(selectionValues[1]);
                }
            }
        }
Exemple #19
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(System.Web.UI.Control[] controls, string selection)
        {
            RockDropDownList dropDownList          = controls[0] as RockDropDownList;
            RockCheckBox     enableCallOrigination = controls[1] as RockCheckBox;

            string[] values = selection.Split('|');

            if (values.Length >= 1)
            {
                dropDownList.SetValue(values[0]);
            }

            if (values.Length >= 2)
            {
                enableCallOrigination.Checked = values[1].AsBoolean();
            }
        }
Exemple #20
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(System.Web.UI.Control[] controls, string selection)
        {
            RockDropDownList    locationTypeList           = controls[0] as RockDropDownList;
            RockRadioButtonList addressPartRadioButtonList = controls[1] as RockRadioButtonList;

            string[] values = selection.Split('|');

            if (values.Length >= 1)
            {
                locationTypeList.SetValue(values[0]);
            }

            if (values.Length >= 2)
            {
                addressPartRadioButtonList.SetValue(values[1]);
            }
        }
Exemple #21
0
        /// <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);

            var groupTypePicker = new GroupTypePicker();

            groupTypePicker.ID                    = parentControl.ID + "_groupTypePicker";
            groupTypePicker.Label                 = "Group Type";
            groupTypePicker.CssClass              = "js-grouptype-picker";
            groupTypePicker.GroupTypes            = new GroupTypeService(new RockContext()).Queryable().OrderBy(a => a.Order).ThenBy(a => a.Name).ToList();
            groupTypePicker.SelectedIndexChanged += groupTypePicker_SelectedIndexChanged;
            groupTypePicker.AutoPostBack          = true;
            parentControl.Controls.Add(groupTypePicker);

            int?selectedGroupTypeId = parentControl.Page.Request.Params[groupTypePicker.UniqueID].AsIntegerOrNull();

            groupTypePicker.SelectedGroupTypeId = selectedGroupTypeId;

            var cblRole = new RockCheckBoxList();

            cblRole.Label    = "with Group Role(s)";
            cblRole.CssClass = "js-group-role";
            cblRole.ID       = parentControl.ID + "_cblRole";
            parentControl.Controls.Add(cblRole);

            PopulateGroupRolesCheckList(groupTypePicker);

            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 });
        }
        /// <summary>
        /// Sets the type of the group.
        /// </summary>
        /// <param name="groupType">Type of the group.</param>
        /// <param name="rockContext">The rock context.</param>
        public void SetGroupType(GroupType groupType, RockContext rockContext)
        {
            EnsureChildControls();

            if (groupType != null)
            {
                GroupTypeGuid         = groupType.Guid;
                _tbGroupTypeName.Text = groupType.Name;
                _ddlGroupTypeInheritFrom.SetValue(groupType.InheritedGroupTypeId);

                if (EnableCheckinOptions)
                {
                    _ddlAttendanceRule.SetValue((int)groupType.AttendanceRule);
                    _ddlPrintTo.SetValue((int)groupType.AttendancePrintTo);
                }

                CreateGroupTypeAttributeControls(groupType, rockContext);
            }
        }
        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="configurationValues"></param>
        /// <param name="value">The value.</param>
        public override void SetEditValue(Control control, Dictionary <string, ConfigurationValue> configurationValues, string value)
        {
            Panel pnlRange = control as Panel;

            if (pnlRange != null)
            {
                RockDropDownList lowerValueControl = pnlRange.Controls.OfType <RockDropDownList>().FirstOrDefault(a => a.ID.EndsWith("_ddlLower"));
                RockDropDownList upperValueControl = pnlRange.Controls.OfType <RockDropDownList>().FirstOrDefault(a => a.ID.EndsWith("_ddlUpper"));

                if (value != null)
                {
                    string[] valuePair = value.Split(new char[] { ',' }, StringSplitOptions.None);
                    if (valuePair.Length == 2)
                    {
                        lowerValueControl.SetValue(valuePair[0].AsGuidOrNull());
                        upperValueControl.SetValue(valuePair[1].AsGuidOrNull());
                    }
                }
            }
        }
Exemple #24
0
        /// <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 dvpDataView = new DataViewItemPicker();

            dvpDataView.ID       = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.CssClass = "js-data-view-picker";
            dvpDataView.Label    = "Is Member of Group from Data View";
            dvpDataView.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(dvpDataView);

            // Define Control: Group Member Status DropDown List
            var ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.ID       = filterControl.GetChildControlInstanceName(_CtlGroupStatus);
            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            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.CssClass = "js-group-member-role";
            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.Get(typeof(Model.Group)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView, ddlGroupMemberStatus, ddlRoleType });
        }
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(System.Web.UI.Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 1)
            {
                Guid interactionChannelGuid = selectionValues[0].AsGuid();
                var  rockContext            = new RockContext();
                var  interactionChannel     = new InteractionChannelService(rockContext).Get(interactionChannelGuid);
                var  ddlInteractionChannel  = (controls[0] as RockDropDownList);
                ddlInteractionChannel.SetValue(interactionChannel != null ? interactionChannel.Id : ( int? )null);

                ddlInteractionChannel_SelectedIndexChanged(ddlInteractionChannel, new EventArgs());

                if (selectionValues.Length >= 2)
                {
                    var interactionComponentGuid = selectionValues[1].AsGuidOrNull();
                    if (interactionComponentGuid.HasValue)
                    {
                        RockDropDownList ddlInteractionComponent = (controls[1] as RockDropDownList);
                        var interactionComponent = new InteractionComponentService(rockContext).Get(interactionComponentGuid.Value);
                        ddlInteractionComponent.SetValue(interactionComponent != null ? interactionComponent.Id : ( int? )null);
                    }
                }

                RockTextBox tbOperation = controls[2] as RockTextBox;
                if (selectionValues.Length >= 3)
                {
                    tbOperation.Text = selectionValues[2];
                }

                RockRadioButtonList rblSelectionMode = controls[3] as RockRadioButtonList;
                if (selectionValues.Length >= 4)
                {
                    rblSelectionMode.SetValue(selectionValues[3]);
                }
            }
        }
Exemple #26
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 1)
            {
                Guid interactionChannelGuid = selectionValues[0].AsGuid();
                var  rockContext            = new RockContext();
                var  interactionChannel     = new InteractionChannelService(rockContext).Get(interactionChannelGuid);
                var  ddlInteractionChannel  = (controls[0] as RockDropDownList);
                ddlInteractionChannel.SetValue(interactionChannel != null ? interactionChannel.Id : ( int? )null);

                ddlInteractionChannel_SelectedIndexChanged(ddlInteractionChannel, new EventArgs());

                if (selectionValues.Length >= 2)
                {
                    var interactionComponentGuid = selectionValues[1].AsGuidOrNull();
                    if (interactionComponentGuid.HasValue)
                    {
                        RockDropDownList ddlInteractionComponent = (controls[1] as RockDropDownList);
                        var interactionComponent = new InteractionComponentService(rockContext).Get(interactionComponentGuid.Value);
                        ddlInteractionComponent.SetValue(interactionComponent != null ? interactionComponent.Id : ( int? )null);
                    }
                }

                RockTextBox tbOperation = controls[2] as RockTextBox;
                if (selectionValues.Length >= 3)
                {
                    tbOperation.Text = selectionValues[2];
                }

                SlidingDateRangePicker slidingDateRangePicker = controls[3] as SlidingDateRangePicker;
                if (selectionValues.Length >= 4)
                {
                    slidingDateRangePicker.DelimitedValues = selectionValues[3].Replace(',', '|');
                }
            }
        }
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl)
        {
            var groupTypePicker = new GroupTypePicker();

            groupTypePicker.ID                    = parentControl.ID + "_groupTypePicker";
            groupTypePicker.Label                 = "Group Type";
            groupTypePicker.GroupTypes            = new GroupTypeService(new RockContext()).Queryable().ToList();
            groupTypePicker.SelectedIndexChanged += groupTypePicker_SelectedIndexChanged;
            groupTypePicker.AutoPostBack          = true;
            parentControl.Controls.Add(groupTypePicker);

            int?selectedGroupTypeId = parentControl.Page.Request.Params[groupTypePicker.UniqueID].AsIntegerOrNull();

            groupTypePicker.SelectedGroupTypeId = selectedGroupTypeId;

            var cblRole = new RockCheckBoxList();

            cblRole.Label = "with Group Role(s)";
            cblRole.ID    = parentControl.ID + "_cblRole";
            parentControl.Controls.Add(cblRole);

            PopulateGroupRolesCheckList(groupTypePicker.SelectedGroupTypeId ?? 0, cblRole);

            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 only include to only show true for group members with that status. Leaving this blank will return true for all members.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            parentControl.Controls.Add(ddlGroupMemberStatus);

            return(new Control[3] {
                groupTypePicker, cblRole, ddlGroupMemberStatus
            });
        }
Exemple #28
0
        /// <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);

            return(new Control[7] {
                gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus, cbIncludeInactiveGroups
            });
        }
Exemple #29
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            if (controls.Count() < 6)
            {
                return;
            }

            GroupPicker      groupPicker                  = controls[0] as GroupPicker;
            RockCheckBox     cbChildGroups                = controls[1] as RockCheckBox;
            RockCheckBox     cbIncludeSelectedGroup       = controls[2] as RockCheckBox;
            RockCheckBox     cbChildGroupsPlusDescendants = controls[3] as RockCheckBox;
            RockCheckBoxList cblRoles             = controls[4] as RockCheckBoxList;
            RockDropDownList ddlGroupMemberStatus = controls[5] as RockDropDownList;
            RockCheckBox     cbIncludeInactive    = controls[6] as RockCheckBox;

            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 2)
            {
                List <Guid> groupGuids = selectionValues[0].Split(',').AsGuidList();
                var         groups     = new GroupService(new RockContext()).GetByGuids(groupGuids);
                if (groups != null)
                {
                    groupPicker.SetValues(groups);
                }

                if (selectionValues.Length >= 3)
                {
                    cbChildGroups.Checked = selectionValues[2].AsBooleanOrNull() ?? false;
                }

                if (selectionValues.Length >= 6)
                {
                    cbIncludeSelectedGroup.Checked       = selectionValues[4].AsBooleanOrNull() ?? false;
                    cbChildGroupsPlusDescendants.Checked = selectionValues[5].AsBooleanOrNull() ?? false;
                }
                else
                {
                    cbIncludeSelectedGroup.Checked       = true;
                    cbChildGroupsPlusDescendants.Checked = true;
                }

                if (selectionValues.Length >= 7)
                {
                    cbIncludeInactiveGroups.Checked = selectionValues[6].AsBooleanOrNull() ?? false;
                }
                else
                {
                    // if options where saved before this option was added, set to false, even though it would have included inactive before
                    cbIncludeInactiveGroups.Checked = false;
                }

                gp_SelectItem(this, new EventArgs());

                string[] selectedRoleGuids = selectionValues[1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in cblRoles.Items.OfType <ListItem>())
                {
                    item.Selected = selectedRoleGuids.Contains(item.Value);
                }

                if (selectionValues.Length >= 4)
                {
                    ddlGroupMemberStatus.SetValue(selectionValues[3]);
                }
                else
                {
                    ddlGroupMemberStatus.SetValue(string.Empty);
                }
            }
        }
Exemple #30
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var 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);

            var 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);

            var 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);

            var 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);

            var 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);

            var 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-dateadded-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);

            SlidingDateRangePicker firstAttendanceDateRangePicker = new SlidingDateRangePicker();

            firstAttendanceDateRangePicker.ID = filterControl.ID + "_firstAttendanceDateRangePicker";
            firstAttendanceDateRangePicker.AddCssClass("js-firstattendance-sliding-date-range");
            firstAttendanceDateRangePicker.Label = "First Attendance";
            firstAttendanceDateRangePicker.Help  = "The date range of the first attendance using the 'Sunday Date' of each attendance";
            pwAdvanced.Controls.Add(firstAttendanceDateRangePicker);

            SlidingDateRangePicker lastAttendanceDateRangePicker = new SlidingDateRangePicker();

            lastAttendanceDateRangePicker.ID = filterControl.ID + "_lastAttendanceDateRangePicker";
            lastAttendanceDateRangePicker.AddCssClass("js-lastattendance-sliding-date-range");
            lastAttendanceDateRangePicker.Label = "Last Attendance";
            lastAttendanceDateRangePicker.Help  = "The date range of the last attendance using the 'Sunday Date' of each attendance";
            pwAdvanced.Controls.Add(lastAttendanceDateRangePicker);

            return(new Control[11] {
                gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus, cbIncludeInactiveGroups, addedOnDateRangePicker, pwAdvanced, firstAttendanceDateRangePicker, lastAttendanceDateRangePicker
            });
        }