コード例 #1
0
        private void addNotificationToParent(MicroblogComment c, String microblogLink, int sentId)
        {
            if (c.ParentId == 0)
            {
                return;
            }

            MicroblogComment parent = MicroblogComment.findById(c.ParentId);

            int receiverId = parent.User.Id;

            if (c.User.Id == receiverId)
            {
                return;
            }

            if (receiverId == sentId)
            {
                return;
            }


            String commentTitle = strUtil.ParseHtml(parent.Content, 30);

            //String msg = c.User.Name + " 回复了你的微博评论 <a href=\"" + microblogLink + "\">" + commentTitle + "</a>";
            String clink = "<a href=\"" + microblogLink + "\">" + commentTitle + "</a>";
            String msg   = string.Format(lang.get("replyMicroblog"), c.User.Name, clink);

            nfService.send(receiverId, typeof(User).FullName, msg, NotificationType.Comment);
        }
コード例 #2
0
        public virtual void InsertComment( MicroblogComment c, String microblogLink )
        {
            saveComment( c );

            long receiverId = addNotificationToRoot( c, microblogLink );
            addNotificationToParent( c, microblogLink, receiverId );
        }
コード例 #3
0
        public virtual void InsertComment(MicroblogComment c, String microblogLink)
        {
            saveComment(c);

            long receiverId = addNotificationToRoot(c, microblogLink);

            addNotificationToParent(c, microblogLink, receiverId);
        }
コード例 #4
0
        public virtual void InsertComment( MicroblogComment c, String microblogLink )
        {
            saveComment( c );
            copyCommentCountToFeed( c );

            int receiverId = addNotificationToRoot( c, microblogLink );
            addNotificationToParent( c, microblogLink, receiverId );
        }
コード例 #5
0
        public virtual void InsertComment(MicroblogComment c, String microblogLink)
        {
            saveComment(c);
            copyCommentCountToFeed(c);

            int receiverId = addNotificationToRoot(c, microblogLink);

            addNotificationToParent(c, microblogLink, receiverId);
        }
コード例 #6
0
        public virtual void DeleteTrueBatch(string ids)
        {
            int[] arrIds = cvt.ToIntArray(ids);
            if (arrIds.Length == 0)
            {
                return;
            }

            MicroblogComment.deleteBatch("id in (" + ids + ")");
        }
コード例 #7
0
        private void saveComment(Microblog tblog, String content)
        {
            MicroblogComment c = new MicroblogComment();

            c.Root    = tblog;
            c.Content = content;
            c.User    = ctx.viewer.obj as User;
            c.Ip      = ctx.Ip;

            commentService.InsertComment(c, to(new MicroblogController().Show, tblog.Id));
        }
コード例 #8
0
        // 弹窗中的回复窗口
        public void Reply(int id)
        {
            int parentId = ctx.GetInt("parentId");

            set("c.ParentId", parentId);
            set("c.RootId", id);
            target(SaveComment, id);

            MicroblogComment c       = commentService.GetById(parentId);
            String           content = "//@" + c.User.Name + ":" + c.Content;

            set("content", content);
        }
コード例 #9
0
        private int addNotificationToRoot(MicroblogComment c, String microblogLink)
        {
            Microblog root = c.Root;

            int receiverId = root.User.Id;

            if (c.User.Id == receiverId)
            {
                return(0);
            }

            String blogTitle = strUtil.ParseHtml(root.Content, 30);

            String msg = c.User.Name + " " + lang.get("commentYour") + lang.get("microblog") + " <a href=\"" + microblogLink + "\">" + blogTitle + "</a>";

            nfService.send(receiverId, typeof(User).FullName, msg, NotificationType.Comment);
            return(receiverId);
        }
コード例 #10
0
        private void addNotificationToParent(MicroblogComment c, string microblogLink, long sentId)
        {
            if (c.ParentId == 0) return;

            MicroblogComment parent = MicroblogComment.findById( c.ParentId );

            long receiverId = parent.User.Id;
            if (c.User.Id == receiverId) return;

            if (receiverId == sentId) return;

            String commentTitle = strUtil.ParseHtml( parent.Content, 30 );

            //String msg = c.User.Name + " 回复了你的微博评论 <a href=\"" + microblogLink + "\">" + commentTitle + "</a>";
            String clink = "<a href=\"" + microblogLink + "\">" + commentTitle + "</a>";
            String msg = string.Format( lang.get( "replyMicroblog" ), c.User.Name, clink );

            nfService.send( receiverId, typeof( User ).FullName, msg, NotificationType.Comment );
        }
