Exemplo n.º 1
0
        public string ParseView()
        {
            var membershipPending = false;
            var isOwner           = false;

            if (HttpContext.Current.Request.IsAuthenticated)
            {
                var userRoleInfo = this.CurrentUser.Social.Roles.FirstOrDefault(r => r.RoleID == this.RoleInfo.RoleID);

                if (userRoleInfo != null)
                {
                    isOwner = userRoleInfo.IsOwner;
                    if (userRoleInfo.Status == RoleStatus.Pending)
                    {
                        membershipPending = true;
                    }
                }

                if (this.RoleInfo.CreatedByUserID == this.CurrentUser.UserID || this.CurrentUser.IsSuperUser)
                {
                    isOwner = true;
                }
            }

            var editUrl = Localization.GetString("GroupEditUrl", Constants.SharedResourcesPath);

            if (isOwner)
            {
                this.Template = this.Template.Replace("[GROUPEDITBUTTON]", string.Format(editUrl, this.GroupEditUrl));
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsNotOwner", false);
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsOwner", true);
            }
            else if (this.CurrentUser.IsInRole(this.RoleInfo.RoleName))
            {
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsNotOwner", true);
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsOwner", false);
            }

            this.Template = Utilities.ParseTokenWrapper(this.Template, "IsNotOwner", false);
            this.Template = Utilities.ParseTokenWrapper(this.Template, "IsOwner", false);

            if (this.CurrentUser.IsInRole(this.RoleInfo.RoleName) || !HttpContext.Current.Request.IsAuthenticated || membershipPending)
            {
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsNotMember", false);
            }
            else
            {
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsNotMember", true);
            }

            if (this.CurrentUser.IsInRole(this.RoleInfo.RoleName))
            {
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsMember", true);
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsPendingMember", false);
            }
            else
            {
                this.Template = Utilities.ParseTokenWrapper(this.Template, "IsMember", false);
            }

            this.Template = Utilities.ParseTokenWrapper(this.Template, "AllowJoin", this.RoleInfo.IsPublic);

            this.Template = this.Template.Replace("[GROUPEDITBUTTON]", string.Empty);

            var url = this.NavigationManager.NavigateURL(this.GroupViewTabId, string.Empty, new string[] { "groupid=" + this.RoleInfo.RoleID.ToString() });

            this.Template = Utilities.ParseTokenWrapper(this.Template, "IsPendingMember", membershipPending);
            this.Template = this.Template.Replace("[groupviewurl]", url);
            Components.GroupItemTokenReplace tokenReplace = new Components.GroupItemTokenReplace(this.RoleInfo);
            this.Template = tokenReplace.ReplaceGroupItemTokens(this.Template);
            return(this.Template);
        }
