Beispiel #1
0
        protected void rptrTopics_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ForumTopic forumTopic = e.Item.DataItem as ForumTopic;
                Customer   customer   = forumTopic.User;

                HyperLink hlTopic = e.Item.FindControl("hlTopic") as HyperLink;
                if (hlTopic != null)
                {
                    hlTopic.NavigateUrl = SEOHelper.GetForumTopicURL(forumTopic.ForumTopicID);
                    hlTopic.Text        = Server.HtmlEncode(forumTopic.Subject);
                }

                HyperLink hlTopicStarter = e.Item.FindControl("hlTopicStarter") as HyperLink;
                if (hlTopicStarter != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        if (customer != null)
                        {
                            hlTopicStarter.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                            hlTopicStarter.NavigateUrl = SEOHelper.GetUserProfileURL(customer.CustomerID);
                        }
                    }
                    else
                    {
                        hlTopicStarter.Visible = false;
                    }
                }

                Label lblTopicStarter = e.Item.FindControl("lblTopicStarter") as Label;
                if (lblTopicStarter != null)
                {
                    if (!CustomerManager.AllowViewingProfiles)
                    {
                        if (customer != null)
                        {
                            lblTopicStarter.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        }
                    }
                    else
                    {
                        lblTopicStarter.Visible = false;
                    }
                }
            }
        }
        protected string GetToInfo(int CustomerID)
        {
            string   customerInfo = string.Empty;
            Customer customer     = CustomerManager.GetCustomerByID(CustomerID);

            if (customer != null && !customer.IsGuest)
            {
                if (CustomerManager.AllowViewingProfiles)
                {
                    customerInfo = string.Format("<a href=\"{0}\">{1}</a>", SEOHelper.GetUserProfileURL(customer.CustomerID), Server.HtmlEncode(CustomerManager.FormatUserName(customer)));
                }
                else
                {
                    customerInfo = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                }
            }
            return(customerInfo);
        }
Beispiel #3
0
        public void BindData()
        {
            if (forumPost != null)
            {
                lblLastPostDate.Text = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn).ToString("MMMM dd, yyyy");
                ForumTopic forumTopic = forumPost.Topic;
                if (forumTopic != null)
                {
                    hlTopic.Text        = Server.HtmlEncode(ForumManager.StripTopicSubject(forumTopic.Subject));
                    hlTopic.ToolTip     = Server.HtmlEncode(forumTopic.Subject);
                    hlTopic.NavigateUrl = SEOHelper.GetForumTopicURL(forumTopic.ForumTopicID);
                }
                Customer customer = forumPost.User;
                if (customer != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        hlUser.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.NavigateUrl = SEOHelper.GetUserProfileURL(customer.CustomerID);
                        lblUser.Visible    = false;
                    }
                    else
                    {
                        lblUser.Text   = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.Visible = false;
                    }
                }

                pnlPostInfo.Visible = true;
                pnlNoPost.Visible   = false;
            }
            else
            {
                pnlPostInfo.Visible = false;
                pnlNoPost.Visible   = true;
            }
        }
Beispiel #4
0
        protected void rptrSearchResults_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ForumTopic forumTopic = e.Item.DataItem as ForumTopic;
                Customer   customer   = forumTopic.User;

                Panel pnlTopicImage = e.Item.FindControl("pnlTopicImage") as Panel;
                if (pnlTopicImage != null)
                {
                    switch (forumTopic.TopicType)
                    {
                    case ForumTopicTypeEnum.Normal:
                        pnlTopicImage.CssClass = "post";
                        break;

                    case ForumTopicTypeEnum.Announcement:
                        pnlTopicImage.CssClass = "postannoucement";
                        break;

                    default:
                        pnlTopicImage.CssClass = "post";
                        break;
                    }
                }

                Label lblTopicType = e.Item.FindControl("lblTopicType") as Label;
                if (lblTopicType != null)
                {
                    switch (forumTopic.TopicType)
                    {
                    case ForumTopicTypeEnum.Announcement:
                        lblTopicType.Text = string.Format("[{0}]", GetLocaleResourceString("Forum.Announcement"));
                        break;

                    default:
                        lblTopicType.Visible = false;
                        break;
                    }
                }

                HyperLink hlTopic = e.Item.FindControl("hlTopic") as HyperLink;
                if (hlTopic != null)
                {
                    hlTopic.NavigateUrl = SEOHelper.GetForumTopicURL(forumTopic.ForumTopicID);
                    hlTopic.Text        = Server.HtmlEncode(forumTopic.Subject);
                }

                HyperLink hlTopicStarter = e.Item.FindControl("hlTopicStarter") as HyperLink;
                if (hlTopicStarter != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        if (customer != null)
                        {
                            hlTopicStarter.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                            hlTopicStarter.NavigateUrl = SEOHelper.GetUserProfileURL(customer.CustomerID);
                        }
                    }
                    else
                    {
                        hlTopicStarter.Visible = false;
                    }
                }

                Label lblTopicStarter = e.Item.FindControl("lblTopicStarter") as Label;
                if (lblTopicStarter != null)
                {
                    if (!CustomerManager.AllowViewingProfiles)
                    {
                        if (customer != null)
                        {
                            lblTopicStarter.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        }
                    }
                    else
                    {
                        lblTopicStarter.Visible = false;
                    }
                }
            }
        }
