/// <summary> /// Gets the culture. /// </summary> /// <returns> /// The get culture. /// </returns> private string GetCulture() { // Language and culture string languageFile = this.Get <YafBoardSettings>().Language; string culture4tag = this.Get <YafBoardSettings>().Culture; if (!string.IsNullOrEmpty(this.PageContext.LanguageFile)) { languageFile = this.PageContext.LanguageFile; } if (!string.IsNullOrEmpty(this.PageContext.CultureUser)) { culture4tag = this.PageContext.CultureUser; } // Get first default full culture from a language file tag. string langFileCulture = StaticDataHelper.CultureDefaultFromFile(languageFile); return(langFileCulture.Substring(0, 2) == culture4tag.Substring(0, 2) ? culture4tag : langFileCulture); }
/// <summary> /// Gets the culture. /// </summary> /// <param name="overrideByPageUserCulture">if set to <c>true</c> [override by page user culture].</param> /// <returns> /// The get culture. /// </returns> private string GetCulture(bool overrideByPageUserCulture) { // Language and culture var languageFile = this.Get <BoardSettings>().Language; var culture4Tag = this.Get <BoardSettings>().Culture; if (overrideByPageUserCulture) { if (this.PageContext.User.LanguageFile.IsSet()) { languageFile = this.PageContext.User.LanguageFile; } if (this.PageContext.User.Culture.IsSet()) { culture4Tag = this.PageContext.User.Culture; } } else { if (this.User.Item1.LanguageFile.IsSet()) { languageFile = this.User.Item1.LanguageFile; } if (this.User.Item1.Culture.IsSet()) { culture4Tag = this.User.Item1.Culture; } } // Get first default full culture from a language file tag. var langFileCulture = StaticDataHelper.CultureDefaultFromFile(languageFile); return(langFileCulture.Substring(0, 2) == culture4Tag.Substring(0, 2) ? culture4Tag : langFileCulture); }
/// <summary> /// Gets the culture. /// </summary> /// <param name="overrideByPageUserCulture">if set to <c>true</c> [override by page user culture].</param> /// <returns> /// The get culture. /// </returns> private string GetCulture(bool overrideByPageUserCulture) { // Language and culture string languageFile = this.Get <YafBoardSettings>().Language; string culture4Tag = this.Get <YafBoardSettings>().Culture; if (overrideByPageUserCulture) { if (this.PageContext.CurrentUserData.LanguageFile.IsSet()) { languageFile = this.PageContext.CurrentUserData.LanguageFile; } if (this.PageContext.CurrentUserData.CultureUser.IsSet()) { culture4Tag = this.PageContext.CurrentUserData.CultureUser; } } else { if (!string.IsNullOrEmpty(this.UserData.LanguageFile)) { languageFile = this.UserData.LanguageFile; } if (!string.IsNullOrEmpty(this.UserData.CultureUser)) { culture4Tag = this.UserData.CultureUser; } } // Get first default full culture from a language file tag. string langFileCulture = StaticDataHelper.CultureDefaultFromFile(languageFile); return(langFileCulture.Substring(0, 2) == culture4Tag.Substring(0, 2) ? culture4Tag : langFileCulture); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } var boardSettings = this.Get <YafBoardSettings>(); this.PageLinks.AddLink(boardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.GetText("ADMIN_ADMIN", "Administration"), YafBuildLink.GetLink(ForumPages.admin_admin)); this.PageLinks.AddLink(this.GetText("ADMIN_BOARDSETTINGS", "TITLE"), string.Empty); this.Page.Header.Title = "{0} - {1}".FormatWith( this.GetText("ADMIN_ADMIN", "Administration"), this.GetText("ADMIN_BOARDSETTINGS", "TITLE")); this.Save.Text = this.GetText("COMMON", "SAVE"); // create list boxes by populating datasources from Data class var themeData = StaticDataHelper.Themes().AsEnumerable().Where(x => !x.Field <bool>("IsMobile")); if (themeData.Any()) { this.Theme.DataSource = themeData.CopyToDataTable(); this.Theme.DataTextField = "Theme"; this.Theme.DataValueField = "FileName"; } var mobileThemeData = StaticDataHelper.Themes().AsEnumerable().Where(x => x.Field <bool>("IsMobile")); if (mobileThemeData.Any()) { var mobileThemes = mobileThemeData.CopyToDataTable(); // Add Dummy Disabled Mobile Theme Item to allow disabling the Mobile Theme DataRow dr = mobileThemes.NewRow(); dr["Theme"] = "[ {0} ]".FormatWith(this.GetText("ADMIN_COMMON", "DISABLED")); dr["FileName"] = string.Empty; dr["IsMobile"] = false; mobileThemes.Rows.InsertAt(dr, 0); this.MobileTheme.DataSource = mobileThemes; this.MobileTheme.DataTextField = "Theme"; this.MobileTheme.DataValueField = "FileName"; } this.Culture.DataSource = StaticDataHelper.Cultures() .AsEnumerable() .OrderBy(x => x.Field <string>("CultureNativeName")) .CopyToDataTable(); this.Culture.DataTextField = "CultureNativeName"; this.Culture.DataValueField = "CultureTag"; this.ShowTopic.DataSource = StaticDataHelper.TopicTimes(); this.ShowTopic.DataTextField = "TopicText"; this.ShowTopic.DataValueField = "TopicValue"; this.FileExtensionAllow.DataSource = StaticDataHelper.AllowDisallow(); this.FileExtensionAllow.DataTextField = "Text"; this.FileExtensionAllow.DataValueField = "Value"; this.JqueryUITheme.DataSource = StaticDataHelper.JqueryUIThemes(); this.JqueryUITheme.DataTextField = "Theme"; this.JqueryUITheme.DataValueField = "Theme"; this.BindData(); // bind poll group list var pollGroup = LegacyDb.PollGroupList(this.PageContext.PageUserID, null, this.PageContext.PageBoardID) .Distinct(new AreEqualFunc <TypedPollGroup>((v1, v2) => v1.PollGroupID == v2.PollGroupID)) .ToList(); pollGroup.Insert(0, new TypedPollGroup(string.Empty, -1)); // TODO: vzrus needs some work, will be in polls only until feature is debugged there. this.PollGroupListDropDown.Items.AddRange(pollGroup.Select(x => new ListItem(x.Question, x.PollGroupID.ToString())).ToArray()); // population default notification setting options... var items = EnumHelper.EnumToDictionary <UserNotificationSetting>(); if (!boardSettings.AllowNotificationAllPostsAllTopics) { // remove it... items.Remove(UserNotificationSetting.AllTopics.ToInt()); } var notificationItems = items.Select(x => new ListItem(HtmlHelper.StripHtml(this.GetText("CP_SUBSCRIPTIONS", x.Value)), x.Key.ToString())).ToArray(); this.DefaultNotificationSetting.Items.AddRange(notificationItems); SetSelectedOnList(ref this.JqueryUITheme, boardSettings.JqueryUITheme); // Get first default full culture from a language file tag. string langFileCulture = StaticDataHelper.CultureDefaultFromFile(boardSettings.Language) ?? "en-US"; SetSelectedOnList(ref this.Theme, boardSettings.Theme); SetSelectedOnList(ref this.MobileTheme, boardSettings.MobileTheme); // If 2-letter language code is the same we return Culture, else we return a default full culture from language file /* SetSelectedOnList( * ref this.Culture, * langFileCulture.Substring(0, 2) == this.Get<YafBoardSettings>().Culture * ? this.Get<YafBoardSettings>().Culture * : langFileCulture);*/ SetSelectedOnList(ref this.Culture, boardSettings.Culture); if (this.Culture.SelectedIndex == 0) { // If 2-letter language code is the same we return Culture, else we return a default full culture from language file SetSelectedOnList( ref this.Culture, langFileCulture.Substring(0, 2) == boardSettings.Culture ? boardSettings.Culture : langFileCulture); } SetSelectedOnList(ref this.ShowTopic, boardSettings.ShowTopicsDefault.ToString()); SetSelectedOnList( ref this.FileExtensionAllow, boardSettings.FileExtensionAreAllowed ? "0" : "1"); SetSelectedOnList( ref this.DefaultNotificationSetting, boardSettings.DefaultNotificationSetting.ToInt().ToString()); this.NotificationOnUserRegisterEmailList.Text = boardSettings.NotificationOnUserRegisterEmailList; this.AllowThemedLogo.Checked = boardSettings.AllowThemedLogo; this.EmailModeratorsOnModeratedPost.Checked = boardSettings.EmailModeratorsOnModeratedPost; this.EmailModeratorsOnReportedPost.Checked = boardSettings.EmailModeratorsOnReportedPost; this.AllowDigestEmail.Checked = boardSettings.AllowDigestEmail; this.DefaultSendDigestEmail.Checked = boardSettings.DefaultSendDigestEmail; this.ForumEmail.Text = boardSettings.ForumEmail; this.ForumBaseUrlMask.Text = boardSettings.BaseUrlMask; this.CopyrightRemovalKey.Text = boardSettings.CopyrightRemovalDomainKey; this.DigestSendEveryXHours.Text = boardSettings.DigestSendEveryXHours.ToString(); if (boardSettings.BoardPollID > 0) { this.PollGroupListDropDown.SelectedValue = boardSettings.BoardPollID.ToString(); } else { this.PollGroupListDropDown.SelectedIndex = 0; } this.PollGroupList.Visible = true; // Copyright Linkback Algorithm // Please keep if you haven't purchased a removal or commercial license. this.CopyrightHolder.Visible = true; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } var boardSettings = this.Get <BoardSettings>(); this.CdvVersion.Text = boardSettings.CdvVersion.ToString(); // create list boxes by populating data sources from Data class var themeData = StaticDataHelper.Themes(); if (themeData.Any()) { this.Theme.DataSource = themeData; } this.Culture.DataSource = StaticDataHelper.Cultures().AsEnumerable() .OrderBy(x => x.Field <string>("CultureNativeName")).CopyToDataTable(); this.Culture.DataTextField = "CultureNativeName"; this.Culture.DataValueField = "CultureTag"; this.ShowTopic.DataSource = StaticDataHelper.TopicTimes(); this.ShowTopic.DataTextField = "TopicText"; this.ShowTopic.DataValueField = "TopicValue"; this.BindData(); // bind poll group list var pollGroup = this.GetRepository <Poll>() .PollGroupList(this.PageContext.PageUserID, null, this.PageContext.PageBoardID).Distinct( new AreEqualFunc <TypedPollGroup>((v1, v2) => v1.PollGroupID == v2.PollGroupID)).ToList(); pollGroup.Insert(0, new TypedPollGroup(this.GetText("NONE"), -1)); // TODO: vzrus needs some work, will be in polls only until feature is debugged there. this.PollGroupListDropDown.Items.AddRange( pollGroup.Select(x => new ListItem(x.Question, x.PollGroupID.ToString())).ToArray()); // population default notification setting options... var items = EnumHelper.EnumToDictionary <UserNotificationSetting>(); if (!boardSettings.AllowNotificationAllPostsAllTopics) { // remove it... items.Remove(UserNotificationSetting.AllTopics.ToInt()); } var notificationItems = items.Select( x => new ListItem( HtmlHelper.StripHtml(this.GetText("SUBSCRIPTIONS", x.Value)), x.Key.ToString())) .ToArray(); this.DefaultNotificationSetting.Items.AddRange(notificationItems); // Get first default full culture from a language file tag. var langFileCulture = StaticDataHelper.CultureDefaultFromFile(boardSettings.Language) ?? "en-US"; if (boardSettings.Theme.Contains(".xml")) { SetSelectedOnList(ref this.Theme, "yaf"); } else { SetSelectedOnList(ref this.Theme, boardSettings.Theme); } // If 2-letter language code is the same we return Culture, else we return a default full culture from language file /* SetSelectedOnList( * ref this.Culture, * langFileCulture.Substring(0, 2) == this.Get<BoardSettings>().Culture * ? this.Get<BoardSettings>().Culture * : langFileCulture);*/ SetSelectedOnList(ref this.Culture, boardSettings.Culture); if (this.Culture.SelectedIndex == 0) { // If 2-letter language code is the same we return Culture, else we return a default full culture from language file SetSelectedOnList( ref this.Culture, langFileCulture.Substring(0, 2) == boardSettings.Culture ? boardSettings.Culture : langFileCulture); } SetSelectedOnList(ref this.ShowTopic, boardSettings.ShowTopicsDefault.ToString()); SetSelectedOnList( ref this.DefaultNotificationSetting, boardSettings.DefaultNotificationSetting.ToInt().ToString()); this.FileExtensionAllow.Checked = boardSettings.FileExtensionAreAllowed; this.NotificationOnUserRegisterEmailList.Text = boardSettings.NotificationOnUserRegisterEmailList; this.EmailModeratorsOnModeratedPost.Checked = boardSettings.EmailModeratorsOnModeratedPost; this.EmailModeratorsOnReportedPost.Checked = boardSettings.EmailModeratorsOnReportedPost; this.AllowDigestEmail.Checked = boardSettings.AllowDigestEmail; this.DefaultSendDigestEmail.Checked = boardSettings.DefaultSendDigestEmail; this.ForumEmail.Text = boardSettings.ForumEmail; this.ForumBaseUrlMask.Text = boardSettings.BaseUrlMask; var item = this.BoardLogo.Items.FindByText(boardSettings.ForumLogo); if (item != null) { item.Selected = true; } this.CopyrightRemovalKey.Text = boardSettings.CopyrightRemovalDomainKey; this.DigestSendEveryXHours.Text = boardSettings.DigestSendEveryXHours.ToString(); if (boardSettings.BoardPollID > 0) { this.PollGroupListDropDown.SelectedValue = boardSettings.BoardPollID.ToString(); } else { this.PollGroupListDropDown.SelectedIndex = 0; } this.PollGroupList.Visible = true; // Copyright Link-back Algorithm // Please keep if you haven't purchased a removal or commercial license. this.CopyrightHolder.Visible = true; // Render board Announcement // add items to the dropdown this.BoardAnnouncementUntilUnit.Items.Add(new ListItem(this.GetText("PROFILE", "MONTH"), "3")); this.BoardAnnouncementUntilUnit.Items.Add(new ListItem(this.GetText("PROFILE", "DAYS"), "1")); this.BoardAnnouncementUntilUnit.Items.Add(new ListItem(this.GetText("PROFILE", "HOURS"), "2")); // select hours this.BoardAnnouncementUntilUnit.SelectedIndex = 0; // default number of hours to suspend user for this.BoardAnnouncementUntil.Text = "1"; if (boardSettings.BoardAnnouncement.IsNotSet()) { return; } this.CurrentAnnouncement.Visible = true; this.CurrentMessage.Text = $"{this.GetText("ANNOUNCEMENT_CURRENT")}: {boardSettings.BoardAnnouncementUntil}"; this.BoardAnnouncementType.SelectedValue = boardSettings.BoardAnnouncementType; this.BoardAnnouncement.Text = boardSettings.BoardAnnouncement; }
/// <summary> /// Binds the data. /// </summary> private void BindData() { var board = this.GetRepository <Board>().GetById(this.PageContext.PageBoardID); using (var dt = new DataTable("Files")) { dt.Columns.Add("FileName", typeof(string)); dt.Columns.Add("Description", typeof(string)); var dr = dt.NewRow(); dr["FileName"] = BoardInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry dr["Description"] = this.GetText("BOARD_LOGO_SELECT"); dt.Rows.Add(dr); var dir = new DirectoryInfo( this.Get <HttpRequestBase>() .MapPath($"{BoardInfo.ForumServerFileRoot}{BoardFolders.Current.Logos}")); var files = dir.GetFiles("*.*"); dt.AddImageFiles(files, BoardFolders.Current.Logos); this.BoardLogo.DataSource = dt; this.BoardLogo.DataValueField = "FileName"; this.BoardLogo.DataTextField = "Description"; this.BoardLogo.DataBind(); } this.Name.Text = board.Name; var boardSettings = this.Get <BoardSettings>(); this.CdvVersion.Text = boardSettings.CdvVersion.ToString(); // create list boxes by populating data sources from Data class var themeData = StaticDataHelper.Themes(); if (themeData.Any()) { this.Theme.DataSource = themeData; this.Theme.DataBind(); } this.Culture.DataSource = StaticDataHelper.Cultures().OrderBy(x => x.CultureNativeName); this.Culture.DataTextField = "CultureNativeName"; this.Culture.DataValueField = "CultureTag"; this.Culture.DataBind(); this.ShowTopic.DataSource = StaticDataHelper.TopicTimes(); this.ShowTopic.DataTextField = "Name"; this.ShowTopic.DataValueField = "Value"; this.ShowTopic.DataBind(); // population default notification setting options... var items = EnumHelper.EnumToDictionary <UserNotificationSetting>(); if (!boardSettings.AllowNotificationAllPostsAllTopics) { // remove it... items.Remove(UserNotificationSetting.AllTopics.ToInt()); } var notificationItems = items.Select( x => new ListItem( HtmlHelper.StripHtml(this.GetText("SUBSCRIPTIONS", x.Value)), x.Key.ToString())) .ToArray(); this.DefaultNotificationSetting.Items.AddRange(notificationItems); // Get first default full culture from a language file tag. var langFileCulture = StaticDataHelper.CultureDefaultFromFile(boardSettings.Language) ?? "en-US"; if (boardSettings.Theme.Contains(".xml")) { SetSelectedOnList(ref this.Theme, "yaf"); } else { SetSelectedOnList(ref this.Theme, boardSettings.Theme); } SetSelectedOnList(ref this.Culture, boardSettings.Culture); if (this.Culture.SelectedIndex == 0) { // If 2-letter language code is the same we return Culture, else we return a default full culture from language file SetSelectedOnList( ref this.Culture, langFileCulture.Substring(0, 2) == boardSettings.Culture ? boardSettings.Culture : langFileCulture); } SetSelectedOnList(ref this.ShowTopic, boardSettings.ShowTopicsDefault.ToString()); SetSelectedOnList( ref this.DefaultNotificationSetting, boardSettings.DefaultNotificationSetting.ToInt().ToString()); this.NotificationOnUserRegisterEmailList.Text = boardSettings.NotificationOnUserRegisterEmailList; this.EmailModeratorsOnModeratedPost.Checked = boardSettings.EmailModeratorsOnModeratedPost; this.EmailModeratorsOnReportedPost.Checked = boardSettings.EmailModeratorsOnReportedPost; this.AllowDigestEmail.Checked = boardSettings.AllowDigestEmail; this.DefaultSendDigestEmail.Checked = boardSettings.DefaultSendDigestEmail; this.ForumEmail.Text = boardSettings.ForumEmail; this.ForumBaseUrlMask.Text = boardSettings.BaseUrlMask; var item = this.BoardLogo.Items.FindByText(boardSettings.ForumLogo); if (item != null) { item.Selected = true; } this.CopyrightRemovalKey.Text = boardSettings.CopyrightRemovalDomainKey; this.DigestSendEveryXHours.Text = boardSettings.DigestSendEveryXHours.ToString(); // Copyright Link-back Algorithm // Please keep if you haven't purchased a removal or commercial license. this.CopyrightHolder.Visible = true; }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.IsPostBack) { this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink("Administration", YafBuildLink.GetLink(ForumPages.admin_admin)); this.PageLinks.AddLink("Board Settings", string.Empty); // create list boxes by populating datasources from Data class var themeData = StaticDataHelper.Themes().AsEnumerable().Where(x => !x.Field <bool>("IsMobile")); if (themeData.Any()) { this.Theme.DataSource = themeData.CopyToDataTable(); this.Theme.DataTextField = "Theme"; this.Theme.DataValueField = "FileName"; } var mobileThemeData = StaticDataHelper.Themes().AsEnumerable().Where(x => x.Field <bool>("IsMobile")); if (mobileThemeData.Any()) { this.MobileTheme.DataSource = mobileThemeData.CopyToDataTable(); this.MobileTheme.DataTextField = "Theme"; this.MobileTheme.DataValueField = "FileName"; } this.Culture.DataSource = StaticDataHelper.Cultures().AsEnumerable().OrderBy(x => x.Field <string>("CultureNativeName")).CopyToDataTable( ); this.Culture.DataTextField = "CultureNativeName"; this.Culture.DataValueField = "CultureTag"; this.ShowTopic.DataSource = StaticDataHelper.TopicTimes(); this.ShowTopic.DataTextField = "TopicText"; this.ShowTopic.DataValueField = "TopicValue"; this.FileExtensionAllow.DataSource = StaticDataHelper.AllowDisallow(); this.FileExtensionAllow.DataTextField = "Text"; this.FileExtensionAllow.DataValueField = "Value"; this.BindData(); // bind poll group list var pollGroup = DB.PollGroupList(this.PageContext.PageUserID, null, this.PageContext.PageBoardID).Distinct( new AreEqualFunc <TypedPollGroup>((v1, v2) => v1.PollGroupID == v2.PollGroupID)).ToList(); pollGroup.Insert(0, new TypedPollGroup(String.Empty, -1)); // TODO: vzrus needs some work, will be in polls only until feature is debugged there. this.PollGroupListDropDown.Items.AddRange( pollGroup.Select(x => new ListItem(x.Question, x.PollGroupID.ToString())).ToArray()); // population default notification setting options... var items = EnumHelper.EnumToDictionary <UserNotificationSetting>(); if (!this.PageContext.BoardSettings.AllowNotificationAllPostsAllTopics) { // remove it... items.Remove(UserNotificationSetting.AllTopics.ToInt()); } var notificationItems = items.Select( x => new ListItem( HtmlHelper.StripHtml(this.PageContext.Localization.GetText("CP_SUBSCRIPTIONS", x.Value)), x.Key.ToString())) .ToArray(); this.DefaultNotificationSetting.Items.AddRange(notificationItems); // Get first default full culture from a language file tag. string langFileCulture = StaticDataHelper.CultureDefaultFromFile(this.PageContext.BoardSettings.Language) ?? "en"; SetSelectedOnList(ref this.Theme, this.PageContext.BoardSettings.Theme); SetSelectedOnList(ref this.MobileTheme, this.PageContext.BoardSettings.MobileTheme); // If 2-letter language code is the same we return Culture, else we return a default full culture from language file SetSelectedOnList( ref this.Culture, langFileCulture.Substring(0, 2) == this.PageContext.BoardSettings.Culture ? this.PageContext.BoardSettings.Culture : langFileCulture); SetSelectedOnList(ref this.ShowTopic, this.PageContext.BoardSettings.ShowTopicsDefault.ToString()); SetSelectedOnList( ref this.FileExtensionAllow, this.PageContext.BoardSettings.FileExtensionAreAllowed ? "0" : "1"); SetSelectedOnList( ref this.DefaultNotificationSetting, this.PageContext.BoardSettings.DefaultNotificationSetting.ToInt().ToString()); this.NotificationOnUserRegisterEmailList.Text = this.PageContext.BoardSettings.NotificationOnUserRegisterEmailList; this.AllowThemedLogo.Checked = this.PageContext.BoardSettings.AllowThemedLogo; this.EmailModeratorsOnModeratedPost.Checked = this.PageContext.BoardSettings.EmailModeratorsOnModeratedPost; this.AllowDigestEmail.Checked = this.PageContext.BoardSettings.AllowDigestEmail; this.DefaultSendDigestEmail.Checked = this.PageContext.BoardSettings.DefaultSendDigestEmail; if (this.PageContext.BoardSettings.BoardPollID > 0) { this.PollGroupListDropDown.SelectedValue = this.PageContext.BoardSettings.BoardPollID.ToString(); } else { this.PollGroupListDropDown.SelectedIndex = 0; } this.PollGroupList.Visible = true; } }
/// <summary> /// The bind data. /// </summary> private void BindData() { this.TimeZones.DataSource = StaticDataHelper.TimeZones(); if (this.PageContext.BoardSettings.AllowUserTheme) { this.Theme.DataSource = StaticDataHelper.Themes(); this.Theme.DataTextField = "Theme"; this.Theme.DataValueField = "FileName"; } if (this.PageContext.BoardSettings.AllowUserLanguage) { this.Culture.DataSource = StaticDataHelper.Cultures(); this.Culture.DataValueField = "CultureTag"; this.Culture.DataTextField = "CultureNativeName"; } this.DataBind(); if (this.PageContext.BoardSettings.EnableDNACalendar) { this.datePicker.LocID = this.PageContext.Localization.GetText("COMMON", "CAL_JQ_CULTURE"); this.datePicker.AnotherFormatString = this.PageContext.Localization.GetText("COMMON", "CAL_JQ_CULTURE_DFORMAT"); this.datePicker.DateFormatString = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern; this.datePicker.Value = this.UserData.Profile.Birthday > DateTime.MinValue ? this.UserData.Profile.Birthday.Date : DateTime.MinValue.Date; this.datePicker.ToolTip = this.PageContext.Localization.GetText("COMMON", "CAL_JQ_TT"); this.datePicker.DefaultDateString = string.Empty; } else { this.datePicker.Enabled = false; this.datePicker.Visible = false; this.BirthdayLabel.Visible = false; } this.DisplayName.Text = this.UserData.DisplayName; this.Location.Text = this.UserData.Profile.Location; this.HomePage.Text = this.UserData.Profile.Homepage; this.Email.Text = this.UserData.Email; this.Realname.Text = this.UserData.Profile.RealName; this.Occupation.Text = this.UserData.Profile.Occupation; this.Interests.Text = this.UserData.Profile.Interests; this.Weblog.Text = this.UserData.Profile.Blog; this.WeblogUrl.Text = this.UserData.Profile.BlogServiceUrl; this.WeblogID.Text = this.UserData.Profile.BlogServicePassword; this.WeblogUsername.Text = this.UserData.Profile.BlogServiceUsername; this.MSN.Text = this.UserData.Profile.MSN; this.YIM.Text = this.UserData.Profile.YIM; this.AIM.Text = this.UserData.Profile.AIM; this.ICQ.Text = this.UserData.Profile.ICQ; this.Xmpp.Text = this.UserData.Profile.XMPP; this.Skype.Text = this.UserData.Profile.Skype; this.Gender.SelectedIndex = this.UserData.Profile.Gender; ListItem timeZoneItem = this.TimeZones.Items.FindByValue(this.UserData.TimeZone.ToString()); if (timeZoneItem != null) { timeZoneItem.Selected = true; } this.DSTUser.Checked = this.UserData.DSTUser; this.HideMe.Checked = this.UserData.IsActiveExcluded && (this.PageContext.BoardSettings.AllowUserHideHimself || this.PageContext.IsAdmin); if (YafContext.Current.BoardSettings.MobileTheme.IsSet() && UserAgentHelper.IsMobileDevice(HttpContext.Current.Request.UserAgent) || HttpContext.Current.Request.Browser.IsMobileDevice) { this.UseMobileThemeRow.Visible = true; this.UseMobileTheme.Checked = this.UserData.UseMobileTheme; } if (this.PageContext.BoardSettings.AllowUserTheme && this.Theme.Items.Count > 0) { // Allows to use different per-forum themes, // While "Allow User Change Theme" option in hostsettings is true string themeFile = this.PageContext.BoardSettings.Theme; if (!string.IsNullOrEmpty(this.UserData.ThemeFile)) { themeFile = this.UserData.ThemeFile; } ListItem themeItem = this.Theme.Items.FindByValue(themeFile); if (themeItem != null) { themeItem.Selected = true; } } if (!this.PageContext.BoardSettings.AllowUserLanguage || this.Culture.Items.Count <= 0) { return; } string languageFile = this.PageContext.BoardSettings.Language; string culture4tag = this.PageContext.BoardSettings.Culture; if (!string.IsNullOrEmpty(this.UserData.LanguageFile)) { languageFile = this.UserData.LanguageFile; } if (!string.IsNullOrEmpty(this.UserData.CultureUser)) { culture4tag = this.UserData.CultureUser; } // Get first default full culture from a language file tag. string langFileCulture = StaticDataHelper.CultureDefaultFromFile(languageFile); // If 2-letter language code is the same we return Culture, else we return a default full culture from language file ListItem foundCultItem = this.Culture.Items.FindByValue((langFileCulture.Substring(0, 2) == culture4tag.Substring(0, 2) ? culture4tag : langFileCulture)); if (foundCultItem != null) { foundCultItem.Selected = true; } }