예제 #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";

            _hfActivityTypeGuid = new HiddenField();
            Controls.Add(_hfActivityTypeGuid);
            _hfActivityTypeGuid.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";

            _lblInactive = new Label();
            Controls.Add(_lblInactive);
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID           = this.ID + "_lblInactive";
            _lblInactive.CssClass     = "pull-right";
            _lblInactive.Text         = "<span class='label label-danger'>Inactive</span>";

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

            _sbSecurity = new SecurityButton();
            Controls.Add(_sbSecurity);
            _sbSecurity.ID = this.ID + "_sbSecurity";
            _sbSecurity.Attributes["class"] = "btn btn-security btn-xs security pull-right";
            _sbSecurity.EntityTypeId        = EntityTypeCache.Get(typeof(Rock.Model.WorkflowActivityType)).Id;

            _cbActivityTypeIsActive = new RockCheckBox {
                Text = "Active"
            };
            Controls.Add(_cbActivityTypeIsActive);
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').hide(); 
        $('#{1}').removeClass('workflow-activity-inactive'); 
    }} 
    else {{ 
        $('#{0}').show(); 
        $('#{1}').addClass('workflow-activity-inactive'); 
    }}
";

            _cbActivityTypeIsActive.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, _lblInactive.ID, this.ID + "_section"));

            _tbActivityTypeName = new RockTextBox();
            Controls.Add(_tbActivityTypeName);
            _tbActivityTypeName.ID                   = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label                = "Name";
            _tbActivityTypeName.Required             = true;
            _tbActivityTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID);

            _tbActivityTypeDescription = new RockTextBox();
            Controls.Add(_tbActivityTypeDescription);
            _tbActivityTypeDescription.ID                   = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label                = "Description";
            _tbActivityTypeDescription.TextMode             = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows                 = 2;
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID);

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox {
                Text = "Activated with Workflow"
            };
            Controls.Add(_cbActivityTypeIsActivatedWithWorkflow);
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";
            checkboxScriptFormat = @"
javascript: 
    if ($(this).is(':checked')) {{ 
        $('#{0}').addClass('activated-with-workflow'); 
    }} 
    else {{ 
        $('#{0}').removeClass('activated-with-workflow'); 
    }}
";
            _cbActivityTypeIsActivatedWithWorkflow.InputAttributes.Add("onclick", string.Format(checkboxScriptFormat, this.ID + "_section"));


            _lbAddActionType = new LinkButton();
            Controls.Add(_lbAddActionType);
            _lbAddActionType.ID               = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass         = "btn btn-xs btn-action add-action";
            _lbAddActionType.Click           += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-plus'></i> Add Action"
            });

            _pwAttributes = new PanelWidget();
            Controls.Add(_pwAttributes);
            _pwAttributes.ID       = this.ID + "_pwAttributes";
            _pwAttributes.Title    = "Activity Attributes";
            _pwAttributes.CssClass = "attribute-panel";

            _gAttributes = new Grid();
            _pwAttributes.Controls.Add(_gAttributes);
            _gAttributes.ID          = this.ID + "_gAttributes";
            _gAttributes.AllowPaging = false;
            _gAttributes.DisplayType = GridDisplayType.Light;
            _gAttributes.RowItemText = "Activity Attribute";
            _gAttributes.AddCssClass("attribute-grid");
            _gAttributes.DataKeyNames        = new string[] { "Guid" };
            _gAttributes.Actions.ShowAdd     = true;
            _gAttributes.Actions.AddClick   += gAttributes_Add;
            _gAttributes.GridRebind         += gAttributes_Rebind;
            _gAttributes.GridReorder        += gAttributes_Reorder;
            _gAttributes.ShowActionsInHeader = false;

            var reorderField = new ReorderField();

            _gAttributes.Columns.Add(reorderField);

            var nameField = new BoundField();

            nameField.DataField  = "Name";
            nameField.HeaderText = "Attribute";
            _gAttributes.Columns.Add(nameField);

            var descField = new BoundField();

            descField.DataField  = "Description";
            descField.HeaderText = "Description";
            _gAttributes.Columns.Add(descField);

            var fieldTypeField = new BoundField();

            fieldTypeField.DataField  = "FieldType";
            fieldTypeField.HeaderText = "Field Type";
            _gAttributes.Columns.Add(fieldTypeField);

            var reqField = new BoolField();

            reqField.DataField  = "IsRequired";
            reqField.HeaderText = "Required";
            _gAttributes.Columns.Add(reqField);

            var editField = new EditField();

            editField.Click += gAttributes_Edit;
            _gAttributes.Columns.Add(editField);

            var delField = new DeleteField();

            delField.Click += gAttributes_Delete;
            _gAttributes.Columns.Add(delField);
        }
