/// <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) { ListControl editControl; editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); if (configurationValues != null && configurationValues.ContainsKey(GROUP_TYPE_KEY)) { Guid?groupTypeGuid = configurationValues.GetValueOrNull(GROUP_TYPE_KEY).AsGuidOrNull(); if (groupTypeGuid != null) { var groupType = GroupTypeCache.Get(groupTypeGuid.Value); if (groupType != null) { var locationTypeValues = groupType.LocationTypeValues; if (locationTypeValues != null) { foreach (var locationTypeValue in locationTypeValues) { editControl.Items.Add(new ListItem(locationTypeValue.Value, locationTypeValue.Id.ToString())); } } } } } return(editControl); }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { var controls = base.ConfigurationControls(); var tbValuePrompt = new RockTextBox(); controls.Add( tbValuePrompt ); tbValuePrompt.AutoPostBack = true; tbValuePrompt.TextChanged += OnQualifierUpdated; tbValuePrompt.Label = "Label Prompt"; tbValuePrompt.Help = "The text to display as a prompt in the label textbox."; var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.DataTextField = "Name"; ddl.DataValueField = "Id"; ddl.DataSource = new Rock.Model.DefinedTypeService( new RockContext() ).Queryable().OrderBy( d => d.Order ).ToList(); ddl.DataBind(); ddl.Items.Insert(0, new ListItem(string.Empty, string.Empty)); ddl.Label = "Defined Type"; ddl.Help = "Optional Defined Type to select values from, otherwise values will be free-form text fields."; var tbCustomValues = new RockTextBox(); controls.Add( tbCustomValues ); tbCustomValues.TextMode = TextBoxMode.MultiLine; tbCustomValues.Rows = 3; tbCustomValues.AutoPostBack = true; tbCustomValues.TextChanged += OnQualifierUpdated; tbCustomValues.Label = "Custom Values"; tbCustomValues.Help = "Optional list of options to use for the values. Format is either 'value1,value2,value3,...', or 'value1:text1,value2:text2,value3:text3,...'."; return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { RockDropDownList groupLocationTypeList = new RockDropDownList(); groupLocationTypeList.Items.Clear(); foreach ( var value in Rock.Web.Cache.DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid() ).DefinedValues.OrderBy( a => a.Order ).ThenBy( a => a.Value ) ) { groupLocationTypeList.Items.Add( new ListItem( value.Value, value.Guid.ToString() ) ); } groupLocationTypeList.Items.Insert( 0, Rock.Constants.None.ListItem ); groupLocationTypeList.ID = filterControl.ID + "_groupLocationTypeList"; groupLocationTypeList.Label = "Location Type"; filterControl.Controls.Add( groupLocationTypeList ); LocationPicker locationPicker = new LocationPicker(); locationPicker.ID = filterControl.ID + "_locationPicker"; locationPicker.Label = "Location"; filterControl.Controls.Add( locationPicker ); NumberBox numberBox = new NumberBox(); numberBox.ID = filterControl.ID + "_numberBox"; numberBox.NumberType = ValidationDataType.Double; numberBox.Label = "Miles"; numberBox.AddCssClass( "number-box-miles" ); filterControl.Controls.Add( numberBox ); return new Control[3] { groupLocationTypeList, locationPicker, numberBox }; }
/// <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 editControl = new RockDropDownList { ID = id }; editControl.Items.Add( new ListItem() ); var statuses = new ConnectionStatusService( new RockContext() ) .Queryable().AsNoTracking() .OrderBy( s => s.ConnectionType.Name ) .ThenBy( s => s.Name ) .Select( s => new { s.Guid, s.Name, ConnectionTypeName = s.ConnectionType.Name } ) .ToList(); if ( statuses.Any() ) { foreach ( var status in statuses ) { var listItem = new ListItem( status.Name, status.Guid.ToString().ToUpper() ); listItem.Attributes.Add( "OptionGroup", status.ConnectionTypeName ); editControl.Items.Add( listItem ); } return editControl; } return null; }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { List<Control> controls = new List<Control>(); var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.Items.Add( new ListItem( None.Text, None.IdValue ) ); foreach ( var entityType in new EntityTypeService( new RockContext() ).GetEntities().OrderBy( e => e.FriendlyName ).ThenBy( e => e.Name ) ) { ddl.Items.Add( new ListItem( entityType.FriendlyName, entityType.Name ) ); } ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.Label = "Entity Type"; ddl.Help = "The type of entity to display categories for."; var tbColumn = new RockTextBox(); controls.Add( tbColumn ); tbColumn.AutoPostBack = true; tbColumn.TextChanged += OnQualifierUpdated; tbColumn.Label = "Qualifier Column"; tbColumn.Help = "Entity column qualifier."; var tbValue = new RockTextBox(); controls.Add( tbValue ); tbValue.AutoPostBack = true; tbValue.TextChanged += OnQualifierUpdated; tbValue.Label = "Qualifier Value"; tbValue.Help = "Entity column value."; return controls; }
/// <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) { ListControl editControl; if (configurationValues != null && configurationValues.ContainsKey(ALLOW_MULTIPLE_KEY) && configurationValues[ALLOW_MULTIPLE_KEY].Value.AsBoolean()) { editControl = new Rock.Web.UI.Controls.RockCheckBoxList { ID = id }; editControl.AddCssClass("checkboxlist-group"); } else { editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); } if (configurationValues != null && configurationValues.ContainsKey(DEFINED_TYPE_KEY)) { int definedTypeId = 0; if (Int32.TryParse(configurationValues[DEFINED_TYPE_KEY].Value, out definedTypeId)) { Rock.Model.DefinedValueService definedValueService = new Model.DefinedValueService(); foreach (var definedValue in definedValueService.GetByDefinedTypeId(definedTypeId)) { editControl.Items.Add(new ListItem(definedValue.Name, definedValue.Id.ToString())); } } } return(editControl); }
/// <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 workflow types (the one that gets selected is // used to build a list of workflow activity types) var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.Label = "Workflow Type"; ddl.Help = "The Workflow Type to select activities from."; var originalValue = ddl.SelectedValue; Rock.Model.WorkflowTypeService workflowTypeService = new Model.WorkflowTypeService( new RockContext() ); foreach ( var workflowType in workflowTypeService.Queryable().OrderBy( w => w.Name ) ) { ddl.Items.Add( new ListItem( workflowType.Name, workflowType.Guid.ToString() ) ); } var httpContext = System.Web.HttpContext.Current; if ( string.IsNullOrEmpty(originalValue) && httpContext != null && httpContext.Request != null && httpContext.Request.Params["workflowTypeId"] != null && httpContext.Request.Params["workflowTypeId"].AsIntegerOrNull() == 0 ) { var workflowType = GetContextWorkflowType(); ddl.Items.Add( new ListItem( ( string.IsNullOrWhiteSpace( workflowType.Name ) ? "Current Workflow" : workflowType.Name ), "" ) ); ddl.SelectedIndex = ddl.Items.Count - 1; } return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var ddlGroupType = new RockDropDownList(); ddlGroupType.ID = filterControl.ID + "_0"; filterControl.Controls.Add( ddlGroupType ); foreach ( Rock.Model.GroupType groupType in new GroupTypeService( new RockContext() ).Queryable() ) { ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Guid.ToString() ) ); } var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes ); ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; filterControl.Controls.Add( ddlIntegerCompare ); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; filterControl.Controls.Add( tbAttendedCount ); var tbInLastWeeksCount = new RockTextBox(); tbInLastWeeksCount.ID = filterControl.ID + "_tbInLastWeeksCount"; filterControl.Controls.Add( tbInLastWeeksCount ); var controls = new Control[4] { ddlGroupType, ddlIntegerCompare, tbAttendedCount, tbInLastWeeksCount }; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format( "{0}|{1}|4|16", ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) ); return controls; }
/// <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 editControl = new RockDropDownList { ID = id }; editControl.Items.Add( new ListItem() ); var types = new ConnectionTypeService( new RockContext() ) .Queryable().AsNoTracking() .OrderBy( o => o.Name ) .Select( o => new { o.Guid, o.Name, } ) .ToList(); if ( types.Any() ) { foreach ( var type in types ) { var listItem = new ListItem( type.Name, type.Guid.ToString().ToUpper() ); editControl.Items.Add( listItem ); } return editControl; } return null; }
/// <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() { List<Control> controls = new List<Control>(); var ddlMode = new RockDropDownList(); controls.Add( ddlMode ); ddlMode.BindToEnum<CodeEditorMode>(); ddlMode.AutoPostBack = true; ddlMode.SelectedIndexChanged += OnQualifierUpdated; ddlMode.Label = "Editor Mode"; ddlMode.Help = "The type of code that will be entered."; var ddlTheme = new RockDropDownList(); controls.Add( ddlTheme ); ddlTheme.BindToEnum<CodeEditorTheme>(); ddlTheme.AutoPostBack = true; ddlTheme.SelectedIndexChanged += OnQualifierUpdated; ddlTheme.Label = "Editor Theme"; ddlTheme.Help = "The styling them to use for the code editor."; var nbHeight = new NumberBox(); controls.Add( nbHeight ); nbHeight.NumberType = System.Web.UI.WebControls.ValidationDataType.Integer; nbHeight.AutoPostBack = true; nbHeight.TextChanged += OnQualifierUpdated; nbHeight.Label = "Editor Height"; nbHeight.Help = "The height of the control in pixels."; return controls; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var ddlGroupType = new RockDropDownList(); ddlGroupType.ID = filterControl.ID + "_0"; filterControl.Controls.Add( ddlGroupType ); foreach ( Rock.Model.GroupType groupType in new GroupTypeService( new RockContext() ).Queryable() ) { ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Guid.ToString() ) ); } var ddl = ComparisonControl( NumericFilterComparisonTypes ); ddl.ID = filterControl.ID + "_1"; filterControl.Controls.Add( ddl ); var tb = new RockTextBox(); tb.ID = filterControl.ID + "_2"; filterControl.Controls.Add( tb ); var tb2 = new RockTextBox(); tb2.ID = filterControl.ID + "_3"; filterControl.Controls.Add( tb ); var controls = new Control[4] { ddlGroupType, ddl, tb, tb2 }; SetSelection( entityType, controls, string.Format( "{0}|{1}|4|16", ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) ); return controls; }
/// <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 filteredFieldTypes = new List <string>(); if (configurationValues != null && configurationValues.ContainsKey(ATTRIBUTE_FIELD_TYPES_KEY)) { filteredFieldTypes = configurationValues[ATTRIBUTE_FIELD_TYPES_KEY].Value .Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); } var editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); var attributes = GetContextAttributes(); if (attributes != null) { foreach (var attribute in attributes) { var fieldType = FieldTypeCache.Get(attribute.Value.FieldTypeId); if (!filteredFieldTypes.Any() || filteredFieldTypes.Contains(fieldType.Class, StringComparer.OrdinalIgnoreCase)) { editControl.Items.Add(new ListItem(attribute.Value.Name, attribute.Key.ToString())); } } } return(editControl); }
/// <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) { ListControl editControl; editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); if (configurationValues != null && configurationValues.ContainsKey(GROUP_TYPE_KEY)) { Guid groupTypeGuid = Guid.Empty; if (Guid.TryParse(configurationValues[GROUP_TYPE_KEY].Value, out groupTypeGuid)) { var groupType = Rock.Web.Cache.GroupTypeCache.Read(groupTypeGuid); if (groupType != null) { var locationTypeValues = groupType.LocationTypeValues; if (locationTypeValues != null) { foreach (var locationTypeValue in locationTypeValues) { editControl.Items.Add(new ListItem(locationTypeValue.Name, locationTypeValue.Id.ToString())); } } } } } return(editControl); }
/// <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; }
/// <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 ddl = new RockDropDownList { ID = id }; foreach ( ComparisonType comparisonType in Enum.GetValues( typeof( ComparisonType ) ) ) { ddl.Items.Add( new ListItem( comparisonType.ConvertToString(), comparisonType.ConvertToInt().ToString() ) ); } return ddl; }
/// <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 service = new EmailTemplateService(); foreach ( var emailTemplate in service.Queryable().OrderBy( e => e.Title ) ) { editControl.Items.Add( new ListItem( emailTemplate.Title, emailTemplate.Guid.ToString() ) ); } return editControl; }
/// <summary> /// Renders the controls neccessary for prompting user for a new value and adds them to the parentControl /// </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 ddl = new RockDropDownList { ID = id }; Type colors = typeof( System.Drawing.Color ); PropertyInfo[] colorInfo = colors.GetProperties( BindingFlags.Public | BindingFlags.Static ); foreach ( PropertyInfo info in colorInfo ) { ddl.Items.Add( new ListItem( info.Name, info.Name ) ); } return ddl; }
/// <summary> /// Initializes a new instance of the <see cref="NewFamilyMembersRow" /> class. /// </summary> public NewFamilyMembersRow() : base() { _rblRole = new RockRadioButtonList(); _ddlTitle = new DropDownList(); _tbFirstName = new RockTextBox(); _tbNickName = new RockTextBox(); _tbLastName = new RockTextBox(); _rblGender = new RockRadioButtonList(); _dpBirthdate = new DatePicker(); _ddlConnectionStatus = new DropDownList(); _ddlGrade = new RockDropDownList(); _lbDelete = new LinkButton(); }
/// <summary> /// Initializes a new instance of the <see cref="NewFamilyMembersRow" /> class. /// </summary> public NewFamilyMembersRow() : base() { _rblRole = new RockRadioButtonList(); _ddlTitle = new DropDownList(); _tbFirstName = new RockTextBox(); _tbLastName = new RockTextBox(); _ddlSuffix = new DropDownList(); _rblGender = new RockRadioButtonList(); _dpBirthdate = new DatePicker(); _ddlConnectionStatus = new DropDownList(); _ddlGrade = new RockDropDownList(); _lbDelete = new LinkButton(); }
/// <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 ) { var editControl = new RockDropDownList { ID = id }; CampusService campusService = new CampusService(); var campusList = campusService.Queryable().OrderBy( a => a.Name ).ToList(); editControl.Items.Add( None.ListItem ); foreach ( var campus in campusList ) { editControl.Items.Add( new ListItem( campus.Name, campus.Id.ToString() ) ); } return editControl; }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { var controls = base.ConfigurationControls(); var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; var definedType = DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.GROUPTYPE_PURPOSE.AsGuid() ); ddl.BindToDefinedType( definedType, true ); ddl.Label = "Purpose"; ddl.Help = "An optional setting to limit the selection of group types to those that have the selected purpose."; return controls; }
/// <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; }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { var controls = base.ConfigurationControls(); var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.DataTextField = "Name"; ddl.DataValueField = "Id"; ddl.DataSource = new Rock.Model.DefinedTypeService().Queryable().OrderBy( d => d.Order ).ToList(); ddl.DataBind(); ddl.Items.Insert(0, new ListItem(string.Empty, string.Empty)); ddl.Label = "Defined Type"; ddl.Help = "Optional Defined Type to select values from, otherwise values will be free-form text fields."; return controls; }
/// <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 Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add( new ListItem() ); var workflowTypeAttributes = GetContextWorkflowTypeAttributes(); if ( workflowTypeAttributes != null ) { foreach ( var attribute in workflowTypeAttributes ) { editControl.Items.Add( new ListItem( attribute.Value.Name, attribute.Key.ToString() ) ); } } return editControl; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls(this, Controls); _registrationTemplatePicker = new RegistrationTemplatePicker(); _registrationTemplatePicker.ID = this.ID + "_registrationTemplatePicker"; _registrationTemplatePicker.SelectItem += _ddlRegistrationTemplate_SelectedIndexChanged; _registrationTemplatePicker.Label = "Registration Template"; Controls.Add(_registrationTemplatePicker); _ddlRegistrationInstance = new RockDropDownList(); _ddlRegistrationInstance.ID = this.ID + "_ddlRegistrationInstance"; _ddlRegistrationInstance.Label = "Registration Instance"; Controls.Add(_ddlRegistrationInstance); }
/// <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 roles = new GroupService( new RockContext() ).Queryable().Where(g => g.IsSecurityRole).OrderBy( t => t.Name ); if ( roles.Any() ) { foreach ( var role in roles ) { editControl.Items.Add( new ListItem( role.Name, role.Guid.ToString() ) ); } return editControl; } return null; }
/// <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 systemEmails = new SystemEmailService( new RockContext() ).Queryable().OrderBy( e => e.Title ); if ( systemEmails.Any() ) { foreach ( var systemEmail in systemEmails ) { editControl.Items.Add( new ListItem( systemEmail.Title, systemEmail.Guid.ToString() ) ); } return editControl; } return null; }
/// <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 templates = new CommunicationTemplateService( new RockContext() ).Queryable().OrderBy( t => t.Name ); if ( templates.Any() ) { foreach ( var template in templates ) { editControl.Items.Add( new ListItem( template.Name, template.Guid.ToString() ) ); } return editControl; } return null; }
/// <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 editControl = new RockDropDownList { ID = id }; editControl.Items.Add( new ListItem() ); var contentChannels = new ContentChannelService( new RockContext() ).Queryable().OrderBy( d => d.Name ); if ( contentChannels.Any() ) { foreach ( var contentChannel in contentChannels ) { editControl.Items.Add( new ListItem( contentChannel.Name, contentChannel.Guid.ToString().ToUpper() ) ); } return editControl; } return null; }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { RockDropDownList contentChannelPicker = new RockDropDownList(); contentChannelPicker.CssClass = "js-content-channel-picker"; contentChannelPicker.ID = filterControl.ID + "_contentChannelPicker"; contentChannelPicker.Label = "Content Channel"; contentChannelPicker.Items.Clear(); var contentChannelList = new ContentChannelService( new RockContext() ).Queryable().OrderBy( a => a.Name ).ToList(); foreach ( var contentChannel in contentChannelList ) { contentChannelPicker.Items.Add( new ListItem( contentChannel.Name, contentChannel.Id.ToString() ) ); } filterControl.Controls.Add( contentChannelPicker ); return new Control[] { contentChannelPicker }; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls(this, Controls); _ddlGroupType = new RockDropDownList(); _ddlGroupType.ID = this.ID + "_ddlGroupType"; _ddlGroupType.AutoPostBack = true; _ddlGroupType.SelectedIndexChanged += _ddlGroupType_SelectedIndexChanged; Controls.Add(_ddlGroupType); _ddlGroupRole = new RockDropDownList(); _ddlGroupRole.ID = this.ID + "_ddlGroupRole"; Controls.Add(_ddlGroupRole); LoadGroupTypes(); }
/// <summary> /// Initializes a new instance of the <see cref="NewGroupMembersRow" /> class. /// </summary> public NewGroupMembersRow() : base() { _rblRole = new RockRadioButtonList(); _ddlTitle = new DropDownList(); _tbFirstName = new RockTextBox(); _tbNickName = new RockTextBox(); _tbMiddleName = new RockTextBox(); _tbLastName = new RockTextBox(); _ddlSuffix = new DropDownList(); _ddlConnectionStatus = new RockDropDownList(); _rblGender = new RockRadioButtonList(); _dpBirthdate = new DatePicker(); _ddlGradePicker = new GradePicker { UseAbbreviation = true, UseGradeOffsetAsValue = true }; _ddlGradePicker.Label = string.Empty; _lbDelete = new LinkButton(); }
/// <summary> /// Initializes a new instance of the <see cref="NewGroupMembersRow" /> class. /// </summary> public PreRegistrationChildRow() : base() { _lNickName = new RockLiteral(); _lLastName = new RockLiteral(); _tbNickName = new RockTextBox(); _tbLastName = new RockTextBox(); _ddlSuffix = new DefinedValuePicker(); _ddlGender = new RockDropDownList(); _dpBirthdate = new DatePicker(); _ddlGradePicker = new GradePicker { UseAbbreviation = true, UseGradeOffsetAsValue = true }; _ddlGradePicker.Label = string.Empty; _pnbMobile = new PhoneNumberBox(); _ddlRelationshipType = new RockDropDownList(); _phAttributes = new PlaceHolder(); _lbDelete = new LinkButton(); }
/// <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) { ListControl editControl; editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); IEnumerable <WorkflowActivityType> activityTypes = null; Guid?workflowTypeGuid = configurationValues != null && configurationValues.ContainsKey(WORKFLOW_TYPE_KEY) ? configurationValues[WORKFLOW_TYPE_KEY].Value.AsGuidOrNull() : null; WorkflowType workflowType = null; if (workflowTypeGuid.HasValue) { var workflowTypeService = new WorkflowTypeService(new RockContext()); workflowType = workflowTypeService.Get(workflowTypeGuid.Value); } if (workflowType == null) { workflowType = GetContextWorkflowType(); } if (workflowType != null) { activityTypes = workflowType.ActivityTypes; if (activityTypes != null && activityTypes.Any()) { foreach (var activityType in activityTypes.OrderBy(a => a.Order)) { editControl.Items.Add(new ListItem(activityType.Name ?? "[New Activity]", activityType.Guid.ToString().ToUpper())); } } return(editControl); } return(null); }
/// <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 ) { var editControl = new RockDropDownList { ID = id }; SiteService siteService = new SiteService( new RockContext() ); var siteList = siteService.Queryable().OrderBy( a => a.Name ).ToList(); if ( siteList.Any() ) { foreach ( var site in siteList ) { editControl.Items.Add( new ListItem( site.Name, site.Id.ToString() ) ); } return editControl; } return null; }
/// <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) { ListControl editControl; if (configurationValues != null && configurationValues.ContainsKey(ALLOW_MULTIPLE_KEY) && configurationValues[ALLOW_MULTIPLE_KEY].Value.AsBoolean()) { editControl = new Rock.Web.UI.Controls.RockCheckBoxList { ID = id, RepeatDirection = RepeatDirection.Horizontal }; editControl.AddCssClass("checkboxlist-group"); } else { editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); } if (configurationValues != null && configurationValues.ContainsKey(DEFINED_TYPE_KEY)) { int?definedTypeId = configurationValues[DEFINED_TYPE_KEY].Value.AsIntegerOrNull(); if (definedTypeId.HasValue) { Rock.Model.DefinedValueService definedValueService = new Model.DefinedValueService(new RockContext()); var definedValues = definedValueService.GetByDefinedTypeId(definedTypeId.Value); if (definedValues.Any()) { bool useDescription = configurationValues.ContainsKey(DISPLAY_DESCRIPTION) && configurationValues[DISPLAY_DESCRIPTION].Value.AsBoolean(); foreach (var definedValue in definedValues) { editControl.Items.Add(new ListItem(useDescription ? definedValue.Description : definedValue.Value, definedValue.Id.ToString())); } } return(editControl); } } return(null); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hiddenField = new HiddenField(); _hiddenField.ID = this.ID + "_hiddenField"; Controls.Add(_hiddenField); _hfDisableVrm = new HiddenField(); _hfDisableVrm.ID = this.ID + "_hiddenField_dvrm"; _hfDisableVrm.Value = "True"; Controls.Add(_hfDisableVrm); _textBox = new RockTextBox(); _textBox.ID = this.ID + "_textBox"; Controls.Add(_textBox); _dropDownList = new RockDropDownList(); _dropDownList.ID = this.ID + "_dropDownList"; Controls.Add(_dropDownList); }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { var controls = base.ConfigurationControls(); var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.Items.Clear(); ddl.Items.Add( new ListItem( string.Empty, string.Empty ) ); foreach ( var ft in new BinaryFileTypeService( new RockContext() ) .Queryable() .OrderBy( f => f.Name ) .Select( f => new { f.Guid, f.Name } ) ) { ddl.Items.Add( new ListItem( ft.Name, ft.Guid.ToString().ToLower() ) ); } ddl.Label = "File Type"; ddl.Help = "File type to use to store and retrieve the file. New file types can be configured under 'Admin Tools > General Settings > File Types'"; return controls; }
/// <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) { ListControl editControl; editControl = new Rock.Web.UI.Controls.RockDropDownList { ID = id }; editControl.Items.Add(new ListItem()); IEnumerable <WorkflowActivityType> activityTypes = null; var workflowType = GetContextWorkflowType(); if (workflowType != null) { activityTypes = workflowType.ActivityTypes; } if (activityTypes == null && configurationValues != null && configurationValues.ContainsKey(WORKFLOW_TYPE_KEY)) { Guid workflowTypeGuid = configurationValues[WORKFLOW_TYPE_KEY].Value.AsGuid(); if (!workflowTypeGuid.IsEmpty()) { activityTypes = new WorkflowActivityTypeService(new RockContext()) .Queryable() .Where(t => t.WorkflowType.Guid.Equals(workflowTypeGuid)); } } if (activityTypes != null && activityTypes.Any()) { foreach (var activityType in activityTypes.OrderBy(a => a.Order)) { editControl.Items.Add(new ListItem(activityType.Name ?? "[New Activity]", activityType.Guid.ToString().ToUpper())); } } return(editControl); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); _ddlDefinedValues = new RockDropDownList(); _ddlDefinedValues.ID = this.ID + "_ddlDefinedValues"; _ddlDefinedValues.EnhanceForLongLists = this.EnhanceForLongLists; _ddlDefinedValues.SelectedIndexChanged += ddlDefinedValues_SelectedIndexChanged; _ddlDefinedValues.AutoPostBack = true; Controls.Add(_ddlDefinedValues); var linkButtonClickJs = $@"javascript:$('.{this.ClientID}-js-defined-value-selector').fadeOut(400, function() {{ $('.{this.ClientID}-js-defined-value-selector').attr('style', 'display: none !important'); $('#{DefinedValueEditorControl.ClientID}').fadeIn(); }}); return false;"; LinkButtonAddDefinedValue = new LinkButton(); LinkButtonAddDefinedValue.ID = this.ID + "_lbAddDefinedValue"; LinkButtonAddDefinedValue.CssClass = "btn btn-default btn-square js-button-add-defined-value"; LinkButtonAddDefinedValue.OnClientClick = linkButtonClickJs; LinkButtonAddDefinedValue.Controls.Add(new HtmlGenericControl { InnerHtml = "<i class='fa fa-plus'></i>" }); Controls.Add(LinkButtonAddDefinedValue); if (this.Required) { this.RequiredFieldValidator = new RequiredFieldValidator(); this.RequiredFieldValidator.ID = this.ID + "_rfv"; this.RequiredFieldValidator.ControlToValidate = _ddlDefinedValues.ID; this.RequiredFieldValidator.Display = ValidatorDisplay.Dynamic; this.RequiredFieldValidator.CssClass = "validation-error help-inline"; this.RequiredFieldValidator.Enabled = true; this.RequiredFieldValidator.ValidationGroup = this.ValidationGroup; Controls.Add(this.RequiredFieldValidator); } LoadDefinedValues(); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls(this, Controls); _ddlContentChannel = new RockDropDownList(); _ddlContentChannel.ID = this.ID + "_ddlContentChannel"; _ddlContentChannel.AutoPostBack = true; _ddlContentChannel.EnhanceForLongLists = true; _ddlContentChannel.Label = "Content Channel"; _ddlContentChannel.SelectedIndexChanged += _ddlContentChannel_SelectedIndexChanged; Controls.Add(_ddlContentChannel); _ddlContentChannelItem = new RockDropDownList(); _ddlContentChannelItem.EnhanceForLongLists = true; _ddlContentChannelItem.ID = this.ID + "_ddlContentChannelItem"; Controls.Add(_ddlContentChannelItem); LoadContentChannels(); }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { var controls = base.ConfigurationControls(); var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.DataTextField = "Name"; ddl.DataValueField = "Id"; ddl.DataSource = new BinaryFileTypeService( new RockContext() ) .Queryable() .OrderBy( f => f.Name ) .Select( f => new { f.Id, f.Name } ) .ToList(); ddl.DataBind(); ddl.Items.Insert( 0, new ListItem( string.Empty, string.Empty ) ); ddl.Label = "File Type"; ddl.Help = "The type of files to list."; 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 group types (the one that gets selected is // used to build a list of group location type defined values that the // group type allows) var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.Label = "Group Type"; ddl.Help = "The Group Type to select location types from."; Rock.Model.GroupTypeService groupTypeService = new Model.GroupTypeService( new RockContext() ); foreach ( var groupType in groupTypeService.Queryable().OrderBy( g => g.Name ) ) { ddl.Items.Add( new ListItem( groupType.Name, groupType.Guid.ToString() ) ); } return controls; }
/// <summary> /// Creates the HTML controls required to configure this type of field /// </summary> /// <returns></returns> public override List<Control> ConfigurationControls() { List<Control> controls = new List<Control>(); var tb = new RockTextBox(); controls.Add( tb ); tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 3; tb.AutoPostBack = true; tb.TextChanged += OnQualifierUpdated; tb.Label = "Values"; tb.Help = "The source of the values to display in a list. Format is either 'value1,value2,value3,...', 'value1:text1,value2:text2,value3:text3,...', or a SQL Select statement that returns result set with a 'Value' and 'Text' column."; var ddl = new RockDropDownList(); controls.Add( ddl ); ddl.Items.Add( new ListItem( "Drop Down List", "ddl" ) ); ddl.Items.Add( new ListItem( "Radio Buttons", "rb" ) ); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += OnQualifierUpdated; ddl.Label = "Field Type"; ddl.Help = "Field type to use for selection"; return controls; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); _ddlDefinedValues = new RockDropDownList(); _ddlDefinedValues.ID = this.ID + "_ddlDefinedValues"; _ddlDefinedValues.EnhanceForLongLists = this.EnhanceForLongLists; _ddlDefinedValues.Style.Add("width", "85%"); _ddlDefinedValues.SelectedIndexChanged += ddlDefinedValues_SelectedIndexChanged; _ddlDefinedValues.AutoPostBack = true; Controls.Add(_ddlDefinedValues); LinkButtonAddDefinedValue = new LinkButton(); LinkButtonAddDefinedValue.ID = this.ID + "_lbAddDefinedValue"; LinkButtonAddDefinedValue.CssClass = "btn btn-default btn-square js-button-add-defined-value"; LinkButtonAddDefinedValue.OnClientClick = $"javascript:$('.{this.ClientID}-js-defined-value-selector').fadeToggle(400, 'swing', function() {{ $('#{DefinedValueEditorControl.ClientID}').fadeToggle(); }}); return false;"; LinkButtonAddDefinedValue.Controls.Add(new HtmlGenericControl { InnerHtml = "<i class='fa fa-plus'></i>" }); Controls.Add(LinkButtonAddDefinedValue); LoadDefinedValues(); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { if (!_controlsLoaded) { Controls.Clear(); _hfExistingKeyNames = new HtmlInputHidden(); _hfExistingKeyNames.AddCssClass("js-existing-key-names"); _hfExistingKeyNames.ID = this.ID + "_hfExistingKeyNames"; Controls.Add(_hfExistingKeyNames); _lAttributeActionTitle = new Literal(); _lAttributeActionTitle.ID = "lAttributeActionTitle"; Controls.Add(_lAttributeActionTitle); _validationSummary = new ValidationSummary(); _validationSummary.ID = "valiationSummary"; _validationSummary.CssClass = "alert alert-danger"; _validationSummary.HeaderText = "Please Correct the Following"; Controls.Add(_validationSummary); _tbName = new RockTextBox(); _tbName.ID = "tbName"; _tbName.Label = "Name"; _tbName.Required = true; Controls.Add(_tbName); _tbDescription = new RockTextBox(); _tbDescription.Label = "Description"; _tbDescription.ID = "tbDescription"; _tbDescription.TextMode = TextBoxMode.MultiLine; _tbDescription.Rows = 3; Controls.Add(_tbDescription); _cpCategories = new CategoryPicker(); _cpCategories.ID = "cpCategories_" + this.ID.ToString(); _cpCategories.Label = "Categories"; _cpCategories.AllowMultiSelect = true; _cpCategories.EntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id; _cpCategories.EntityTypeQualifierColumn = "EntityTypeId"; Controls.Add(_cpCategories); _tbKey = new RockTextBox(); _tbKey.ID = "tbKey"; _tbKey.Label = "Key"; _tbKey.Required = true; Controls.Add(_tbKey); _cvKey = new CustomValidator(); _cvKey.ID = "cvKey"; _cvKey.ControlToValidate = _tbKey.ID; _cvKey.ClientValidationFunction = "validateKey"; _cvKey.ServerValidate += cvKey_ServerValidate; _cvKey.Display = ValidatorDisplay.Dynamic; _cvKey.CssClass = "validation-error help-inline"; _cvKey.ErrorMessage = "There is already an existing property with the key value you entered or the key has illegal characters. Please select a different key value and use only letters, numbers and underscores."; Controls.Add(_cvKey); _tbIconCssClass = new RockTextBox(); _tbIconCssClass.ID = "_tbIconCssClass"; _tbIconCssClass.Label = "Icon CSS Class"; Controls.Add(_tbIconCssClass); _cbRequired = new RockCheckBox(); _cbRequired.ID = "cbRequired"; _cbRequired.Label = "Required"; _cbRequired.Text = "Require a value"; Controls.Add(_cbRequired); _cbShowInGrid = new RockCheckBox(); _cbShowInGrid.ID = "cbShowInGrid"; _cbShowInGrid.Label = "Show in Grid"; _cbShowInGrid.Text = "Yes"; _cbShowInGrid.Help = "If selected, this attribute will be included in a grid."; Controls.Add(_cbShowInGrid); _cbAllowSearch = new RockCheckBox(); _cbAllowSearch.ID = "cbAllowSearch"; _cbAllowSearch.Label = "Allow Search"; _cbAllowSearch.Text = "Yes"; _cbAllowSearch.Help = "If selected, this attribute can be search on."; _cbAllowSearch.Visible = false; // Default is to not show this option Controls.Add(_cbAllowSearch); _ddlFieldType = new RockDropDownList(); _ddlFieldType.ID = "ddlFieldType"; _ddlFieldType.Label = "Field Type"; _ddlFieldType.AutoPostBack = true; _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged; _ddlFieldType.DataValueField = "Id"; _ddlFieldType.DataTextField = "Name"; Controls.Add(_ddlFieldType); _phQualifiers = new PlaceHolder(); _phQualifiers.ID = "phQualifiers"; _phQualifiers.EnableViewState = false; Controls.Add(_phQualifiers); _phDefaultValue = new PlaceHolder(); _phDefaultValue.ID = "phDefaultValue"; _phDefaultValue.EnableViewState = false; Controls.Add(_phDefaultValue); _btnSave = new LinkButton(); _btnSave.ID = "btnSave"; _btnSave.Text = "OK"; _btnSave.CssClass = "btn btn-primary"; _btnSave.Click += btnSave_Click; Controls.Add(_btnSave); _btnCancel = new LinkButton(); _btnCancel.ID = "btnCancel"; _btnCancel.Text = "Cancel"; _btnCancel.CssClass = "btn btn-link"; _btnCancel.CausesValidation = false; _btnCancel.Click += btnCancel_Click; Controls.Add(_btnCancel); _controlsLoaded = true; } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfExpanded = new HiddenField(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.Value = "False"; _hfActivityGuid = new HiddenField(); Controls.Add(_hfActivityGuid); _hfActivityGuid.ID = this.ID + "_hfActivityTypeGuid"; _lblActivityTypeName = new Label(); Controls.Add(_lblActivityTypeName); _lblActivityTypeName.ClientIDMode = ClientIDMode.Static; _lblActivityTypeName.ID = this.ID + "_lblActivityTypeName"; _lblActivityTypeDescription = new Label(); Controls.Add(_lblActivityTypeDescription); _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static; _lblActivityTypeDescription.ID = this.ID + "_lblActivityTypeDescription"; _lblStatus = new Label(); Controls.Add(_lblStatus); _lblStatus.ClientIDMode = ClientIDMode.Static; _lblStatus.ID = this.ID + "_lblInactive"; _lblStatus.CssClass = "pull-right"; _lbDeleteActivityType = new LinkButton(); Controls.Add(_lbDeleteActivityType); _lbDeleteActivityType.CausesValidation = false; _lbDeleteActivityType.ID = this.ID + "_lbDeleteActivityType"; _lbDeleteActivityType.CssClass = "btn btn-xs btn-square btn-danger js-activity-delete"; _lbDeleteActivityType.Click += lbDeleteActivityType_Click; _lbDeleteActivityType.Controls.Add(new LiteralControl { Text = "<i class='fa fa-times'></i>" }); _cbActivityIsComplete = new RockCheckBox { Text = "Complete" }; Controls.Add(_cbActivityIsComplete); _cbActivityIsComplete.ID = this.ID + "_cbActivityTypeIsActive"; _cbActivityIsComplete.Label = "Activity Completed"; _cbActivityIsComplete.Text = "Yes"; _ppAssignedToPerson = new PersonPicker(); _ppAssignedToPerson.ID = this.ID + "_ppAssignedToPerson"; Controls.Add(_ppAssignedToPerson); _ppAssignedToPerson.Label = "Assign to Person"; _lAssignedToPerson = new RockLiteral(); _lAssignedToPerson.ID = this.ID + "_lAssignedToPerson"; Controls.Add(_lAssignedToPerson); _lAssignedToPerson.Label = "Assigned to Person"; _gpAssignedToGroup = new GroupPicker(); _gpAssignedToGroup.ID = this.ID + "_gpAssignedToGroup"; Controls.Add(_gpAssignedToGroup); _gpAssignedToGroup.Label = "Assign to Group"; _lAssignedToGroup = new RockLiteral(); _lAssignedToGroup.ID = this.ID + "_lAssignedToGroup"; Controls.Add(_lAssignedToGroup); _lAssignedToGroup.Label = "Assigned to Group"; _ddlAssignedToRole = new RockDropDownList(); Controls.Add(_ddlAssignedToRole); _ddlAssignedToRole.ID = this.ID + "_ddlAssignedToRole"; _ddlAssignedToRole.Label = "Assign to Security Role"; _lAssignedToRole = new RockLiteral(); _lAssignedToRole.ID = this.ID + "_lAssignedToRole"; Controls.Add(_lAssignedToRole); _lAssignedToRole.Label = "Assigned to Security Role"; _lState = new Literal(); Controls.Add(_lState); _lState.ID = this.ID + "_lState"; _ddlAssignedToRole.Items.Add(new ListItem(string.Empty, "0")); var roles = new GroupService(new RockContext()).Queryable().Where(g => g.IsSecurityRole).OrderBy(t => t.Name); if (roles.Any()) { foreach (var role in roles) { _ddlAssignedToRole.Items.Add(new ListItem(role.Name, role.Id.ToString())); } } _phAttributes = new PlaceHolder(); Controls.Add(_phAttributes); _phAttributes.ID = this.ID + "_phAttributes"; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls(this, Controls); this.Attributes["data-itemlabel"] = this.Label != string.Empty ? this.Label : "Address"; this.Attributes["data-required"] = this.Required.ToTrueFalse().ToLower(); _ddlCountry = new RockDropDownList(); _ddlCountry.EnhanceForLongLists = true; Controls.Add(_ddlCountry); _ddlCountry.ID = "ddlCountry"; _ddlCountry.DataValueField = "Id"; _ddlCountry.AutoPostBack = true; _ddlCountry.SelectedIndexChanged += _ddlCountry_SelectedIndexChanged; _ddlCountry.CssClass = "form-control js-country"; _tbStreet1 = new TextBox(); Controls.Add(_tbStreet1); _tbStreet1.ID = "tbStreet1"; _tbStreet1.CssClass = "form-control js-address-field js-street1"; _tbStreet2 = new TextBox(); Controls.Add(_tbStreet2); _tbStreet2.ID = "tbStreet2"; _tbStreet2.CssClass = "form-control js-address-field js-street2"; _tbCity = new TextBox(); Controls.Add(_tbCity); _tbCity.ID = "tbCity"; _tbCity.CssClass = "form-control js-address-field js-city"; _tbCounty = new TextBox(); Controls.Add(_tbCounty); _tbCounty.ID = "tbCounty"; _tbCounty.CssClass = "form-control js-address-field js-county"; _tbState = new TextBox(); Controls.Add(_tbState); _tbState.ID = "tbState"; _tbState.CssClass = "form-control js-address-field js-state"; _ddlState = new DropDownList(); Controls.Add(_ddlState); _ddlState.ID = "ddlState"; _ddlState.DataValueField = "Id"; _ddlState.CssClass = "form-control js-state"; _tbPostalCode = new TextBox(); Controls.Add(_tbPostalCode); _tbPostalCode.ID = "tbPostalCode"; _tbPostalCode.CssClass = "form-control js-postal-code js-postcode js-address-field"; // Add custom validator CustomValidator = new CustomValidator(); CustomValidator.ID = this.ID + "_cfv"; CustomValidator.ClientValidationFunction = "Rock.controls.addressControl.clientValidate"; CustomValidator.ErrorMessage = (this.Label != string.Empty ? this.Label : "Address") + " is required."; CustomValidator.CssClass = "validation-error help-inline"; CustomValidator.Enabled = true; CustomValidator.Display = ValidatorDisplay.Dynamic; CustomValidator.ValidationGroup = ValidationGroup; Controls.Add(CustomValidator); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { if (!_controlsLoaded) { Controls.Clear(); _lAttributeActionTitle = new Literal(); _lAttributeActionTitle.ID = "lAttributeActionTitle"; Controls.Add(_lAttributeActionTitle); _validationSummary = new ValidationSummary(); _validationSummary.ID = "valiationSummary"; _validationSummary.CssClass = "alert alert-danger"; _validationSummary.HeaderText = "Please Correct the Following"; Controls.Add(_validationSummary); _tbName = new RockTextBox(); _tbName.ID = "tbName"; _tbName.Label = "Name"; _tbName.Required = true; Controls.Add(_tbName); _tbDescription = new RockTextBox(); _tbDescription.Label = "Description"; _tbDescription.ID = "tbDescription"; _tbDescription.TextMode = TextBoxMode.MultiLine; _tbDescription.Rows = 3; Controls.Add(_tbDescription); _cpCategories = new CategoryPicker(); _cpCategories.ID = "cpCategories_" + this.ID.ToString(); _cpCategories.Label = "Categories"; _cpCategories.AllowMultiSelect = true; _cpCategories.EntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id; _cpCategories.EntityTypeQualifierColumn = "EntityTypeId"; Controls.Add(_cpCategories); _tbKey = new RockTextBox(); _tbKey.ID = "tbKey"; _tbKey.Label = "Key"; _tbKey.Required = true; Controls.Add(_tbKey); _cvKey = new CustomValidator(); _cvKey.ID = "cvKey"; _cvKey.ControlToValidate = _tbKey.ID; _cvKey.ClientValidationFunction = "validateKey"; _cvKey.ServerValidate += cvKey_ServerValidate; _cvKey.Display = ValidatorDisplay.Dynamic; _cvKey.CssClass = "validation-error help-inline"; _cvKey.ErrorMessage = "There is already an existing property with the key value you entered. Please select a different key value."; Controls.Add(_cvKey); _cbRequired = new RockCheckBox(); _cbRequired.ID = "cbRequired"; _cbRequired.Label = "Required"; _cbRequired.Text = "Require a value"; Controls.Add(_cbRequired); _cbShowInGrid = new RockCheckBox(); _cbShowInGrid.ID = "cbShowInGrid"; _cbShowInGrid.Label = "Show in Grid"; _cbShowInGrid.Text = "Yes"; _cbShowInGrid.Help = "If selected, this attribute will be included in a grid."; Controls.Add(_cbShowInGrid); _ddlFieldType = new RockDropDownList(); _ddlFieldType.ID = "ddlFieldType"; _ddlFieldType.Label = "Field Type"; _ddlFieldType.AutoPostBack = true; _ddlFieldType.SelectedIndexChanged += _ddlFieldType_SelectedIndexChanged; Controls.Add(_ddlFieldType); if (!Page.IsPostBack) { _ddlFieldType.DataValueField = "Id"; _ddlFieldType.DataTextField = "Name"; _ddlFieldType.DataSource = new FieldTypeService() .Queryable() .OrderBy(a => a.Name) .Select(a => new { a.Id, a.Name }).ToList();; _ddlFieldType.DataBind(); } _phQualifiers = new PlaceHolder(); _phQualifiers.ID = "phQualifiers"; _phQualifiers.EnableViewState = false; Controls.Add(_phQualifiers); _phDefaultValue = new PlaceHolder(); _phDefaultValue.ID = "phDefaultValue"; _phDefaultValue.EnableViewState = false; Controls.Add(_phDefaultValue); _btnSave = new LinkButton(); _btnSave.ID = "btnSave"; _btnSave.Text = "OK"; _btnSave.CssClass = "btn btn-primary"; _btnSave.Click += btnSave_Click; Controls.Add(_btnSave); _btnCancel = new LinkButton(); _btnCancel.ID = "btnCancel"; _btnCancel.Text = "Cancel"; _btnCancel.CssClass = "btn btn-link"; _btnCancel.CausesValidation = false; _btnCancel.Click += btnCancel_Click; Controls.Add(_btnCancel); _tbName.Attributes["onblur"] = string.Format("populateAttributeKey('{0}','{1}')", _tbName.ClientID, _tbKey.ClientID); _controlsLoaded = true; } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); ddlFilterType = new RockDropDownList(); Controls.Add(ddlFilterType); ddlFilterType.ID = this.ID + "_ddlFilter"; nbFilterError = new NotificationBox(); nbFilterError.ID = this.ID + "_nbFilterError"; nbFilterError.Visible = false; HasFilterError = false; var filterEntityType = EntityTypeCache.Get(FilterEntityTypeName); var component = Rock.Reporting.DataFilterContainer.GetComponent(FilterEntityTypeName); if (component != null) { component.Options = FilterOptions; filterControls = component.CreateChildControls(FilteredEntityType, this, this.FilterMode); } else { nbFilterError.NotificationBoxType = NotificationBoxType.Danger; nbFilterError.Text = $"Unable to determine filter component for {FilterEntityTypeName}. "; nbFilterError.Visible = true; HasFilterError = true; Controls.Add(nbFilterError); filterControls = new Control[0]; } SetFilterControlsValidationGroup(this.ValidationGroup); ddlFilterType.AutoPostBack = true; ddlFilterType.SelectedIndexChanged += ddlFilterType_SelectedIndexChanged; ddlFilterType.Items.Clear(); if (HasFilterError) { // if there is a FilterError, the filter component might not be listed, so it shows that nothing is selected if filtertype can't be found ddlFilterType.Items.Add(new ListItem()); } if (AuthorizedComponents != null) { foreach (var section in AuthorizedComponents) { foreach (var item in section.Value) { if (!this.ExcludedFilterTypes.Any(a => a == item.Key)) { ListItem li = new ListItem(item.Value, item.Key); if (!string.IsNullOrWhiteSpace(section.Key)) { li.Attributes.Add("optiongroup", section.Key); } var filterComponent = Rock.Reporting.DataFilterContainer.GetComponent(item.Key); if (filterComponent != null) { string description = Reflection.GetDescription(filterComponent.GetType()); if (!string.IsNullOrWhiteSpace(description)) { li.Attributes.Add("title", description); } } li.Selected = item.Key == FilterEntityTypeName; ddlFilterType.Items.Add(li); } } } } hfExpanded = new HiddenField(); Controls.Add(hfExpanded); hfExpanded.ID = this.ID + "_hfExpanded"; hfExpanded.Value = "True"; lbDelete = new LinkButton(); Controls.Add(lbDelete); lbDelete.ID = this.ID + "_lbDelete"; lbDelete.CssClass = "btn btn-xs btn-square btn-danger"; lbDelete.Click += lbDelete_Click; lbDelete.CausesValidation = false; var iDelete = new HtmlGenericControl("i"); lbDelete.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); cbIncludeFilter = new RockCheckBox(); cbIncludeFilter.ContainerCssClass = "filterfield-checkbox"; cbIncludeFilter.TextCssClass = "control-label"; Controls.Add(cbIncludeFilter); cbIncludeFilter.ID = this.ID + "_cbIncludeFilter"; nbComponentDescription = new NotificationBox(); nbComponentDescription.NotificationBoxType = NotificationBoxType.Info; nbComponentDescription.ID = this.ID + "_nbComponentDescription"; Controls.Add(nbComponentDescription); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); Controls.Clear(); RockControlHelper.CreateChildControls(this, Controls); _tbStreet1 = new TextBox(); Controls.Add(_tbStreet1); _tbStreet1.ID = "tbStreet1"; _tbStreet1.CssClass = "form-control"; this.RequiredFieldValidator.ControlToValidate = _tbStreet1.ID; _tbStreet2 = new TextBox(); Controls.Add(_tbStreet2); _tbStreet2.ID = "tbStreet2"; _tbStreet2.CssClass = "form-control"; _tbCity = new TextBox(); Controls.Add(_tbCity); _tbCity.ID = "tbCity"; _tbCity.CssClass = "form-control"; _tbCounty = new TextBox(); Controls.Add(_tbCounty); _tbCounty.ID = "tbCounty"; _tbCounty.CssClass = "form-control"; _tbState = new TextBox(); Controls.Add(_tbState); _tbState.ID = "tbState"; _tbState.CssClass = "form-control"; _ddlState = new DropDownList(); Controls.Add(_ddlState); _ddlState.ID = "ddlState"; _ddlState.DataValueField = "Id"; _ddlState.CssClass = "form-control"; _tbPostalCode = new TextBox(); Controls.Add(_tbPostalCode); _tbPostalCode.ID = "tbPostalCode"; _tbPostalCode.CssClass = "form-control"; _ddlCountry = new RockDropDownList(); _ddlCountry.EnhanceForLongLists = true; Controls.Add(_ddlCountry); _ddlCountry.ID = "ddlCountry"; _ddlCountry.DataValueField = "Id"; _ddlCountry.AutoPostBack = true; _ddlCountry.SelectedIndexChanged += _ddlCountry_SelectedIndexChanged; _ddlCountry.CssClass = "form-control"; string defaultCountry = GetDefaultCountry(); string defaultState = GetDefaultState(); BindCountries(); BindStates(defaultCountry); _ddlState.SetValue(defaultState); _tbState.Text = defaultState; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfActionTypeGuid = new HiddenField(); _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid"; _lblActionTypeName = new Label(); _lblActionTypeName.ClientIDMode = ClientIDMode.Static; _lblActionTypeName.ID = this.ID + "_lblActionTypeName"; _lbDeleteActionType = new LinkButton(); _lbDeleteActionType.CausesValidation = false; _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType"; _lbDeleteActionType.CssClass = "btn btn-xs btn-danger"; _lbDeleteActionType.Click += lbDeleteActionType_Click; var iDelete = new HtmlGenericControl("i"); _lbDeleteActionType.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); _tbActionTypeName = new DataTextBox(); _tbActionTypeName.ID = this.ID + "_tbActionTypeName"; _tbActionTypeName.Label = "Name"; _ddlEntityType = new RockDropDownList(); _ddlEntityType.ID = this.ID + "_ddlEntityType"; _ddlEntityType.Label = "Action Type"; // make it autopostback since Attributes are dependant on which EntityType is selected _ddlEntityType.AutoPostBack = true; _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged; foreach (var item in WorkflowActionContainer.Instance.Components.Values.OrderBy(a => a.Value.EntityType.FriendlyName)) { var type = item.Value.GetType(); if (type != null) { var entityType = EntityTypeCache.Read(type); var li = new ListItem(entityType.FriendlyName, entityType.Id.ToString()); // Get description string description = string.Empty; var descAttributes = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false); if (descAttributes != null) { foreach (System.ComponentModel.DescriptionAttribute descAttribute in descAttributes) { description = descAttribute.Description; } } if (!string.IsNullOrWhiteSpace(description)) { li.Attributes.Add("title", description); } _ddlEntityType.Items.Add(li); } } // set label when they exit the edit field _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID); _tbActionTypeName.SourceTypeName = "Rock.Model.WorkflowActionType, Rock"; _tbActionTypeName.PropertyName = "Name"; _cbIsActionCompletedOnSuccess = new RockCheckBox { Label = "Action is Completed on Success" }; _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess"; _cbIsActivityCompletedOnSuccess = new RockCheckBox { Label = "Activity is Completed on Success" }; _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess"; _phActionAttributes = new PlaceHolder(); _phActionAttributes.ID = this.ID + "_phActionAttributes"; Controls.Add(_hfActionTypeGuid); Controls.Add(_lblActionTypeName); Controls.Add(_tbActionTypeName); Controls.Add(_ddlEntityType); Controls.Add(_cbIsActionCompletedOnSuccess); Controls.Add(_cbIsActivityCompletedOnSuccess); Controls.Add(_phActionAttributes); Controls.Add(_lbDeleteActionType); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfValue.ID = this.ID + "_hfValue"; Controls.Add(_hfValue); _actionControls = new List <RockTextBox>(); _buttonHtmlControls = new List <RockDropDownList>(); _activityControls = new List <RockDropDownList>(); _responseControls = new List <RockTextBox>(); string[] nameValues = this.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < nameValues.Length; i++) { string[] nameValueResponse = nameValues[i].Split(new char[] { '^' }); var tbAction = new RockTextBox(); tbAction.ID = this.ID + "_tbAction" + i.ToString(); Controls.Add(tbAction); tbAction.Placeholder = "Action"; tbAction.AddCssClass("form-action-key"); tbAction.AddCssClass("form-control"); tbAction.AddCssClass("js-form-action-input"); tbAction.Text = nameValueResponse.Length > 0 ? nameValueResponse[0] : string.Empty; _actionControls.Add(tbAction); var ddlButtonHtml = new RockDropDownList(); ddlButtonHtml.ID = this.ID + "_ddlButtonHtml" + i.ToString(); ddlButtonHtml.EnableViewState = false; Controls.Add(ddlButtonHtml); ddlButtonHtml.AddCssClass("form-action-button"); ddlButtonHtml.AddCssClass("form-control"); ddlButtonHtml.AddCssClass("js-form-action-input"); var definedType = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.BUTTON_HTML.AsGuid()); foreach (var definedValue in definedType.DefinedValues) { var li = new ListItem(definedValue.Value, definedValue.Guid.ToString()); li.Selected = nameValueResponse.Length > 1 && li.Value.Equals(nameValueResponse[1], StringComparison.OrdinalIgnoreCase); ddlButtonHtml.Items.Add(li); } _buttonHtmlControls.Add(ddlButtonHtml); var ddlActivity = new RockDropDownList(); ddlActivity.ID = this.ID + "_ddlActivity" + i.ToString(); ddlActivity.EnableViewState = false; Controls.Add(ddlActivity); ddlActivity.AddCssClass("form-action-value"); ddlActivity.AddCssClass("form-control"); ddlActivity.AddCssClass("js-form-action-input"); ddlActivity.DataTextField = "Value"; ddlActivity.DataValueField = "Key"; ddlActivity.DataSource = Activities; ddlActivity.DataBind(); ddlActivity.Items.Insert(0, new ListItem(string.Empty, string.Empty)); foreach (ListItem li in ddlActivity.Items) { li.Selected = nameValueResponse.Length > 2 && li.Value.Equals(nameValueResponse[2], StringComparison.OrdinalIgnoreCase); } _activityControls.Add(ddlActivity); var tbResponse = new RockTextBox(); tbResponse.ID = this.ID + "_tbResponse" + i.ToString(); Controls.Add(tbResponse); tbResponse.Placeholder = "Response Text"; tbResponse.AddCssClass("form-action-response"); tbResponse.AddCssClass("form-control"); tbResponse.AddCssClass("js-form-action-input"); tbResponse.Text = nameValueResponse.Length > 3 ? nameValueResponse[3] : string.Empty; _responseControls.Add(tbResponse); } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); ddlFilterType = new RockDropDownList(); Controls.Add(ddlFilterType); ddlFilterType.ID = this.ID + "_ddlFilter"; var component = Rock.Reporting.DataFilterContainer.GetComponent(FilterEntityTypeName); if (component != null) { component.Options = FilterOptions; filterControls = component.CreateChildControls(FilteredEntityType, this, this.FilterMode); } else { filterControls = new Control[0]; } ddlFilterType.AutoPostBack = true; ddlFilterType.SelectedIndexChanged += ddlFilterType_SelectedIndexChanged; ddlFilterType.Items.Clear(); foreach (var section in AuthorizedComponents) { foreach (var item in section.Value) { if (!this.ExcludedFilterTypes.Any(a => a == item.Key)) { ListItem li = new ListItem(item.Value, item.Key); if (!string.IsNullOrWhiteSpace(section.Key)) { li.Attributes.Add("optiongroup", section.Key); } var filterComponent = Rock.Reporting.DataFilterContainer.GetComponent(item.Key); if (filterComponent != null) { string description = Reflection.GetDescription(filterComponent.GetType()); if (!string.IsNullOrWhiteSpace(description)) { li.Attributes.Add("title", description); } } li.Selected = item.Key == FilterEntityTypeName; ddlFilterType.Items.Add(li); } } } hfExpanded = new HiddenField(); Controls.Add(hfExpanded); hfExpanded.ID = this.ID + "_hfExpanded"; hfExpanded.Value = "True"; lbDelete = new LinkButton(); Controls.Add(lbDelete); lbDelete.ID = this.ID + "_lbDelete"; lbDelete.CssClass = "btn btn-xs btn-danger "; lbDelete.Click += lbDelete_Click; lbDelete.CausesValidation = false; var iDelete = new HtmlGenericControl("i"); lbDelete.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); cbIncludeFilter = new RockCheckBox(); cbIncludeFilter.ContainerCssClass = "filterfield-checkbox"; Controls.Add(cbIncludeFilter); cbIncludeFilter.ID = this.ID + "_cbIncludeFilter"; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfActionTypeGuid = new HiddenField(); Controls.Add(_hfActionTypeGuid); _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid"; _lblActionTypeName = new Label(); Controls.Add(_lblActionTypeName); _lblActionTypeName.ClientIDMode = ClientIDMode.Static; _lblActionTypeName.ID = this.ID + "_lblActionTypeName"; _lbDeleteActionType = new LinkButton(); Controls.Add(_lbDeleteActionType); _lbDeleteActionType.CausesValidation = false; _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType"; _lbDeleteActionType.CssClass = "btn btn-xs btn-square btn-danger js-action-delete"; _lbDeleteActionType.Click += lbDeleteActionType_Click; var iDelete = new HtmlGenericControl("i"); _lbDeleteActionType.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); _ddlCriteriaAttribute = new RockDropDownList(); Controls.Add(_ddlCriteriaAttribute); _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute"; _ddlCriteriaAttribute.EnableViewState = false; _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria"; _ddlCriteriaAttribute.Label = "Run If"; _ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running. If the criteria is not met, this action will be skipped when this activity is processed."; _ddlCriteriaComparisonType = new RockDropDownList(); Controls.Add(_ddlCriteriaComparisonType); _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType"; _ddlCriteriaComparisonType.EnableViewState = false; _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison"; _ddlCriteriaComparisonType.BindToEnum <ComparisonType>(); _ddlCriteriaComparisonType.Label = " "; _tbddlCriteriaValue = new RockTextOrDropDownList(); Controls.Add(_tbddlCriteriaValue); _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue"; _tbddlCriteriaValue.EnableViewState = false; _tbddlCriteriaValue.TextBox.Label = "Text Value"; _tbddlCriteriaValue.DropDownList.Label = "Attribute Value"; _tbActionTypeName = new RockTextBox(); Controls.Add(_tbActionTypeName); _tbActionTypeName.ID = this.ID + "_tbActionTypeName"; _tbActionTypeName.Label = "Name"; _tbActionTypeName.Required = true; _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID); _wfatpEntityType = new WorkflowActionTypePicker(); _wfatpEntityType.SelectItem += wfatpEntityType_SelectItem; Controls.Add(_wfatpEntityType); _wfatpEntityType.ID = this.ID + "_wfatpEntityType"; _wfatpEntityType.Label = "Action Type"; _rlEntityTypeOverview = new RockLiteral(); Controls.Add(_rlEntityTypeOverview); _rlEntityTypeOverview.ID = this.ID + ""; _rlEntityTypeOverview.Label = "Action Type Overview"; _cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" }; Controls.Add(_cbIsActionCompletedOnSuccess); _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess"; _cbIsActivityCompletedOnSuccess = new RockCheckBox { Text = "Activity is Completed on Success" }; Controls.Add(_cbIsActivityCompletedOnSuccess); _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess"; _formEditor = new WorkflowFormEditor(); Controls.Add(_formEditor); _formEditor.ID = this.ID + "_formEditor"; _phActionAttributes = new PlaceHolder(); Controls.Add(_phActionAttributes); _phActionAttributes.ID = this.ID + "_phActionAttributes"; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfActionTypeGuid = new HiddenField(); Controls.Add(_hfActionTypeGuid); _hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid"; _lblActionTypeName = new Label(); Controls.Add(_lblActionTypeName); _lblActionTypeName.ClientIDMode = ClientIDMode.Static; _lblActionTypeName.ID = this.ID + "_lblActionTypeName"; _lbDeleteActionType = new LinkButton(); Controls.Add(_lbDeleteActionType); _lbDeleteActionType.CausesValidation = false; _lbDeleteActionType.ID = this.ID + "_lbDeleteActionType"; _lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete"; _lbDeleteActionType.Click += lbDeleteActionType_Click; var iDelete = new HtmlGenericControl("i"); _lbDeleteActionType.Controls.Add(iDelete); iDelete.AddCssClass("fa fa-times"); _ddlCriteriaAttribute = new RockDropDownList(); Controls.Add(_ddlCriteriaAttribute); _ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute"; _ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria"; _ddlCriteriaAttribute.Label = "Run If"; _ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running. If the criteria is not met, this action will be skipped when this activity is processed."; _ddlCriteriaComparisonType = new RockDropDownList(); Controls.Add(_ddlCriteriaComparisonType); _ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType"; _ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison"; _ddlCriteriaComparisonType.BindToEnum <ComparisonType>(); _ddlCriteriaComparisonType.Label = " "; _tbddlCriteriaValue = new RockTextOrDropDownList(); Controls.Add(_tbddlCriteriaValue); _tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue"; _tbddlCriteriaValue.TextBox.Label = "Text Value"; _tbddlCriteriaValue.DropDownList.Label = "Attribute Value"; _tbActionTypeName = new RockTextBox(); Controls.Add(_tbActionTypeName); _tbActionTypeName.ID = this.ID + "_tbActionTypeName"; _tbActionTypeName.Label = "Name"; _tbActionTypeName.Required = true; _tbActionTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID); _ddlEntityType = new RockDropDownList(); Controls.Add(_ddlEntityType); _ddlEntityType.ID = this.ID + "_ddlEntityType"; _ddlEntityType.Label = "Action Type"; // make it autopostback since Attributes are dependant on which EntityType is selected _ddlEntityType.AutoPostBack = true; _ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged; foreach (var item in ActionContainer.Instance.Components.Values.OrderBy(a => a.Value.EntityType.FriendlyName)) { var type = item.Value.GetType(); if (type != null) { var entityType = EntityTypeCache.Read(type); var li = new ListItem(entityType.FriendlyName, entityType.Id.ToString()); // Get description string description = string.Empty; var descAttributes = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false); if (descAttributes != null) { foreach (System.ComponentModel.DescriptionAttribute descAttribute in descAttributes) { description = descAttribute.Description; } } if (!string.IsNullOrWhiteSpace(description)) { li.Attributes.Add("title", description); } _ddlEntityType.Items.Add(li); } } _cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" }; Controls.Add(_cbIsActionCompletedOnSuccess); _cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess"; _cbIsActivityCompletedOnSuccess = new RockCheckBox { Text = "Activity is Completed on Success" }; Controls.Add(_cbIsActivityCompletedOnSuccess); _cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess"; _formEditor = new WorkflowFormEditor(); Controls.Add(_formEditor); _formEditor.ID = this.ID + "_formEditor"; _phActionAttributes = new PlaceHolder(); Controls.Add(_phActionAttributes); _phActionAttributes.ID = this.ID + "_phActionAttributes"; }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfExpanded = new HiddenFieldWithClass(); Controls.Add(_hfExpanded); _hfExpanded.ID = this.ID + "_hfExpanded"; _hfExpanded.CssClass = "filter-expanded"; _hfExpanded.Value = "False"; _hfGroupTypeGuid = new HiddenField(); _hfGroupTypeGuid.ID = this.ID + "_hfGroupTypeGuid"; _hfGroupTypeId = new HiddenField(); _hfGroupTypeId.ID = this.ID + "_hfGroupTypeId"; _lblGroupTypeName = new Label(); _lblGroupTypeName.ClientIDMode = ClientIDMode.Static; _lblGroupTypeName.ID = this.ID + "_lblGroupTypeName"; _lbDeleteGroupType = new LinkButton(); _lbDeleteGroupType.CausesValidation = false; _lbDeleteGroupType.ID = this.ID + "_lbDeleteGroupType"; _lbDeleteGroupType.CssClass = "btn btn-xs btn-danger"; _lbDeleteGroupType.Click += lbDeleteGroupType_Click; _lbDeleteGroupType.Controls.Add(new LiteralControl { Text = "<i class='fa fa-times'></i>" }); _lbDeleteGroupType.Attributes["onclick"] = string.Format("javascript: return Rock.dialogs.confirmDelete(event, '{0}', '{1}');", "check-in area", "Once saved, you will lose all attendance data."); _ddlGroupTypeInheritFrom = new RockDropDownList(); _ddlGroupTypeInheritFrom.ID = this.ID + "_ddlGroupTypeInheritFrom"; _ddlGroupTypeInheritFrom.Label = "Inherit from"; _ddlGroupTypeInheritFrom.AutoPostBack = true; _ddlGroupTypeInheritFrom.SelectedIndexChanged += ddlGroupTypeInheritFrom_SelectedIndexChanged; _ddlGroupTypeInheritFrom.Items.Add(Rock.Constants.None.ListItem); var groupTypeCheckinFilterList = new GroupTypeService(new RockContext()).Queryable() .Where(a => a.GroupTypePurposeValue.Guid == new Guid(Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER)) .OrderBy(a => a.Order).ThenBy(a => a.Name) .Select(a => new { a.Id, a.Name }).ToList(); foreach (var groupType in groupTypeCheckinFilterList) { _ddlGroupTypeInheritFrom.Items.Add(new ListItem(groupType.Name, groupType.Id.ToString())); } _tbGroupTypeName = new DataTextBox(); _tbGroupTypeName.ID = this.ID + "_tbGroupTypeName"; _tbGroupTypeName.Label = "Check-in Area Name"; // set label when they exit the edit field _tbGroupTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblGroupTypeName.ClientID); _tbGroupTypeName.SourceTypeName = "Rock.Model.GroupType, Rock"; _tbGroupTypeName.PropertyName = "Name"; _phGroupTypeAttributes = new PlaceHolder(); _phGroupTypeAttributes.ID = this.ID + "_phGroupTypeAttributes"; _lbAddCheckinGroupType = new LinkButton(); _lbAddCheckinGroupType.ID = this.ID + "_lblbAddCheckinGroupType"; _lbAddCheckinGroupType.CssClass = "btn btn-xs btn-action checkin-grouptype-add-sub-area"; _lbAddCheckinGroupType.Click += lbAddCheckinGroupType_Click; _lbAddCheckinGroupType.CausesValidation = false; _lbAddCheckinGroupType.Controls.Add(new LiteralControl { Text = "<i class='fa fa-plus'></i> Add Sub-Area" }); _lbAddCheckinGroup = new LinkButton(); _lbAddCheckinGroup.ID = this.ID + "_lbAddCheckinGroup"; _lbAddCheckinGroup.CssClass = "btn btn-xs btn-action checkin-grouptype-add-checkin-group"; _lbAddCheckinGroup.Click += lbAddGroup_Click; _lbAddCheckinGroup.CausesValidation = false; _lbAddCheckinGroup.Controls.Add(new LiteralControl { Text = "<i class='fa fa-plus'></i> Add Check-in Group" }); Controls.Add(_hfGroupTypeGuid); Controls.Add(_hfGroupTypeId); Controls.Add(_lblGroupTypeName); Controls.Add(_ddlGroupTypeInheritFrom); Controls.Add(_tbGroupTypeName); Controls.Add(_phGroupTypeAttributes); // Check-in Labels grid CreateCheckinLabelsGrid(); Controls.Add(_lbDeleteGroupType); Controls.Add(_lbAddCheckinGroupType); Controls.Add(_lbAddCheckinGroup); }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { Controls.Clear(); _hfFormGuid = new HiddenField(); _hfFormGuid.ID = this.ID + "_hfFormGuid"; Controls.Add(_hfFormGuid); _ddlNotificationSystemEmail = new RockDropDownList(); _ddlNotificationSystemEmail.EnableViewState = false; _ddlNotificationSystemEmail.DataValueField = "Id"; _ddlNotificationSystemEmail.DataTextField = "Title"; _ddlNotificationSystemEmail.Label = "Notification Email"; _ddlNotificationSystemEmail.Help = "An optional system email that should be sent to the person or people assigned to this activity (Any System Email with a category of 'Workflow')."; _ddlNotificationSystemEmail.ID = this.ID + "_ddlNotificationSystemEmail"; Controls.Add(_ddlNotificationSystemEmail); var systemEmailCategory = CategoryCache.Get(Rock.SystemGuid.Category.SYSTEM_EMAIL_WORKFLOW.AsGuid()); if (systemEmailCategory != null) { using (var rockContext = new RockContext()) { _ddlNotificationSystemEmail.DataSource = new SystemEmailService(rockContext).Queryable() .Where(e => e.CategoryId == systemEmailCategory.Id) .OrderBy(e => e.Title) .Select(a => new { a.Id, a.Title }) .ToList(); _ddlNotificationSystemEmail.DataBind(); } } _ddlNotificationSystemEmail.Items.Insert(0, new ListItem("None", "0")); _cbIncludeActions = new RockCheckBox(); _cbIncludeActions.Label = "Include Actions in Email"; _cbIncludeActions.Text = "Yes"; _cbIncludeActions.Help = "Should the email include the option for recipient to select an action directly from within the email? Note: This only applies if none of the the form fields are required. The workflow will be persisted immediately prior to sending the email."; _cbIncludeActions.ID = this.ID + "_cbIncludeActions"; Controls.Add(_cbIncludeActions); _ceHeaderText = new CodeEditor(); _ceHeaderText.Label = "Form Header"; _ceHeaderText.Help = "Text to display to user above the form fields. <span class='tip tip-lava'></span> <span class='tip tip-html'>"; _ceHeaderText.ID = this.ID + "_tbHeaderText"; _ceHeaderText.EditorMode = CodeEditorMode.Html; _ceHeaderText.EditorTheme = CodeEditorTheme.Rock; _ceHeaderText.EditorHeight = "200"; Controls.Add(_ceHeaderText); _ceFooterText = new CodeEditor(); _ceFooterText.Label = "Form Footer"; _ceFooterText.Help = "Text to display to user below the form fields. <span class='tip tip-lava'></span> <span class='tip tip-html'>"; _ceFooterText.ID = this.ID + "_tbFooterText"; _ceFooterText.EditorMode = CodeEditorMode.Html; _ceFooterText.EditorTheme = CodeEditorTheme.Rock; _ceFooterText.EditorHeight = "200"; Controls.Add(_ceFooterText); _falActions = new WorkflowFormActionList(); _falActions.ID = this.ID + "_falActions"; Controls.Add(_falActions); _ddlActionAttribute = new RockDropDownList(); _ddlActionAttribute.EnableViewState = false; _ddlActionAttribute.ID = this.ID + "_ddlActionAttribute"; _ddlActionAttribute.Label = "Command Selected Attribute"; _ddlActionAttribute.Help = "Optional text attribute that should be updated with the selected command label."; Controls.Add(_ddlActionAttribute); _cbAllowNotes = new RockCheckBox(); _cbAllowNotes.Label = "Enable Note Entry"; _cbAllowNotes.Text = "Yes"; _cbAllowNotes.Help = "Should this form include an area for viewing and editing notes related to the workflow?"; _cbAllowNotes.ID = this.ID + "_cbAllowNotes"; Controls.Add(_cbAllowNotes); }