Пример #1
0
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            // Define Control: Person Data View Picker
            var ddlDataView = new DataViewPicker();
            ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView );
            ddlDataView.Label = "Contains People from this Data View";
            ddlDataView.Help = "A Person Data View that provides the set of possible Group Members.";
            filterControl.Controls.Add( ddlDataView );

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

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

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

            return new Control[] {ddlDataView, ddlCompare, nbCount};
        }
Пример #2
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 ddlDataView = new DataViewPicker();
            ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView );
            ddlDataView.Label = "Is Member of Group from Data View";
            ddlDataView.Help = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
            filterControl.Controls.Add( ddlDataView );

            // Define Control: Group Member Status DropDown List
            var ddlGroupMemberStatus = new RockDropDownList();
            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID = filterControl.GetChildControlInstanceName( _CtlGroupStatus );
            ddlGroupMemberStatus.Label = "with Group Member Status";
            ddlGroupMemberStatus.Help = "Specifies the Status the Member must have to be included in the result. If no value is selected, Members of every Group Status will be shown.";
            ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true );
            ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() );
            filterControl.Controls.Add( ddlGroupMemberStatus );

            // Define Control: Role Type DropDown List
            var ddlRoleType = new RockDropDownList();
            ddlRoleType.ID = filterControl.GetChildControlInstanceName( _CtlRoleType );
            ddlRoleType.Label = "with Group Role Type";
            ddlRoleType.Help = "Specifies the type of Group Role the Member must have to be included in the result. If no value is selected, Members in every Role will be shown.";
            ddlRoleType.Items.Add( new ListItem( string.Empty, RoleTypeSpecifier.Any.ToString() ) );
            ddlRoleType.Items.Add( new ListItem( "Leader", RoleTypeSpecifier.Leader.ToString() ) );
            ddlRoleType.Items.Add( new ListItem( "Member", RoleTypeSpecifier.Member.ToString() ) );
            filterControl.Controls.Add( ddlRoleType );

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

            return new Control[] { ddlDataView, ddlGroupMemberStatus, ddlRoleType };
        }
Пример #3
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="parentControl">The parent control.</param>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField parentControl )
        {
            // Define Control: Location Data View Picker
            var ddlDataView = new DataViewPicker();
            ddlDataView.ID = parentControl.GetChildControlInstanceName( _CtlDataView );
            ddlDataView.Label = "Connected to Locations";
            ddlDataView.Help = "A Data View that provides the list of Locations to which the Person may be connected.";

            parentControl.Controls.Add( ddlDataView );

            // Define Control: Location Type DropDown List
            var ddlLocationType = new RockDropDownList();
            ddlLocationType.ID = parentControl.GetChildControlInstanceName( _CtlLocationType );
            ddlLocationType.Label = "Address Type";
            ddlLocationType.Help = "Specifies the type of Address the filter will be applied to. If no value is selected, all of the Person's Addresses will be considered.";

            var familyLocations = GroupTypeCache.GetFamilyGroupType().LocationTypeValues.OrderBy( a => a.Order ).ThenBy( a => a.Value );

            foreach (var value in familyLocations)
            {
                ddlLocationType.Items.Add( new ListItem( value.Value, value.Guid.ToString() ) );
            }

            ddlLocationType.Items.Insert( 0, None.ListItem );

            parentControl.Controls.Add( ddlLocationType );

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Read( typeof(Location) ).Id;
            ddlDataView.EntityTypeId = entityTypeId;

            return new Control[] {ddlDataView, ddlLocationType};
        }
        /// <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 )
        {
            var pnlGroupAttributeFilterControls = new DynamicControlsPanel();
            pnlGroupAttributeFilterControls.ID = filterControl.GetChildControlInstanceName( _CtlGroup );
            pnlGroupAttributeFilterControls.CssClass = "js-container-control";
            filterControl.Controls.Add( pnlGroupAttributeFilterControls );

            pnlGroupAttributeFilterControls.Controls.Clear();

            // Create the field selection dropdown
            var ddlProperty = new RockDropDownList();
            ddlProperty.ID = pnlGroupAttributeFilterControls.GetChildControlInstanceName( _CtlProperty );

            pnlGroupAttributeFilterControls.Controls.Add( ddlProperty );

            // Add empty selection as first item.
            ddlProperty.Items.Add( new ListItem() );

            foreach (var entityField in GetGroupMemberAttributes())
            {
                string controlId = pnlGroupAttributeFilterControls.GetChildControlInstanceName( entityField.Name );
                var control = entityField.FieldType.Field.FilterControl( entityField.FieldConfig, controlId, true, filterControl.FilterMode );
                if (control != null)
                {
                    // Add the field to the dropdown of available fields
                    ddlProperty.Items.Add( new ListItem( entityField.Title, entityField.Name ) );
                    pnlGroupAttributeFilterControls.Controls.Add( control );
                }
            }

            ddlProperty.AutoPostBack = true;

            return new Control[] {pnlGroupAttributeFilterControls};
        }
Пример #5
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 ddlDataView = new DataViewPicker();
            ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView );
            ddlDataView.Label = "Is Member of Group from Data View";
            ddlDataView.Help = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
            filterControl.Controls.Add( ddlDataView );

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

            return new Control[] { ddlDataView };
        }
Пример #6
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</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: History Data View Picker
            var ddlDataView = new DataViewPicker();
            ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView );
            ddlDataView.Label = "Has a Group Type in this Data View";
            ddlDataView.Help = "A Data View that provides the set of Group Types to match.";

            filterControl.Controls.Add( ddlDataView );

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Read( typeof( GroupType ) ).Id;
            ddlDataView.EntityTypeId = entityTypeId;

            return new Control[] { ddlDataView };
        }
Пример #7
0
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            // Define Control: Person Data View Picker
            var ddlDataView = new DataViewPicker();
            ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView );
            ddlDataView.Label = "Represents People from this Data View";
            ddlDataView.Help = "A Person Data View that represents the set of possible Group Members.";
            filterControl.Controls.Add( ddlDataView );

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

            return new Control[] { ddlDataView };
        }