/// <summary> /// Initializes a new instance of the <see cref="NoteControl"/> class. /// </summary> public NoteControl() { _tbNote = new RockTextBox(); _tbNote.Placeholder = "Write a note..."; _cbAlert = new CheckBox(); _cbPrivate = new CheckBox(); _lbSaveNote = new LinkButton(); _lbEditNote = new LinkButton(); _lbDeleteNote = new LinkButton(); _sbSecurity = new SecurityButton(); }
/// <summary> /// Initializes a new instance of the <see cref="NoteEditor"/> class. /// </summary> public NoteEditor() { _tbNote = new RockTextBox(); _tbNote.Label = "Note"; _cbAlert = new CheckBox(); _cbPrivate = new CheckBox(); _lbSaveNote = new LinkButton(); _lbEditNote = new LinkButton(); _lbDeleteNote = new LinkButton(); _sbSecurity = new SecurityButton(); }
/// <summary> /// Initializes a new instance of the <see cref="NoteControl"/> class. /// </summary> public NoteControl() { _ddlNoteType = new DropDownList(); _tbNote = new RockTextBox(); _tbNote.Placeholder = "Write a note..."; _cbAlert = new CheckBox(); _cbPrivate = new CheckBox(); _lbSaveNote = new LinkButton(); _lbEditNote = new LinkButton(); _lbDeleteNote = new LinkButton(); _sbSecurity = new SecurityButton(); _dtCreateDate = new DateTimePicker(); }
/// <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); }
/// <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 ); }