private void Page_Load(object sender, EventArgs e)
        {
            wikiId     = Request.QueryString["wikiId"];
            wikiPageId = Request.QueryString["wikiPageId"];
            contentId  = Request.QueryString["contentId"];
            Item currItem = Sitecore.Context.Item;

            // UnderstoodDotOrg.Services.Models.Telligent.Question question = TelligentService.GetQuestion(wikiId, wikiPageId, contentId);
            UnderstoodDotOrg.Services.Models.Telligent.Question question = Questions.GetQuestion(wikiId, wikiPageId, contentId);

            QuestionTitleLabel.Text   = question.Title;
            QuestionBodyLabel.Text    = question.Body;
            GroupLabel.Text           = question.Group;
            AuthorLabel.Text          = question.Author;
            hypAuthorLink.NavigateUrl = MembershipHelper.GetPublicProfileUrl(question.Author);
            DateLabel.Text            = question.PublishedDate;
            //HtmlAnchor hrefTopicUrl = e.FindControlAs<HtmlAnchor>("hrefTopicUrl");
            if (hrefTopicUrl != null)
            {
                Item parentItem = Sitecore.Context.Item.Parent;
                hrefTopicUrl.HRef = parentItem.GetUrl() + "?topic=" + HttpUtility.UrlEncode(question.Group);
            }
            SubmitButton.Text = UnderstoodDotOrg.Common.DictionaryConstants.SubmitAnswerLabel;
            FollowButton.LoadState(question.ContentId, Constants.TelligentContentType.Weblog, question.ContentTypeId);
        }
Ejemplo n.º 2
0
        protected void questionsRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            var       item = (Question)e.Item.DataItem;
            HyperLink hypUserProfileLink = (HyperLink)e.Item.FindControl("hypUserProfileLink");

            hypUserProfileLink.NavigateUrl = MembershipHelper.GetPublicProfileUrl(item.Author);
        }
