예제 #1
0
파일: Comments.cs 프로젝트: fizikci/Cinar
 public string GetComment(UserComment comment, int parentId)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat("<div id=\"comments{0}_{1}\" class=\"item{2}\">", this.Id, comment.Id, parentId > 0 ? " child" : "");
     if (this.withTitle)
         sb.AppendFormat("<div class=\"title\">{0}</div>", comment.Title);
     sb.AppendFormat("<div class=\"text\">{0}</div>", comment.CommentText);
     sb.AppendFormat("<div class=\"sign\">{0}, {1:dd-MM-yyyy HH:mm}</div>",
         (String.IsNullOrEmpty(comment.Web) ? "" : ("<a href=\"" + comment.Web + "\" target=\"_blank\">")) + comment.Nick + (String.IsNullOrEmpty(comment.Web) ? "" : "</a>"),
         comment.InsertDate);
     if ((this.allowAnonymous || !Provider.User.IsAnonim()) && this.hierarchic)
         sb.AppendFormat("<span class=\"linkWriteAnswer\" onclick=\"commentsAdd({0},{1},{2},{3},{4},{5},{6})\">{7}</span>", this.active.ToString().ToLower(), this.Id, this.allowAnonymous.ToString().ToLower(), Provider.User.IsAnonim().ToString().ToLower(), this.withTitle.ToString().ToLower(), comment.Id, this.withWeb.ToString().ToLower(), Provider.GetModuleResource("(Reply)")); // modül, comment
     if (comment.ResponseCount > 0)
         sb.AppendFormat("<span class=\"linkNAnswer\" onclick=\"runModuleMethod('Comments',{0},'GetComments',{{parentId:{1}}},commentsShow);$(this).hide();\">({2} {3})</span> ", this.Id, comment.Id, comment.ResponseCount, Provider.GetModuleResource("reply"));
     sb.AppendFormat("</div>");
     return sb.ToString();
 }
예제 #2
0
파일: Comments.cs 프로젝트: fizikci/Cinar
        public string SaveComment(int parentId, string nick, string email, string web, string title, string text)
        {
            UserComment comment = new UserComment();
            comment.Web = web;
            comment.Email = Provider.User.IsAnonim() ? email : Provider.User.Email;
            comment.Nick = Provider.User.IsAnonim() ? nick : Provider.User.Nick;
            comment.CommentText = text.Replace("\n", "\n<br/>");
            comment.ContentId = Provider.Content.Id;
            comment.ParentId = parentId;
            comment.Title = title;
            comment.Visible = !this.Moderated;

            // Nick boş ise kullanıcı nickini atayalım
            if (String.IsNullOrEmpty(comment.Nick))
                comment.Nick = Provider.User.Nick; // anonim veya user nick
            // IPyi atayalım
            comment.IP = Provider.Request.UserHostAddress;

            comment.Save();
            return this.GetComment(comment, parentId);
        }