コード例 #1
0
ファイル: InGroupFilter.cs プロジェクト: MrUpsideDown/Rock
        /// <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)
        {
            if (controls.Count() >= 3)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                GroupPicker groupPicker = controls[0] as GroupPicker;
                groupPicker.RenderControl(writer);
                RockCheckBox cbChildGroups = controls[1] as RockCheckBox;
                cbChildGroups.RenderControl(writer);
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                RockCheckBoxList cblRoles = controls[2] as RockCheckBoxList;
                cblRoles.RenderControl(writer);
                RockDropDownList ddlGroupMemberStatus = controls[3] as RockDropDownList;
                ddlGroupMemberStatus.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
        }
コード例 #2
0
ファイル: InGroupFilter.cs プロジェクト: BricksandMortar/Rock
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            if (controls.Count() < 6)
            {
                return(null);
            }

            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 cbInactiveGroups = controls[6] as RockCheckBox;

            List <int> groupIdList = groupPicker.SelectedValues.AsIntegerList();
            var        groupGuids  = new GroupService(new RockContext()).GetByIds(groupIdList).Select(a => a.Guid).Distinct().ToList();

            return(string.Format(
                       "{0}|{1}|{2}|{3}|{4}|{5}|{6}",
                       groupGuids.AsDelimited(","),
                       cblRoles.SelectedValues.AsDelimited(","),
                       cbChildGroups.Checked.ToString(),
                       ddlGroupMemberStatus.SelectedValue,
                       cbIncludeSelectedGroup.Checked.ToString(),
                       cbChildGroupsPlusDescendants.Checked.ToString(),
                       cbIncludeInactiveGroups.Checked.ToString()));
        }
コード例 #3
0
ファイル: InGroupFilter.cs プロジェクト: MrUpsideDown/Rock
        /// <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
            });
        }
コード例 #4
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);

            return(new Control[3] {
                gp, cbChildGroups, cblRole
            });
        }
コード例 #5
0
ファイル: GroupFieldType.cs プロジェクト: shelsonjava/Rock
        /// <summary>
        /// Creates the control(s) neccessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override System.Web.UI.Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            GroupPicker groupPicker = new GroupPicker {
                ID = id
            };

            return(groupPicker);
        }
コード例 #6
0
 /// <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)
 {
     if (controls.Count() >= 1)
     {
         GroupPicker groupPicker = controls[0] as GroupPicker;
         groupPicker.RenderControl(writer);
     }
 }
コード例 #7
0
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            var picker = new GroupPicker {
                ID = id, AllowMultiSelect = true
            };

            return(picker);
        }
コード例 #8
0
ファイル: GroupFieldType.cs プロジェクト: shelsonjava/Rock
        /// <summary>
        /// Reads new values entered by the user for the field
        /// </summary>
        /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <returns></returns>
        public override string GetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues)
        {
            GroupPicker groupPicker = control as GroupPicker;

            if (groupPicker != null)
            {
                return(groupPicker.SelectedValue);
            }

            return(null);
        }
コード例 #9
0
ファイル: GroupFieldType.cs プロジェクト: shelsonjava/Rock
 /// <summary>
 /// Sets the value.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="configurationValues">The configuration values.</param>
 /// <param name="value">The value.</param>
 public override void SetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues, string value)
 {
     if (value != null)
     {
         GroupPicker groupPicker = control as GroupPicker;
         int         groupId     = 0;
         int.TryParse(value, out groupId);
         Group group = new GroupService().Get(groupId);
         groupPicker.SetValue(group);
     }
 }
コード例 #10
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";
            filterControl.Controls.Add(gp);

            return(new Control[1] {
                gp
            });
        }
コード例 #11
0
        /// <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 = "&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 + "_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);
        }
