Inheritance: Rock.Web.UI.Controls.LabeledTextBox
Example #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();

            _lblGroupTypeName = new Label();
            _lblGroupTypeName.ClientIDMode = ClientIDMode.Static;
            _lblGroupTypeName.ID           = this.ID + "_lblGroupTypeName";

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

            _ddlGroupTypeInheritFrom       = new RockDropDownList();
            _ddlGroupTypeInheritFrom.ID    = this.ID + "_ddlGroupTypeInheritFrom";
            _ddlGroupTypeInheritFrom.Label = "Inherit from";

            _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()));
            }
            _ddlGroupTypeInheritFrom.AutoPostBack          = true;
            _ddlGroupTypeInheritFrom.SelectedIndexChanged += _ddlGroupTypeInheritFrom_SelectedIndexChanged;
            _ddlAttendanceRule       = new RockDropDownList();
            _ddlAttendanceRule.ID    = this.ID + "_ddlAttendanceRule";
            _ddlAttendanceRule.Label = "Check-in Rule";
            _ddlAttendanceRule.Help  = "The rule that check in should use when a person attempts to check in to a group of this type.  If 'None' is selected, user will not be added to group and is not required to belong to group.  If 'Add On Check In' is selected, user will be added to group if they don't already belong.  If 'Already Belongs' is selected, user must already be a member of the group or they will not be allowed to check in.";
            _ddlAttendanceRule.BindToEnum <Rock.Model.AttendanceRule>();

            _ddlPrintTo       = new RockDropDownList();
            _ddlPrintTo.ID    = this.ID + "_ddlPrintTo";
            _ddlPrintTo.Label = "Print To";
            _ddlPrintTo.Help  = "When printing check-in labels, should the device's printer or the location's printer be used?  Note: the device has a similar setting which takes precedence over this setting.";
            _ddlPrintTo.Items.Add(new ListItem("Device Printer", "1"));
            _ddlPrintTo.Items.Add(new ListItem("Location Printer", "2"));

            _phGroupTypeAttributes    = new PlaceHolder();
            _phGroupTypeAttributes.ID = this.ID + "_phGroupTypeAttributes";

            Controls.Add(_lblGroupTypeName);
            Controls.Add(_ddlGroupTypeInheritFrom);
            Controls.Add(_ddlAttendanceRule);
            Controls.Add(_ddlPrintTo);
            Controls.Add(_tbGroupTypeName);
            Controls.Add(_phGroupTypeAttributes);

            // Check-in Labels grid
            CreateCheckinLabelsGrid();
        }
Example #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";

            _hfGroupGuid    = new HiddenField();
            _hfGroupGuid.ID = this.ID + "_hfGroupGuid";

            _hfGroupId    = new HiddenField();
            _hfGroupId.ID = this.ID + "_hfGroupId";

            _hfGroupTypeId    = new HiddenField();
            _hfGroupTypeId.ID = this.ID + "_hfGroupTypeId";

            _lblGroupName    = new Literal();
            _lblGroupName.ID = this.ID + "_lblGroupName";

            _lbDeleteGroup = new LinkButton();
            _lbDeleteGroup.CausesValidation = false;
            _lbDeleteGroup.ID       = this.ID + "_lbDeleteGroup";
            _lbDeleteGroup.CssClass = "btn btn-xs btn-danger";
            _lbDeleteGroup.Click   += lbDeleteGroup_Click;
            _lbDeleteGroup.Attributes["onclick"] = string.Format("javascript: return Rock.dialogs.confirmDelete(event, '{0}', '{1}');", "group", "Once saved, you will lose all attendance data.");

            var iDelete = new HtmlGenericControl("i");

            _lbDeleteGroup.Controls.Add(iDelete);
            iDelete.AddCssClass("fa fa-times");

            _tbGroupName       = new DataTextBox();
            _tbGroupName.ID    = this.ID + "_tbGroupName";
            _tbGroupName.Label = "Check-in Group Name";

            // set label when they exit the edit field
            _tbGroupName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblGroupName.ID);
            _tbGroupName.SourceTypeName       = "Rock.Model.Group, Rock";
            _tbGroupName.PropertyName         = "Name";

            _phGroupAttributes    = new PlaceHolder();
            _phGroupAttributes.ID = this.ID + "_phGroupAttributes";

            Controls.Add(_hfGroupGuid);
            Controls.Add(_hfGroupId);
            Controls.Add(_hfGroupTypeId);
            Controls.Add(_lblGroupName);
            Controls.Add(_tbGroupName);
            Controls.Add(_phGroupAttributes);

            // Locations Grid
            CreateLocationsGrid();

            Controls.Add(_lbDeleteGroup);
        }
