Example #1
0
        private void LoadSettings()
        {
            //avatarPath = Page.ResolveUrl("~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/");
#if !MONO
            divTimeZone.Visible = true;
#endif

            QuestionRequired.Enabled = siteSettings.RequiresQuestionAndAnswer;
            AnswerRequired.Enabled   = siteSettings.RequiresQuestionAndAnswer;

            //lnkAvatarUpload.Visible = false;

            switch (siteSettings.AvatarSystem)
            {
            case "gravatar":
                allowGravatars = true;
                disableAvatars = false;
                break;

            case "internal":
                allowGravatars = false;
                disableAvatars = false;


                if (siteUser != null)
                {
                    // lnkAvatarUpload.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString();
                    // lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(Resource.UploadAvatarHeading) + "', this.href, GBCallback)";
                    lnkAvatarUpld.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString();
                }

                if (WebConfigSettings.AvatarsCanOnlyBeUploadedByAdmin)
                {
                    //lnkAvatarUpload.Visible = false;
                    lnkAvatarUpld.Visible = false;
                    //lblMaxAvatarSize.Visible = false;
                    //avatarFile.Visible = false;
                    // progressBar.Visible = false;
                    //btnUploadAvatar.Visible = false;
                    // regexAvatarFile.Visible = false;
                    // regexAvatarFile.Enabled = false;
                    avatarHelp.Visible = false;
                }

                break;

            case "none":
            default:
                allowGravatars = false;
                disableAvatars = true;
                break;
            }

            if (displaySettings.OverrideAvatarLabel.Length > 0)
            {
                lblAvatar.ConfigKey = displaySettings.OverrideAvatarLabel;
            }

            if (displaySettings.HidePostCount)
            {
                divForumPosts.Visible = false;
            }

            allowUserSkin = ((siteSettings.AllowUserSkins) || ((WebConfigSettings.AllowEditingSkins) && (WebUser.IsInRoles(siteSettings.RolesThatCanManageSkins))));

            if (allowUserSkin)
            {
                this.divSkin.Visible         = true;
                ScriptConfig.IncludeColorBox = true;
            }
            else
            {
                this.divSkin.Visible = false;
                SkinSetting.Visible  = false;
            }

            if (siteSettings.UseLdapAuth && !siteSettings.AllowDbFallbackWithLdap)
            {
                this.lnkChangePassword.Visible = false;
            }

            divEditorPreference.Visible = siteSettings.AllowUserEditorPreference;

            timeOffset = SiteUtils.GetUserTimeOffset();
            timeZone   = SiteUtils.GetUserTimeZone();

            divOpenID.Visible = WebConfigSettings.EnableOpenIdAuthentication && siteSettings.AllowOpenIdAuth;

            rpxApiKey          = siteSettings.RpxNowApiKey;
            rpxApplicationName = siteSettings.RpxNowApplicationName;

            if (WebConfigSettings.UseOpenIdRpxSettingsFromWebConfig)
            {
                if (WebConfigSettings.OpenIdRpxApiKey.Length > 0)
                {
                    rpxApiKey = WebConfigSettings.OpenIdRpxApiKey;
                }

                if (WebConfigSettings.OpenIdRpxApplicationName.Length > 0)
                {
                    rpxApplicationName = WebConfigSettings.OpenIdRpxApplicationName;
                }
            }

            if (rpxApiKey.Length > 0)
            {
                lnkOpenIDUpdate.Visible = false;
                rpxLink.Visible         = divOpenID.Visible;
            }

            if (!mojoSetup.RunningInFullTrust())
            {
                divOpenID.Visible = false;
            }

            if (
                (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) ||
                (!siteSettings.AllowWindowsLiveMessengerForMembers) ||
                ((siteSettings.WindowsLiveAppId.Length == 0) && (ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"] == null))
                )
            {
                divLiveMessenger.Visible = false;
            }

            int countOfNewsLetters = LetterInfo.GetCount(siteSettings.SiteGuid);

            liNewsletters.Visible   = (WebConfigSettings.EnableNewsletter && (countOfNewsLetters > 0));
            tabNewsletters.Visible  = liNewsletters.Visible;
            newsLetterPrefs.Visible = liNewsletters.Visible;

            commerceConfig = SiteUtils.GetCommerceConfig();
            if (!commerceConfig.IsConfigured)
            {
                liOrderHistory.Visible  = false;
                tabOrderHistory.Visible = false;
            }

            if ((WebConfigSettings.UserNameValidationExpression.Length > 0) && (siteSettings.AllowUserFullNameChange))
            {
                regexUserName.ValidationExpression = WebConfigSettings.UserNameValidationExpression;
                regexUserName.ErrorMessage         = WebConfigSettings.UserNameValidationWarning;
                regexUserName.Enabled = true;
            }

            FailSafeUserNameValidator.ErrorMessage    = Resource.UserNameHasInvalidCharsWarning;
            FailSafeUserNameValidator.ServerValidate += new ServerValidateEventHandler(FailSafeUserNameValidator_ServerValidate);

            AddClassToBody("userprofile");
        }
Example #2
0
        private void LoadSettings()
        {
            avatarPath = Page.ResolveUrl("~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/");

            //lnkAvatarUpload.Visible = false;

            switch (siteSettings.AvatarSystem)
            {
            case "gravatar":
                allowGravatars = true;
                disableAvatars = true;
                break;

            case "internal":
                allowGravatars = false;
                disableAvatars = false;
                if (siteUser != null)
                {
                    lnkAvatarUpload.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString();
                    lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(Resource.UploadAvatarHeading) + "', this.href, GBCallback)";
                }

                if (WebConfigSettings.AvatarsCanOnlyBeUploadedByAdmin)
                {
                    lnkAvatarUpload.Visible = false;
                    //lblMaxAvatarSize.Visible = false;
                    //avatarFile.Visible = false;
                    // progressBar.Visible = false;
                    //btnUploadAvatar.Visible = false;
                    // regexAvatarFile.Visible = false;
                    // regexAvatarFile.Enabled = false;
                    avatarHelp.Visible = false;
                }

                break;

            case "none":
            default:
                allowGravatars = false;
                disableAvatars = true;
                break;
            }



            if (siteSettings.AllowUserSkins)
            {
                this.divSkin.Visible = true;
            }
            else
            {
                this.divSkin.Visible = false;
            }

            if (siteSettings.UseLdapAuth)
            {
                this.lnkChangePassword.Visible = false;
            }

            timeOffset = SiteUtils.GetUserTimeOffset();

            divOpenID.Visible = WebConfigSettings.EnableOpenIdAuthentication && siteSettings.AllowOpenIdAuth;

            rpxApiKey          = siteSettings.RpxNowApiKey;
            rpxApplicationName = siteSettings.RpxNowApplicationName;

            if (WebConfigSettings.UseOpenIdRpxSettingsFromWebConfig)
            {
                if (WebConfigSettings.OpenIdRpxApiKey.Length > 0)
                {
                    rpxApiKey = WebConfigSettings.OpenIdRpxApiKey;
                }

                if (WebConfigSettings.OpenIdRpxApplicationName.Length > 0)
                {
                    rpxApplicationName = WebConfigSettings.OpenIdRpxApplicationName;
                }
            }

            if (rpxApiKey.Length > 0)
            {
                lnkOpenIDUpdate.Visible = false;
                rpxLink.Visible         = divOpenID.Visible;
            }

            if (WebConfigSettings.RunningInMediumTrust)
            {
                divOpenID.Visible = false;
            }

            if (
                (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) ||
                (!siteSettings.AllowWindowsLiveMessengerForMembers) ||
                ((siteSettings.WindowsLiveAppId.Length == 0) && (ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"] == null))
                )
            {
                divLiveMessenger.Visible = false;
            }

            int countOfNewsLetters = LetterInfo.GetCount(siteSettings.SiteGuid);

            liNewsletters.Visible   = (WebConfigSettings.EnableNewsletter && (countOfNewsLetters > 0));
            tabNewsletters.Visible  = liNewsletters.Visible;
            newsLetterPrefs.Visible = liNewsletters.Visible;

            commerceConfig = SiteUtils.GetCommerceConfig();
            if (!commerceConfig.IsConfigured)
            {
                liOrderHistory.Visible  = false;
                tabOrderHistory.Visible = false;
            }
        }