コード例 #12
0
ファイル: InGroupSimpleFilter.cs プロジェクト: ewin66/rockrms
        /// <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.CssClass         = "js-group-picker";
            gp.AllowMultiSelect = true;
            filterControl.Controls.Add(gp);

            return(new Control[1] {
                gp
            });
        }
コード例 #13
0
ファイル: InGroupSimpleFilter.cs プロジェクト: waldo2590/Rock
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            if (controls.Count() < 1)
            {
                return(null);
            }

            GroupPicker groupPicker = controls[0] as GroupPicker;
            List <int>  groupIdList = groupPicker.SelectedValues.AsIntegerList();
            var         groupGuids  = new GroupService(new RockContext()).GetByIds(groupIdList).Select(a => a.Guid).Distinct().ToList();

            return(groupGuids.AsDelimited(","));
        }
コード例 #14
0
ファイル: InGroupFilter.cs プロジェクト: waldo2590/Rock
        /// <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)
        {
            if (controls.Count() < 9)
            {
                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     cbIncludeInactiveGroups = controls[6] as RockCheckBox;
            PanelWidget      pwAdvanced              = controls[8] as PanelWidget;

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            groupPicker.RenderControl(writer);
            cbChildGroups.RenderControl(writer);
            if (!cbChildGroups.Checked)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            cbIncludeSelectedGroup.ContainerCssClass = "margin-l-md";
            cbIncludeSelectedGroup.RenderControl(writer);
            cbChildGroupsPlusDescendants.ContainerCssClass = "margin-l-md";
            cbChildGroupsPlusDescendants.RenderControl(writer);
            cbIncludeInactiveGroups.ContainerCssClass = "margin-l-md";
            cbIncludeInactiveGroups.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            cblRoles.RenderControl(writer);

            ddlGroupMemberStatus.RenderControl(writer);
            pwAdvanced.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
コード例 #15
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field.
        /// IMPORTANT! The order of the controls must match the order/index usage
        /// in the ConfigurationValues and SetConfigurationValues methods.
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // Save the selected groupType before we rebind it.
            int?groupId = null;

            if (_gpGroupPicker != null)
            {
                groupId = _gpGroupPicker.SelectedValue.AsIntegerOrNull();

                // store this so we know if the Group actually changes when the SelectedIndexChanged is fired.
                _groupId = groupId;
            }

            // build a group picker (the one that gets selected is
            // used to build a list of groupmember values)
            _gpGroupPicker             = new GroupPicker();
            _gpGroupPicker.Label       = "Group";
            _gpGroupPicker.Help        = "The Group to select the member(s) from.";
            _gpGroupPicker.SelectItem += OnQualifierUpdated;
            if (groupId.HasValue)
            {
                _gpGroupPicker.SetValue(groupId.Value);
            }
            controls.Add(_gpGroupPicker);

            // Add checkbox for deciding if the group member picker list is rendered as a drop
            // down list or a checkbox list.
            var cb = new RockCheckBox();

            controls.Add(cb);
            cb.AutoPostBack    = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label           = "Allow Multiple Values";
            cb.Text            = "Yes";
            cb.Help            = "When set, allows multiple group members to be selected.";

            // option for Displaying an enhanced 'chosen' value picker
            var cbEnanced = new RockCheckBox();

            controls.Add(cbEnanced);
            cbEnanced.AutoPostBack    = true;
            cbEnanced.CheckedChanged += OnQualifierUpdated;
            cbEnanced.Label           = "Enhance For Long Lists";
            cbEnanced.Text            = "Yes";
            cbEnanced.Help            = "When set, will render a searchable selection of options.";

            return(controls);
        }
コード例 #16
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            gp             = new GroupPicker();
            gp.ID          = filterControl.ID + "_0";
            gp.Label       = "Group";
            gp.SelectItem += gp_SelectItem;
            filterControl.Controls.Add(gp);

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

            return(new Control[2] {
                gp, cblRole
            });
        }
