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); }
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(); } }
//-------------------------------------------------------------------------------------------------- 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); }
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); }