protected override void CreateChildControls()
        {
            base.EnsureChildControls();

            var childGuid = Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_CHILD.AsGuid();
            var person    = GetPerson();

            if (person != null && person.Id != 0)
            {
                List <Guid> attributeGuids = null;
                if (person.GetFamilyRole().Guid == childGuid)
                {
                    attributeGuids = GetAttributeValue(AttributeKeys.PersonAttributesChild).SplitDelimitedValues().AsGuidList();
                }
                else
                {
                    attributeGuids = GetAttributeValue(AttributeKeys.PersonAttributesAdult).SplitDelimitedValues().AsGuidList();
                }
                if (attributeGuids != null && attributeGuids.Count > 0)
                {
                    var attributeKeys = AttributeCache.All().Where(a => attributeGuids.Contains(a.Guid)).Select(a => a.Key).ToList();
                    person.LoadAttributes();
                    Helper.AddEditControls("", attributeKeys, person, phAttributes, this.BlockValidationGroup, true, null, numberOfColumns: 2);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Build the dynamic controls based on the attributes
        /// </summary>
        private void BuildDynamicControls(bool editMode)
        {
            var stepEntityTypeId   = EntityTypeCache.GetId(typeof(Step));
            var excludedAttributes = AttributeCache.All()
                                     .Where(a => a.EntityTypeId == stepEntityTypeId)
                                     .Where(a => a.Key == "Order" || a.Key == "Active");

            avcAttributes.ExcludedAttributes = excludedAttributes.ToArray();

            var stepType = GetStepType();
            var step     = GetStep() ?? new Step {
                StepTypeId = stepType.Id
            };

            step.LoadAttributes();

            if (editMode)
            {
                avcAttributes.AddEditControls(step);
            }
            else
            {
                avcAttributesView.AddDisplayControls(step);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Loads the attribute list for content channel.
        /// </summary>
        private void LoadAttributeListForContentChannel()
        {
            int contentChannelId           = ddlContentChannel.SelectedValue.AsInteger();
            var contentChannelEntityTypeId = EntityTypeCache.Get(Rock.SystemGuid.EntityType.CONTENT_CHANNEL_ITEM).Id;

            var attributes = new List <AttributeCache>();

            if (contentChannelId != 0)
            {
                using (var rockContext = new RockContext())
                {
                    var channel = new ContentChannelService(rockContext).Get(contentChannelId);

                    attributes = AttributeCache.All()
                                 .Where(a => a.EntityTypeId == contentChannelEntityTypeId)
                                 .Where(a => (a.EntityTypeQualifierColumn == "ContentChannelId" && a.EntityTypeQualifierValue == channel.Id.ToString()) ||
                                        (a.EntityTypeQualifierColumn == "ContentChannelTypeId" && a.EntityTypeQualifierValue == channel.ContentChannelTypeId.ToString()))
                                 .ToList();
                }
            }

            var attributeItems = attributes
                                 .Select(a => new
            {
                a.Key,
                a.Name
            })
                                 .ToList();

            ddlContentChannelAttributes.DataSource     = attributeItems;
            ddlContentChannelAttributes.DataValueField = "Key";
            ddlContentChannelAttributes.DataTextField  = "Name";
            ddlContentChannelAttributes.DataBind();
        }
Beispiel #4
0
        /// <summary>
        /// Builds the non bulk dynamic controls.
        /// </summary>
        private void BuildNonBulkDynamicControls()
        {
            var stepEntityTypeId = EntityTypeCache.GetId(typeof(Step));
            var stepAttributes   = AttributeCache.All().Where(a => a.EntityTypeId == stepEntityTypeId);

            avcNonBulkAttributes.ExcludedAttributes = stepAttributes
                                                      .Where(a =>
                                                             a.Key == "Order" ||
                                                             a.Key == "Active" ||
                                                             a.ShowOnBulk)
                                                      .ToArray();

            var stepType = GetStepType();

            if (stepType != null)
            {
                var step = GetCurrentSetPersonStep() ?? new Step {
                    StepTypeId = stepType.Id
                };
                step.LoadAttributes();
                avcNonBulkAttributes.AddEditControls(step);
            }
            else
            {
                avcNonBulkAttributes.AddEditControls(null);
            }

            UpdateNonBulkDynamicControlsForPersonChange();
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindComponents();

                int?        smsPipelineId = GetSmsPipelineId();
                SmsPipeline smsPipeline   = null;

                if (smsPipelineId == null || smsPipelineId == 0)
                {
                    BindEditDetails(null);
                }
                else
                {
                    var smsPipelineService = new SmsPipelineService(new RockContext());
                    smsPipeline = GetSmsPipeline(smsPipelineId.Value, smsPipelineService, "SmsActions");
                    BindReadOnlyDetails(smsPipeline);
                }

                BindActions(smsPipeline);

                //
                // This must come after BindComponents so that the SmsActionContainer will
                // have been initialized already and any new attributes created.
                //
                var smsActionEntityTypeId = EntityTypeCache.Get(typeof(SmsAction)).Id;
                var attributes            = AttributeCache.All()
                                            .Where(a => a.EntityTypeId == smsActionEntityTypeId)
                                            .Where(a => a.Key == "Order" || a.Key == "Active");
                avcAttributes.ExcludedAttributes    = attributes.ToArray();
                avcAttributes.ExcludedCategoryNames = new string[] { SmsActionComponent.BaseAttributeCategories.Filters };
                avcFilters.IncludedCategoryNames    = new string[] { SmsActionComponent.BaseAttributeCategories.Filters };
            }
            else
            {
                if (Request["__EVENTTARGET"].ToStringSafe() == lbDragCommand.ClientID)
                {
                    ProcessDragEvents();
                }

                if (hfIsTestingDrawerOpen.Value.AsBoolean())
                {
                    divTestingDrawer.Style.Add("display", null);
                }
                else
                {
                    divTestingDrawer.Style.Add("display", "none");
                }
            }

            base.OnLoad(e);
        }
Beispiel #6
0
            /// <summary>
            /// Gets the custom settings control. The returned control will be added to the parent automatically.
            /// </summary>
            /// <param name="attributeEntity">The attribute entity.</param>
            /// <param name="parent">The parent control that will eventually contain the returned control.</param>
            /// <returns>
            /// A control that contains all the custom UI.
            /// </returns>
            public override Control GetCustomSettingsControl(IHasAttributes attributeEntity, Control parent)
            {
                var pnlContent = new Panel();
                var groupMemberEntityTypeId = EntityTypeCache.GetId <GroupMember>().Value;

                var jfBuilder = new JsonFieldsBuilder
                {
                    Label               = "Additional Fields",
                    SourceType          = typeof(GroupMember),
                    AvailableAttributes = AttributeCache.All()
                                          .Where(a => a.EntityTypeId == groupMemberEntityTypeId)
                                          .Where(a => a.EntityTypeQualifierColumn.IsNullOrWhiteSpace() && a.EntityTypeQualifierValue.IsNullOrWhiteSpace())
                                          .ToList()
                };

                pnlContent.Controls.Add(jfBuilder);

                return(pnlContent);
            }
Beispiel #7
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindComponents();
                BindActions();

                //
                // This must come after BindComponents so that the SmsActionContainer will
                // have been initialized already and any new attributes created.
                //
                var smsActionEntityTypeId = EntityTypeCache.Get(typeof(SmsAction)).Id;
                var attributes            = AttributeCache.All()
                                            .Where(a => a.EntityTypeId == smsActionEntityTypeId)
                                            .Where(a => a.Key == "Order" || a.Key == "Active");
                avcAttributes.ExcludedAttributes    = attributes.ToArray();
                avcAttributes.ExcludedCategoryNames = new string[] { SmsActionComponent.BaseAttributeCategories.Filters };
                avcFilters.IncludedCategoryNames    = new string[] { SmsActionComponent.BaseAttributeCategories.Filters };

                tbFromNumber.Text = "+16235553322"; // Ted Decker's cell
                tbToNumber.Text   = "+15559991234"; // Fake church number
            }
            else
            {
                if (Request["__EVENTTARGET"].ToStringSafe() == lbDragCommand.ClientID)
                {
                    ProcessDragEvents();
                }

                if (hfIsTestingDrawerOpen.Value.AsBoolean())
                {
                    divTestingDrawer.Style.Add("display", null);
                }
                else
                {
                    divTestingDrawer.Style.Add("display", "none");
                }
            }

            base.OnLoad(e);
        }