Esempio n. 1
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);
        }
Esempio n. 2
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);
        }