protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum)); PageLinks.AddLink("Administration", YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.admin_admin)); PageLinks.AddLink("Board Settings", ""); // create list boxes by populating datasources from Data class Theme.DataSource = YafStaticData.Themes(); Theme.DataTextField = "Theme"; Theme.DataValueField = "FileName"; Language.DataSource = YafStaticData.Languages(); Language.DataTextField = "Language"; Language.DataValueField = "FileName"; ShowTopic.DataSource = YafStaticData.TopicTimes(); ShowTopic.DataTextField = "TopicText"; ShowTopic.DataValueField = "TopicValue"; FileExtensionAllow.DataSource = YafStaticData.AllowDisallow(); FileExtensionAllow.DataTextField = "Text"; FileExtensionAllow.DataValueField = "Value"; BindData(); SetSelectedOnList(ref Theme, PageContext.BoardSettings.Theme); SetSelectedOnList(ref Language, PageContext.BoardSettings.Language); SetSelectedOnList(ref ShowTopic, PageContext.BoardSettings.ShowTopicsDefault.ToString()); SetSelectedOnList(ref FileExtensionAllow, PageContext.BoardSettings.FileExtensionAreAllowed ? "0" : "1"); AllowThemedLogo.Checked = PageContext.BoardSettings.AllowThemedLogo; } }
private void BindData() { TimeZones.DataSource = YafStaticData.TimeZones(); Theme.DataSource = YafStaticData.Themes(); Theme.DataTextField = "Theme"; Theme.DataValueField = "FileName"; Language.DataSource = YafStaticData.Languages(); Language.DataTextField = "Language"; Language.DataValueField = "FileName"; DataBind(); // get an instance of the combined user data class. YafCombinedUserData userData = new YafCombinedUserData(CurrentUserID); Location.Text = userData.Profile.Location; HomePage.Text = userData.Profile.Homepage; Email.Text = userData.Email; Realname.Text = userData.Profile.RealName; Occupation.Text = userData.Profile.Occupation; Interests.Text = userData.Profile.Interests; Weblog.Text = userData.Profile.Blog; WeblogUrl.Text = userData.Profile.BlogServiceUrl; WeblogID.Text = userData.Profile.BlogServicePassword; WeblogUsername.Text = userData.Profile.BlogServiceUsername; MSN.Text = userData.Profile.MSN; YIM.Text = userData.Profile.YIM; AIM.Text = userData.Profile.AIM; ICQ.Text = userData.Profile.ICQ; Skype.Text = userData.Profile.Skype; PMNotificationEnabled.Checked = userData.PMNotification; Gender.SelectedIndex = userData.Profile.Gender; ListItem timeZoneItem = TimeZones.Items.FindByValue(userData.TimeZone.ToString()); if (timeZoneItem != null) { timeZoneItem.Selected = true; } OverrideForumThemeRow.Visible = PageContext.BoardSettings.AllowUserTheme; if (PageContext.BoardSettings.AllowUserTheme) { // Allows to use different per-forum themes, // While "Allow User Change Theme" option in hostsettings is true string themeFile = PageContext.BoardSettings.Theme; if (userData.ThemeFile != null) { themeFile = userData.ThemeFile; } ListItem themeItem = Theme.Items.FindByValue(themeFile); if (themeItem != null) { themeItem.Selected = true; } OverrideDefaultThemes.Checked = userData.OverrideDefaultThemes; } if (PageContext.BoardSettings.AllowUserLanguage) { string languageFile = PageContext.BoardSettings.Language; if (userData.LanguageFile != string.Empty) { languageFile = userData.LanguageFile; } ListItem foundItem = Language.Items.FindByValue(languageFile); if (foundItem != null) { foundItem.Selected = true; } } }