Beispiel #5
0
        public void BindData()
        {
            if (newsComment != null)
            {
                lblCreatedOn.Text     = DateTimeHelper.ConvertToUserTime(newsComment.CreatedOn).ToString();
                lblTitle.Text         = Server.HtmlEncode(newsComment.Title);
                lblComment.Text       = NewsManager.FormatCommentText(newsComment.Comment);
                lblNewsCommentID.Text = newsComment.NewsCommentID.ToString();

                Customer customer = newsComment.Customer;
                if (customer != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        hlUser.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.NavigateUrl = SEOHelper.GetUserProfileURL(customer.CustomerID);
                        lblUser.Visible    = false;
                    }
                    else
                    {
                        lblUser.Text   = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.Visible = false;
                    }

                    if (CustomerManager.AllowCustomersToUploadAvatars)
                    {
                        Picture customerAvatar = customer.Avatar;
                        int     avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                        if (customerAvatar != null)
                        {
                            string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                            this.imgAvatar.ImageUrl = pictureUrl;
                        }
                        else
                        {
                            if (CustomerManager.DefaultAvatarEnabled)
                            {
                                string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                                this.imgAvatar.ImageUrl = pictureUrl;
                            }
                            else
                            {
                                imgAvatar.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
                else
                {
                    lblUser.Text   = GetLocaleResourceString("Customer.NotRegistered");
                    hlUser.Visible = false;
                    if (CustomerManager.AllowCustomersToUploadAvatars && CustomerManager.DefaultAvatarEnabled)
                    {
                        int    avatarSize = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                        string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                        this.imgAvatar.ImageUrl = pictureUrl;
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
            }
        }
        public void BindData()
        {
            if (forumPost != null)
            {
                lAnchor.Text = string.Format("<a name=\"{0}\"></a>", forumPost.ForumPostID);

                btnEdit.Visible   = ForumManager.IsUserAllowedToEditPost(NopContext.Current.User, forumPost);
                btnDelete.Visible = ForumManager.IsUserAllowedToDeletePost(NopContext.Current.User, forumPost);

                lblDate.Text        = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn).ToString("f");
                lblText.Text        = ForumManager.FormatPostText(forumPost.Text);
                lblForumPostID.Text = forumPost.ForumPostID.ToString();

                Customer customer = forumPost.User;
                if (customer != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        hlUser.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.NavigateUrl = SEOHelper.GetUserProfileURL(customer.CustomerID);
                        lblUser.Visible    = false;
                    }
                    else
                    {
                        lblUser.Text   = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.Visible = false;
                    }

                    if (CustomerManager.AllowCustomersToUploadAvatars)
                    {
                        Picture customerAvatar = customer.Avatar;
                        int     avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                        if (customerAvatar != null)
                        {
                            string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                            this.imgAvatar.ImageUrl = pictureUrl;
                        }
                        else
                        {
                            if (CustomerManager.DefaultAvatarEnabled)
                            {
                                string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                                this.imgAvatar.ImageUrl = pictureUrl;
                            }
                            else
                            {
                                imgAvatar.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }

                    if (customer.IsForumModerator)
                    {
                        lblStatus.Text = GetLocaleResourceString("Forum.Moderator");
                    }
                    else
                    {
                        phStatus.Visible = false;
                    }

                    if (ForumManager.ShowCustomersPostCount)
                    {
                        lblTotalPosts.Text = customer.TotalForumPosts.ToString();
                    }
                    else
                    {
                        phTotalPosts.Visible = false;
                    }

                    if (CustomerManager.ShowCustomersJoinDate)
                    {
                        lblJoined.Text = DateTimeHelper.ConvertToUserTime(customer.RegistrationDate).ToString("d");
                    }
                    else
                    {
                        phJoined.Visible = false;
                    }

                    if (CustomerManager.ShowCustomersLocation)
                    {
                        Country country = CountryManager.GetCountryByID(customer.CountryID);
                        if (country != null)
                        {
                            lblLocation.Text = Server.HtmlEncode(country.Name);
                        }
                        else
                        {
                            phLocation.Visible = false;
                        }
                    }
                    else
                    {
                        phLocation.Visible = false;
                    }

                    if (ForumManager.AllowPrivateMessages)
                    {
                        if (customer != null && !customer.IsGuest)
                        {
                            btnSendPM.CustomerID = customer.CustomerID;
                            phPM.Visible         = true;
                        }
                        else
                        {
                            phPM.Visible = false;
                        }
                    }
                    else
                    {
                        phPM.Visible = false;
                    }

                    if (ForumManager.SignaturesEnabled && !String.IsNullOrEmpty(customer.Signature))
                    {
                        lblSignature.Text = ForumManager.FormatSignatureText(customer.Signature);
                    }
                    else
                    {
                        pnlSignature.Visible = false;
                    }
                }
                else
                {
                    //error, cannot be
                }
            }
        }