예제 #2
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";

            _hfFormGuid = new HiddenField();
            Controls.Add(_hfFormGuid);
            _hfFormGuid.ID = this.ID + "_hfFormGuid";

            _hfFormId = new HiddenField();
            Controls.Add(_hfFormId);
            _hfFormId.ID = this.ID + "_hfFormId";

            _lblFormName = new Label();
            Controls.Add(_lblFormName);
            _lblFormName.ClientIDMode = ClientIDMode.Static;
            _lblFormName.ID           = this.ID + "_lblFormName";

            _lbDeleteForm = new LinkButton();
            Controls.Add(_lbDeleteForm);
            _lbDeleteForm.CausesValidation = false;
            _lbDeleteForm.ID       = this.ID + "_lbDeleteForm";
            _lbDeleteForm.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteForm.Click   += lbDeleteForm_Click;
            _lbDeleteForm.Controls.Add(new LiteralControl {
                Text = "<i class='fa fa-times'></i>"
            });

            _tbFormName = new RockTextBox();
            Controls.Add(_tbFormName);
            _tbFormName.ID                   = this.ID + "_tbFormName";
            _tbFormName.Label                = "Form Name";
            _tbFormName.Required             = true;
            _tbFormName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblFormName.ID);

            _gFields = new Grid();
            Controls.Add(_gFields);
            _gFields.ID          = this.ID + "_gFields";
            _gFields.AllowPaging = false;
            _gFields.DisplayType = GridDisplayType.Light;
            _gFields.RowItemText = "Field";
            _gFields.AddCssClass("field-grid");
            _gFields.DataKeyNames      = new string[] { "Guid" };
            _gFields.Actions.ShowAdd   = true;
            _gFields.Actions.AddClick += gFields_Add;
            _gFields.GridRebind       += gFields_Rebind;
            _gFields.GridReorder      += gFields_Reorder;

            var reorderField = new ReorderField();

            _gFields.Columns.Add(reorderField);

            var nameField = new BoundField();

            nameField.DataField  = "Name";
            nameField.HeaderText = "Field";
            _gFields.Columns.Add(nameField);

            var sourceField = new EnumField();

            sourceField.DataField  = "FieldSource";
            sourceField.HeaderText = "Source";
            _gFields.Columns.Add(sourceField);

            var typeField = new FieldTypeField();

            typeField.DataField  = "FieldType";
            typeField.HeaderText = "Type";
            _gFields.Columns.Add(typeField);

            var isInternalField = new BoolField();

            isInternalField.DataField  = "IsInternal";
            isInternalField.HeaderText = "Internal";
            _gFields.Columns.Add(isInternalField);

            var isSharedValueField = new BoolField();

            isSharedValueField.DataField  = "IsSharedValue";
            isSharedValueField.HeaderText = "Common";
            _gFields.Columns.Add(isSharedValueField);

            var showCurrentValueField = new BoolField();

            showCurrentValueField.DataField  = "ShowCurrentValue";
            showCurrentValueField.HeaderText = "Use Current Value";
            _gFields.Columns.Add(showCurrentValueField);

            var isRequiredField = new BoolField();

            isRequiredField.DataField  = "IsRequired";
            isRequiredField.HeaderText = "Required";
            _gFields.Columns.Add(isRequiredField);

            var isGridField = new BoolField();

            isGridField.DataField  = "IsGridField";
            isGridField.HeaderText = "Show on Grid";
            _gFields.Columns.Add(isGridField);

            var showOnWaitListField = new BoolField();

            showOnWaitListField.DataField  = "ShowOnWaitlist";
            showOnWaitListField.HeaderText = "Show on Wait List";
            _gFields.Columns.Add(showOnWaitListField);

            var editField = new EditField();

            editField.Click += gFields_Edit;
            _gFields.Columns.Add(editField);

            var delField = new DeleteField();

            delField.Click += gFields_Delete;
            _gFields.Columns.Add(delField);
        }
        /// <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";

            _hfFormGuid = new HiddenField();
            Controls.Add( _hfFormGuid );
            _hfFormGuid.ID = this.ID + "_hfFormGuid";

            _hfFormId = new HiddenField();
            Controls.Add( _hfFormId );
            _hfFormId.ID = this.ID + "_hfFormId";

            _lblFormName = new Label();
            Controls.Add( _lblFormName );
            _lblFormName.ClientIDMode = ClientIDMode.Static;
            _lblFormName.ID = this.ID + "_lblFormName";

            _lbDeleteForm = new LinkButton();
            Controls.Add( _lbDeleteForm );
            _lbDeleteForm.CausesValidation = false;
            _lbDeleteForm.ID = this.ID + "_lbDeleteForm";
            _lbDeleteForm.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteForm.Click += lbDeleteForm_Click;
            _lbDeleteForm.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } );

            _tbFormName = new RockTextBox();
            Controls.Add( _tbFormName );
            _tbFormName.ID = this.ID + "_tbFormName";
            _tbFormName.Label = "Form Name";
            _tbFormName.Required = true;
            _tbFormName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblFormName.ID );

            _gFields = new Grid();
            Controls.Add( _gFields );
            _gFields.ID = this.ID + "_gFields";
            _gFields.AllowPaging = false;
            _gFields.DisplayType = GridDisplayType.Light;
            _gFields.RowItemText = "Field";
            _gFields.AddCssClass( "field-grid" );
            _gFields.DataKeyNames = new string[] { "Guid" };
            _gFields.Actions.ShowAdd = true;
            _gFields.Actions.AddClick += gFields_Add;
            _gFields.GridRebind += gFields_Rebind;
            _gFields.GridReorder += gFields_Reorder;

            var reorderField = new ReorderField();
            _gFields.Columns.Add( reorderField );

            var nameField = new BoundField();
            nameField.DataField = "Name";
            nameField.HeaderText = "Field";
            _gFields.Columns.Add( nameField );

            var sourceField = new EnumField();
            sourceField.DataField = "FieldSource";
            sourceField.HeaderText = "Source";
            _gFields.Columns.Add( sourceField );

            var typeField = new FieldTypeField();
            typeField.DataField = "FieldType";
            typeField.HeaderText = "Type";
            _gFields.Columns.Add( typeField );

            var isInternalField = new BoolField();
            isInternalField.DataField = "IsInternal";
            isInternalField.HeaderText = "Internal";
            _gFields.Columns.Add( isInternalField );

            var isSharedValueField = new BoolField();
            isSharedValueField.DataField = "IsSharedValue";
            isSharedValueField.HeaderText = "Common";
            _gFields.Columns.Add( isSharedValueField );

            var showCurrentValueField = new BoolField();
            showCurrentValueField.DataField = "ShowCurrentValue";
            showCurrentValueField.HeaderText = "Use Current Value";
            _gFields.Columns.Add( showCurrentValueField );

            var isRequiredField = new BoolField();
            isRequiredField.DataField = "IsRequired";
            isRequiredField.HeaderText = "Required";
            _gFields.Columns.Add( isRequiredField );

            var isGridField = new BoolField();
            isGridField.DataField = "IsGridField";
            isGridField.HeaderText = "Show on Grid";
            _gFields.Columns.Add( isGridField );

            var editField = new EditField();
            editField.Click += gFields_Edit;
            _gFields.Columns.Add( editField );

            var delField = new DeleteField();
            delField.Click += gFields_Delete;
            _gFields.Columns.Add( delField );
        }
        /// <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";

            _hfActivityTypeGuid = new HiddenField();
            Controls.Add( _hfActivityTypeGuid );
            _hfActivityTypeGuid.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";

            _lblInactive = new Label();
            Controls.Add( _lblInactive );
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID = this.ID + "_lblInactive";
            _lblInactive.CssClass = "pull-right";
            _lblInactive.Text = "<span class='label label-danger'>Inactive</span>";

            _lbDeleteActivityType = new LinkButton();
            Controls.Add( _lbDeleteActivityType );
            _lbDeleteActivityType.CausesValidation = false;
            _lbDeleteActivityType.ID = this.ID + "_lbDeleteActivityType";
            _lbDeleteActivityType.CssClass = "btn btn-xs btn-danger js-activity-delete";
            _lbDeleteActivityType.Click += lbDeleteActivityType_Click;
            _lbDeleteActivityType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-times'></i>" } );

            _sbSecurity = new SecurityButton();
            Controls.Add( _sbSecurity );
            _sbSecurity.ID = this.ID + "_sbSecurity";
            _sbSecurity.Attributes["class"] = "btn btn-security btn-xs security pull-right";
            _sbSecurity.EntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.WorkflowActivityType ) ).Id;

            _cbActivityTypeIsActive = new RockCheckBox { Text = "Active" };
            Controls.Add( _cbActivityTypeIsActive );
            _cbActivityTypeIsActive.ID = this.ID + "_cbActivityTypeIsActive";
            string checkboxScriptFormat = @"
            javascript:
            if ($(this).is(':checked')) {{
            $('#{0}').hide();
            $('#{1}').removeClass('workflow-activity-inactive');
            }}
            else {{
            $('#{0}').show();
            $('#{1}').addClass('workflow-activity-inactive');
            }}
            ";

            _cbActivityTypeIsActive.InputAttributes.Add( "onclick", string.Format( checkboxScriptFormat, _lblInactive.ID, this.ID + "_section" ) );

            _tbActivityTypeName = new RockTextBox();
            Controls.Add( _tbActivityTypeName );
            _tbActivityTypeName.ID = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label = "Name";
            _tbActivityTypeName.Required = true;
            _tbActivityTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID );

            _tbActivityTypeDescription = new RockTextBox();
            Controls.Add( _tbActivityTypeDescription );
            _tbActivityTypeDescription.ID = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label = "Description";
            _tbActivityTypeDescription.TextMode = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows = 2;
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID );

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox { Text = "Activated with Workflow" };
            Controls.Add( _cbActivityTypeIsActivatedWithWorkflow );
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";
            checkboxScriptFormat = @"
            javascript:
            if ($(this).is(':checked')) {{
            $('#{0}').addClass('activated-with-workflow');
            }}
            else {{
            $('#{0}').removeClass('activated-with-workflow');
            }}
            ";
            _cbActivityTypeIsActivatedWithWorkflow.InputAttributes.Add( "onclick", string.Format( checkboxScriptFormat, this.ID + "_section" ) );

            _lbAddActionType = new LinkButton();
            Controls.Add( _lbAddActionType );
            _lbAddActionType.ID = this.ID + "_lbAddAction";
            _lbAddActionType.CssClass = "btn btn-xs btn-action";
            _lbAddActionType.Click += lbAddActionType_Click;
            _lbAddActionType.CausesValidation = false;
            _lbAddActionType.Controls.Add( new LiteralControl { Text = "<i class='fa fa-plus'></i> Add Action" } );

            _pwAttributes = new PanelWidget();
            Controls.Add( _pwAttributes );
            _pwAttributes.ID = this.ID + "_pwAttributes";
            _pwAttributes.Title = "Activity Attributes";
            _pwAttributes.CssClass = "attribute-panel";

            _gAttributes = new Grid();
            _pwAttributes.Controls.Add( _gAttributes );
            _gAttributes.ID = this.ID + "_gAttributes";
            _gAttributes.AllowPaging = false;
            _gAttributes.DisplayType = GridDisplayType.Light;
            _gAttributes.RowItemText = "Activity Attribute";
            _gAttributes.AddCssClass( "attribute-grid" );
            _gAttributes.DataKeyNames = new string[] { "Guid" };
            _gAttributes.Actions.ShowAdd = true;
            _gAttributes.Actions.AddClick += gAttributes_Add;
            _gAttributes.GridRebind += gAttributes_Rebind;
            _gAttributes.GridReorder += gAttributes_Reorder;

            var reorderField = new ReorderField();
            _gAttributes.Columns.Add( reorderField );

            var nameField = new BoundField();
            nameField.DataField = "Name";
            nameField.HeaderText = "Attribute";
            _gAttributes.Columns.Add( nameField );

            var descField = new BoundField();
            descField.DataField = "Description";
            descField.HeaderText = "Description";
            _gAttributes.Columns.Add( descField );

            var fieldTypeField = new BoundField();
            fieldTypeField.DataField = "FieldType";
            fieldTypeField.HeaderText = "Field Type";
            _gAttributes.Columns.Add( fieldTypeField );

            var reqField = new BoolField();
            reqField.DataField = "IsRequired";
            reqField.HeaderText = "Required";
            _gAttributes.Columns.Add( reqField );

            var editField = new EditField();
            editField.Click += gAttributes_Edit;
            _gAttributes.Columns.Add( editField );

            var delField = new DeleteField();
            delField.Click += gAttributes_Delete;
            _gAttributes.Columns.Add( delField );
        }