public void List() { IAppData post = ctx.GetItem("visitTarget") as IAppData; IDataVisitor visitor = ctx.GetItem("visitor") as IDataVisitor; String visitLink = to(Visit, post.Id) + "?type=" + visitor.GetType().FullName; set("visitLink", visitLink); visitorService.setVisitor(visitor); IList visitorList = visitorService.GetRecent(post.Id, 8); IBlock block = getBlock("visitors"); foreach (User user in visitorList) { block.Set("user.Name", user.Name); block.Set("user.Face", user.PicSmall); block.Set("user.Link", Link.ToMember(user)); block.Next(); } }
public void Visit(int id) { if (ctx.viewer.IsLogin == false) { echoRedirect(lang("exPlsLogin")); return; } if (blacklistService.IsBlack(ctx.owner.Id, ctx.viewer.Id)) { echoRedirect(lang("backVisitPost")); return; } if (ctx.viewer.Id == ctx.owner.obj.Id && ctx.owner.obj.GetType() == typeof(User)) { echoRedirect(lang("exVisitSelf")); return; } String visitorType = ctx.Get("type"); if (MappingClass.Instance.FactoryList[visitorType] == null) { echoRedirect(lang("exTypeError")); return; } IDataVisitor visitor = Entity.New(visitorType) as IDataVisitor; if (visitor == null) { echoRedirect(lang("exTypeError")); return; } User owner = ctx.owner.obj as User; if (ctx.viewer.HasPrivacyPermission(owner, UserPermission.VisitLog.ToString()) == false) { echoRedirect(lang("exVisitLogNoPermission")); return; } visitorService.setVisitor(visitor); IEntity post = ndb.findById(visitor.getTargetType(), id); if (post == null) { echoRedirect(lang("exDataNotFound")); return; } IDataVisitor v = visitorService.Visit(ctx.viewer.Id, post as IAppData); String url = ctx.web.PathReferrer + "#visitorList"; redirectUrl(url); }
public class DataC : IData { public void Accept(IDataVisitor visitor) {visitor.Visit(this);}}
public virtual void setVisitor( object v ) { this.visitor = v as IDataVisitor; }
public virtual void setVisitor(object v) { this.visitor = v as IDataVisitor; }