Example #3
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();

            _hfGroupGuid    = new HiddenField();
            _hfGroupGuid.ID = this.ID + "_hfGroupGuid";

            _hfGroupId    = new HiddenField();
            _hfGroupId.ID = this.ID + "_hfGroupId";

            _hfGroupTypeId    = new HiddenField();
            _hfGroupTypeId.ID = this.ID + "_hfGroupTypeId";

            _lblGroupName    = new Literal();
            _lblGroupName.ID = this.ID + "_lblGroupName";

            _tbGroupName       = new DataTextBox();
            _tbGroupName.ID    = this.ID + "_tbGroupName";
            _tbGroupName.Label = "Check-in Group Name";

            _cbIsActive      = new RockCheckBox();
            _cbIsActive.ID   = this.ID + "_cbIsActive";
            _cbIsActive.Text = "Active";

            // set label when they exit the edit field
            _tbGroupName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblGroupName.ID);
            _tbGroupName.SourceTypeName       = "Rock.Model.Group, Rock";
            _tbGroupName.PropertyName         = "Name";

            _phGroupAttributes    = new PlaceHolder();
            _phGroupAttributes.ID = this.ID + "_phGroupAttributes";

            Controls.Add(_hfGroupGuid);
            Controls.Add(_hfGroupId);
            Controls.Add(_hfGroupTypeId);
            Controls.Add(_lblGroupName);
            Controls.Add(_tbGroupName);
            Controls.Add(_cbIsActive);
            Controls.Add(_phGroupAttributes);

            // Locations Grid
            CreateLocationsGrid();
        }
Example #4
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";

            _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);
        }
Example #5
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();

            _hfGroupGuid = new HiddenField();
            _hfGroupGuid.ID = this.ID + "_hfGroupGuid";

            _hfGroupId = new HiddenField();
            _hfGroupId.ID = this.ID + "_hfGroupId";

            _hfGroupTypeId = new HiddenField();
            _hfGroupTypeId.ID = this.ID + "_hfGroupTypeId";

            _lblGroupName = new Literal();
            _lblGroupName.ClientIDMode = ClientIDMode.Static;
            _lblGroupName.ID = this.ID + "_lblGroupName";

            _lbDeleteGroup = new LinkButton();
            _lbDeleteGroup.CausesValidation = false;
            _lbDeleteGroup.ID = this.ID + "_lbDeleteGroup";
            _lbDeleteGroup.CssClass = "btn btn-xs btn-danger";
            _lbDeleteGroup.Click += lbDeleteGroup_Click;
            _lbDeleteGroup.Attributes["onclick"] = string.Format( "javascript: return Rock.dialogs.confirmDelete(event, '{0}', '{1}');", "group", "Once saved, you will lose all attendance data." );

            var iDelete = new HtmlGenericControl( "i" );
            _lbDeleteGroup.Controls.Add( iDelete );
            iDelete.AddCssClass( "fa fa-times" );

            _tbGroupName = new DataTextBox();
            _tbGroupName.ID = this.ID + "_tbGroupName";
            _tbGroupName.Label = "Check-in Group Name";

            // set label when they exit the edit field
            _tbGroupName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblGroupName.ID );
            _tbGroupName.SourceTypeName = "Rock.Model.Group, Rock";
            _tbGroupName.PropertyName = "Name";

            _phGroupAttributes = new PlaceHolder();
            _phGroupAttributes.ID = this.ID + "_phGroupAttributes";

            Controls.Add( _hfGroupGuid );
            Controls.Add( _hfGroupId );
            Controls.Add( _hfGroupTypeId );
            Controls.Add( _lblGroupName );
            Controls.Add( _tbGroupName );
            Controls.Add( _phGroupAttributes );

            // Locations Grid
            CreateLocationsGrid();

            Controls.Add( _lbDeleteGroup );
        }
