コード例 #1
0
ファイル: DisplayPost.ascx.cs プロジェクト: zi-yu/orionsbelt
        protected string FormatUserBox()
        {
            System.Data.DataRowView row = DataRow;
            string html = "";

            // Avatar
            if (ForumPage.BoardSettings.AvatarUpload && row["HasAvatarImage"] != null && long.Parse(row["HasAvatarImage"].ToString()) > 0)
            {
                html += String.Format("<img src='{1}image.aspx?u={0}'><br clear=\"all\"/>", row["UserID"], Data.ForumRoot);
            }
            else if (row["user_avatar"].ToString().Length > 0)
            {
                string s = row["user_avatar"].ToString();
                if (s == null || s == string.Empty)
                {
                    s = User.DefaultAvatar;
                }
                html += String.Format("<img src='{0}' width='50px' height='50px'><br clear=\"all\"/>",
                                      s
                                      );
            }

            // Rank Image
            if (row["RankImage"].ToString().Length > 0)
            {
                html += String.Format("<img align=left src=\"{0}images/ranks/{1}\"/><br clear=\"all\"/>", Data.ForumRoot, row["RankImage"]);
            }

            // Rank
            html += String.Format("{0}: {1}<br clear=\"all\"/>", ForumPage.GetText("rank"), row["RankName"]);

            // Groups
            if (ForumPage.BoardSettings.ShowGroups)
            {
                using (DataTable dt = DB.usergroup_list(row["UserID"]))
                {
                    html += String.Format("{0}: ", ForumPage.GetText("groups"));
                    bool bFirst = true;
                    foreach (DataRow grp in dt.Rows)
                    {
                        if (bFirst)
                        {
                            html  += grp["Name"].ToString();
                            bFirst = false;
                        }
                        else
                        {
                            html += String.Format(", {0}", grp["Name"]);
                        }
                    }
                    html += "<br/>";
                }
            }

            // Extra row
            html += "<br/>";

            // Joined
            html += String.Format("{0}: {1}<br/>", ForumPage.GetText("joined"), ForumPage.FormatDateShort((DateTime)row["user_registDate"]));

            // Posts
            html += String.Format("{0}: {1:N0}<br/>", ForumPage.GetText("posts"), row["Posts"]);

            // Location
            if (row["Location"].ToString().Length > 0)
            {
                html += String.Format("{0}: {1}<br/>", ForumPage.GetText("location"), FormatMsg.RepairHtml(ForumPage, row["Location"].ToString(), false));
            }

            return(html);
        }