Example #1
0
        // GroupDiscussionList rptGroupDiscussion;

        protected void Page_Load(object sender, EventArgs e)
        {
            lbSubmitReply.Text = DictionaryConstants.SubmitButtonText;

            //  rptGroupDiscussion = (GroupDiscussionList)Page.LoadControl("~/Presentation/Sublayouts/Common/GroupDiscussionList.ascx");
            //   rptGroupDiscussion.ID = "rptGroupCards";
            //   plhGroupDiscussions.Controls.Add(rptGroupDiscussion);

            //if (!IsPostBack)
            //{
            txtBody.Attributes.Add("placeholder", "Join the discussion");
            txtBody.Attributes.Add("id", "join-discussion-text");



            Item currItem = Sitecore.Context.Item;

            if (currItem != null)
            {
                hrfBack.HRef = LinkManager.GetItemUrl(currItem.Parent);
                litBack.Text = currItem.Parent.Name;
                GroupDiscussionItem grpDItem = new GroupDiscussionItem(currItem);
                if (grpDItem != null)
                {
                    Session["discussionItem"] = grpDItem;
                    string forumID  = grpDItem.ForumID.Text;
                    string threadID = grpDItem.ThreadID.Text;
                    try
                    {
                        ThreadModel thModel = UnderstoodDotOrg.Services.CommunityServices.Threads.ThreadModelFactory(forumID, threadID);

                        //Populate the initial Post
                        ProfileCommentCard.LoadState(thModel.Author);

                        rptGroupDiscussion.DataSource = thModel.Replies;
                        rptGroupDiscussion.DataBind();

                        if (thModel.Author != null)
                        {
                            ThanksButton.LoadState(thModel.Author.UserName);
                            ThinkingOfYouButton.LoadState(thModel.Author.UserName);
                        }

                        lblSubject.Text = thModel.Subject;

                        litComment.Text    = thModel.Body;
                        litNumReplies.Text = thModel.ReplyCount;
                        LikeButton.LoadState(thModel.ContentId, thModel.ContentTypeId);
                        litMemberCount.Text = thModel.Replies.Select(m => m.AuthorName).Distinct().Count().ToString();
                    }
                    catch (Exception ex)
                    {
                        Sitecore.Diagnostics.Error.LogError("Error Retrieving replies Page_Load Parent Group Discussions.\nError" + ex.Message);
                    }
                }
            }
            //}
        }
Example #2
0
        protected void AnswerRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                var       item               = (Answer)e.Item.DataItem;
                Item      currItem           = Sitecore.Context.Item;
                var       q                  = Questions.QuestionFactory(currItem);
                HyperLink hypUserProfileLink = (HyperLink)e.Item.FindControl("hypUserProfileLink");
                if (hypUserProfileLink != null)
                {
                    hypUserProfileLink.NavigateUrl = MembershipHelper.GetPublicProfileUrl(item.Author);
                }
                LikeButton btnLikeCtrl = e.FindControlAs <LikeButton>("LikeButton");
                if (btnLikeCtrl != null)
                {
                    btnLikeCtrl.LoadState(item.ContentId, item.ContentTypeId);
                }
                HtmlButton btnLikeThumbsUp = e.FindControlAs <HtmlButton>("btnLike");
                if (btnLikeThumbsUp != null)
                {
                    btnLikeThumbsUp.Attributes.Add("commentContentId", item.ContentId);
                }
                //Literal litGroup = e.FindControlAs<Literal>("lbGroup");
                //if (litGroup !=null)
                //{

                //    if(q!=null){
                //        litGroup.Text = q.Group;
                //    }
                //}
                //HtmlAnchor hrefAnchor = e.FindControlAs<HtmlAnchor>("hrefTopic");
                //if (hrefAnchor != null)
                //{
                //    hrefAnchor.HRef = currItem.Parent.GetUrl() + "?topic=" + HttpUtility.UrlEncode(q.Group);
                //}
            }
        }