Example #6
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";

            _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();

            _hfActivityTypeGuid = new HiddenField();
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            _lblActivityTypeName.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeName.ID = this.ID + "_lblActivityTypeName";
            _lblActivityTypeDescription = new Label();
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID = this.ID + "_lblInactive";
            _lblInactive.CssClass = "label label-important pull-right";
            _lblInactive.Text = "Inactive";

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

            _cbActivityTypeIsActive = new RockCheckBox { Label = "Active" };
            _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 DataTextBox();
            _tbActivityTypeName.ID = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label = "Name";

            // set label when they exit the edit field
            _tbActivityTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID );
            _tbActivityTypeName.SourceTypeName = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeName.PropertyName = "Name";

            _tbActivityTypeDescription = new DataTextBox();
            _tbActivityTypeDescription.ID = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label = "Description";
            _tbActivityTypeDescription.TextMode = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows = 4;

            // set label when they exit the edit field
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID );
            _tbActivityTypeDescription.SourceTypeName = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeDescription.PropertyName = "Description";

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox { Label = "Activated with Workflow" };
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";

            _lbAddActionType = new LinkButton();
            _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" } );

            Controls.Add( _hfActivityTypeGuid );
            Controls.Add( _lblActivityTypeName );
            Controls.Add( _lblActivityTypeDescription );
            Controls.Add( _lblInactive );
            Controls.Add( _tbActivityTypeName );
            Controls.Add( _tbActivityTypeDescription );
            Controls.Add( _cbActivityTypeIsActive );
            Controls.Add( _cbActivityTypeIsActivatedWithWorkflow );
            Controls.Add( _lbDeleteActivityType );
            Controls.Add( _lbAddActionType );
        }
        /// <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 );
        }
Example #9
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();

            _lblGroupTypeName = new Label();
            _lblGroupTypeName.ClientIDMode = ClientIDMode.Static;
            _lblGroupTypeName.ID = this.ID + "_lblGroupTypeName";

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

            _ddlGroupTypeInheritFrom = new RockDropDownList();
            _ddlGroupTypeInheritFrom.ID = this.ID + "_ddlGroupTypeInheritFrom";
            _ddlGroupTypeInheritFrom.Label = "Inherit from";

            _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() ) );
            }
            _ddlGroupTypeInheritFrom.AutoPostBack = true;
            _ddlGroupTypeInheritFrom.SelectedIndexChanged += _ddlGroupTypeInheritFrom_SelectedIndexChanged;
            _ddlAttendanceRule = new RockDropDownList();
            _ddlAttendanceRule.ID = this.ID + "_ddlAttendanceRule";
            _ddlAttendanceRule.Label = "Check-in Rule";
            _ddlAttendanceRule.Help = "The rule that check in should use when a person attempts to check in to a group of this type.  If 'None' is selected, user will not be added to group and is not required to belong to group.  If 'Add On Check In' is selected, user will be added to group if they don't already belong.  If 'Already Belongs' is selected, user must already be a member of the group or they will not be allowed to check in.";
            _ddlAttendanceRule.BindToEnum<Rock.Model.AttendanceRule>();

            _ddlPrintTo = new RockDropDownList();
            _ddlPrintTo.ID = this.ID + "_ddlPrintTo";
            _ddlPrintTo.Label = "Print To";
            _ddlPrintTo.Help = "When printing check-in labels, should the device's printer or the location's printer be used?  Note: the device has a similar setting which takes precedence over this setting.";
            _ddlPrintTo.Items.Add( new ListItem( "Device Printer", "1" ) );
            _ddlPrintTo.Items.Add( new ListItem( "Location Printer", "2" ) );

            _phGroupTypeAttributes = new PlaceHolder();
            _phGroupTypeAttributes.ID = this.ID + "_phGroupTypeAttributes";

            Controls.Add( _lblGroupTypeName );
            Controls.Add( _ddlGroupTypeInheritFrom );
            Controls.Add( _ddlAttendanceRule );
            Controls.Add( _ddlPrintTo );
            Controls.Add( _tbGroupTypeName );
            Controls.Add( _phGroupTypeAttributes );

            // Check-in Labels grid
            CreateCheckinLabelsGrid();
        }