Exemplo n.º 2
0
        public string ParseView()
        {
            bool         membershipPending = false;
            bool         isOwner           = false;
            UserRoleInfo userRoleInfo      = null;

            if (HttpContext.Current.Request.IsAuthenticated)
            {
                userRoleInfo = CurrentUser.Social.Roles.Where(r => r.RoleID == RoleInfo.RoleID).FirstOrDefault();

                if (userRoleInfo != null)
                {
                    isOwner = userRoleInfo.IsOwner;
                    if (userRoleInfo.Status == RoleStatus.Pending)
                    {
                        membershipPending = true;
                    }
                }
                if (RoleInfo.CreatedByUserID == CurrentUser.UserID)
                {
                    isOwner = true;
                }
            }
            var editUrl = Localization.GetString("GroupEditUrl", resxPath);

            if (isOwner)
            {
                Template = Template.Replace("[GROUPEDITBUTTON]", String.Format(editUrl, GroupEditUrl));
                Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", false);
                Template = Utilities.ParseTokenWrapper(Template, "IsOwner", true);
            }
            else if (!isOwner && CurrentUser.IsInRole(RoleInfo.RoleName))
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", true);
                Template = Utilities.ParseTokenWrapper(Template, "IsOwner", false);
            }
            Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", false);
            Template = Utilities.ParseTokenWrapper(Template, "IsOwner", false);

            if (CurrentUser.IsInRole(RoleInfo.RoleName) || !HttpContext.Current.Request.IsAuthenticated || membershipPending)
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotMember", false);
            }
            else
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotMember", true);
            }

            if (CurrentUser.IsInRole(RoleInfo.RoleName))
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsMember", true);
                Template = Utilities.ParseTokenWrapper(Template, "IsPendingMember", false);
            }
            else
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsMember", false);
            }

            Template = Template.Replace("[GROUPEDITBUTTON]", String.Empty);

            string url = string.Empty;

            url = Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + RoleInfo.RoleID.ToString() });

            Template = Utilities.ParseTokenWrapper(Template, "IsPendingMember", membershipPending);
            Template = Template.Replace("[groupviewurl]", url);
            Components.GroupItemTokenReplace tokenReplace = new Components.GroupItemTokenReplace(RoleInfo);
            Template = tokenReplace.ReplaceGroupItemTokens(Template);
            return(Template);
        }
        public string ParseView()
        {
            var membershipPending = false;
            var isOwner = false;

            if (HttpContext.Current.Request.IsAuthenticated)
            {
                var userRoleInfo = CurrentUser.Social.Roles.FirstOrDefault(r => r.RoleID == RoleInfo.RoleID);

                if (userRoleInfo != null)
                {
                    isOwner = userRoleInfo.IsOwner;
                    if (userRoleInfo.Status == RoleStatus.Pending)
                    {
                        membershipPending = true;
                    }
                }
                if (RoleInfo.CreatedByUserID == CurrentUser.UserID || CurrentUser.IsSuperUser)
                {
                    isOwner = true;
                }
            }

            var editUrl = Localization.GetString("GroupEditUrl", Constants.SharedResourcesPath);

            if (isOwner)
            {

                Template = Template.Replace("[GROUPEDITBUTTON]", String.Format(editUrl, GroupEditUrl));
                Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", false);
                Template = Utilities.ParseTokenWrapper(Template, "IsOwner", true);
            }
            else if (CurrentUser.IsInRole(RoleInfo.RoleName))
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", true);
                Template = Utilities.ParseTokenWrapper(Template, "IsOwner", false);
            }

            Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", false);
            Template = Utilities.ParseTokenWrapper(Template, "IsOwner", false);

            if (CurrentUser.IsInRole(RoleInfo.RoleName) || !HttpContext.Current.Request.IsAuthenticated || membershipPending)
                Template = Utilities.ParseTokenWrapper(Template, "IsNotMember", false);
            else
                Template = Utilities.ParseTokenWrapper(Template, "IsNotMember", true);

            if (CurrentUser.IsInRole(RoleInfo.RoleName))
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsMember", true);
                Template = Utilities.ParseTokenWrapper(Template, "IsPendingMember", false);
            }
            else
                Template = Utilities.ParseTokenWrapper(Template, "IsMember", false);


            // Added Join private groups functionality
            // Template = Utilities.ParseTokenWrapper(Template, "AllowJoin", RoleInfo.IsPublic);
            Template = Utilities.ParseTokenWrapper(Template, "AllowJoin", true);
                        
            Template = Template.Replace("[GROUPEDITBUTTON]", String.Empty);

            var url = Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + RoleInfo.RoleID.ToString() });
            
            Template = Utilities.ParseTokenWrapper(Template, "IsPendingMember", membershipPending);
            Template = Template.Replace("[groupviewurl]", url);
            Components.GroupItemTokenReplace tokenReplace = new Components.GroupItemTokenReplace(RoleInfo);
            Template = tokenReplace.ReplaceGroupItemTokens(Template);
            return Template;
        }
Exemplo n.º 4
0
        public string ParseView()
        {
            bool membershipPending = false;
            bool isOwner = false;
            UserRoleInfo userRoleInfo = null;
            if (HttpContext.Current.Request.IsAuthenticated)
            {
                userRoleInfo = CurrentUser.Social.Roles.Where(r => r.RoleID == RoleInfo.RoleID).FirstOrDefault();
                
                if (userRoleInfo != null)
                {
                    isOwner = userRoleInfo.IsOwner;
                    if (userRoleInfo.Status == RoleStatus.Pending)
                    {
                        membershipPending = true;
                    }
                }
                if (RoleInfo.CreatedByUserID == CurrentUser.UserID)
                {
                    isOwner = true;
                }
                
            }
            var editUrl = Localization.GetString("GroupEditUrl", resxPath);

            if (isOwner)
            {

                Template = Template.Replace("[GROUPEDITBUTTON]", String.Format(editUrl, GroupEditUrl));
                Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", false);
                Template = Utilities.ParseTokenWrapper(Template, "IsOwner", true);
            } else if (!isOwner && CurrentUser.IsInRole(RoleInfo.RoleName))
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", true);
                Template = Utilities.ParseTokenWrapper(Template, "IsOwner", false);
            }
            Template = Utilities.ParseTokenWrapper(Template, "IsNotOwner", false);
            Template = Utilities.ParseTokenWrapper(Template, "IsOwner", false);

            if (CurrentUser.IsInRole(RoleInfo.RoleName) || !HttpContext.Current.Request.IsAuthenticated || membershipPending)
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotMember", false);
            } else
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsNotMember", true);
            }

            if (CurrentUser.IsInRole(RoleInfo.RoleName))
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsMember", true);
                Template = Utilities.ParseTokenWrapper(Template, "IsPendingMember", false);
            } else
            {
                Template = Utilities.ParseTokenWrapper(Template, "IsMember", false);
            }

            Template = Template.Replace("[GROUPEDITBUTTON]", String.Empty);

            string url = string.Empty;
            url = Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + RoleInfo.RoleID.ToString() });
            
            Template = Utilities.ParseTokenWrapper(Template, "IsPendingMember", membershipPending);
            Template = Template.Replace("[groupviewurl]", url);
            Components.GroupItemTokenReplace tokenReplace = new Components.GroupItemTokenReplace(RoleInfo);
            Template = tokenReplace.ReplaceGroupItemTokens(Template);
            return Template;
        }