protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var topic in TopicList)
            {
                if (topic.RecentPostID != 0)
                {
                    //poster
                    sb.Append("<div class='clearFix' style='margin-bottom:20px;'>");
                    sb.Append(topic.RecentPostAuthor.RenderCustomProfileLink("describe-text", "link gray"));

                    //topic
                    sb.Append("<div style='margin-top:5px;'>");
                    sb.Append("<a href='" + _settings.LinkProvider.RecentPost(topic.RecentPostID, topic.ID, topic.PostCount) + "'>" + HttpUtility.HtmlEncode(topic.Title) + "</a>");
                    sb.Append("</div>");


                    //date
                    sb.Append("<div style='margin-top:5px;'>");
                    sb.Append(DateTimeService.DateTime2StringPostStyle(topic.RecentPostCreateDate));
                    sb.Append("</div>");

                    sb.Append("</div>");
                }
            }

            writer.Write(sb.ToString());
        }
예제 #2
0
        public AjaxResponse Preview(string text, Guid settingsID)
        {
            _settings = ForumManager.GetSettings(settingsID);
            UserInfo      currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            StringBuilder sb          = new StringBuilder();

            sb.Append("<div class=\"tintLight borderBase clearFix\" style=\"padding:10px 0px; border-top:none; border-left:none; border-right:none;\">");
            sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" style='width:100%;'>");
            sb.Append("<tr valign=\"top\">");

            sb.Append("<td align=\"center\" style='width:180px; padding:0px 5px;'>");

            sb.Append("<div class=\"forum_postBoxUserSection\" style=\"overflow: hidden; width:150px;\">");
            sb.Append("<a class=\"linkHeader\"  href=\"" + CommonLinkUtility.GetUserProfile(currentUser.ID, _settings.ProductID) + "\">" + currentUser.DisplayUserName() + "</a>");

            sb.Append("<div style=\"margin:5px 0px;\" class=\"textMediumDescribe\">");
            sb.Append(HttpUtility.HtmlEncode(currentUser.Title));
            sb.Append("</div>");

            sb.Append("<a href=" + CommonLinkUtility.GetUserProfile(currentUser.ID, _settings.ProductID) + ">");
            sb.Append(_settings.ForumManager.GetHTMLImgUserAvatar(currentUser.ID));
            sb.Append("</a>");
            sb.Append("</div>");
            sb.Append("</td>");

            //post
            sb.Append("<td>");
            sb.Append("<div style='margin-bottom:5px; padding:0px 5px;'>");
            sb.Append(DateTimeService.DateTime2StringPostStyle(DateTimeService.CurrentDate()));
            sb.Append("</div>");

            var previewID = Guid.NewGuid().ToString();

            sb.Append("<div id=\"forum_message_" + previewID + "\" class=\"forum_mesBox\" style=\"width:550px;\">");
            sb.Append(text);
            sb.Append("</div>");

            sb.Append("</td></tr></table>");
            sb.Append("</div>");

            AjaxResponse resp = new AjaxResponse();

            resp.rs1 = sb.ToString();
            return(resp);
        }