Example #10
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();

            _hfGroupGuid = new HiddenField();
            _hfGroupGuid.ID = this.ID + "_hfGroupGuid";

            _hfGroupId = new HiddenField();
            _hfGroupId.ID = this.ID + "_hfGroupId";

            _hfGroupTypeId = new HiddenField();
            _hfGroupTypeId.ID = this.ID + "_hfGroupTypeId";

            _lblGroupName = new Literal();
            _lblGroupName.ID = this.ID + "_lblGroupName";

            _tbGroupName = new DataTextBox();
            _tbGroupName.ID = this.ID + "_tbGroupName";
            _tbGroupName.Label = "Check-in Group Name";

            // set label when they exit the edit field
            _tbGroupName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblGroupName.ID );
            _tbGroupName.SourceTypeName = "Rock.Model.Group, Rock";
            _tbGroupName.PropertyName = "Name";

            _phGroupAttributes = new PlaceHolder();
            _phGroupAttributes.ID = this.ID + "_phGroupAttributes";

            Controls.Add( _hfGroupGuid );
            Controls.Add( _hfGroupId );
            Controls.Add( _hfGroupTypeId );
            Controls.Add( _lblGroupName );
            Controls.Add( _tbGroupName );
            Controls.Add( _phGroupAttributes );

            // Locations Grid
            CreateLocationsGrid();
        }
        /// <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();

            _hfActivityTypeGuid    = new HiddenField();
            _hfActivityTypeGuid.ID = this.ID + "_hfActivityTypeGuid";

            _lblActivityTypeName = new Label();
            _lblActivityTypeName.ClientIDMode        = ClientIDMode.Static;
            _lblActivityTypeName.ID                  = this.ID + "_lblActivityTypeName";
            _lblActivityTypeDescription              = new Label();
            _lblActivityTypeDescription.ClientIDMode = ClientIDMode.Static;
            _lblActivityTypeDescription.ID           = this.ID + "_lblActivityTypeDescription";

            _lblInactive = new Label();
            _lblInactive.ClientIDMode = ClientIDMode.Static;
            _lblInactive.ID           = this.ID + "_lblInactive";
            _lblInactive.CssClass     = "label label-important pull-right";
            _lblInactive.Text         = "Inactive";

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

            _cbActivityTypeIsActive = new RockCheckBox {
                Label = "Active"
            };
            _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 DataTextBox();
            _tbActivityTypeName.ID    = this.ID + "_tbActivityTypeName";
            _tbActivityTypeName.Label = "Name";

            // set label when they exit the edit field
            _tbActivityTypeName.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeName.ID);
            _tbActivityTypeName.SourceTypeName       = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeName.PropertyName         = "Name";

            _tbActivityTypeDescription          = new DataTextBox();
            _tbActivityTypeDescription.ID       = this.ID + "_tbActivityTypeDescription";
            _tbActivityTypeDescription.Label    = "Description";
            _tbActivityTypeDescription.TextMode = TextBoxMode.MultiLine;
            _tbActivityTypeDescription.Rows     = 4;

            // set label when they exit the edit field
            _tbActivityTypeDescription.Attributes["onblur"] = string.Format("javascript: $('#{0}').text($(this).val());", _lblActivityTypeDescription.ID);
            _tbActivityTypeDescription.SourceTypeName       = "Rock.Model.WorkflowActivityType, Rock";
            _tbActivityTypeDescription.PropertyName         = "Description";

            _cbActivityTypeIsActivatedWithWorkflow = new RockCheckBox {
                Label = "Activated with Workflow"
            };
            _cbActivityTypeIsActivatedWithWorkflow.ID = this.ID + "_cbActivityTypeIsActivatedWithWorkflow";

            _lbAddActionType                  = new LinkButton();
            _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"
            });

            Controls.Add(_hfActivityTypeGuid);
            Controls.Add(_lblActivityTypeName);
            Controls.Add(_lblActivityTypeDescription);
            Controls.Add(_lblInactive);
            Controls.Add(_tbActivityTypeName);
            Controls.Add(_tbActivityTypeDescription);
            Controls.Add(_cbActivityTypeIsActive);
            Controls.Add(_cbActivityTypeIsActivatedWithWorkflow);
            Controls.Add(_lbDeleteActivityType);
            Controls.Add(_lbAddActionType);
        }
        /// <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);
        }