Inheritance: System.Web.UI.WebControls.WebControl
 public override void Initialize(System.ComponentModel.IComponent component)
 {
     _gravatar = component as Gravatar;
     if (_gravatar == null)
         throw new ArgumentException("Component must be a gravatar control", "component");
     base.Initialize(component);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Post == null)
                return;

            PageBase page = (PageBase)Page;
            PostPanel.CssClass = this.CssClass;
            ReplyInfo reply = (ReplyInfo)Post;
            msgBody.Text = reply.Message.ReplaceNoParseTags().ParseVideoTags().ParseWebUrls();
            litDate.Text = SnitzTime.TimeAgoTag(reply.Date, page.IsAuthenticated, page.Member);
            litAuthor.Text = reply.AuthorProfilePopup;
            ProfileCommon prof = ProfileCommon.GetUserProfile(reply.AuthorName);
            var author = Members.GetAuthor(reply.AuthorId);
            if (prof.Gravatar)
            {
                Gravatar avatar = new Gravatar { Email = author.Email };
                if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                    avatar.DefaultImage = author.AvatarUrl;
                avatar.CssClass = "avatar";
                phAvatar.Controls.Add(avatar);

            }
            else
            {

                SnitzMembershipUser mu = (SnitzMembershipUser)Membership.GetUser(author.Username);
                Literal avatar = new Literal { Text = author.AvatarImg };
                if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName)))
                    avatar.Text = avatar.Text.Replace("'avatar'", "'avatar online'");
                phAvatar.Controls.Add(avatar);
            }
        }
示例#3
0
 public override void Initialize(System.ComponentModel.IComponent component)
 {
     _gravatar = component as Gravatar;
     if (_gravatar == null)
     {
         throw new ArgumentException("Component must be a gravatar control", "component");
     }
     base.Initialize(component);
 }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Post == null)
                return;

            PageBase page = (PageBase)Page;
            PostPanel.CssClass = this.CssClass;
            TopicInfo topic = (TopicInfo) Post;
            lblSubject.Text = topic.Subject;
            msgBody.Text = topic.Message.ReplaceNoParseTags().ParseVideoTags().ParseWebUrls();
            litDate.Text = SnitzTime.TimeAgoTag(topic.Date, page.IsAuthenticated, page.Member);
            litAuthor.Text = topic.AuthorProfilePopup;

            ProfileCommon prof = ProfileCommon.GetUserProfile(topic.AuthorName);
            var author = Members.GetAuthor(topic.AuthorId);
            if (prof.Gravatar)
            {
                Gravatar avatar = new Gravatar { Email = author.Email };
                if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                    avatar.DefaultImage = author.AvatarUrl;
                phAvatar.Controls.Add(avatar);

            }
            else
            {

                SnitzMembershipUser mu = (SnitzMembershipUser)Membership.GetUser(author.Username);
                Literal avatar = new Literal { Text = author.AvatarImg };
                if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName)))
                    avatar.Text = avatar.Text.Replace("'avatar'", "'avatar online'");
                phAvatar.Controls.Add(avatar);
            }
            litViews.Text = String.Format("viewed {0} times", topic.Views);
            blgDay.Text = topic.Date.Day.ToString();
            blgMonth.Text = topic.Date.ToString("MMM");
            hBookmark.OnClientClick = "confirmBookMark('Do you want to bookmark this Blog entry?'," + topic.Id + ",-1);return false;";
            hComments.Text = String.Format("{0} {1}", topic.ReplyCount, webResources.lblComments);
        }