Ejemplo n.º 3
0
        protected void rptThreads_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem != null)
            {
                if (e.Item.DataItem is ThreadModel)
                {
                    ThreadModel item     = (ThreadModel)e.Item.DataItem;
                    Item        thread   = null;
                    HiddenField hdFrmID  = (HiddenField)e.Item.FindControl("forumId");
                    HiddenField hdThID   = (HiddenField)e.Item.FindControl("threadId");
                    string      forumId  = String.Empty;
                    string      threadId = String.Empty;
                    if (hdFrmID != null && hdThID != null)
                    {
                        forumId  = hdFrmID.Value;
                        threadId = hdThID.Value;
                        thread   = Threads.ConvertThreadtoSitecoreItem(forumId, threadId); //Sitecore.Context.Database.SelectSingleItem("fast:/sitecore/content/Home//*[@Subject = '" + subject + "']");
                        // ID = thread.ID.ToString();
                    }
                    HtmlAnchor hrefDiscussions = (HtmlAnchor)e.Item.FindControl("hrefDiscussion");
                    if (hrefDiscussions != null)
                    {
                        if (thread != null)
                        {
                            hrefDiscussions.HRef = LinkManager.GetItemUrl(thread);
                        }
                    }

                    HtmlAnchor hrefLastPostUser = (HtmlAnchor)e.Item.FindControl("hrefLastPostUser");
                    if (hrefLastPostUser != null)
                    {
                        if (thread != null)
                        {
                            hrefLastPostUser.HRef = MembershipHelper.GetPublicProfileUrl(item.LastPostUser);
                        }
                    }

                    Literal litDiscussionLabel = (Literal)e.Item.FindControl("litDiscussionLabel");
                    if (litDiscussionLabel != null)
                    {
                        litDiscussionLabel.Text = DictionaryConstants.DiscussionLabel;
                    }

                    Literal litRepliesLabel = (Literal)e.Item.FindControl("litRepliesLabel");
                    if (litRepliesLabel != null)
                    {
                        litRepliesLabel.Text = DictionaryConstants.RepliesLabel;
                    }


                    Literal litLatestPostLabel = (Literal)e.Item.FindControl("litLatestPostLabel");
                    if (litLatestPostLabel != null)
                    {
                        litLatestPostLabel.Text = DictionaryConstants.LatestPostLabel;
                    }
                }
            }
        }
        protected void btnSendNewMessage_Click(object sender, EventArgs e)
        {
            string usernames = String.Join(",", chklUsernames.Items.Cast <ListItem>()
                                           .Where(li => li.Selected)
                                           .Select(li => li.Value).ToArray());
            string newConvID = TelligentService.CreateConversation(ScreenName, txtSubject.Text, CKEditorControl1.Text, usernames);

            if (!String.IsNullOrEmpty(newConvID))
            {
                try
                {
                    BindConversations(true);
                    rptMessages.DataSource = new List <Message>();
                    rptMessages.DataBind();

                    //Send ExactTarget Email
                    MembershipManager memMan = new MembershipManager();
                    string[]          users  = usernames.Split(',');
                    foreach (string username in users)
                    {
                        string memberEmail   = TelligentService.GetMemberEmail(username);
                        string myAccountLink = LinkManager.GetItemUrl(Sitecore.Context.Database.GetItem(Constants.Pages.MyAccount.ToString()));

                        BaseReply reply = ExactTargetService.InvokeEM21PrivateMessage(
                            new InvokeEM21PrivateMessageRequest
                        {
                            PreferredLanguage = CurrentMember.PreferredLanguage,
                            ///TODO: change url to profile setting link
                            ContactSettingsLink = MembershipHelper.GetPublicProfileUrl(username),
                            ///TODO: change URL to message centre link
                            MsgCenterLink           = myAccountLink,
                            PMText                  = CKEditorControl1.Text,
                            ReportInappropriateLink = "*****@*****.**",
                            ToEmail                 = memberEmail,
                            RequestUrl              = Request.Url
                        });
                    }
                }catch (Exception ex)
                {
                    Sitecore.Diagnostics.Error.LogError("SendNewMessage Error:\n" + ex.Message);
                }


                Response.Redirect(Request.Url.AbsolutePath);
            }
        }
