コード例 #1
0
        private void saveComment(Microblog oBlog, String content)
        {
            User    creator = oBlog.Creator;
            IMember owner   = User.findById(oBlog.OwnerId);

            OpenComment c = new OpenComment();

            c.Content   = content;
            c.TargetUrl = MbLink.ToShowFeed(oBlog.User, oBlog.Id);

            c.TargetDataType = oBlog.GetType().FullName;
            c.TargetDataId   = oBlog.Id;


            c.TargetTitle  = string.Format("(微博{0}){1}", oBlog.Created.ToShortDateString(), strUtil.ParseHtml(oBlog.Content, 25));
            c.TargetUserId = oBlog.User.Id;

            c.OwnerId = owner.Id;
            c.AppId   = 0;
            c.FeedId  = oBlog.Id;

            c.Ip       = oBlog.Ip;
            c.Author   = creator.Name;
            c.ParentId = 0;
            c.AtId     = 0;

            c.Member = creator;

            commentService.Create(c);
        }
コード例 #2
0
        private string getCommentUrl(Microblog x)
        {
            String dataType = strUtil.IsNullOrEmpty(x.DataType) ? typeof(Microblog).FullName : x.DataType;
            long   dataId   = getDataId(x);

            return(t2(new wojilu.Web.Controller.Open.CommentController().List)
                   + "?dataType=" + dataType
                   + "&ownerId=" + x.User.Id
                   + "&dataId=" + dataId
                   + "&dataTitle=(微博" + x.Created.ToShortDateString() + ")" + strUtil.ParseHtml(x.Content, 25)
                   + "&url=" + MbLink.ToShow(x.User, x.Id)
                   + "&dataUserId=" + x.Creator.Id
                   + "&feedId=" + x.Id);
        }
コード例 #3
0
        private void bindVideoInfo(IBlock block, Microblog blog)
        {
            IBlock vBlock = block.GetBlock("video");

            if (strUtil.HasText(blog.FlashUrl))
            {
                String vpic = strUtil.HasText(blog.PicUrl) ? blog.PicUrl : strUtil.Join(sys.Path.Img, "/big/novideopic.png");

                vBlock.Set("blog.FlashPic", vpic);
                vBlock.Set("blog.ShowLink", MbLink.ToShowFeed(blog.User, blog.Id));

                vBlock.Next();
            }
        }
コード例 #4
0
        //--------------------------------------------------------------------------------------------------

        private void bindOne(IBlock block, Microblog blog, Boolean isFavorite, Boolean showUserFace)
        {
            block.Set("blog.Id", blog.Id);
            block.Set("blog.Created", blog.Created);

            if (ctx.GetItemString("_showType") == "microblog")
            {
                block.Set("blog.ShowLink", MbLink.ToShowMicroblog(blog.User, blog.Id));
            }
            else
            {
                block.Set("blog.ShowLink", MbLink.ToShowFeed(blog.User, blog.Id));
            }

            block.Set("blog.Content", getBlogContent(blog));

            bindUserInfo(block, ctx, blog, showUserFace); // 用户信息
            bindRepost(block, blog);                      // 转发信息
            bindPicInfo(block, blog);                     // 图片信息
            bindVideoInfo(block, blog);                   // 视频信息

            // 评论数
            block.Set("blog.StrReplies", blog.Replies == 0 ? "" : string.Format("<span class=\"feed-replies\">(<span class=\"feed-replies-num\" id=\"renum{1}\">{0}</span>)</span>", blog.Replies, blog.Id));

            block.Set("blog.StrLikes", blog.Likes == 0 ? "" : string.Format("<span class=\"feed-likes\">(<span class=\"feed-likes-num\">{0}</span>)</span>", blog.Likes));
            block.Set("blog.SaveLikeLink", to(SaveLike, blog.Id));


            // 转发数
            String reposts = blog.Reposts > 0 ? "(" + blog.Reposts + ")" : "";

            block.Set("blog.Reposts", reposts);

            block.Set("blog.CommentsLink", getCommentUrl(blog));
            block.Set("blog.ForwardUrl", to(Forward, blog.Id));
            block.Set("blog.FavoriteCmd", getFavoriteCmd(blog, isFavorite));     // 收藏命令

            // 删除命令
            String deleteCmd = getDeleteCmd(ctx, blog);

            block.Set("blog.DeleteCmd", deleteCmd);
        }
コード例 #5
0
        public virtual void Single(long id)
        {
            Microblog blog = microblogService.GetById(id);

            set("blog.UserName", blog.User.Name);
            set("blog.UserLink", toUser(blog.User));
            set("blog.Content", blog.Content);

            if (ctx.GetItemString("_showType") == "microblog")
            {
                set("blog.ShowLink", MbLink.ToShowMicroblog(blog.User, blog.Id));
            }
            else
            {
                set("blog.ShowLink", MbLink.ToShowFeed(blog.User, blog.Id));
            }

            set("blog.Replies", blog.Replies);
            set("blog.Reposts", blog.Reposts);

            bindPicInfo(this.utils.getCurrentView(), blog);
            bindVideoInfo(this.utils.getCurrentView(), blog);
        }