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