/// <summary> /// The create images data table. /// </summary> protected void CreateImagesDataTable() { 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("COMMON", "NONE"); dt.Rows.Add(dr); var dir = new DirectoryInfo( this.Get <HttpRequestBase>().MapPath($"{BoardInfo.ForumServerFileRoot}{BoardFolders.Current.Forums}")); if (dir.Exists) { var files = dir.GetFiles("*.*"); dt.AddImageFiles(files, BoardFolders.Current.Forums); } this.ForumImages.DataSource = dt; this.ForumImages.DataValueField = "FileName"; this.ForumImages.DataTextField = "Description"; this.ForumImages.DataBind(); } }
/// <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.DataBind(); this.Name.Text = board.Name; }
/// <summary> /// The register CKEditor custom JS. /// </summary> protected override void RegisterCKEditorCustomJS() { BoardContext.Current.PageElements.RegisterJsBlock( "ckeditorinitbbcodebasic", JavaScriptBlocks.CKEditorBasicLoadJs( this.TextAreaControl.ClientID, BoardContext.Current.User.Culture.IsSet() ? BoardContext.Current.User.Culture.Substring(0, 2) : this.PageContext.BoardSettings.Culture.Substring(0, 2), this.MaxCharacters, this.Get <ITheme>().BuildThemePath("bootstrap-forum.min.css"), BoardInfo.GetURLToContent("forum.min.css"), this.PageContext.BoardSettings.EditorToolbarBasic)); }
/// <summary> /// Register the CSS Files in the header. /// </summary> /// <param name="version"> /// The version. /// </param> private void RegisterCssFiles(int version) { var element = this.PageContext.CurrentForumPage.TopPageControl; element.Controls.Add( ControlHelper.MakeCssIncludeControl( $"{this.Get<ITheme>().BuildThemePath("bootstrap-forum.min.css")}?v={version}")); // make the style sheet link controls. element.Controls.Add( ControlHelper.MakeCssIncludeControl( BoardInfo.GetURLToContent( this.PageContext.CurrentForumPage.IsAdminPage ? $"forum-admin.min.css?v={version}" : $"forum.min.css?v={version}"))); }
/// <summary> /// The create images data table. /// </summary> protected void CreateImagesDataTable() { using (var dt = new DataTable("Files")) { dt.Columns.Add("FileID", typeof(long)); dt.Columns.Add("FileName", typeof(string)); dt.Columns.Add("Description", typeof(string)); var dr = dt.NewRow(); dr["FileID"] = 0; dr["FileName"] = BoardInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry dr["Description"] = this.GetText("COMMON", "NONE"); dt.Rows.Add(dr); var dir = new DirectoryInfo( this.Get <HttpRequestBase>().MapPath($"{BoardInfo.ForumServerFileRoot}{BoardFolders.Current.Forums}")); if (dir.Exists) { var files = dir.GetFiles("*.*"); long fileId = 1; var filesList = from file in files let sExt = file.Extension.ToLower() where sExt == ".png" || sExt == ".gif" || sExt == ".jpg" select file; filesList.ForEach( file => { dr = dt.NewRow(); dr["FileID"] = fileId++; dr["FileName"] = $"{BoardInfo.ForumClientFileRoot}{BoardFolders.Current.Forums}/{file.Name}"; dr["Description"] = file.Name; dt.Rows.Add(dr); }); } this.ForumImages.DataSource = dt; this.ForumImages.DataValueField = "FileName"; this.ForumImages.DataTextField = "Description"; this.ForumImages.DataBind(); } }
/// <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("FileID", typeof(long)); dt.Columns.Add("FileName", typeof(string)); dt.Columns.Add("Description", typeof(string)); var dr = dt.NewRow(); dr["FileID"] = 0; 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("*.*"); long fileID = 1; (from file in files let extension = file.Extension.ToLower() where extension == ".png" || extension == ".gif" || extension == ".jpg" || extension == ".svg" select file).ForEach( file => { dr = dt.NewRow(); dr["FileID"] = fileID++; dr["FileName"] = $"{BoardInfo.ForumClientFileRoot}{BoardFolders.Current.Logos}/{file.Name}"; dr["Description"] = file.Name; dt.Rows.Add(dr); }); this.BoardLogo.DataSource = dt; this.BoardLogo.DataValueField = "FileName"; this.BoardLogo.DataTextField = "Description"; } this.DataBind(); this.Name.Text = board.Name; }
/// <summary> /// Select image in dropdown list and sets appropriate preview. /// </summary> /// <param name="list"> /// DropDownList where to search. /// </param> /// <param name="preview"> /// Preview image. /// </param> /// <param name="imageUrl"> /// URL to search for. /// </param> private void SelectImage([NotNull] DropDownList list, [NotNull] HtmlImage preview, [NotNull] string imageUrl) { // try to find item in a list var item = list.Items.FindByText(imageUrl); if (item != null) { // select found item item.Selected = true; // set preview image preview.Src = $"{BoardInfo.ForumClientFileRoot}{BoardFolders.Current.Medals}/{imageUrl}"; } else { // if we found nothing, set blank image as preview preview.Src = BoardInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } }
/// <summary> /// The register CKEditor custom JS. /// </summary> protected override void RegisterCKEditorCustomJS() { var toolbar = this.PageContext.BoardSettings.EditorToolbarFull; if (!(this.PageContext.BoardSettings.EnableAlbum && this.PageContext.NumAlbums > 0)) { // remove albums toolbar = toolbar.Replace(", \"albumsbrowser\"", string.Empty); } BoardContext.Current.PageElements.RegisterJsBlock( "ckeditorinitbbcode", JavaScriptBlocks.CKEditorLoadJs( this.TextAreaControl.ClientID, BoardContext.Current.User.Culture.IsSet() ? BoardContext.Current.User.Culture.Substring(0, 2) : this.PageContext.BoardSettings.Culture.Substring(0, 2), this.MaxCharacters, this.Get <ITheme>().BuildThemePath("bootstrap-forum.min.css"), BoardInfo.GetURLToContent("forum.min.css"), toolbar)); }
/// <summary> /// Create images list. /// </summary> protected void CreateImagesList() { var list = new List <NamedParameter> { new(this.GetText("COMMON", "NONE"), BoardInfo.GetURLToContent("images/spacer.gif")) }; var dir = new DirectoryInfo( this.Get <HttpRequestBase>().MapPath($"{BoardInfo.ForumServerFileRoot}{this.Get<BoardFolders>().Forums}")); if (dir.Exists) { var files = dir.GetFiles("*.*").ToList(); list.AddImageFiles(files, this.Get <BoardFolders>().Forums); } this.ForumImages.DataSource = list; this.ForumImages.DataValueField = "Value"; this.ForumImages.DataTextField = "Name"; this.ForumImages.DataBind(); }
/// <summary> /// The register CKEditor custom JS. /// </summary> protected override void RegisterCKEditorCustomJS() { var toolbar = this.PageBoardContext.BoardSettings.EditorToolbarFull; if (!(this.PageBoardContext.BoardSettings.EnableAlbum && this.PageBoardContext.NumAlbums > 0)) { // remove albums toolbar = toolbar.Replace(", \"albumsbrowser\"", string.Empty); } if (!this.PageBoardContext.UploadAccess) { // remove attachments toolbar = toolbar.Replace(", \"attachments\"", string.Empty); } var language = BoardContext.Current.PageUser.Culture.IsSet() ? BoardContext.Current.PageUser.Culture.Substring(0, 2) : this.PageBoardContext.BoardSettings.Culture.Substring(0, 2); if (ValidationHelper.IsNumeric(language)) { language = this.PageBoardContext.BoardSettings.Culture; } BoardContext.Current.PageElements.RegisterJsBlock( nameof(JavaScriptBlocks.CKEditorLoadJs), JavaScriptBlocks.CKEditorLoadJs( this.TextAreaControl.ClientID, language, this.MaxCharacters, this.Get <ITheme>().BuildThemePath("bootstrap-forum.min.css"), BoardInfo.GetURLToContent("forum.min.css"), toolbar, this.PageBoardContext.UploadAccess)); }
/// <summary> /// Add the given CSS to the page header within a style tag /// </summary> /// <param name="cssUrlContent">Content of the CSS URL.</param> public void RegisterCssIncludeContent(string cssUrlContent) { this.RegisterCssInclude( YafContext.Current.CurrentForumPage.TopPageControl, BoardInfo.GetURLToContent(cssUrlContent)); }
/// <summary> /// Binds the data. /// </summary> private void BindData() { var user = this.PageContext.CurrentForumPage.IsAdminPage ? this.GetRepository <User>().GetById(this.currentUserId) : this.PageContext.User; this.DeleteAvatar.Visible = false; this.NoAvatar.Visible = false; this.AvatarUploadRow.Visible = this.PageContext.CurrentForumPage.IsAdminPage || this.PageContext.BoardSettings.AvatarUpload; this.AvatarOurs.Visible = this.PageContext.CurrentForumPage.IsAdminPage || this.PageContext.BoardSettings.AvatarGallery; if (this.AvatarOurs.Visible) { var avatars = new List <NamedParameter> { new(this.GetText("OURAVATAR"), BoardInfo.GetURLToContent("images/spacer.gif")) }; var dir = new DirectoryInfo( this.Get <HttpRequestBase>() .MapPath($"{BoardInfo.ForumServerFileRoot}{this.Get<BoardFolders>().Avatars}")); var files = dir.GetFiles("*.*").ToList(); avatars.AddImageFiles(files, this.Get <BoardFolders>().Avatars); if (avatars.Any()) { this.AvatarGallery.DataSource = avatars; this.AvatarGallery.DataValueField = "Value"; this.AvatarGallery.DataTextField = "Name"; this.AvatarGallery.DataBind(); } else { this.AvatarOurs.Visible = false; } } if (!user.AvatarImage.IsNullOrEmptyField()) { this.AvatarImg.ImageUrl = $"{BoardInfo.ForumClientFileRoot}resource.ashx?u={this.currentUserId}&v={DateTime.Now.Ticks}"; this.DeleteAvatar.Visible = true; } else if (user.Avatar.IsSet()) { if (!user.Avatar.StartsWith("/")) { return; } var item = this.AvatarGallery.Items.FindByValue(user.Avatar); if (item == null) { return; } this.AvatarImg.ImageUrl = user.Avatar; item.Selected = true; this.DeleteAvatar.Visible = true; } else if (this.PageContext.BoardSettings.AvatarGravatar) { var x = new MD5CryptoServiceProvider(); var bs = Encoding.UTF8.GetBytes(this.PageContext.MembershipUser.Email); bs = x.ComputeHash(bs); var s = new StringBuilder(); bs.ForEach(b => s.Append(b.ToString("x2").ToLower())); var emailHash = s.ToString(); var gravatarUrl = $"https://www.gravatar.com/avatar/{emailHash}.jpg?r={this.PageContext.BoardSettings.GravatarRating}"; this.AvatarImg.ImageUrl = gravatarUrl; this.NoAvatar.Text = "Gravatar Image"; this.NoAvatar.Visible = true; } else { this.AvatarImg.ImageUrl = "../images/noavatar.svg"; this.NoAvatar.Visible = true; } this.AvatarImg.Attributes.CssStyle.Add("max-width", this.PageContext.BoardSettings.AvatarWidth.ToString()); this.AvatarImg.Attributes.CssStyle.Add("max-height", this.PageContext.BoardSettings.AvatarHeight.ToString()); }
/// <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> /// Bind data for this control. /// </summary> private void BindData() { // load available images from images/medals folder var medals = new List <NamedParameter> { new NamedParameter( this.GetText("ADMIN_EDITMEDAL", "SELECT_IMAGE"), BoardInfo.GetURLToContent("images/spacer.gif")) }; // add files from medals folder var dir = new DirectoryInfo( this.Get <HttpRequestBase>().MapPath($"{BoardInfo.ForumServerFileRoot}{BoardFolders.Current.Medals}")); var files = dir.GetFiles("*.*").ToList(); medals.AddImageFiles(files, BoardFolders.Current.Medals); // medal image this.MedalImage.DataSource = medals; this.MedalImage.DataValueField = "Value"; this.MedalImage.DataTextField = "Name"; // ribbon bar image this.RibbonImage.DataSource = medals; this.RibbonImage.DataValueField = "Value"; this.RibbonImage.DataTextField = "Name"; // small medal image this.SmallMedalImage.DataSource = medals; this.SmallMedalImage.DataValueField = "Value"; this.SmallMedalImage.DataTextField = "Name"; // small ribbon bar image this.SmallRibbonImage.DataSource = medals; this.SmallRibbonImage.DataValueField = "Value"; this.SmallRibbonImage.DataTextField = "Name"; // bind data to controls this.DataBind(); if (!this.CurrentMedalId.HasValue) { // Hide user & group this.UserAndGroupsHolder.Visible = false; return; } // load users and groups who has been assigned this medal this.UserList.DataSource = this.GetRepository <UserMedal>().List(null, this.CurrentMedalId.Value); this.UserList.DataBind(); this.GroupList.DataSource = this.GetRepository <GroupMedal>().List(null, this.CurrentMedalId.Value); this.GroupList.DataBind(); var medal = this.GetRepository <Medal>().GetSingle(m => m.ID == this.CurrentMedalId.Value); // set controls this.Name.Text = medal.Name; this.Description.Text = medal.Description; this.Message.Text = medal.Message; this.Category.Text = medal.Category; this.ShowMessage.Checked = medal.MedalFlags.ShowMessage; this.AllowRibbon.Checked = medal.MedalFlags.AllowRibbon; this.AllowHiding.Checked = medal.MedalFlags.AllowHiding; // select images SelectImage(this.MedalImage, medal.MedalURL); SelectImage(this.RibbonImage, medal.RibbonURL); SelectImage(this.SmallMedalImage, medal.SmallMedalURL); SelectImage(this.SmallRibbonImage, medal.SmallRibbonURL); }
/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // load available images from images/medals folder using (var dt = new DataTable("Files")) { // create structure dt.Columns.Add("FileID", typeof(long)); dt.Columns.Add("FileName", typeof(string)); dt.Columns.Add("Description", typeof(string)); // add blank row var dr = dt.NewRow(); dr["FileID"] = 0; dr["FileName"] = BoardInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry dr["Description"] = this.GetText("ADMIN_EDITMEDAL", "SELECT_IMAGE"); dt.Rows.Add(dr); // add files from medals folder var dir = new DirectoryInfo( this.Get <HttpRequestBase>().MapPath($"{BoardInfo.ForumServerFileRoot}{BoardFolders.Current.Medals}")); var files = dir.GetFiles("*.*"); long fileId = 1; foreach (var file in from file in files let sExt = file.Extension.ToLower() where sExt == ".png" || sExt == ".gif" || sExt == ".jpg" select file) { dr = dt.NewRow(); dr["FileID"] = fileId++; dr["FileName"] = file.Name; dr["Description"] = file.Name; dt.Rows.Add(dr); } // medal image this.MedalImage.DataSource = dt; this.MedalImage.DataValueField = "FileName"; this.MedalImage.DataTextField = "Description"; // ribbon bar image this.RibbonImage.DataSource = dt; this.RibbonImage.DataValueField = "FileName"; this.RibbonImage.DataTextField = "Description"; // small medal image this.SmallMedalImage.DataSource = dt; this.SmallMedalImage.DataValueField = "FileName"; this.SmallMedalImage.DataTextField = "Description"; // small ribbon bar image this.SmallRibbonImage.DataSource = dt; this.SmallRibbonImage.DataValueField = "FileName"; this.SmallRibbonImage.DataTextField = "Description"; } // bind data to controls this.DataBind(); // load existing medal if we are editing one if (this.CurrentMedalId.HasValue) { // load users and groups who has been assigned this medal this.UserList.DataSource = this.GetRepository <UserMedal>().ListAsDataTable(null, this.CurrentMedalId); this.UserList.DataBind(); this.GroupList.DataSource = this.GetRepository <Medal>().GroupMedalListAsDataTable(null, this.CurrentMedalId); this.GroupList.DataBind(); var medal = this.GetRepository <Medal>().GetSingle(m => m.ID == this.CurrentMedalId); // set controls this.Name.Text = medal.Name; this.Description.Text = medal.Description; this.Message.Text = medal.Message; this.Category.Text = medal.Category; this.SortOrder.Text = medal.SortOrder.ToString(); this.ShowMessage.Checked = medal.MedalFlags.ShowMessage; this.AllowRibbon.Checked = medal.MedalFlags.AllowRibbon; this.AllowHiding.Checked = medal.MedalFlags.AllowHiding; this.AllowReOrdering.Checked = medal.MedalFlags.AllowReOrdering; // select images this.SelectImage(this.MedalImage, this.MedalPreview, medal.MedalURL); this.SelectImage(this.RibbonImage, this.RibbonPreview, medal.RibbonURL); this.SelectImage(this.SmallMedalImage, this.SmallMedalPreview, medal.SmallMedalURL); this.SelectImage(this.SmallRibbonImage, this.SmallRibbonPreview, medal.SmallRibbonURL); } else { // set all previews on blank image var spacerPath = BoardInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry this.MedalPreview.Src = spacerPath; this.RibbonPreview.Src = spacerPath; this.SmallMedalPreview.Src = spacerPath; this.SmallRibbonPreview.Src = spacerPath; } }
/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // load available images from images/medals folder using (var dt = new DataTable("Files")) { // create structure dt.Columns.Add("FileName", typeof(string)); dt.Columns.Add("Description", typeof(string)); // add blank row var dr = dt.NewRow(); dr["FileName"] = BoardInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry dr["Description"] = this.GetText("ADMIN_EDITMEDAL", "SELECT_IMAGE"); dt.Rows.Add(dr); // add files from medals folder var dir = new DirectoryInfo( this.Get <HttpRequestBase>().MapPath($"{BoardInfo.ForumServerFileRoot}{BoardFolders.Current.Medals}")); var files = dir.GetFiles("*.*"); dt.AddImageFiles(files, BoardFolders.Current.Medals); // medal image this.MedalImage.DataSource = dt; this.MedalImage.DataValueField = "FileName"; this.MedalImage.DataTextField = "Description"; // ribbon bar image this.RibbonImage.DataSource = dt; this.RibbonImage.DataValueField = "FileName"; this.RibbonImage.DataTextField = "Description"; // small medal image this.SmallMedalImage.DataSource = dt; this.SmallMedalImage.DataValueField = "FileName"; this.SmallMedalImage.DataTextField = "Description"; // small ribbon bar image this.SmallRibbonImage.DataSource = dt; this.SmallRibbonImage.DataValueField = "FileName"; this.SmallRibbonImage.DataTextField = "Description"; } // bind data to controls this.DataBind(); if (!this.CurrentMedalId.HasValue) { return; } // load users and groups who has been assigned this medal this.UserList.DataSource = this.GetRepository <UserMedal>().ListAsDataTable(null, this.CurrentMedalId); this.UserList.DataBind(); this.GroupList.DataSource = this.GetRepository <Medal>().GroupMedalListAsDataTable(null, this.CurrentMedalId); this.GroupList.DataBind(); var medal = this.GetRepository <Medal>().GetSingle(m => m.ID == this.CurrentMedalId.Value); // set controls this.Name.Text = medal.Name; this.Description.Text = medal.Description; this.Message.Text = medal.Message; this.Category.Text = medal.Category; this.SortOrder.Text = medal.SortOrder.ToString(); this.ShowMessage.Checked = medal.MedalFlags.ShowMessage; this.AllowRibbon.Checked = medal.MedalFlags.AllowRibbon; this.AllowHiding.Checked = medal.MedalFlags.AllowHiding; this.AllowReOrdering.Checked = medal.MedalFlags.AllowReOrdering; // select images SelectImage(this.MedalImage, medal.MedalURL); SelectImage(this.RibbonImage, medal.RibbonURL); SelectImage(this.SmallMedalImage, medal.SmallMedalURL); SelectImage(this.SmallRibbonImage, medal.SmallRibbonURL); }
/// <summary> /// Handles the PreRender event of the ForumPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void CurrentForumPage_PreRender([NotNull] object sender, [NotNull] EventArgs e) { var head = this.ForumControl.Page.Header ?? this.CurrentForumPage.FindControlRecursiveBothAs <HtmlHead>("YafHead"); if (head == null) { return; } // Link tags var appleTouchIcon = new HtmlLink { Href = BoardInfo.GetURLToContent("favicons/apple-touch-icon.png") }; appleTouchIcon.Attributes.Add("rel", "apple-touch-icon"); appleTouchIcon.Attributes.Add("sizes", "180x180"); head.Controls.Add(appleTouchIcon); var icon32 = new HtmlLink { Href = BoardInfo.GetURLToContent("favicons/favicon-32x32.png") }; icon32.Attributes.Add("rel", "icon"); icon32.Attributes.Add("sizes", "32x32"); head.Controls.Add(icon32); var icon16 = new HtmlLink { Href = BoardInfo.GetURLToContent("favicons/favicon-16x16.png") }; icon16.Attributes.Add("rel", "icon"); icon16.Attributes.Add("sizes", "16x16"); head.Controls.Add(icon16); var manifest = new HtmlLink { Href = BoardInfo.GetURLToContent("favicons/site.webmanifest") }; manifest.Attributes.Add("rel", "manifest"); head.Controls.Add(manifest); var maskIcon = new HtmlLink { Href = BoardInfo.GetURLToContent("favicons/safari-pinned-tab.svg") }; maskIcon.Attributes.Add("rel", "mask-icon"); maskIcon.Attributes.Add("color", "#5bbad5"); head.Controls.Add(maskIcon); var shortcutIcon = new HtmlLink { Href = BoardInfo.GetURLToContent("favicons/favicon.ico") }; shortcutIcon.Attributes.Add("rel", "shortcut icon"); head.Controls.Add(shortcutIcon); // Meta Tags head.Controls.Add(new HtmlMeta { Name = "msapplication-TileColor", Content = "#da532c" }); head.Controls.Add( new HtmlMeta { Name = "msapplication-config", Content = BoardInfo.GetURLToContent("favicons/browserconfig.xml") }); head.Controls.Add(new HtmlMeta { Name = "theme-color", Content = "#ffffff" }); }