コード例 #11
0
        public void commentForm(int id)
        {
            target(SaveReply);
            set("c.RootId", id);
            set("viewer.PicSmall", ctx.viewer.obj.PicSmall);

            int parentPanelId = ctx.GetInt("parentPanelId");

            if (parentPanelId <= 0)
            {
                parentPanelId = id;
            }
            set("parentPanelId", parentPanelId);

            MicroblogComment c = ctx.GetItem("lastComment") as MicroblogComment;
            int parentId       = c == null ? 0 : c.Id;

            set("c.ParentId", parentId);
        }
コード例 #12
0
        private int saveCommentPrivate(String content)
        {
            int rootId   = ctx.PostInt("rootId");
            int parentId = ctx.PostInt("parentId");

            Microblog blog = microblogService.GetById(rootId);

            MicroblogComment c = new MicroblogComment();

            c.Root     = blog;
            c.ParentId = parentId;
            c.User     = (User)ctx.viewer.obj;
            c.Ip       = ctx.Ip;
            c.Content  = content;

            String microblogLink = Link.To(blog.User, new MicroblogController().Show, blog.Id);

            commentService.InsertComment(c, microblogLink);
            return(rootId);
        }
コード例 #13
0
        public void Delete(int id)
        {
            if (hasPermission() == false)
            {
                echoText(lang("exNoPermission"));
                return;
            }

            MicroblogComment c = MicroblogComment.findById(id);

            if (c == null)
            {
                echoText(lang("exDataNotFound"));
                return;
            }

            c.delete();

            echoAjaxOk();
        }
コード例 #14
0
 private void copyCommentCountToFeed( MicroblogComment c )
 {
     feedService.SetCommentCount( c.Root );
 }
コード例 #15
0
 public virtual List <MicroblogComment> GetTop(long id, int count)
 {
     return(MicroblogComment.find("RootId=" + id).list(count));
 }
コード例 #16
0
 private void copyCommentCountToFeed(MicroblogComment c)
 {
     feedService.SetCommentCount(c.Root);
 }
コード例 #17
0
 private static void saveComment(MicroblogComment c)
 {
     db.insert(c);
 }
コード例 #18
0
        private int saveCommentPrivate( String content )
        {
            int rootId = ctx.PostInt( "rootId" );
            int parentId = ctx.PostInt( "parentId" );

            Microblog blog = microblogService.GetById( rootId );

            MicroblogComment c = new MicroblogComment();
            c.Root = blog;
            c.ParentId = parentId;
            c.User = (User)ctx.viewer.obj;
            c.Ip = ctx.Ip;
            c.Content = content;

            String microblogLink = Link.To( blog.User, new MicroblogController().Show, blog.Id );
            commentService.InsertComment( c, microblogLink );
            return rootId;
        }
コード例 #19
0
 public virtual DataPage <MicroblogComment> GetComments(int id, int pageSize)
 {
     return(MicroblogComment.findPage("RootId=" + id, pageSize));
 }
コード例 #20
0
 public List <MicroblogComment> GetTop(int id, int count)
 {
     return(MicroblogComment.find("RootId=" + id).list(count));
 }
コード例 #21
0
 public DataPage <MicroblogComment> GetPageByUser(int ownerId, int pageSize)
 {
     return(MicroblogComment.findPage("UserId=" + ownerId));
 }
コード例 #22
0
 public virtual MicroblogComment GetById(int id)
 {
     return(MicroblogComment.findById(id));
 }
コード例 #23
0
ファイル: MicroblogController.cs プロジェクト: Boshin/wojilu
        private void saveComment( Microblog tblog, String content )
        {
            MicroblogComment c = new MicroblogComment();
            c.Root = tblog;
            c.Content = content;
            c.User = ctx.viewer.obj as User;
            c.Ip = ctx.Ip;

            commentService.InsertComment( c, to( new MicroblogController().Show, tblog.Id ) );
        }
コード例 #24
0
 private static void saveComment( MicroblogComment c )
 {
     db.insert( c );
 }
コード例 #25
0
        private long addNotificationToRoot( MicroblogComment c, String microblogLink )
        {
            Microblog root = c.Root;

            long receiverId = root.User.Id;
            if (c.User.Id == receiverId) return 0;

            String blogTitle = strUtil.ParseHtml( root.Content, 30 );

            String msg = c.User.Name + " " + lang.get( "commentYour" ) + lang.get( "microblog" ) + " <a href=\"" + microblogLink + "\">" + blogTitle + "</a>";
            nfService.send( receiverId, typeof( User ).FullName, msg, NotificationType.Comment );
            return receiverId;
        }
コード例 #26
0
 public virtual DataPage <MicroblogComment> GetSysPage(int pageSize)
 {
     return(MicroblogComment.findPage("", pageSize));
 }