示例#5
0
        private void SetupTabs()
        {
            _editmode = _editmode || IsMyProfile;

            SetControlStatus();

            tbxName.Text = _user.Username;
            tbxRealName.Text = String.Format("{0} {1}", _user.Firstname, _user.Lastname);
            tbxAge.Text = Common.TranslateNumerals(Common.GetAgeFromDOB(_user.DateOfBirth));
            if (_profile.HideAge && !IsMyProfile)
                tbxAge.Text = @"Mind your own business";
            if (!String.IsNullOrEmpty(_user.MaritalStatus.Trim()))
                ddlMarStatus.SelectedValue = _user.MaritalStatus;
            if (!String.IsNullOrEmpty(_user.Gender.Trim()))
                ddlGender.SelectedValue = _user.Gender;
            tbxState.Text = _user.State;
            tbxCity.Text = _user.City;
            tbxCountry.Text = _user.Country;
            tbxOccupation.Text = _user.Occupation;
            string title = "";
            var rInf = new RankInfo(_user.Username, ref title, _user.PostCount, SnitzCachedLists.GetRankings());
            tbxForumTitle.Text = title;
            if(_user.DateOfBirth.Trim() != "")
            {
                var dateTime = _user.DateOfBirth.ToDateTime();
                if (dateTime != null) DobPicker.SetDOB(dateTime.Value);
            }
            cbxDaylightSaving.Checked = _user.UseDaylightSaving;
            ddlTimeZone.SelectedValue = !String.IsNullOrEmpty(_user.TimeZone) ? _user.TimeZone : Config.TimeZoneString;
            ddTheme.SelectedValue = Config.UserTheme;
            if (_profile.Gravatar)
            {
                var grav = new Gravatar
                {
                    ID = "imgAvatar",
                    Email = _user.Email,

                    DefaultImageBehavior = GravatarDefaultImageBehavior.Default,
                    Rating = GravatarRating.Default
                };
                if(_user.AvatarUrl != "")
                    grav.DefaultImage = _user.AvatarUrl;
                phAvatar.Controls.Add(grav);
            }else
            {
                var img = new Literal {Text = _user.AvatarImg};
                phAvatar.Controls.Add(img);
            }

            cbxReceiveEmail.Checked = _user.ReceiveEmails;
            cbxHideEmail.Checked = _user.HideEmail;
            cbxUseSig.Checked = _user.UseSignature;
            cbxViewSig.Checked = _user.ViewSignatures;
            cbxHideAge.Checked = _profile.HideAge;
            cbxGravatar.Checked = _profile.Gravatar;

            tbxSkype.Text = _profile.Skype;
            tbxYAHOO.Text = _user.Yahoo;
            tbxAIM.Text = _user.AIM;
            tbxSkype.Text = _user.Skype;
            tbxICQ.Text = _user.ICQ;

            repBookMarks.DataSource = _profile.BookMarks;
            repBookMarks.DataBind();

            rptRecentTopics.DataSource = Members.GetRecentTopics(_user.Id,Member);
            rptRecentTopics.DataBind();

            string[] roles = Roles.GetRolesForUser(_profileUser);
            LitRoles.Text = String.Join("<br/>",roles);
            lblUserId.Text += @" : " + _user.Id;
            lblPosts.Text += @" : " + _user.PostCount;
            lblSince.Text += @" : " + Members.MemberSinceTimeAgo(_user);
            lblVisit.Text += @" : " + Members.LastVisitTimeAgo(_user);

            cbxPublic.Checked = _profile.PublicGallery;
            grdSubs.DataSource = Subscriptions.GetMemberSubscriptions(_user.Id);
            grdSubs.DataBind();
        }
示例#6
0
        private Control GetTopicAuthorIcon(int authorid)
        {
            var author = Members.GetAuthor(authorid);
            ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username);
            if (prof.Gravatar)
            {
                Gravatar avatar = new Gravatar { Email = author.Email };
                if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                    avatar.DefaultImage = author.AvatarUrl;
                avatar.CssClass = "avatarsmall";
                return avatar;

            }
            else
            {

                SnitzMembershipUser mu = (SnitzMembershipUser)Membership.GetUser(author.Username);
                Literal avatar = new Literal { Text = author.AvatarImg };
                if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName)))
                    avatar.Text = avatar.Text.Replace("'avatar'", "'avatarsmall online'");
                else
                    avatar.Text = avatar.Text.Replace("'avatar'", "'avatarsmall'");
                return avatar;
            }
        }