Ejemplo n.º 5
0
        public static bool SendThinkingOfYou(string senderScreenName, string recipientScreenName)
        {
            try
            {
                //Grab text for thank you from dictionary
                string strThinkMsg = String.Format(DictionaryConstants.ThinkingOfYouMessage, senderScreenName);

                //Send private message
                string newConvID = TelligentService.TelligentService.CreateConversation(senderScreenName, DictionaryConstants.ThinkingOfYouLabel, strThinkMsg, recipientScreenName);

                if (!String.IsNullOrEmpty(newConvID))
                {
                    //Send email
                    MembershipManager mm        = new MembershipManager();
                    Member            recipient = mm.GetMemberByScreenName(recipientScreenName);

                    if (recipient != null)
                    {
                        //Send email
                        string myAccountLink = Sitecore.Links.LinkManager.GetItemUrl(Sitecore.Context.Database.GetItem(Constants.Pages.MyAccount.ToString()));

                        BaseReply reply = Services.ExactTarget.ExactTargetService.InvokeEM21PrivateMessage(
                            new InvokeEM21PrivateMessageRequest
                        {
                            PreferredLanguage = recipient.PreferredLanguage,
                            ///TODO: change url to profile setting link
                            ContactSettingsLink = MembershipHelper.GetPublicProfileUrl(senderScreenName),
                            ///TODO: change URL to message centre link
                            MsgCenterLink           = myAccountLink,
                            PMText                  = strThinkMsg,
                            ReportInappropriateLink = "*****@*****.**",
                            ToEmail                 = recipient.Email
                        });
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Sitecore.Diagnostics.Error.LogError("Error sending thinking of you\n" + ex.Message);
            }

            return(false);
        }
        private void InitView()
        {
            ProfileUrl = MembershipHelper.GetPublicProfileUrl(_profileMember);

            // Determine if member is viewing own profile and impersonating a view
            string viewMode = Request.QueryString[Constants.VIEW_MODE] ?? string.Empty;
            bool   isImpersonatingVisitor = false;
            bool   isImpersonatingMember  = false;

            if (IsUserLoggedIn && CurrentMember.ScreenName == _profileMember.ScreenName)
            {
                isImpersonatingMember  = viewMode == Constants.VIEW_MODE_MEMBER;
                isImpersonatingVisitor = viewMode == Constants.VIEW_MODE_VISITOR;
            }

            ucAccountHeader.ProfileMember = ucAccountNonFriendProfile.ProfileMember = _profileMember;

            ucAccountHeader.IsImpersonatingVistor = isImpersonatingVisitor;
            ucAccountHeader.IsImpersonatingMember = isImpersonatingMember;

            // Check friendship
            if (IsUserLoggedIn &&
                !string.IsNullOrEmpty(CurrentMember.ScreenName))
            {
                // Short circuit friends display to visitor/member view
                if (isImpersonatingVisitor || isImpersonatingMember)
                {
                    ucAccountNonFriendProfile.IsImpersonatingMember = isImpersonatingMember;
                    ucAccountNonFriendProfile.IsImpersonatingVistor = isImpersonatingVisitor;
                    ucAccountNonFriendProfile.Visible = true;
                    return;
                }

                // Display friends view
                if (CurrentMember.ScreenName == _profileMember.ScreenName ||
                    TelligentService.IsApprovedFriend(CurrentMember.ScreenName, _profileMember.ScreenName))
                {
                    InitFriendsView();
                    return;
                }
            }

            ucAccountNonFriendProfile.Visible = true;
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ProfileUser != null)
            {
                // TODO: since we manage telligent users, we should be storing data on our member to avoid
                // unneeded api lookups
                var mm = new MembershipManager();
                _member = mm.GetMemberByScreenName(ProfileUser.Username);

                if (_member == null)
                {
                    return;
                }

                ProfileUrl         = MembershipHelper.GetPublicProfileUrl(ProfileUser.Username);
                ProfileActivityUrl = MembershipHelper.GetPublicProfileActivityUrl(ProfileUser.Username);

                BindEvents();
                PopulateContent();
            }
        }
Ejemplo n.º 8
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);
                //}
            }
        }
        protected void questionsRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            var       item = (Question)e.Item.DataItem;
            HyperLink hypUserProfileLink = (HyperLink)e.Item.FindControl("hypUserProfileLink");

            if (hypUserProfileLink != null)
            {
                hypUserProfileLink.NavigateUrl = MembershipHelper.GetPublicProfileUrl(item.Author);
            }

            HtmlAnchor hrefTopicUrl = e.FindControlAs <HtmlAnchor>("hrefTopicUrl");

            if (hrefTopicUrl != null)
            {
                Item currItem = Sitecore.Context.Item;
                hrefTopicUrl.HRef = currItem.GetUrl() + "?topic=" + HttpUtility.UrlEncode(item.Group);
            }
            FollowButton btnFoll = e.FindControlAs <FollowButton>("FollowButton");

            if (btnFoll != null)
            {
                btnFoll.LoadState(item.ContentId, Constants.TelligentContentType.Weblog, item.ContentTypeId);
            }
        }
        private void Page_Load(object sender, EventArgs e)
        {
            if (this.CurrentMember == null && this.CurrentUser == null)
            {
                if (!string.IsNullOrEmpty(CurrentPage.SignInPage.Url))
                {
                    Response.Redirect(CurrentPage.SignInPage.Url);
                }
                else
                {
                    Response.Redirect("/");
                }
            }

            if (!IsPostBack)
            {
                //update member
                MembershipManager membershipManager = new MembershipManager();
                this.CurrentMember = membershipManager.GetMember(this.CurrentMember.MemberId);
                this.CurrentUser   = membershipManager.GetUser(this.CurrentMember.MemberId, true);

                MyProfileItem context = (MyProfileItem)Sitecore.Context.Item;
                HyperLink     myHL    = (HyperLink)this.FindControl("uxAddChild");
                myHL.Text = context.AddChildText;

                SetLabels();
                SetRole();

                uxChildList.DataSource = this.CurrentMember.Children;
                uxChildList.DataBind();

                //disable new children if you already have 6 or more
                if (this.CurrentMember.Children.Count >= 6)
                {
                    uxAddChild.Visible = false;
                }

                SetInterests();

                uxEmailAddress.Text = txtEmail.Text = this.CurrentUser.UserName;


                SetJourney();

                uxPassword.Text = replacePassword("digitalpulp!");

                string phoneNumber = string.Empty;

                if (!string.IsNullOrEmpty(this.CurrentMember.MobilePhoneNumber))
                {
                    phoneNumber = this.CurrentMember.MobilePhoneNumber.Replace("-", string.Empty).Trim();

                    //if (phoneNumber.Length == 10 && !phoneNumber.Contains("-"))
                    //{
                    phoneNumber = phoneNumber.Insert(3, "-");
                    phoneNumber = phoneNumber.Insert(7, "-");
                    //}
                }
                else
                {
                    //10 points to Gryffindor if you know where this phone number comes from
                    txtPhoneNumber.Attributes["placeholder"] = "212-555-2368";
                }

                uxPhoneNumber.Text  = phoneNumber;
                txtPhoneNumber.Text = phoneNumber;

                uxPrivacyLevel.Text = this.CurrentMember.allowConnections ? DictionaryConstants.OpenToConnect : DictionaryConstants.NotOpenToConnect;

                uxScreenname.Text = this.CurrentMember.ScreenName;

                uxZipcode.Text = this.CurrentMember.ZipCode.Trim();

                uxAddChild.Text        = string.Format(uxAddChild.Text, ((ChildCount)this.CurrentMember.Children.Count).ToString());
                uxAddChild.NavigateUrl = MyProfileStepTwoItem.GetCompleteMyProfileStepTwo().GetUrl() + "?" + Constants.QueryStrings.Registration.Mode + "=" + Constants.QueryStrings.Registration.ModeAdd;

                if (Session["PostReloadScript"] != null)
                {
                    string reloadScript = Session["PostReloadScript"].ToString();

                    if (reloadScript != "")
                    {
                        ltlJS.Text = string.Format("<script type=\"text/javascript\">{0}</script>", reloadScript);
                        Session["PostReloadScript"] = null;
                    }
                }

                //top of edit interests
                hypEditCommunityAboutMe.NavigateUrl = String.Format(MyProfileStepFourItem.GetCompleteMyProfileStepFour().GetUrl() + "?{0}={1}", Constants.QueryStrings.Registration.Mode, Constants.QueryStrings.Registration.ModeEdit);

                //jump to edit community
                hypEditCommunity.NavigateUrl = hypCompleteYourProfile.NavigateUrl = String.Format(MyProfileStepFourItem.GetCompleteMyProfileStepFour().GetUrl() + "?{0}={1}#community", Constants.QueryStrings.Registration.Mode, Constants.QueryStrings.Registration.ModeEdit);

                if (!string.IsNullOrEmpty(this.CurrentMember.ScreenName))
                {
                    hypViewAsVisitors.NavigateUrl = MembershipHelper.GetPublicProfileAsVisitorUrl(CurrentMember.ScreenName);
                    hypViewAsMembers.NavigateUrl  = MembershipHelper.GetPublicProfileAsMemberUrl(CurrentMember.ScreenName);
                    hypViewAsFriends.NavigateUrl  = MembershipHelper.GetPublicProfileUrl(CurrentMember.ScreenName);
                }
                else
                {
                    uxNoProfile.Visible  = true;
                    uxPublicView.Visible = false;
                }
            }
        }
        protected void rptMyGroups_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item != null)
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    GroupCardModel  thisItem     = ((GroupCardModel)e.Item.DataItem);
                    ThreadModel     recentThread = null;
                    GroupJoinButton joinBtn      = e.FindControlAs <GroupJoinButton>("btnJoin");
                    if (joinBtn != null)
                    {
                        var id = thisItem.GroupID;
                        joinBtn.LoadState(id);
                    }

                    Literal litReplies = e.FindControlAs <Literal>("litRepliesLabel");
                    if (litReplies != null)
                    {
                        litReplies.Text = DictionaryConstants.RepliesLabel;
                    }
                    Literal litPostedByLabel = e.FindControlAs <Literal>("litPostedByLabel");
                    if (litPostedByLabel != null)
                    {
                        litPostedByLabel.Text = DictionaryConstants.PostedByLabel;
                    }

                    HyperLink hrefGroImageLink = e.FindControlAs <HyperLink>("hrefGroupImageLink");
                    if (hrefGroImageLink != null)
                    {
                        hrefGroImageLink.NavigateUrl = thisItem.GrpItem.GetUrl();
                    }

                    Image imgGrpImage = e.FindControlAs <Image>("imgGroupImage");
                    if (imgGrpImage != null)
                    {
                        imgGrpImage.ImageUrl = thisItem.ModeratorAvatarUrl ?? "http://placehold.it/190x107";
                    }

                    if (thisItem.Forums.Count > 0 && thisItem.Forums != null)
                    {
                        var recentThreadlist = (thisItem.Forums
                                                .Where(f => f.Threads.Count > 0 && f.Threads != null)
                                                .Select(x => x.Threads.Where(thread => thread != null)
                                                        .OrderByDescending(t => t.LastPostDate)).FirstOrDefault());


                        if (recentThreadlist != null)
                        {
                            recentThread = recentThreadlist.FirstOrDefault <ThreadModel>();
                        }

                        if (recentThread != null)
                        {
                            HyperLink hrefDiscussionLink = e.FindControlAs <HyperLink>("hrefDiscussionLink");
                            if (hrefDiscussionLink != null)
                            {
                                var threadItem = Threads.ConvertThreadtoSitecoreItem(recentThread.ForumID, recentThread.ThreadID);
                                if (threadItem != null)
                                {
                                    hrefDiscussionLink.NavigateUrl = threadItem.GetUrl();
                                }
                            }
                            Literal litDiscussionExcerpt = e.FindControlAs <Literal>("litDiscussionExcerpt");
                            if (litDiscussionExcerpt != null)
                            {
                                litDiscussionExcerpt.Text = recentThread.Subject;
                            }
                            Literal litNumReplies = e.FindControlAs <Literal>("litNumReplies");
                            if (litNumReplies != null)
                            {
                                litNumReplies.Text = recentThread.ReplyCount;
                            }

                            Literal litPostUserName = e.FindControlAs <Literal>("litPostUserName");
                            if (litPostUserName != null)
                            {
                                litPostUserName.Text = recentThread.LastPostUser;
                            }
                            HyperLink hrefPostUser = e.FindControlAs <HyperLink>("hrefPostUser");
                            if (hrefPostUser != null)
                            {
                                hrefPostUser.NavigateUrl = MembershipHelper.GetPublicProfileUrl(recentThread.LastPostUser);
                            }
                            Literal litPostTime = e.FindControlAs <Literal>("litPostTime");
                            if (litPostTime != null)
                            {
                                litPostTime.Text = recentThread.LastPostTime;
                            }
                        }
                    }
                }
            }
        }