protected override void OnInit(EventArgs e) { base.OnInit(e); SiteObjectType siteObjectType = Helper.GetObjectType("ForumTopicItem"); isRoleAllowed = Array.Exists(siteObjectType.AllowedRoles.Split(','), y => UserDataContext.GetUserDataContext().UserRoles.Contains(y)); PnlInputAnonymous.Visible = isRoleAllowed && !Request.IsAuthenticated; forumTopic = DataObject.Load <DataObjectForumTopic>(Request.QueryString["FTID"].ToNullableGuid()); bool isCommunityMember; bool isCommunityOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, forumTopic.CommunityID.Value, out isCommunityMember); forumTopicItem = DataObject.Load <DataObjectForumTopicItem>(Request.QueryString["OID"].ToNullableGuid()); if (forumTopicItem.State == ObjectState.Added) { LitTitle.Text = language.GetString("LabelAddForumTopicItem"); lbtnSave.Text = languageShared.GetString("CommandCreate"); objectExisting = false; forumTopicItem.ObjectID = Guid.NewGuid(); forumTopicItem.CommunityID = forumTopic.CommunityID; forumTopicItem.ShowState = forumTopic.IsModerated && !isCommunityOwner ? ObjectShowState.Draft : ObjectShowState.Published; forumTopicItem.Status = ObjectStatus.Public; forumTopicItem.Title = "ForumTopicItem"; forumTopicItem.ReferencedItemId = Request.QueryString["RefOID"].ToNullableGuid(); } else { LitTitle.Text = language.GetString("LabelEditForumTopic"); lbtnSave.Text = languageShared.GetString("CommandSave"); TxtDesc.Text = forumTopicItem.Description; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); forumTopic = DataObject.Load <DataObjectForumTopic>(Request.QueryString["OID"].ToNullableGuid()); if (forumTopic.State == ObjectState.Added) { LitTitle.Text = language.GetString("LabelAddForumTopic"); lbtnSave.Text = languageShared.GetString("CommandCreate"); objectExisting = false; forumTopic.ObjectID = Guid.NewGuid(); forumTopic.CommunityID = UserProfile.Current.ProfileCommunityID; forumTopic.ShowState = ObjectShowState.Published; forumTopic.Status = ObjectStatus.Public; forumTopic.IsModerated = false; forumTopic.TopicItemCreationUsers = CommunityUsersType.Authenticated; } else { LitTitle.Text = language.GetString("LabelEditForumTopic"); lbtnSave.Text = languageShared.GetString("CommandSave"); TxtTitle.Text = forumTopic.Title; TxtDesc.Text = forumTopic.Description; } }
protected void Page_Load(object sender, EventArgs e) { udc = UserDataContext.GetUserDataContext(); this.FTPAGTOP.ItemNameSingular = languageShared.GetString("LabelEntrySingular"); this.FTPAGTOP.ItemNamePlural = languageShared.GetString("LabelEntryPlural"); this.FTPAGTOP.PageSize = pageSize; this.FTPAGTOP.PagerBreak = pagerBreak; this.FTPAGTOP.BrowsableControl = this; this.FTPAGTOP.CustomText = " "; this.FTPAGTOP.RenderHref = true; this.FTPAGBOT.ItemNameSingular = languageShared.GetString("LabelEntrySingular"); this.FTPAGBOT.ItemNamePlural = languageShared.GetString("LabelEntryPlural"); this.FTPAGBOT.PageSize = pageSize; this.FTPAGBOT.PagerBreak = pagerBreak; this.FTPAGBOT.BrowsableControl = this; this.FTPAGBOT.CustomText = " "; this.FTPAGBOT.RenderHref = true; forumTopic = (DataObjectForumTopic)dataObject; SiteObjectType objectType = Helper.GetObjectType("ForumTopicItem"); isRoleAllowed = Array.Exists(objectType.AllowedRoles.Split(','), y => UserDataContext.GetUserDataContext().UserRoles.Contains(y)); isCommunityOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, forumTopic.CommunityID.Value, out isCommunityMember); if ((forumTopic.TopicItemCreationUsers == CommunityUsersType.Members && isCommunityMember) || (forumTopic.TopicItemCreationUsers == CommunityUsersType.Authenticated && udc.IsAuthenticated) || isRoleAllowed) { LnkAdd.Attributes.Add("onClick", string.Format("radWinOpen('/Pages/Popups/ForumTopicItemComment.aspx?ObjID={0}&ObjType={1}', '{2}', 470, 370, true)", forumTopic.ObjectID, Helper.GetObjectTypeNumericID("ForumTopic"), languageShared.GetString("CommandEntryAdd"))); } else { LnkAdd.Enabled = false; LnkAdd.ToolTip = (new TextControl() { LanguageFile = "UserControls.Templates.WebUI.Base", TextKey = "TooltipLoginToAddForumTopicItem" }).Text; } LnkAdd.ID = null; this.LitDesc.Text = forumTopic.Description; RestoreState(); Reload(); }
protected void OnSaveClick(object sender, EventArgs e) { Page.Validate(); if (!string.IsNullOrEmpty(Request.Form["codeBox"])) { PnlError.Visible = true; LitError.Text = GuiLanguage.GetGuiLanguage("Pages.Popups.WebUI.Base").GetString("MessageInvisibleTextBoxCaptcha"); } else if (Page.IsValid) { DataObjectForumTopic forumTopic = DataObject.Load <DataObjectForumTopic>(objectId); bool isCommunityMember; bool isCommunityOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, forumTopic.CommunityID.Value, out isCommunityMember); if (((forumTopic.TopicItemCreationUsers == CommunityUsersType.Members && isCommunityMember) || (forumTopic.TopicItemCreationUsers == CommunityUsersType.Authenticated && udc.IsAuthenticated) || isRoleAllowed) && forumTopic.State == ObjectState.Saved) { DataObjectForumTopicItem forumTopicItem = new DataObjectForumTopicItem(udc); forumTopicItem.ObjectID = Guid.NewGuid(); forumTopicItem.CommunityID = forumTopic.CommunityID; forumTopicItem.Status = forumTopic.Status; forumTopicItem.ShowState = forumTopic.IsModerated && !isCommunityOwner ? ObjectShowState.Draft : ObjectShowState.Published; forumTopicItem.Title = "ForumTopicItem"; forumTopicItem.Description = TxtCom.Content; forumTopicItem.ReferencedItemId = referencedItemId; if (!udc.IsAuthenticated) { forumTopicItem.Nickname = TxtName.Text.CropString(32); forumTopicItem.Email = TxtEmail.Text; } forumTopicItem.Insert(udc, forumTopic.ObjectID.Value, Helper.GetObjectTypeNumericID("ForumTopic")); IncentivePointsManager.AddIncentivePointEvent("FORUMTOPICITEM_UPLOAD", udc, forumTopicItem.CommunityID.Value.ToString()); } ClientScript.RegisterStartupScript(GetType(), "CloseWindow", "$telerik.$(function() { RefreshParentPage();GetRadWindow().Close(); } );", true); } }
protected void OnForumItemDataBound(object sender, RepeaterItemEventArgs e) { DataObjectForumTopic forumTopic = (DataObjectForumTopic)e.Item.DataItem; HyperLink forumTopicLink = (HyperLink)e.Item.FindControl("LnkTopicLink"); forumTopicLink.NavigateUrl = Helper.GetMobileDetailLink("ForumTopic", forumTopic.ObjectID.Value.ToString()); forumTopicLink.ID = null; Literal forumTopicTitle = (Literal)e.Item.FindControl("LitTopicTitle"); forumTopicTitle.Text = forumTopic.Title; Literal forumTopicDesc = (Literal)e.Item.FindControl("LitTopicDesc"); forumTopicDesc.Text = forumTopic.Description.CropString(200); Literal numberPosts = (Literal)e.Item.FindControl("LitNumberPosts"); numberPosts.Text = forumTopic.TopicItemCount.ToString("N0"); Literal numberViews = (Literal)e.Item.FindControl("LitNumberViews"); numberViews.Text = forumTopic.ViewCount.ToString("N0"); }
protected void Page_Load(object sender, EventArgs e) { udc = UserDataContext.GetUserDataContext(); var forum = DataObject.GetParents <DataObjectForum>(udc); lnkBack.Text = Helper.GetObjectName(forum[0].ObjectType, true); lnkBack.NavigateUrl = Helper.GetMobileDetailLink(forum[0].ObjectType, forum[0].ObjectID.ToString()); lnkBack.ID = null; if (!string.IsNullOrEmpty(Request.QueryString["PN"])) { currentPage = Convert.ToInt32(Request.QueryString["PN"]); } pager.PageSize = pageSize; forumTopic = (DataObjectForumTopic)DataObject; SiteObjectType objectType = Helper.GetObjectType("ForumTopicItem"); isRoleAllowed = Array.Exists(objectType.AllowedRoles.Split(','), y => UserDataContext.GetUserDataContext().UserRoles.Contains(y)); isCommunityOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, forumTopic.CommunityID.Value, out isCommunityMember); if ((forumTopic.TopicItemCreationUsers == CommunityUsersType.Members && isCommunityMember) || (forumTopic.TopicItemCreationUsers == CommunityUsersType.Authenticated && udc.IsAuthenticated) || isRoleAllowed) { lnkCreate.NavigateUrl = string.Format("/M/Admin/EditForumTopicItem.aspx?FTID={0}&ReturnUrl={1}", forumTopic.ObjectID, System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(Request.RawUrl))); } else { lnkCreate.Enabled = false; } lnkCreate.ID = null; LitTitle.Text = _4screen.Utils.Extensions.EscapeForXHTML(forumTopic.Title); LitDesc.Text = _4screen.Utils.Extensions.EscapeForXHTML(forumTopic.Description); Reload(); }
protected void Page_Load(object sender, EventArgs e) { forumTopic = DataObject.Load <DataObjectForumTopic>(ObjectID, null, true); foreach (RadComboBoxItem item in this.RcbRights.Items) { item.Text = language.GetString(string.Format("LableForumRights{0}", item.Value)); } if (forumTopic.State == ObjectState.Added) { forumTopic.ObjectID = ObjectID; forumTopic.Title = GuiLanguage.GetGuiLanguage("Shared").GetString("LabelUnnamed"); forumTopic.CommunityID = CommunityID; forumTopic.ShowState = ObjectShowState.InProgress; forumTopic.Status = ObjectStatus.Public; forumTopic.TopicItemCreationUsers = CommunityUsersType.Authenticated; forumTopic.Insert(UserDataContext.GetUserDataContext(), Request.QueryString["FID"].ToGuid(), Helper.GetObjectTypeNumericID("Forum")); forumTopic.Title = string.Empty; } if (!string.IsNullOrEmpty(Request.QueryString["TG"])) { forumTopic.TagList = Server.UrlDecode(Request.QueryString["TG"]); } if (!string.IsNullOrEmpty(Request.QueryString["OS"])) { forumTopic.Status = (ObjectStatus)int.Parse(Request.QueryString["OS"]); } if (!string.IsNullOrEmpty(Request.QueryString["SS"])) { forumTopic.ShowState = (ObjectShowState)int.Parse(Request.QueryString["SS"]); } if (!string.IsNullOrEmpty(Request.QueryString["CR"])) { forumTopic.Copyright = int.Parse(Request.QueryString["CR"]); } if (!string.IsNullOrEmpty(Request.QueryString["GC"])) { string[] geoLatLong = Request.QueryString["GC"].Split(','); double geoLat, geoLong = double.MinValue; if (geoLatLong.Length == 2) { if (double.TryParse(geoLatLong[0], out geoLat) && double.TryParse(geoLatLong[1], out geoLong)) { forumTopic.Geo_Lat = geoLat; forumTopic.Geo_Long = geoLong; } } } if (!string.IsNullOrEmpty(Request.QueryString["ZP"])) { forumTopic.Zip = Server.UrlDecode(Request.QueryString["ZP"]); } if (!string.IsNullOrEmpty(Request.QueryString["CI"])) { forumTopic.City = Server.UrlDecode(Request.QueryString["CI"]); } if (!string.IsNullOrEmpty(Request.QueryString["RE"])) { forumTopic.Street = Server.UrlDecode(Request.QueryString["RE"]); } if (!string.IsNullOrEmpty(Request.QueryString["CO"])) { forumTopic.CountryCode = Server.UrlDecode(Request.QueryString["CO"]); } FillEditForm(); }
protected void OnForumItemDataBound(object sender, RepeaterItemEventArgs e) { if (!showTopicColumn) { e.Item.FindControl("TdTopicC").Visible = false; } if (!showStarterColumn) { e.Item.FindControl("TdStarterC").Visible = false; } if (!showInfoColumn) { e.Item.FindControl("TdInfoC").Visible = false; } if (!showLastPosterColumn) { e.Item.FindControl("TdLastPosterC").Visible = false; } DataObjectForumTopic forumTopic = (DataObjectForumTopic)e.Item.DataItem; HyperLink forumTopicLink = (HyperLink)e.Item.FindControl("LnkTopicLink"); forumTopicLink.NavigateUrl = Helper.GetDetailLink("ForumTopic", forumTopic.ObjectID.Value.ToString()); Literal forumTopicTitle = (Literal)e.Item.FindControl("LitTopicTitle"); forumTopicTitle.Text = forumTopic.Title; Literal forumTopicDesc = (Literal)e.Item.FindControl("LitTopicDesc"); forumTopicDesc.Text = forumTopic.Description.CropString(200); if (forumTopic.LastTopicItemID.HasValue) { ((HyperLink)e.Item.FindControl("LnkOpenLatestPost")).NavigateUrl = Helper.GetDetailLink(forumTopic.ObjectType, forumTopic.ObjectID.ToString(), false) + "&COID=" + forumTopic.LastTopicItemID; ((HyperLink)e.Item.FindControl("LnkOpenLatestPost")).Attributes.Add("style", "margin-top: 5px;"); e.Item.FindControl("LnkOpenLatestPost").Visible = true; e.Item.FindControl("LnkOpenLatestPost").ID = null; } Control threadStarterControl = e.Item.FindControl("PhStarter"); SmallOutputUser2 threadStarter = (SmallOutputUser2)this.LoadControl("~/UserControls/Templates/SmallOutputUser2.ascx"); DataObjectUser threadStarterUser = DataObject.Load <DataObjectUser>(forumTopic.UserID, ObjectShowState.Published, false); if (forumTopic.UserID != Constants.ANONYMOUS_USERID.ToGuid()) { threadStarter.DataObjectUser = threadStarterUser; threadStarter.LinkActive = true; } else { threadStarter.UserName = forumTopic.Nickname; threadStarter.UserDetailURL = string.Empty; threadStarter.UserPictureURL = _4screen.CSB.Common.SiteConfig.MediaDomainName + Helper.GetObjectType("User").DefaultImageURL; threadStarter.PrimaryColor = Helper.GetDefaultUserPrimaryColor(); threadStarter.SecondaryColor = Helper.GetDefaultUserSecondaryColor(); } threadStarterControl.Controls.Add(threadStarter); Literal threadStarterInfo = (Literal)e.Item.FindControl("LitStarterInfo"); threadStarterInfo.Text = forumTopic.Inserted.ToShortDateString() + " " + forumTopic.Inserted.ToShortTimeString(); Literal numberPosts = (Literal)e.Item.FindControl("LitNumberPosts"); numberPosts.Text = forumTopic.TopicItemCount.ToString("N0"); Literal numberViews = (Literal)e.Item.FindControl("LitNumberViews"); numberViews.Text = forumTopic.ViewCount.ToString("N0"); PlaceHolder rating = (PlaceHolder)e.Item.FindControl("PhRating"); Control ratingControl = LoadControl("/UserControls/Templates/ObjectVotingTelerik.ascx"); ((IObjectVoting)ratingControl).DataObject = forumTopic; rating.Controls.Add(ratingControl); Control lastPosterControl = e.Item.FindControl("PhLastPoster"); Literal lastPosterInfo = (Literal)e.Item.FindControl("ListLastPosterInfo"); if (forumTopic.TopicItemCount > 0) { SmallOutputUser2 lastPoster = (SmallOutputUser2)this.LoadControl("~/UserControls/Templates/SmallOutputUser2.ascx"); DataObjectUser lastPosterUser = DataObject.Load <DataObjectUser>(forumTopic.LastTopicItemUserID, ObjectShowState.Published, false); if (forumTopic.LastTopicItemUserID != Constants.ANONYMOUS_USERID.ToGuid()) { lastPoster.DataObjectUser = lastPosterUser; lastPoster.LinkActive = true; } else { lastPoster.UserName = forumTopic.LastTopicItemNickname; lastPoster.UserDetailURL = string.Empty; lastPoster.UserPictureURL = _4screen.CSB.Common.SiteConfig.MediaDomainName + Helper.GetObjectType("User").DefaultImageURL; lastPoster.PrimaryColor = Helper.GetDefaultUserPrimaryColor(); lastPoster.SecondaryColor = Helper.GetDefaultUserSecondaryColor(); } lastPosterControl.Controls.Add(lastPoster); lastPosterInfo.Text = forumTopic.LastTopicItemDate.Value.ToShortDateString() + " " + forumTopic.LastTopicItemDate.Value.ToShortTimeString(); } else { lastPosterControl.Controls.Add(new LiteralControl(" ")); lastPosterInfo.Text = " "; } }