using System; using System.Web; using System.Web.UI; using CMS.Community; using CMS.Forums; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_Community_Forums_GroupForumSearchResults : CMSAbstractWebPart { #region "Public properties" /// /// Gets or sets the value that indicates whether search results support forum selection. /// public bool EnableForumSelection { get { return ValidationHelper.GetBoolean(GetValue("EnableForumSelection"), true); } set { SetValue("EnableForumSelection", value); } } /// /// Gets or sets the value that indicates whether usernam should be link to the user profile page. /// public bool RedirectToUserProfile { get { return ValidationHelper.GetBoolean(GetValue("RedirectToUserProfile"), forumElem.RedirectToUserProfile); } set { SetValue("RedirectToUserProfile", value); forumElem.RedirectToUserProfile = value; } } /// /// Gets or sets the value which indicates whether badge info should be displayed. /// public bool DisplayBadgeInfo { get { return ValidationHelper.GetBoolean(GetValue("DisplayBadgeInfo"), forumElem.DisplayBadgeInfo); } set { SetValue("DisplayBadgeInfo", value); forumElem.DisplayBadgeInfo = value; } } /// /// Gets or sets no result text. /// public string NoResultsText { get { return DataHelper.GetNotEmpty(GetValue("NoResultsText"), forumElem.SearchNoResults); } set { SetValue("NoResultsText", value); forumElem.SearchNoResults = value; } } /// /// Gets or sets value that indicates whether avatars should be displayed. /// public bool EnableAvatars { get { return ValidationHelper.GetBoolean(GetValue("EnableAvatars"), forumElem.EnableAvatars); } set { SetValue("EnableAvatars", value); forumElem.EnableAvatars = value; } } /// /// Gets or sets max side sizfe of avatar image. /// public int AvatarMaxSideSize { get { return ValidationHelper.GetInteger(GetValue("AvatarMaxSideSize"), forumElem.AvatarMaxSideSize); } set { SetValue("AvatarMaxSideSize", value); forumElem.AvatarMaxSideSize = value; } } /// /// Gets or sets the group code name. /// public string ForumLayout { get { return ValidationHelper.GetString(GetValue("ForumViewMode"), "Flat"); } set { SetValue("ForumViewMode", value); forumElem.ForumLayout = value; } } #endregion #region "Methods" /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { forumElem.StopProcessing = true; } else { forumElem.ForumLayout = ForumLayout; forumElem.DisplayBadgeInfo = DisplayBadgeInfo; forumElem.RedirectToUserProfile = RedirectToUserProfile; forumElem.SearchNoResults = NoResultsText; if (EnableForumSelection) { forumElem.SearchInForums = QueryHelper.GetString("searchforums", ""); } forumElem.EnableAvatars = EnableAvatars; forumElem.AvatarMaxSideSize = AvatarMaxSideSize; forumElem.SearchResult = true; if (CommunityContext.CurrentGroup != null) { forumElem.CommunityGroupID = CommunityContext.CurrentGroup.GroupID; } } } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); Visible = !StopProcessing; // If forum is not in search state, hide if (ForumContext.CurrentState != ForumStateEnum.Search) { Visible = false; } } #endregion }