/// <summary> /// Handles the Init event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Init([NotNull] object sender, [NotNull] EventArgs e) { // get the forum editor based on the settings this.reportEditor = ForumEditorHelper.GetCurrentForumEditor(); // add editor to the page this.EditorLine.Controls.Add(this.reportEditor); }
/// <summary> /// Handles the Initialization event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Init([NotNull] object sender, [NotNull] EventArgs e) { this.editor = ForumEditorHelper.GetCurrentForumEditor(); this.editor.MaxCharacters = this.PageContext.BoardSettings.MaxPostSize; this.EditorLine.Controls.Add(this.editor); this.editor.UserCanUpload = this.Get <BoardSettings>().AllowPrivateMessageAttachments; // add editor to the page this.EditorLine.Controls.Add(this.editor); }
/// <summary> /// Handles the Initialization event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Init([NotNull] object sender, [NotNull] EventArgs e) { // create editor based on administrator's settings // get the forum editor based on the settings this._editor = ForumEditorHelper.GetCurrentForumEditor(); this.EditorLine.Controls.Add(this._editor); this._editor.UserCanUpload = this.Get <YafBoardSettings>().AllowPrivateMessageAttachments; // add editor to the page this.EditorLine.Controls.Add(this._editor); }
/// <summary> /// Handles the Initialization event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Init([NotNull] object sender, [NotNull] EventArgs e) { // create editor based on administrator's settings // get the forum editor based on the settings this._editor = ForumEditorHelper.GetCurrentForumEditor(); this.EditorLine.Controls.Add(this._editor); // TODO : Handle Attachments for pm's this._editor.UserCanUpload = false; // add editor to the page this.EditorLine.Controls.Add(this._editor); }
/// <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([NotNull] EventArgs e) { if (this.PageContext.ForumUploadAccess) { this.PageContext.PageElements.AddScriptReference("FileUploadScript"); #if DEBUG this.PageContext.PageElements.RegisterCssIncludeContent("jquery.fileupload.comb.css"); #else this.PageContext.PageElements.RegisterCssIncludeContent("jquery.fileupload.comb.min.css"); #endif } this.forumEditor = ForumEditorHelper.GetCurrentForumEditor(); this.EditorLine.Controls.Add(this.forumEditor); base.OnInit(e); }
/// <summary> /// Binds the data. /// </summary> private void BindData() { this.ForumEditor.DataSource = ForumEditorHelper.GetFilteredEditorList(); // TODO: vzrus: UseFullTextSearch check box is data layer specific and can be hidden by YAF.Classes.Data.LegacyDb.FullTextSupported property.) this.DataBind(); // load Board Setting collection information... var settingCollection = new YafBoardSettingCollection(this.Get <YafBoardSettings>()); // handle checked fields... foreach (var name in settingCollection.SettingsBool.Keys) { Control control = this.HostSettingsTabs.FindControlRecursive(name); if (control is CheckBox && settingCollection.SettingsBool[name].CanRead) { // get the value from the property... ((CheckBox)control).Checked = (bool) Convert.ChangeType( settingCollection.SettingsBool[name].GetValue(this.Get <YafBoardSettings>(), null), typeof(bool)); } } // handle string fields... foreach (var name in settingCollection.SettingsString.Keys) { Control control = this.HostSettingsTabs.FindControlRecursive(name); if (control is TextBox && settingCollection.SettingsString[name].CanRead) { // get the value from the property... ((TextBox)control).Text = (string) Convert.ChangeType( settingCollection.SettingsString[name].GetValue(this.Get <YafBoardSettings>(), null), typeof(string)); } else if (control is DropDownList && settingCollection.SettingsString[name].CanRead) { ListItem listItem = ((DropDownList)control).Items.FindByValue( settingCollection.SettingsString[name].GetValue(this.Get <YafBoardSettings>(), null) .ToString()); if (listItem != null) { listItem.Selected = true; } } } // handle int fields... foreach (var name in settingCollection.SettingsInt.Keys) { Control control = this.HostSettingsTabs.FindControlRecursive(name); if (control is TextBox && settingCollection.SettingsInt[name].CanRead) { ((TextBox)control).CssClass = name.Equals("ServerTimeCorrection") ? "NumericServerTimeCorrection" : "Numeric"; // get the value from the property... ((TextBox)control).Text = settingCollection.SettingsInt[name].GetValue(this.Get <YafBoardSettings>(), null).ToString(); } else if (control is DropDownList && settingCollection.SettingsInt[name].CanRead) { ListItem listItem = ((DropDownList)control).Items.FindByValue( settingCollection.SettingsInt[name].GetValue(this.Get <YafBoardSettings>(), null).ToString()); if (listItem != null) { listItem.Selected = true; } } } // handle double fields... foreach (var name in settingCollection.SettingsDouble.Keys) { Control control = this.HostSettingsTabs.FindControlRecursive(name); if (control is TextBox && settingCollection.SettingsDouble[name].CanRead) { ((TextBox)control).CssClass = "Numeric"; // get the value from the property... ((TextBox)control).Text = settingCollection.SettingsDouble[name].GetValue(this.Get <YafBoardSettings>(), null).ToString(); } else if (control is DropDownList && settingCollection.SettingsDouble[name].CanRead) { ListItem listItem = ((DropDownList)control).Items.FindByValue( settingCollection.SettingsDouble[name].GetValue(this.Get <YafBoardSettings>(), null) .ToString()); if (listItem != null) { listItem.Selected = true; } } } // special field handling... this.AvatarSize.Text = (this.Get <YafBoardSettings>().AvatarSize != 0) ? this.Get <YafBoardSettings>().AvatarSize.ToString() : string.Empty; this.MaxFileSize.Text = (this.Get <YafBoardSettings>().MaxFileSize != 0) ? this.Get <YafBoardSettings>().MaxFileSize.ToString() : string.Empty; this.SQLVersion.Text = this.HtmlEncode(this.Get <YafBoardSettings>().SQLVersion); if (General.GetCurrentTrustLevel() <= AspNetHostingPermissionLevel.Medium) { return; } this.AppCores.Text = Platform.Processors; this.AppMemory.Text = "{0} MB of {1} MB".FormatWith( Platform.AllocatedMemory.ToType <long>() / 1000000, Platform.MappedMemory.ToType <long>() / 1000000); this.AppOSName.Text = Platform.VersionString; this.AppRuntime.Text = "{0} {1}".FormatWith(Platform.RuntimeName, Platform.RuntimeString); }
/// <summary> /// Binds the data. /// </summary> private void BindData() { this.ForumEditor.DataSource = ForumEditorHelper.GetFilteredEditorList(); this.DataBind(); // load Board Setting collection information... var settingCollection = new YafBoardSettingCollection(this.Get <YafBoardSettings>()); // handle checked fields... settingCollection.SettingsBool.Keys.ForEach( name => { var control = this.HostSettingsTabs.FindControlRecursive(name); if (control is CheckBox box && settingCollection.SettingsBool[name].CanRead) { // get the value from the property... box.Checked = (bool)Convert.ChangeType( settingCollection.SettingsBool[name].GetValue(this.Get <YafBoardSettings>(), null), typeof(bool)); } }); // handle string fields... settingCollection.SettingsString.Keys.ForEach( name => { var control = this.HostSettingsTabs.FindControlRecursive(name); switch (control) { case TextBox box when settingCollection.SettingsString[name].CanRead: // get the value from the property... box.Text = (string)Convert.ChangeType( settingCollection.SettingsString[name].GetValue(this.Get <YafBoardSettings>(), null), typeof(string)); break; case DropDownList list when settingCollection.SettingsString[name].CanRead: { var listItem = list.Items.FindByValue( settingCollection.SettingsString[name].GetValue( this.Get <YafBoardSettings>(), null).ToString()); if (listItem != null) { listItem.Selected = true; } break; } } }); // handle int fields... settingCollection.SettingsInt.Keys.ForEach( name => { var control = this.HostSettingsTabs.FindControlRecursive(name); switch (control) { case TextBox box when settingCollection.SettingsInt[name].CanRead: { if (!name.Equals("ServerTimeCorrection")) { box.TextMode = TextBoxMode.Number; } // get the value from the property... box.Text = settingCollection.SettingsInt[name] .GetValue(this.Get <YafBoardSettings>(), null).ToString(); break; } case DropDownList list when settingCollection.SettingsInt[name].CanRead: { var listItem = list.Items.FindByValue( settingCollection.SettingsInt[name].GetValue(this.Get <YafBoardSettings>(), null) .ToString()); if (listItem != null) { listItem.Selected = true; } break; } } }); // handle double fields... settingCollection.SettingsDouble.Keys.ForEach( name => { var control = this.HostSettingsTabs.FindControlRecursive(name); switch (control) { case TextBox box when settingCollection.SettingsDouble[name].CanRead: box.CssClass = "form-control"; // get the value from the property... box.Text = settingCollection.SettingsDouble[name] .GetValue(this.Get <YafBoardSettings>(), null).ToString(); break; case DropDownList list when settingCollection.SettingsDouble[name].CanRead: { var listItem = list.Items.FindByValue( settingCollection.SettingsDouble[name].GetValue( this.Get <YafBoardSettings>(), null).ToString()); if (listItem != null) { listItem.Selected = true; } break; } } }); // special field handling... this.AvatarSize.Text = this.Get <YafBoardSettings>().AvatarSize != 0 ? this.Get <YafBoardSettings>().AvatarSize.ToString() : string.Empty; this.MaxFileSize.Text = this.Get <YafBoardSettings>().MaxFileSize != 0 ? this.Get <YafBoardSettings>().MaxFileSize.ToString() : string.Empty; this.SQLVersion.Text = this.HtmlEncode(this.Get <IDbFunction>().GetSQLVersion()); this.AppCores.Text = YafSystemInfo.Processors; this.AppMemory.Text = $"{YafSystemInfo.AllocatedMemory.ToType<long>() / 1000000} MB of {YafSystemInfo.MappedMemory.ToType<long>() / 1000000} MB"; this.AppOSName.Text = YafSystemInfo.VersionString; this.AppRuntime.Text = $"{YafSystemInfo.RuntimeName} {YafSystemInfo.RuntimeString}"; }
/// <summary> /// Binds the data. /// </summary> private void BindData() { this.TimeZones.DataSource = StaticDataHelper.TimeZones(); if (this.Get <YafBoardSettings>().AllowUserTheme) { this.Theme.DataSource = StaticDataHelper.Themes(); this.Theme.DataTextField = "Theme"; this.Theme.DataValueField = "FileName"; } if (this.Get <YafBoardSettings>().AllowUserLanguage) { this.Culture.DataSource = StaticDataHelper.Cultures(); this.Culture.DataValueField = "CultureTag"; this.Culture.DataTextField = "CultureNativeName"; } this.Country.DataSource = StaticDataHelper.Country(); this.Country.ImageLocation = YafForumInfo.GetURLToContent("images/flags/{0}.png"); this.Country.DataValueField = "Value"; this.Country.DataTextField = "Name"; if (this.UserData.Profile.Country.IsSet()) { this.LookForNewRegionsBind(this.UserData.Profile.Country); } if (this.Get <YafBoardSettings>().AllowUsersTextEditor) { this.ForumEditor.DataSource = ForumEditorHelper.GetFilteredEditorList(); this.ForumEditor.DataValueField = "Value"; this.ForumEditor.DataTextField = "Name"; } this.DataBind(); if (this.Get <YafBoardSettings>().UseFarsiCalender&& this.CurrentCultureInfo.IsFarsiCulture()) { this.Birthday.Text = this.UserData.Profile.Birthday > DateTimeHelper.SqlDbMinTime() || this.UserData.Profile.Birthday.IsNullOrEmptyDBField() ? PersianDateConverter.ToPersianDate(this.UserData.Profile.Birthday) .ToString("d") : PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d"); } else { this.Birthday.Text = this.UserData.Profile.Birthday > DateTimeHelper.SqlDbMinTime() || this.UserData.Profile.Birthday.IsNullOrEmptyDBField() ? this.UserData.Profile.Birthday.Date.ToString( this.CurrentCultureInfo.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture) : DateTimeHelper.SqlDbMinTime() .Date.ToString( this.CurrentCultureInfo.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture); } this.Birthday.ToolTip = this.GetText("COMMON", "CAL_JQ_TT"); this.DisplayName.Text = this.UserData.DisplayName; this.City.Text = this.UserData.Profile.City; 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.Facebook.Text = ValidationHelper.IsNumeric(this.UserData.Profile.Facebook) ? "https://www.facebook.com/profile.php?id={0}".FormatWith( this.UserData.Profile.Facebook) : this.UserData.Profile.Facebook; this.Twitter.Text = this.UserData.Profile.Twitter; this.Google.Text = this.UserData.Profile.Google; this.Xmpp.Text = this.UserData.Profile.XMPP; this.Skype.Text = this.UserData.Profile.Skype; this.Gender.SelectedIndex = this.UserData.Profile.Gender; if (this.UserData.Profile.Country.IsSet()) { ListItem countryItem = this.Country.Items.FindByValue(this.UserData.Profile.Country.Trim()); if (countryItem != null) { countryItem.Selected = true; } } if (this.UserData.Profile.Region.IsSet()) { ListItem regionItem = this.Region.Items.FindByValue(this.UserData.Profile.Region.Trim()); if (regionItem != null) { regionItem.Selected = true; } } 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.Get <YafBoardSettings>().AllowUserHideHimself || this.PageContext.IsAdmin); if (this.Get <YafBoardSettings>().MobileTheme.IsSet()) { this.UseMobileThemeRow.Visible = true; this.UseMobileTheme.Checked = this.UserData.UseMobileTheme; } if (this.Get <YafBoardSettings>().AllowUserTheme&& this.Theme.Items.Count > 0) { // Allows to use different per-forum themes, // While "Allow User Change Theme" option in hostsettings is true var themeFile = this.Get <YafBoardSettings>().Theme; if (this.UserData.ThemeFile.IsSet()) { themeFile = this.UserData.ThemeFile; } ListItem themeItem = this.Theme.Items.FindByValue(themeFile); if (themeItem != null) { themeItem.Selected = true; } } if (this.Get <YafBoardSettings>().AllowUsersTextEditor&& this.ForumEditor.Items.Count > 0) { // Text editor var textEditor = this.UserData.TextEditor.IsSet() ? this.UserData.TextEditor : this.Get <YafBoardSettings>().ForumEditor; var editorItem = this.ForumEditor.Items.FindByValue(textEditor); if (editorItem != null) { editorItem.Selected = true; } else { editorItem = this.ForumEditor.Items.FindByValue("1"); editorItem.Selected = true; } } if (!this.Get <YafBoardSettings>().AllowUserLanguage || this.Culture.Items.Count <= 0) { return; } // 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(this.GetCulture(true)); if (foundCultItem != null) { foundCultItem.Selected = true; } if (!this.Page.IsPostBack) { this.Realname.Focus(); } }
/// <summary> /// Binds the data. /// </summary> private void BindData() { this.ForumEditor.DataSource = ForumEditorHelper.GetFilteredEditorList(); this.DataBind(); // load Board Setting collection information... var settingCollection = new YafBoardSettingCollection(this.Get <YafBoardSettings>()); // handle checked fields... foreach (var name in settingCollection.SettingsBool.Keys) { var control = this.HostSettingsTabs.FindControlRecursive(name); if (control is CheckBox && settingCollection.SettingsBool[name].CanRead) { // get the value from the property... ((CheckBox)control).Checked = (bool) Convert.ChangeType( settingCollection.SettingsBool[name].GetValue(this.Get <YafBoardSettings>(), null), typeof(bool)); } } // handle string fields... foreach (var name in settingCollection.SettingsString.Keys) { var control = this.HostSettingsTabs.FindControlRecursive(name); if (control is TextBox && settingCollection.SettingsString[name].CanRead) { // get the value from the property... ((TextBox)control).Text = (string) Convert.ChangeType( settingCollection.SettingsString[name].GetValue(this.Get <YafBoardSettings>(), null), typeof(string)); } else if (control is DropDownList && settingCollection.SettingsString[name].CanRead) { var listItem = ((DropDownList)control).Items.FindByValue( settingCollection.SettingsString[name].GetValue(this.Get <YafBoardSettings>(), null) .ToString()); if (listItem != null) { listItem.Selected = true; } } } // handle int fields... foreach (var name in settingCollection.SettingsInt.Keys) { var control = this.HostSettingsTabs.FindControlRecursive(name); if (control is TextBox && settingCollection.SettingsInt[name].CanRead) { if (!name.Equals("ServerTimeCorrection")) { ((TextBox)control).TextMode = TextBoxMode.Number; } // get the value from the property... ((TextBox)control).Text = settingCollection.SettingsInt[name].GetValue(this.Get <YafBoardSettings>(), null).ToString(); } else if (control is DropDownList && settingCollection.SettingsInt[name].CanRead) { var listItem = ((DropDownList)control).Items.FindByValue( settingCollection.SettingsInt[name].GetValue(this.Get <YafBoardSettings>(), null).ToString()); if (listItem != null) { listItem.Selected = true; } } } // handle double fields... foreach (var name in settingCollection.SettingsDouble.Keys) { var control = this.HostSettingsTabs.FindControlRecursive(name); if (control is TextBox && settingCollection.SettingsDouble[name].CanRead) { ((TextBox)control).CssClass = "Numeric"; // get the value from the property... ((TextBox)control).Text = settingCollection.SettingsDouble[name].GetValue(this.Get <YafBoardSettings>(), null).ToString(); } else if (control is DropDownList && settingCollection.SettingsDouble[name].CanRead) { var listItem = ((DropDownList)control).Items.FindByValue( settingCollection.SettingsDouble[name].GetValue(this.Get <YafBoardSettings>(), null) .ToString()); if (listItem != null) { listItem.Selected = true; } } } // special field handling... this.AvatarSize.Text = this.Get <YafBoardSettings>().AvatarSize != 0 ? this.Get <YafBoardSettings>().AvatarSize.ToString() : string.Empty; this.MaxFileSize.Text = this.Get <YafBoardSettings>().MaxFileSize != 0 ? this.Get <YafBoardSettings>().MaxFileSize.ToString() : string.Empty; this.SQLVersion.Text = this.HtmlEncode(this.Get <YafBoardSettings>().SQLVersion); this.AppCores.Text = Platform.Processors; this.AppMemory.Text = "{0} MB of {1} MB".FormatWith( Platform.AllocatedMemory.ToType <long>() / 1000000, Platform.MappedMemory.ToType <long>() / 1000000); this.AppOSName.Text = Platform.VersionString; this.AppRuntime.Text = "{0} {1}".FormatWith(Platform.RuntimeName, Platform.RuntimeString); }