コード例 #17
0
ファイル: InGroupSimpleFilter.cs プロジェクト: waldo2590/Rock
        /// <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() < 1)
            {
                return;
            }

            GroupPicker groupPicker = controls[0] as GroupPicker;

            List <Guid> groupGuids = selection.Split(',').AsGuidList();
            var         groups     = new GroupService(new RockContext()).GetByGuids(groupGuids);

            if (groups != null)
            {
                groupPicker.SetValues(groups);
            }
        }
コード例 #18
0
        /// <summary>
        /// Reads new values entered by the user for the field (as id)
        /// </summary>
        /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <returns></returns>
        public override string GetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues)
        {
            GroupPicker picker = control as GroupPicker;

            if (picker != null)
            {
                int?id = picker.ItemId.AsIntegerOrNull();
                if (id.HasValue)
                {
                    var group = new GroupService(new RockContext()).Get(id.Value);

                    if (group != null)
                    {
                        return(group.Guid.ToString());
                    }
                }
            }

            return(null);
        }
コード例 #19
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType"></param>
        /// <param name="filterControl"></param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            _GpkParentGroup       = new GroupPicker();
            _GpkParentGroup.ID    = filterControl.ID + "_0";
            _GpkParentGroup.Label = "Parent Group";
            filterControl.Controls.Add(_GpkParentGroup);

            _CboIncludedGroups       = new RockDropDownList();
            _CboIncludedGroups.ID    = filterControl.ID + "_1";
            _CboIncludedGroups.Label = "Branch Type";
            _CboIncludedGroups.Items.Add(new ListItem {
                Text = "Parent and Descendants", Value = IncludedGroupsSpecifier.EntireBranch.ToString(), Selected = true
            });
            _CboIncludedGroups.Items.Add(new ListItem {
                Text = "Descendants Only", Value = IncludedGroupsSpecifier.DescendantsOnly.ToString()
            });
            filterControl.Controls.Add(_CboIncludedGroups);

            return(new Control[] { _GpkParentGroup, _CboIncludedGroups });
        }
コード例 #20
0
ファイル: InGroupFilter.cs プロジェクト: waldo2590/Rock
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            if (controls.Count() < 8)
            {
                return(null);
            }

            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           cbIncludeInactiveGroups        = controls[6] as RockCheckBox;
            SlidingDateRangePicker addedOnDateRangePicker         = controls[7] as SlidingDateRangePicker;
            SlidingDateRangePicker firstAttendanceDateRangePicker = controls[9] as SlidingDateRangePicker;
            SlidingDateRangePicker lastAttendanceDateRangePicker  = controls[10] as SlidingDateRangePicker;

            List <int> groupIdList = groupPicker.SelectedValues.AsIntegerList();
            var        groupGuids  = new GroupService(new RockContext()).GetByIds(groupIdList).Select(a => a.Guid).Distinct().ToList();

            //// NOTE: convert slidingdaterange delimitedvalues from pipe to comma delimited

            return(string.Format(
                       "{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}",
                       groupGuids.AsDelimited(","),
                       cblRoles.SelectedValues.AsDelimited(","),
                       cbChildGroups.Checked.ToString(),
                       ddlGroupMemberStatus.SelectedValue,
                       cbIncludeSelectedGroup.Checked.ToString(),
                       cbChildGroupsPlusDescendants.Checked.ToString(),
                       cbIncludeInactiveGroups.Checked.ToString(),
                       addedOnDateRangePicker.DelimitedValues.Replace("|", ","),
                       firstAttendanceDateRangePicker.DelimitedValues.Replace("|", ","),
                       lastAttendanceDateRangePicker.DelimitedValues.Replace("|", ",")));
        }
