private string RenderComments(IList<CommentInfo> comments, int commentLevel) { var sb = new StringBuilder(); if (comments != null && comments.Count > 0) { foreach (var comment in comments) { sb.Append( CommentsHelper.GetOneCommentHtmlWithContainer( this, comment, commentLevel == 1 || commentLevel > _maxDepthLevel, cmnts => RenderComments(cmnts, commentLevel + 1), ref _commentIndex ) ); } } return sb.ToString(); }
protected override void RenderContents(HtmlTextWriter writer) { if (!_isClientScriptRegistered) { RegisterClientScripts(); } var sb = new StringBuilder(); var visibleCommentsCount = TotalCount; var isEmpty = CommentsHelper.IsEmptyComments(_items); if (_showCaption) { sb.Append("<div id='commentsTitle' style=\"margin-left:5px;\" class=\"headerPanel\" >" + _commentsTitle + "</div>"); } sb.Append("<a name=\"comments\"></a>"); sb.Append("<div id=\"noComments\" style=\"" + (!isEmpty ? "display:none;" : "") + "\">" + UserControlsCommonResource.NoComments + "</div>"); sb.Append("<div id=\"mainContainer\" style='width:100%; margin-top:5px; " + (visibleCommentsCount % 2 == 0 ? "border-bottom:1px solid #ddd;" : "") + "word-wrap: break-word;" + (isEmpty ? "display:none;" : "") + "'>"); sb.Append(RenderComments() + "</div>"); sb.Append("<br />"); if (_isShowAddCommentBtn) { sb.Append("<a id=\"add_comment_btn\" onclick=\"javascript:CommentsManagerObj.AddNewComment();\">" + _addCommentLink + "</a>"); } sb.Append("<div id=\"commentBox\" style=\"margin-top: 5px; display:none;\">"); sb.Append("<div id=\"commentBoxContainer\">"); sb.Append("<input type=\"hidden\" id=\"hdnParentComment\" value=\"\" />"); sb.Append("<input type=\"hidden\" id=\"hdnAction\" value=\"\" />"); sb.Append("<input type=\"hidden\" id=\"hdnCommentID\" value=\"\" />"); sb.Append("<input type=\"hidden\" id=\"hdnObjectID\" value=\"" + _objectID + "\" />"); sb.Append("<textarea id='commentEditor' name='commentEditor'></textarea>"); sb.Append("<a name='add_comment'></a>"); sb.Append("<div id=\"CommentsFckEditorPlaceHolder_" + JsObjName + "\">"); if (Simple) { sb.Append("<textarea id='simpleTextArea' name='simpleTextArea' style='width: 100%; height:124px;'></textarea>"); } sb.Append("</div>"); sb.Append("<div id=\"comment_attachments\" style=\"padding:5px;\">"); sb.Append("</div>"); sb.Append("<input id=\"hdn_comment_attachments\" type=\"hidden\" value=\"\" />"); sb.Append("<div class=\"middle-button-container\" >"); sb.Append("<a href=\"javascript:void(0);\" id=\"btnAddComment\" class=\"button\" onclick=\"javascript:CommentsManagerObj.AddComment_Click();return false;\">" + _saveButton + "</a><span class=\"splitter-buttons\"></span>"); if (EnableAttachmets) { sb.Append("<a href=\"javascript:void(0);\" id=\"comments_Uploader\" class=\"button\">" + AttachButton + "</a><span class=\"splitter-buttons\"></span>"); } sb.AppendFormat("<a href='javascript:void(0);' id='btnPreview' class='button disable' onclick='javascript:CommentsManagerObj.Preview_Click();return false;'>{0}</a><span class=\"splitter-buttons\"></span>", _previewButton); sb.AppendFormat("<a href='javascript:void(0);' id='btnCancel' class='button gray cancelFckEditorChangesButtonMarker' name='{1}' onclick='CommentsManagerObj.Cancel();' />{0}</a>", _cancelButton, "CommentsFckEditor_" + JsObjName); sb.Append("</div>"); sb.Append("</div>"); sb.Append("<div id=\"previewBox\" style=\"display: none; margin-top:20px;\">"); sb.Append("<div class='headerPanel' style=\"margin-top: 0px;\">" + _previewButton + "</div>"); sb.Append("<div id=\"previewBoxBody\"></div>"); sb.Append("<div class=\"middle-button-container\">"); sb.Append("<a href=\"javascript:void(0);\" onclick=\"CommentsManagerObj.HidePreview(); return false;\" class=\"button blue\" style=\"margin-right:8px;\">" + _hidePrevuewButton + "</a>"); sb.Append("</div>"); sb.Append("</div>"); sb.Append("</div>"); writer.Write(sb.ToString()); confirm.RenderControl(writer); }