示例#1
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddl = new RockDropDownList();

            controls.Add(ddl);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help  = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService();
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Order))
            {
                ddl.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            // Add checkbox for deciding if the defined values list is renedered 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 defined type values to be selected.";
            return(controls);
        }
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddl = new RockDropDownList();

            controls.Add(ddl);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help  = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService(new RockContext());
            ddl.Items.Add(new ListItem());
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Name))
            {
                ddl.Items.Add(new ListItem(definedType.Name, definedType.Guid.ToString()));
            }

            // option to show descriptions instead of values
            var cbDescription = new RockCheckBox();

            controls.Add(cbDescription);
            cbDescription.AutoPostBack    = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label           = "Display Descriptions";
            cbDescription.Text            = "Yes";
            cbDescription.Help            = "When set, the defined value descriptions will be displayed instead of the values.";
            return(controls);
        }
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values) 
            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService( new RockContext() );
            ddl.Items.Add( new ListItem() );
            foreach ( var definedType in definedTypeService.Queryable().OrderBy( d => d.Name ) )
            {
                ddl.Items.Add( new ListItem( definedType.Name, definedType.Guid.ToString() ) );
            }

            // option to show descriptions instead of values
            var cbDescription = new RockCheckBox();
            controls.Add( cbDescription );
            cbDescription.AutoPostBack = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label = "Display Descriptions";
            cbDescription.Text = "Yes";
            cbDescription.Help = "When set, the defined value descriptions will be displayed instead of the values.";
            return controls;
        }
示例#4
0
        /// <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 Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new RockDropDownList { ID = id }; 

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService();
            foreach ( var definedType in definedTypeService.Queryable().OrderBy( d => d.Order ) )
                editControl.Items.Add( new ListItem( definedType.Name, definedType.Guid.ToString() ) );

            return editControl;
        }
示例#5
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddl = new RockDropDownList();

            controls.Add(ddl);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help  = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService(new RockContext());
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Name))
            {
                ddl.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            // Add checkbox for deciding if the defined values 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 defined type values to be selected.";

            // option for Display Descriptions
            var cbDescription = new RockCheckBox();

            controls.Add(cbDescription);
            cbDescription.AutoPostBack    = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label           = "Display Descriptions";
            cbDescription.Text            = "Yes";
            cbDescription.Help            = "When set, the defined value descriptions will be displayed instead of the values.";

            // 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);
        }
示例#6
0
        /// <summary>
        /// Creates the control(s) neccessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues)
        {
            ListControl editControl = new DropDownList();

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService();
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Order))
            {
                editControl.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            return(editControl);
        }
示例#7
0
        /// <summary>
        /// Returns the field's current value(s)
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">Information about the value</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
        /// <returns></returns>
        public override string FormatValue( Control parentControl, string value, Dictionary<string, ConfigurationValue> configurationValues, bool condensed )
        {
            string formattedValue = string.Empty;

            Guid guid = Guid.Empty;
            if (Guid.TryParse(value, out guid))
            {
                var definedType = new Model.DefinedTypeService().Get(guid);
                if (definedType != null)
                { 
                    formattedValue = definedType.Name;
                }
            }

            return base.FormatValue( parentControl, formattedValue, configurationValues, condensed );
        }
示例#8
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            DropDownList ddl = new DropDownList();

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService();
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Order))
            {
                ddl.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            controls.Add(ddl);

            return(controls);
        }
示例#9
0
        /// <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 Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new RockDropDownList { ID = id };

            var definedTypes = new Model.DefinedTypeService( new RockContext() ).Queryable().OrderBy( d => d.Order );
            if ( definedTypes.Any() )
            {
                foreach ( var definedType in definedTypes )
                {
                    editControl.Items.Add( new ListItem( definedType.Name, definedType.Guid.ToString() ) );
                }
                return editControl;
            }

            return null;
        }
示例#10
0
        /// <summary>
        /// Returns the field's current value(s)
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">Information about the value</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
        /// <returns></returns>
        public override string FormatValue(Control parentControl, string value, Dictionary <string, ConfigurationValue> configurationValues, bool condensed)
        {
            string formattedValue = string.Empty;

            Guid guid = Guid.Empty;

            if (Guid.TryParse(value, out guid))
            {
                var definedType = new Model.DefinedTypeService().Get(guid);
                if (definedType != null)
                {
                    formattedValue = definedType.Name;
                }
            }

            return(base.FormatValue(parentControl, formattedValue, configurationValues, condensed));
        }
示例#11
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddlDefinedType = new RockDropDownList();

            controls.Add(ddlDefinedType);
            ddlDefinedType.AutoPostBack          = true;
            ddlDefinedType.SelectedIndexChanged += OnQualifierUpdated;
            ddlDefinedType.Label = "Defined Type";
            ddlDefinedType.Help  = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService(new RockContext());
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Name))
            {
                ddlDefinedType.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            // Add checkbox for deciding if the defined values list is rendered as a drop
            // down list or a checkbox list.
            var cbAllowMultipleValues = new RockCheckBox();

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

            // option for Display Descriptions
            var cbDescription = new RockCheckBox();

            controls.Add(cbDescription);
            cbDescription.AutoPostBack    = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label           = "Display Descriptions";
            cbDescription.Text            = "Yes";
            cbDescription.Help            = "When set, the defined value descriptions will be displayed instead of the values.";

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

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

            // Add checkbox for deciding if the list should include inactive items
            var cbIncludeInactive = new RockCheckBox();

            controls.Add(cbIncludeInactive);
            cbIncludeInactive.AutoPostBack    = true;
            cbIncludeInactive.CheckedChanged += OnQualifierUpdated;
            cbIncludeInactive.Label           = "Include Inactive";
            cbIncludeInactive.Text            = "Yes";
            cbIncludeInactive.Help            = "When set, inactive defined values will be included in the list.";

            // Checkbox to indicate if new defined types can be added via the field type.
            var cbAllowAddingNewValues = new RockCheckBox
            {
                AutoPostBack = true,
                Label        = "Allow Adding New Values",
                Text         = "Yes",
                Help         = "When set the defined type picker can be used to add new defined types."
            };

            cbAllowAddingNewValues.CheckedChanged += OnQualifierUpdated;
            controls.Add(cbAllowAddingNewValues);

            var tbRepeatColumns = new NumberBox
            {
                AutoPostBack = true,
                Label        = "Repeat Columns",
                Help         = "Select how many columns the list should use before going to the next row. If 0 then the options are put next to each other and wrap around. If blank then 4 columns will be displayed. There is no upper limit enforced here however the block this is used in might add contraints due to available space.",
                MinimumValue = "0"
            };

            tbRepeatColumns.TextChanged += OnQualifierUpdated;
            controls.Add(tbRepeatColumns);

            return(controls);
        }