コード例 #21
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field.
        /// IMPORTANT! The order of the controls must match the order/index usage
        /// in the ConfigurationValues and SetConfigurationValues methods.
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a group picker (the one that gets selected is
            // used to build a list of groupmember values)
            var gpGroupPicker = new GroupPicker();

            gpGroupPicker.Label       = "Group";
            gpGroupPicker.Help        = "The Group to select the member(s) from.";
            gpGroupPicker.SelectItem += OnQualifierUpdated;
            controls.Add(gpGroupPicker);

            // Add checkbox for deciding if the group member picker list is rendered as a drop
            // down list or a checkbox list.
            var cb = new RockCheckBox();

            controls.Add(cb);
            cb.AutoPostBack    = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label           = "Allow Multiple Values";
            cb.Text            = "Yes";
            cb.Help            = "When set, allows multiple group members to be selected.";

            // option for Displaying an enhanced 'chosen' value picker
            var cbEnanced = new RockCheckBox();

            controls.Add(cbEnanced);
            cbEnanced.AutoPostBack    = true;
            cbEnanced.CheckedChanged += OnQualifierUpdated;
            cbEnanced.Label           = "Enhance For Long Lists";
            cbEnanced.Text            = "Yes";
            cbEnanced.Help            = "When set, will render a searchable selection of options.";

            return(controls);
        }
コード例 #22
0
ファイル: InGroupFilter.cs プロジェクト: BricksandMortar/Rock
        /// <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);
                }
            }
        }
コード例 #23
0
ファイル: InGroupFilter.cs プロジェクト: BricksandMortar/Rock
        /// <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
            });
        }
コード例 #24
0
ファイル: InGroupFilter.cs プロジェクト: waldo2590/Rock
        /// <summary>
        /// Handles the SelectItem event of the gp control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void gp_SelectItem(object sender, EventArgs e)
        {
            FilterField filterField = (sender as Control).FirstParentControlOfType <FilterField>();

            GroupPicker      groupPicker   = filterField.ControlsOfTypeRecursive <GroupPicker>().FirstOrDefault(a => a.HasCssClass("js-group-picker"));
            RockCheckBox     cbChildGroups = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-child-groups"));
            RockCheckBox     cbChildGroupsPlusDescendants = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-child-groups-descendants"));
            RockCheckBox     cbIncludeInactiveGroups      = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-inactive-groups"));
            RockCheckBox     cbIncludeSelectedGroup       = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-selected-groups"));
            RockCheckBoxList cblRoles = filterField.ControlsOfTypeRecursive <RockCheckBoxList>().FirstOrDefault(a => a.HasCssClass("js-roles"));

            var rockContext = new RockContext();

            var groupIdList  = groupPicker.SelectedValues.AsIntegerList();
            var groupService = new GroupService(rockContext);

            var selectedGroups = groupService.GetByIds(groupIdList).Select(s => new { s.Id, s.GroupTypeId }).ToList();

            if (selectedGroups.Any())
            {
                var        groupTypeRoleService = new GroupTypeRoleService(rockContext);
                var        qryGroupTypeRoles    = groupTypeRoleService.Queryable();
                List <int> selectedGroupTypeIds = selectedGroups.Select(a => a.GroupTypeId).Distinct().ToList();

                if (cbChildGroups.Checked)
                {
                    List <int> childGroupTypeIds = new List <int>();
                    foreach (var groupId in selectedGroups.Select(a => a.Id).ToList())
                    {
                        if (cbChildGroupsPlusDescendants.Checked)
                        {
                            // get all children and descendants of the selected group(s)
                            var descendantGroupTypes = groupService.GetAllDescendentsGroupTypes(groupId, cbIncludeInactiveGroups.Checked);

                            childGroupTypeIds.AddRange(descendantGroupTypes.Select(a => a.Id).ToList());
                        }
                        else
                        {
                            // get only immediate children of the selected group(s)
                            var childGroups = groupService.Queryable().Where(a => a.ParentGroupId == groupId);
                            if (!cbIncludeInactiveGroups.Checked)
                            {
                                childGroups = childGroups.Where(a => a.IsActive == true);
                            }

                            childGroupTypeIds.AddRange(childGroups.Select(a => a.GroupTypeId).Distinct().ToList());
                        }
                    }

                    childGroupTypeIds = childGroupTypeIds.Distinct().ToList();

                    if (cbIncludeSelectedGroup.Checked)
                    {
                        qryGroupTypeRoles = qryGroupTypeRoles.Where(a => a.GroupTypeId.HasValue && (selectedGroupTypeIds.Contains(a.GroupTypeId.Value) || childGroupTypeIds.Contains(a.GroupTypeId.Value)));
                    }
                    else
                    {
                        qryGroupTypeRoles = qryGroupTypeRoles.Where(a => a.GroupTypeId.HasValue && childGroupTypeIds.Contains(a.GroupTypeId.Value));
                    }
                }
                else
                {
                    qryGroupTypeRoles = qryGroupTypeRoles.Where(a => a.GroupTypeId.HasValue && selectedGroupTypeIds.Contains(a.GroupTypeId.Value));
                }

                var list = qryGroupTypeRoles.OrderBy(a => a.GroupType.Order).ThenBy(a => a.GroupType.Name).ThenBy(a => a.Order).ThenBy(a => a.Name).Select(a => new
                {
                    a.Name,
                    GroupTypeName = a.GroupType.Name,
                    a.Guid
                }).ToList();
                cblRoles.Items.Clear();
                foreach (var item in list)
                {
                    cblRoles.Items.Add(new ListItem(string.Format("{0} ({1})", item.Name, item.GroupTypeName), item.Guid.ToString()));
                }

                cblRoles.Visible = list.Count > 0;
            }
            else
            {
                cblRoles.Visible = false;
            }
        }
