Inheritance: System.Web.UI.WebControls.CompositeControl, IHasValidationGroup
Beispiel #1
0
        /// <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 = "&nbsp;";

            _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 = "&nbsp;";

            _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";

            _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 = "&nbsp;";

            _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";

            _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.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 = "&nbsp;";

            _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";
        }