示例#7
0
        private void DisplayMessage(PrivateMessageInfo pm)
        {
            MemberInfo member = Snitz.BLL.Members.GetMember(pm.FromMemberName);
            ProfileCommon prof = ProfileCommon.GetUserProfile(pm.FromMemberName);
            if (prof.Gravatar)
            {
                Gravatar avatar = new Gravatar { Email = member.Email };
                if (member.AvatarUrl != "")
                    avatar.DefaultImage = member.AvatarUrl;
                phAvatar.Controls.Add(avatar);

            }
            else
            {

                Literal avatar = new Literal { Text = member.AvatarUrl };
                phAvatar.Controls.Add(avatar);
            }
            pmRecipients.Text = pm.Subject;
            pmSubject.Visible = false;
            pmFrom.Text = String.Format("<a href=\"/Account/profile.aspx?user={0}\">{0}</a>", pm.FromMemberName);

            pmTitle.Text = member.Title;
            pmCountry.Text = member.Country;
            pmPostcount.Text = member.PostCount.ToString();
            pmDate.Text = pm.Sent.ToString();

            pmBody.Text = pm.Message.ParseTags();
            PMViews.ActiveViewIndex = 2;
        }
示例#8
0
        protected void ViewSentMessage(object sender, EventArgs e)
        {
            var lnk = (LinkButton)sender;
            PrivateMessageInfo pm = Snitz.BLL.PrivateMessages.GetMessage(Convert.ToInt32(lnk.CommandArgument));
            pm.FromMember = Snitz.BLL.Members.GetMember(pm.FromMemberId);

            if (pm.FromMember.ProfileData != null && pm.FromMember.ProfileData.Gravatar == 1)
            {
                string avatar = String.Format("{0}/Avatars/{1}", Common.GetSiteRoot(), String.IsNullOrEmpty(pm.FromMember.Avatar) ? "default.gif" : pm.FromMember.Avatar);

                var gravatar = new Gravatar { Email = pm.FromMember.Email };
                if (avatar != "")
                    gravatar.DefaultImage = avatar;
                phAvatar.Controls.Add(gravatar);
            }
            else
            {
                var avatar = new Literal { Text = pm.FromMember.AvatarUrl };
                phAvatar.Controls.Add(avatar);
            }
            PMViews.ActiveViewIndex = 2;
            pmRecipients.Text = "To: " + pm.ToMemberName;
            pmFrom.Text = String.Format("<a href=\"/Account/profile.aspx?user={0}\">{0}</a>", pm.FromMemberName);
            pmTitle.Text = pm.FromMember.Title;
            pmCountry.Text = pm.FromMember.Country;
            pmPostcount.Text = pm.FromMember.PostCount.ToString();
            pmDate.Text = SnitzTime.TimeAgoTag(pm.Sent, true, pm.FromMember);
            pmSubject.Visible = true;
            pmSubject.Text = pm.Subject;
            pmBody.Text = pm.Message.ParseTags();
            SetButtonDisplay();
            ButtonReply.Visible = false;
            ButtonReplyQuote.Visible = false;
            ButtonForward.Visible = false;
            ButtonDelete.Visible = false;
        }
示例#9
0
        protected void RptItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            AuthorInfo author;
            if (Cache["M" + UserId] == null)
            {
                author = Members.GetAuthor(UserId);
                Cache.Insert("M" + UserId, author, null, DateTime.Now.AddMinutes(10d),
                                System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                author = (AuthorInfo)Cache["M" + UserId];
            }
            if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
            {
                if (author != null)
                {
                    Label litRank = (Label)item.FindControl("MemberTitleLabel");
                    if (litRank != null)
                    {
                        string title = "";
                        RankInfo rInf = new RankInfo(author.Username, ref title, author.PostCount, SnitzCachedLists.GetRankings());
                        if (Config.ShowRankTitle)
                            litRank.Text = title;

                    }
                    ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username);
                    if (prof.Gravatar)
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        avatar.Visible = false;
                        var ph = (PlaceHolder) item.FindControl("phAvatar");
                        ph.Visible = true;
                        var grav = new Gravatar {Email = author.Email};
                        if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                            grav.DefaultImage = author.AvatarUrl;
                        ph.Controls.Add(grav);

                    }
                    else
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        var ph = (PlaceHolder)item.FindControl("phAvatar");
                        avatar.Text = author.AvatarImg;
                        avatar.Visible = true;
                        ph.Visible = false;
                    }
                }
            }
        }