コード例 #25
0
ファイル: InGroupFilter.cs プロジェクト: waldo2590/Rock
        /// <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
            });
        }
コード例 #26
0
        /// <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 RockTextBox();

            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.ConvertToInt().ToString(),
                AttendedCount      = 4,
                SlidingDateRange   = slidingDateRangePicker.DelimitedValues,
                IncludeChildGroups = false,
            };

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

            return(controls);
        }
コード例 #27
0
        void ReleaseDesignerOutlets()
        {
            if (addNewItemBtn != null)
            {
                addNewItemBtn.Dispose();
                addNewItemBtn = null;
            }

            if (ChooseLabel != null)
            {
                ChooseLabel.Dispose();
                ChooseLabel = null;
            }

            if (closeBoxBtn != null)
            {
                closeBoxBtn.Dispose();
                closeBoxBtn = null;
            }

            if (GMUButton != null)
            {
                GMUButton.Dispose();
                GMUButton = null;
            }

            if (GoBackButton != null)
            {
                GoBackButton.Dispose();
                GoBackButton = null;
            }

            if (GroupLabel != null)
            {
                GroupLabel.Dispose();
                GroupLabel = null;
            }

            if (GroupPicker != null)
            {
                GroupPicker.Dispose();
                GroupPicker = null;
            }

            if (LaunchView != null)
            {
                LaunchView.Dispose();
                LaunchView = null;
            }

            if (PasswordField != null)
            {
                PasswordField.Dispose();
                PasswordField = null;
            }

            if (PasswordLabel != null)
            {
                PasswordLabel.Dispose();
                PasswordLabel = null;
            }

            if (SchoolLabel != null)
            {
                SchoolLabel.Dispose();
                SchoolLabel = null;
            }

            if (searchBtn != null)
            {
                searchBtn.Dispose();
                searchBtn = null;
            }

            if (SelectGroupLabel != null)
            {
                SelectGroupLabel.Dispose();
                SelectGroupLabel = null;
            }

            if (SubmitButton != null)
            {
                SubmitButton.Dispose();
                SubmitButton = null;
            }

            if (VCUButton != null)
            {
                VCUButton.Dispose();
                VCUButton = null;
            }
        }