/// <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() < 3 )
            {
                return;
            }

            RegistrationTemplatePicker registrationTemplatePicker = controls[0] as RegistrationTemplatePicker;
            RockCheckBox cbIncludeInactive = controls[1] as RockCheckBox;
            SlidingDateRangePicker registeredOnDateRangePicker = controls[2] as SlidingDateRangePicker;

            string[] selectionValues = selection.Split( '|' );
            if ( selectionValues.Length >= 1 )
            {
                List<Guid> registrationTemplateGuids = selectionValues[0].Split( ',' ).AsGuidList();
                var registrationTemplates = new RegistrationTemplateService( new RockContext() ).GetByGuids( registrationTemplateGuids );
                if ( registrationTemplates != null )
                {
                    registrationTemplatePicker.SetValues( registrationTemplates );
                }

                if ( selectionValues.Length >= 2 )
                {
                    cbIncludeInactiveRegistrationInstances.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
                    cbIncludeInactiveRegistrationInstances.Checked = false;
                }

                if ( selectionValues.Length >= 3 )
                {
                    // convert comma delimited to pipe
                    registeredOnDateRangePicker.DelimitedValues = selectionValues[7].Replace( ',', '|' );
                }
            }
        }
 /// <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 )
     {
         LocationPicker locationPicker = controls[0] as LocationPicker;
         locationPicker.RenderControl( writer );
     }
 }
        /// <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() < 3 )
            {
                return null;
            }

            RegistrationTemplatePicker registrationTemplatePicker = controls[0] as RegistrationTemplatePicker;
            RockCheckBox cbInactiveRegistrationInstances = controls[1] as RockCheckBox;
            SlidingDateRangePicker registeredOnDateRangePicker = controls[2] as SlidingDateRangePicker;

            List<int> registrationTemplateIdList = registrationTemplatePicker.SelectedValues.AsIntegerList();
            var registrationTemplateGuids = new RegistrationTemplateService( new RockContext() ).GetByIds( registrationTemplateIdList ).Select( a => a.Guid ).Distinct().ToList();

            // convert pipe to comma delimited
            var delimitedValues = registeredOnDateRangePicker.DelimitedValues.Replace( "|", "," );

            return string.Format(
                "{0}|{1}|{2}",
                registrationTemplateGuids.AsDelimited( "," ),
                cbIncludeInactiveRegistrationInstances.Checked.ToString(),
                delimitedValues );
        }
        /// <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() < 4 )
            {
                return;
            }

            RegistrationTemplatePicker registrationTemplatePicker = controls[0] as RegistrationTemplatePicker;
            RockCheckBox cbIncludeInactiveRegistrationInstances = controls[1] as RockCheckBox;
            PanelWidget pwAdvanced = controls[3] as PanelWidget;

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

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

            registrationTemplatePicker.RenderControl( writer );

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

            writer.RenderEndTag();

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

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

            writer.RenderEndTag();
        }
Beispiel #5
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() < 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();
        }
Beispiel #6
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() < 8 )
            {
                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;
            SlidingDateRangePicker addedOnDateRangePicker = controls[7] as SlidingDateRangePicker;

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

                if ( selectionValues.Length >= 8 )
                {
                    // convert comma delimited to pipe
                    addedOnDateRangePicker.DelimitedValues = selectionValues[7].Replace( ',', '|' );
                }
            }
        }
Beispiel #7
0
        /// <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 cbInactiveGroups = controls[6] as RockCheckBox;
            SlidingDateRangePicker addedOnDateRangePicker = controls[7] as SlidingDateRangePicker;

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

            // convert pipe to comma delimited
            var delimitedValues = addedOnDateRangePicker.DelimitedValues.Replace( "|", "," );

            return string.Format(
                "{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
                groupGuids.AsDelimited( "," ),
                cblRoles.SelectedValues.AsDelimited( "," ),
                cbChildGroups.Checked.ToString(),
                ddlGroupMemberStatus.SelectedValue,
                cbIncludeSelectedGroup.Checked.ToString(),
                cbChildGroupsPlusDescendants.Checked.ToString(),
                cbIncludeInactiveGroups.Checked.ToString(),
                delimitedValues );
        }
        /// <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 );
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
        }
Beispiel #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 )
        {
            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;

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

                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 );
                }
            }
        }
Beispiel #10
0
        /// <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;

            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}",
                groupGuids.AsDelimited( "," ),
                cblRoles.SelectedValues.AsDelimited( "," ),
                cbChildGroups.Checked.ToString(),
                ddlGroupMemberStatus.SelectedValue,
                cbIncludeSelectedGroup.Checked.ToString(),
                cbChildGroupsPlusDescendants.Checked.ToString() );
        }
Beispiel #11
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() >= 2 )
            {
                RockDropDownList ddlCompare = controls[0] as RockDropDownList;
                RockTextBox tbPostalCode = controls[1] as RockTextBox;
                writer.AddAttribute( "class", "row field-criteria" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                writer.AddAttribute( "class", "col-md-4" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                ddlCompare.RenderControl( writer );
                writer.RenderEndTag();

                writer.AddAttribute( "class", "col-md-8" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );

                tbPostalCode.RenderControl( writer );
                writer.RenderEndTag();

                writer.RenderEndTag();  // row
                RegisterFilterCompareChangeScript( filterControl );
            }
        }