Пример #1
0
        /// <summary>
        /// Checks the settings.
        /// </summary>
        /// <returns></returns>
        private bool CheckSettings()
        {
            _rockContext = _rockContext ?? new RockContext();

            if (CurrentGroup == null)
            {
                NavigateToHomePage();
                return(false);
            }

            //Authorization check. Nothing is visible otherwise
            if (!CurrentGroup.IsAuthorized(Authorization.EDIT, CurrentPerson))
            {
                return(false);
            }

            _defaultGroupRole = CurrentGroup.GroupType.DefaultGroupRole;

            _dvcConnectionStatus = DefinedValueCache.Get(GetAttributeValue("ConnectionStatus").AsGuid());
            if (_dvcConnectionStatus == null)
            {
                return(false);
            }

            _dvcRecordStatus = DefinedValueCache.Get(GetAttributeValue("RecordStatus").AsGuid());
            if (_dvcRecordStatus == null)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            RegisterScript();

            _rockContext = new RockContext();

            if (CurrentGroup != null && CurrentGroup.IsAuthorized(Authorization.EDIT, CurrentPerson))
            {
                _canEdit = true;
            }
        }
Пример #3
0
        /// <summary>
        /// Checks the settings.
        /// </summary>
        /// <returns></returns>
        private bool CheckSettings()
        {
            _rockContext = _rockContext ?? new RockContext();

            if (CurrentGroup == null)
            {
                NavigateToHomePage();
                return(false);
            }

            //Authorization check. Nothing is visible otherwise
            if (!CurrentGroup.IsAuthorized(Authorization.EDIT, CurrentPerson))
            {
                return(false);
            }

            _defaultGroupRole = CurrentGroup.GroupType.DefaultGroupRole;

            _dvcConnectionStatus = DefinedValueCache.Get(GetAttributeValue("ConnectionStatus").AsGuid());
            if (_dvcConnectionStatus == null)
            {
                return(false);
            }

            _dvcRecordStatus = DefinedValueCache.Get(GetAttributeValue("RecordStatus").AsGuid());
            if (_dvcRecordStatus == null)
            {
                return(false);
            }


            _homeAddressType = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.GROUP_LOCATION_TYPE_HOME.AsGuid());
            _familyType      = GroupTypeCache.Get(Rock.SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuid());
            _adultRole       = _familyType.Roles.FirstOrDefault(r => r.Guid.Equals(Rock.SystemGuid.GroupRole.GROUPROLE_FAMILY_MEMBER_ADULT.AsGuid()));

            if (!GetAttributeValue("LargeButton").AsBoolean())
            {
                btnLaunchModal.Text = "<i class='fa fa-user-plus'></i>";
            }

            if (!string.IsNullOrWhiteSpace(GetAttributeValue("CSSClass")))
            {
                btnLaunchModal.CssClass = GetAttributeValue("CSSClass");
            }

            return(true);
        }
Пример #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (CurrentGroup == null)
            {
                NavigateToHomePage();
                return;
            }

            btnEmail.Visible = GetAttributeValue("AllowEmail").AsBoolean();
            btnSMS.Visible   = GetAttributeValue("AllowSMS").AsBoolean();

            nbAlert.Visible = false;
            var personAlias = RockPage.CurrentPersonAlias;

            _rockContext = new RockContext();

            //If you are not a leader when one is required hide and quit.
            if (!CurrentGroup.IsAuthorized(Authorization.EDIT, CurrentPerson))
            {
                pnlMain.Visible = false;
                nbAlert.Visible = true;
                nbAlert.Text    = "You are not authorized to view this page.";
                return;
            }

            Page.Title   = CurrentGroup.Name;
            ltTitle.Text = "<h1>" + CurrentGroup.Name + " Roster</h1>";

            GetGroupMembers();

            if (!Page.IsPostBack)
            {
                GenerateFilters(true);
                BindData();
            }
            else
            {
                //this line is needed or resizing the page
                //afterpost back will stop the grid from being responsive
                gMembers.DataSource = memberData;
                pnlRoster.AddCssClass("is-showing-items");
            }
            BindRoster();
        }