Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorFieldAttribute" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="required">if set to <c>true</c> [required].</param>
        /// <param name="selctionType">The selection type.</param>
        /// <param name="defaultValue">The default value.</param>
        /// <param name="category">The category.</param>
        /// <param name="order">The order.</param>
        /// <param name="key">The key.</param>
        public ColorFieldAttribute(string name, string description = "", bool required = true, string selctionType = "Color Picker", string defaultValue = "", string category = "", int order = 0, string key = null)
            : base(name, description, required, defaultValue, category, order, key, typeof(Rock.Field.Types.ColorFieldType).FullName)
        {
            var selectionTypeConfigValue = new Field.ConfigurationValue(selctionType);

            FieldConfigurationValues.Add(SELECTION_TYPE, selectionTypeConfigValue);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DateRangeFieldAttribute" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="theme">The theme.</param>
 /// <param name="height">The height.</param>
 /// <param name="required">if set to <c>true</c> [required].</param>
 /// <param name="defaultValue">The default value.</param>
 /// <param name="category">The category.</param>
 /// <param name="order">The order.</param>
 /// <param name="key">The key.</param>
 public CodeEditorFieldAttribute(string name, string description = "", CodeEditorMode mode = CodeEditorMode.Text, CodeEditorTheme theme = CodeEditorTheme.Rock, int height = 200, bool required = true, string defaultValue = "", string category = "", int order = 0, string key = null)
     : base(name, description, required, defaultValue, category, order, key, typeof(Rock.Field.Types.CodeEditorFieldType).FullName)
 {
     FieldConfigurationValues.Add(EDITOR_MODE, new Field.ConfigurationValue(mode.ToString()));
     FieldConfigurationValues.Add(EDITOR_THEME, new Field.ConfigurationValue(theme.ToString()));
     FieldConfigurationValues.Add(EDITOR_HEIGHT, new Field.ConfigurationValue(height.ToString()));
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SlidingDateRangeFieldAttribute" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="required">if set to <c>true</c> [required].</param>
 /// <param name="defaultValue">The default value.</param>
 /// <param name="category">The category.</param>
 /// <param name="order">The order.</param>
 /// <param name="key">The key.</param>
 /// <param name="enabledSlidingDateRangeTypes">The enabled sliding date range types. Choose from: 'Previous, Last, Current, Next, Upcoming, DateRange'</param>
 public SlidingDateRangeFieldAttribute(string name, string description = "", bool required = true, string defaultValue = ",", string category = "", int order = 0, string key = null, string enabledSlidingDateRangeTypes = null)
     : base(name, description, required, defaultValue, category, order, key, typeof(Rock.Field.Types.SlidingDateRangeFieldType).FullName)
 {
     if (enabledSlidingDateRangeTypes != null)
     {
         FieldConfigurationValues.Add(ENABLED_SLIDING_DATE_RANGE_TYPES, new Field.ConfigurationValue(enabledSlidingDateRangeTypes));
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupCategoryFieldAttribute" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="allowMultiple">if set to <c>true</c> [allow multiple].</param>
        /// <param name="groupTypeGuid">The group type unique identifier.</param>
        /// <param name="required">if set to <c>true</c> [required].</param>
        /// <param name="defaultValue">The default value.</param>
        /// <param name="category">The category.</param>
        /// <param name="order">The order.</param>
        /// <param name="key">The key.</param>
        /// <exception cref="System.Exception">
        /// groupTypeGuid must be specified
        /// or
        /// A valid groupTypeGuid must be specified
        /// </exception>
        public GroupCategoryFieldAttribute(string name, string description = "", bool allowMultiple = false, string groupTypeGuid = null,
                                           bool required = true, string defaultValue = "", string category = "", int order = 0, string key = null) :
            base(name, description, required, defaultValue, category, order, key,
                 (allowMultiple ? typeof(CategoriesFieldType).FullName : typeof(CategoryFieldType).FullName))
        {
            FieldConfigurationValues.Add(ENTITY_TYPE_NAME_KEY, new Field.ConfigurationValue("Rock.Model.Group"));
            FieldConfigurationValues.Add(QUALIFIER_COLUMN_KEY, new Field.ConfigurationValue("GroupTypeId"));

            GroupTypeGuid = groupTypeGuid;
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ValueListFieldAttribute" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="required">if set to <c>true</c> [required].</param>
 /// <param name="defaultValue">The default value.</param>
 /// <param name="keyPrompt">The text to display as a prompt in the key textbox.</param>
 /// <param name="valuePrompt">The text to display as a prompt in the label textbox.</param>
 /// <param name="definedTypeGuid">An Optional Defined Type Guid to select values from, otherwise values will be free-form text fields..</param>
 /// <param name="customValues">Optional list of options to use for the values.  Format is either 'value1,value2,value3,...', or 'value1:text1,value2:text2,value3:text3,...'.</param>
 /// <param name="category">The category.</param>
 /// <param name="order">The order.</param>
 /// <param name="key">The key.</param>
 /// <param name="fieldTypeClass">The field type class.</param>
 public KeyValueListFieldAttribute(string name      = "", string description = "", bool required = true, string defaultValue        = "",
                                   string keyPrompt = "", string valuePrompt = "", string definedTypeGuid = "", string customValues = "",
                                   string category  = "", int order          = 0, string key = null, string fieldTypeClass = null)
     : base(name, description, required, defaultValue, valuePrompt, definedTypeGuid, customValues, category, order, key,
            typeof(Rock.Field.Types.KeyValueListFieldType).FullName)
 {
     if (!string.IsNullOrWhiteSpace(keyPrompt))
     {
         var configValue = new Field.ConfigurationValue(keyPrompt);
         FieldConfigurationValues.Add(KEY_PROMPT_KEY, configValue);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryFieldAttribute" /> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="allowMultiple">if set to <c>true</c> [allow multiple].</param>
        /// <param name="entityTypeName">Name of the entity type.</param>
        /// <param name="required">if set to <c>true</c> [required].</param>
        /// <param name="defaultValue">The default value.</param>
        /// <param name="category">The category.</param>
        /// <param name="order">The order.</param>
        /// <param name="key">The key.</param>
        public AttributeCategoryFieldAttribute(string name, string description = "", bool allowMultiple = false,
                                               string entityTypeName           = "", bool required = true, string defaultValue = "", string category = "",
                                               int order = 0, string key = null) :
            base(name, description, required, defaultValue, category, order, key,
                 (allowMultiple ? typeof(CategoriesFieldType).FullName : typeof(CategoryFieldType).FullName))
        {
            FieldConfigurationValues.Add(ENTITY_TYPE_NAME_KEY, new Field.ConfigurationValue("Rock.Model.Attribute"));
            FieldConfigurationValues.Add(QUALIFIER_COLUMN_KEY, new Field.ConfigurationValue("EntityTypeId"));

            var entityType = EntityTypeCache.Read(entityTypeName, false);

            if (entityType != null)
            {
                FieldConfigurationValues.Add(QUALIFIER_VALUE_KEY, new Field.ConfigurationValue(entityType.Id.ToString()));
            }
        }